在snakemake中,是否可以使用带通配符的所有文件作为单个脚本运行的输入/输出?

时间:2018-07-27 10:50:38

标签: snakemake

我有多个文件,我想在一次脚本运行中对其进行分析。例如,脚本first.py使用input.a并输出多个{id}.b(使用dynamic关键字)。例如,它输出三个文件:1.b, 2.b, 3.b

然后,我想运行另一个脚本,将它们一起分析:second.py -i 1.b 2.b 3.b -o 1.c 2.c 3.c

例如,第三个脚本再次单独分析它们:third.py -i 1.c -o 1.d

看起来像这样

rule all:
    input:
        dynamic('{id}.d')


rule third:
    input:
        '{id}.c'
    output:
        '{id}.d'
    shell:
        'third.py -i {input} -o {output}'


# Here, second script would run n jobs,
# while I want it to run once for all input and output files
rule second:
    input:
        '{id}.b'
    output:
        '{id}.c'
    shell:
        'second.py -i {input} -o {output}'


rule first:
    input:
        'input.a'
    output:
        dynamic('{id}.b')
    shell:
        'first.py -i {input} -o {output}'

有没有办法做到这一点?这似乎是一项合理的功能,例如将所有中间文件合并为一个结果文件。

0 个答案:

没有答案