[Python] Snakemake - Call multiple scripts in a rule

Discussão em 'Python' iniciado por Stack, Março 20, 2025.

  1. Stack

    Stack Membro Participativo

    I have a snakemake rule where I call a python script with the script keyword:

    rule merge_results:
    input:
    [...]
    output:
    path_results
    script:
    "merge_results.py"


    However, I would like to also call an R script in this rule, depending on a condition. I wanted to do something like this:

    rule merge_results:
    input:
    [...]
    output:
    path_results
    script:
    "merge_results.py"
    if cond:
    "my_script.R"


    but Snakemake won't allow it. I know I could call my scripts by using the run and shell() keywords, but my python and R scripts use a lot of times the snakemake.input variable, so I would have to change a lot of things in their code in order to call them in a different way. Do you know if I can avoid that and use the script: keyword with multiples files ?

    Continue reading...

Compartilhe esta Página