【问题标题】:Snakemake : "wildcards in input files cannot be determined from output files"Snakemake:“输入文件中的通配符无法从输出文件中确定”
【发布时间】:2019-03-22 13:36:48
【问题描述】:

我使用 Snakemake 执行一些规则,但我有一个问题:

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

output:
    "pass1/SJ.db"

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


'''

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

但我找不到解决此问题的解决方案..

提前致谢

【问题讨论】:

    标签: snakemake


    【解决方案1】:

    如果您在运行脚本之前知道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 '$6==1 || ($6==0 && $7>2)' {input} >> {output};
            """
    

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

    【讨论】:

    • 没问题。如果它解决了您的问题,您能否接受答案。万事如意
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多