Snakemake : “wildcards in input files cannot be determined from output files”

痴心易碎 提交于 2019-12-24 10:38:32

问题


I use Snakemake to execute some rules, and I've a problem with one:

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

output:
    "pass1/SJ.db"

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


'''

Here, I just want to merge some files into a general file, but by searching on google I've see that wildcards use in inputs must be also use in output.

But I can't find a solution to work around this problem ..

Thank's by advance


回答1:


If you know the values of sample prior to running the script, you could do the following:

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 '$6==1 || ($6==0 && $7>2)' {input} >> {output};
        """

In the input step, this will generate a list of files, each of the form pass1/<XYZ>SJ.out.tab.



来源:https://stackoverflow.com/questions/55300845/snakemake-wildcards-in-input-files-cannot-be-determined-from-output-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!