我有一个工作流程,对于这个问题非常简化,如下所示:
rule all:
input: multiext("final",".a",".b",".c",".d")
rule final_cheap:
input: "intermediary.{ext}"
output: "final.{ext}"
#dummy for cheap but complicated operation
shell: "cp {input} {output}"
rule intermediary_cheap:
input: "start.{ext}"
output: "intermediary.{ext}"
#dummy for cheap complicated operation
shell: "cp {input} {output}"
rule start_expensive:
output: "start.{ext}"
#dummy for very expensive operation
shell: "touch {output}"
第一步的成本非常高,接下来的两个步骤也很复杂。
在使用 snakemake -c1
运行此工作流程一次后,我想重新运行该工作流程,但只是从中间规则开始。如何使用命令行标志实现此目标?
snakemake intermediary_cheap all
不起作用,因为 intermediary_cheap
包含通配符,即使包含 all 确实显示了所需通配符的值。
是否有一个命令行标志告诉snakemake运行规则并忽略规则intermediary_cheap
的所有输出,例如snakemake all --forcerule=intermediary_cheap
? (我发明了 --forcerule
标志,据我所知它并不存在。
我现在使用的解决方法是手动删除规则 intermediary_cheap
的输出,然后使用 --force
强制执行规则,然后运行 rule all
,它注意到一些上游输入已更改。但这需要了解所生成的精确文件名,而仅了解规则会更好,因为它处于更高的抽象级别。
最佳答案
我以前没有使用过它,但我想你想要:
snakemake -c 1 --forcerun intermediary_cheap
--forcerun [TARGET [TARGET ...]], -R [TARGET [TARGET ...]]
Force the re-execution or creation of the given rules
or files. Use this option if you changed a rule and
want to have all its output in your workflow updated.
(default: None)
关于snakemake - 如何定位包含通配符的中间 Snakemake 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68363352/