gpt4 book ai didi

蛇形临时()导致不必要的规则重新运行

转载 作者:行者123 更新时间:2023-12-04 13:59:16 26 4
gpt4 key购买 nike

我正在使用snakemake v 5.4.0,但遇到了temp() 问题。在假设场景中:

Rule A --> Rule B1 --> Rule C1
|
--> Rule B2 --> Rule C2

where Rule A generates temp() files used by both pathways 1 (B1 + C1) and 2 (B2 + C2).

如果我运行管道,RuleA 生成的 temp() 文件在两个路径中使用后都会被删除,这正是我所期望的。但是,如果我想重新运行 Pathway 2,则必须重新创建 RuleA 的 temp() 文件,这会触发整个管道的重新运行,而不仅仅是 Pathway2。对于长管道,这在计算上变得非常昂贵。除了不使用 temp() 之外,还有什么好的方法可以防止这种情况发生? ,在我的情况下,这需要许多 TB 的额外硬盘空间?

最佳答案

您可以创建输入文件列表来规则 all ,或无论第一个规则被称为什么,动态地取决于路径 2 的输出是否已经存在(并满足一些健全性检查)。

output= ['P1.out']
if not os.path.exists('P2.out'): # Some more conditions here...
output.append('P2.out')

rule all:
input:
output

rule make_tmp:
output:
temp('a.out')
shell:
r"""
touch {output}
"""

rule make_P1:
input:
'a.out'
output:
'P1.out'
shell:
r"""
touch {output}
"""

rule make_P2:
input:
'a.out'
output:
'P2.out'
shell:
r"""
touch {output}
"""

然而,这在某种程度上违背了使用蛇形的意义。如果必须重新创建 Pathway 1 的输入,您如何确保其输出仍然是最新的?

关于蛇形临时()导致不必要的规则重新运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54665024/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com