如何解决Snakemake在群集上:OutputException并为每个通配符项提交一项作业
我尝试在LSF profile的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}
"""
以上命令的日志文件为here。我怀疑这是运行较大的任务(需要很长时间才能完成第一个通配符)时出现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}
是在expand函数的第二个参数中定义的占位符,{{chromosome}}
是通配符。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。