集群上的Snakemake:OutputException,并为每个通配符项提交一个作业



我尝试在带有LSF配置文件的LSF上使用snakemake,但使用通配符时只提交一个作业。

Submitted job 1 with external jobid '660343 logs/cluster/try_expand/unique/jobid1_4530cab3-d29c-485d-8d46-871fb7042e50.out'.

以下是使用运行的最小示例

snakemake --profile lsf -s try.smk 2> `date +"%Y%m%d_%H%M"`_snakemake_try.log --latency-wait 20
CHROMOSOMES = [ 20, 21, 22]
rule targets:
input: 
expand("try/chr{chromosome}.GATK_calls.indels.PASS.common_var_2.bcf", chromosome=CHROMOSOMES)
log:
"try_logs/targets.log"
rule try_expand:
threads: 6
output:
expand("try/chr{chromosome}.GATK_calls.indels.PASS.common_var_2.bcf", chromosome=CHROMOSOMES) 
shell:"""
touch {output}
"""

上面命令的日志文件在这里。我怀疑这就是OutputException的原因,当运行需要很长时间才能完成第一个通配符的较大任务时。

Waiting at most 20 seconds for missing files.
MissingOutputException in line 22 of extraction.smk:
Missing files after 20 seconds:
chr21.GATK_calls.indels.PASS.common_var.bcf
chr22.GATK_calls.indels.PASS.common_var.bcf

如何避免OutputException并将每个通配符项作为作业提交?谢谢

您混淆了通配符和expand函数的变量。您的规则try_expand在输出中定义了三个文件,因此它只运行一次即可生成所有目标。在输出中,{chromosome}不是通配符,而是expand函数第二个参数的占位符。

你可能想要的是:

CHROMOSOMES = [ 20, 21, 22]
rule targets:
input: 
expand("try/chr{chromosome}.GATK_calls.indels.PASS.common_var_2.bcf", chromosome=CHROMOSOMES)
log:
"try_logs/targets.log"
rule try_expand:
threads: 6
output:
"try/chr{chromosome}.GATK_calls.indels.PASS.common_var_2.bcf" 
shell:
"""
touch {output}
"""

请注意,如果需要在展开函数中使用通配符,则必须将{}加倍
示例:

output: expand("{path}/chr{{chromosome}}.GATK_calls.indels.PASS.common_var_2.bcf", path="/my/path")

这里,{path}是扩展函数的第二个参数中定义的占位符,{{chromosome}}是通配符。

最新更新