【问题标题】:Snakemake Checkpoint Throws (exited with non-zero exit code) even after correct completionSnakemake Checkpoint Throws (exit with non-zero exit code) 即使在正确完成后
【发布时间】:2019-10-01 13:47:02
【问题描述】:

我目前正在运行一个 snakemake 检查点,即使在正确完成命令后,它似乎也会抛出一个非零退出代码,我不确定如何解决该问题。

以下脚本的目的是解析坐标文件bed_file,从bam 文件rna_file 中提取所有区域并最终组装这些区域。代码如下,我的snakemake版本是5.6.0。

#Pull coordinates from a BAM file, and use the command samtools view to extract the corresponding #data, naming the output as the coordinate file, here named "6:25274434-25278245.bam". There are #an unknown number of output files

checkpoint pull_reads_for_BAM:
    input:
    ¦   bed_file = get_lncRNA_file,
    ¦   rna_file = get_RNA_file
    conda:
    ¦   "envs/pydev_1.yml"
    params:
    ¦   "01.pulled_reads"
    output:
    ¦   directory("01.pulled_reads/{tissue}")
    shell:"""

    mkdir 01.pulled_reads/{wildcards.tissue}

    store_regions=$(cat {input.bed_file} | awk -F'\t' '{{ print $1 ":" $2 "-" $3 }}')

    for i in $store_regions ; do
    ¦   samtools view -b -h {input.rna_file} ${{i}} > 01.pulled_reads/{wildcards.tissue}/${{i}}.bam ;
    done

    echo "This completed fine"

    """

rule samtools_sort:
    input:
    ¦   "01.pulled_reads/{tissue}/{i}.bam"
    params:
    ¦   "{i}"
    output:
    ¦   "01.pulled_reads/{tissue}/{i}.sorted.bam"
    shell:
    ¦   "samtools sort -T sorted_reads/{params}.tmp {input} > {output}"

rule samtools_index:
    input:
    ¦   "01.pulled_reads/{tissue}/{i}.sorted.bam"
    output:
    ¦   "01.pulled_reads/{tissue}/{i}.sorted.bam.bai"
    shell:
        "samtools index {input}"

rule string_tie_assembly:
    input:
    ¦   "01.pulled_reads/{tissue}/{i}.sorted.bam"
    output:
    ¦   "02.string_tie_assembly/{tissue}/{i}_assembly.gtf"
    shell:
        "stringtie {input} -f 0.0 -a 0 -m 50 -c 3.0 -f 0.0 -o {output}"


def trigger_aggregate(wildcards):
    checkpoint_output = checkpoints.pull_reads_for_BAM.get(**wildcards).output[0]

    x = expand("02.string_tie_assembly/{tissue}/{i}_assembly.merged.gtf",
    ¦   tissue = wildcards.tissue,
    ¦   i=glob_wildcards(os.path.join(checkpoint_output, "{i}.bam")).i)
    return x


#Aggregate function that triggers rule 
rule combine_all_gtf_things:
    input:
    ¦   trigger_aggregate
    output:
    ¦   "03.final_stuff/{tissue}.merged.gtf"
    shell:"""
    cat {input} > {output}
    """

命令运行完成后,snakemake 出于某种神秘原因返回(exited with non-zero exit code)。我可以看到文件中生成的输出,而且它似乎是正确的,所以我不确定它为什么会抛出这个错误。

我生成的检查点是以此为模型的: https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html

未回答的相关问题: Snakemake checkpoint (exited with non-zero exit code)

【问题讨论】:

    标签: bioinformatics snakemake


    【解决方案1】:

    看来这个问题是由{tissue} 中的通配符被设置为目录引起的。至于为什么这会引发非零退出状态,我不确定。只需将{tissue}_dir 附加到上面的路径即可解决此问题。

    可以在此处找到有关此问题的更多信息: https://bitbucket.org/snakemake/snakemake/issues/1303/snakemake-checkpoint-throws-exited-with

    【讨论】:

      【解决方案2】:

      不确定这是否是一个问题,但如果目录存在或01.pulled_reads 在执行 mkdir 之前不存在,mkdir 01.pulled_reads/{wildcards.tissue} 将失败。

      尝试将-p 选项添加到mkidr,即mkdir -p 01.pulled_reads/{wildcards.tissue}

      【讨论】:

      • 这当然是个好主意,但尝试了一下,仍然得到相同的错误消息。我也尝试将|| true 也添加到此命令的最后一行,但这似乎也不起作用。我已经在 bitbucket 网站上为 snakemake 生成了一个线程,可以在此处关注 bitbucket.org/snakemake/snakemake/issues/1303/…
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 2017-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多