【问题标题】:Is there a way to chain snakemake rules without touch files?有没有办法在没有触摸文件的情况下链接蛇形规则?
【发布时间】:2017-08-10 23:44:45
【问题描述】:

有没有办法在不创建不需要的空文件 helpA、helpB、helpC 然后删除它们的情况下完成以下 helpAll 规则?

rule helpA:
    output: touch("helpA")
    shell: "echo 'help on subject <A>'"

rule helpB:
    output: touch("helpB")
    shell: "echo 'help on subject <B>'"

rule helpC:
    output: touch("helpC")
    shell: "echo 'help on subject <C>'"

rule helpAll:
    input: "helpA","helpB","helpC"
    shell: "rm {input}

一个不错的解决方案是以下排序的规则依赖,但这不是有效的蛇码:

rule helpAll:
    input: rules.helpA,rules.helpB,rules.helpC

或:

rule helpAll:
    depends_on_rule: helpA,helpB,helpC

【问题讨论】:

    标签: chaining snakemake


    【解决方案1】:

    我认为如果不在磁盘上创建文件,snakemake 将无法正常工作。

    但您可以使用 temp 以便自动删除文件。更详细,来自文档:

    Snakemake 允许将输出文件标记为临时文件,这样它们就是 在每个消费作业执行完毕后删除。

    reference

    【讨论】:

    • 您甚至可以将它们组合起来:temp(touch("file")).
    • 这听起来像是解决方案!谢谢。
    猜你喜欢
    • 1970-01-01
    • 2019-10-19
    • 2021-01-21
    • 2016-06-07
    • 2020-08-31
    • 1970-01-01
    • 2018-11-10
    • 1970-01-01
    • 2013-09-03
    相关资源
    最近更新 更多