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}}是通配符。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...