蛇妖:"wildcards in input files cannot be determined from output files"

Snakemake : "wildcards in input files cannot be determined from output files"

我使用 Snakemake 来执行一些规则,我遇到了一个问题:

rule filt_SJ_out:
input: 
    "pass1/{sample}SJ.out.tab"

output:
    "pass1/SJ.db"

shell:''' 
gawk '==1 || (==0 && >2)' {input} >> {output};


'''

在这里,我只想将一些文件合并到一个通用文件中,但是通过搜索 google 我发现输入中使用的通配符也必须在输出中使用。

但是我找不到解决这个问题的方法..

提前致谢

如果您在 运行 脚本之前知道 sample 的值,则可以执行以下操作:

SAMPLES = [... define the possible values of `sample` ...]

rule filt_SJ_out:
    input: 
        expand("pass1/{sample}SJ.out.tab", sample=SAMPLES)
    output:
        "pass1/SJ.db"
    shell:
        """ 
        gawk '==1 || (==0 && >2)' {input} >> {output};
        """

input 步骤中,这将生成一个文件列表,每个文件的格式为 pass1/<XYZ>SJ.out.tab.