【问题标题】:snakemake "one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!"snakemake “以非零退出代码退出的命令之一;请注意,snakemake 使用 bash 严格模式!”
【发布时间】:2021-04-21 08:17:45
【问题描述】:

您好,我正在尝试使用snakemake 运行管道。具体来说,我按照此处指定的说明运行演示 rna-seq 分析管道:https://gagneurlab-drop.readthedocs.io/en/latest/installation.html

当我运行snakemake --cores 1 时,我收到以下错误消息::

    Error in rule aberrantExpression_bamStats:
    jobid: 26
    output: /Users/00104561/drop_demo/Output/processed_data/aberrant_expression/v29/coverage/HG00126.1.M_111124_8.tsv
    shell:
        
        # identify chromosome format
        if samtools idxstats /Users/00104561/drop_demo/Data/rna_bam/HG00126.1.M_111124_8_chr21.bam | grep -qP "^chr";
        then
            chrNames=$(cut -f1 Scripts/AberrantExpression/pipeline/resource/chr_UCSC_NCBI.txt | tr '
' '|')
        else
            chrNames=$(cut -f2 Scripts/AberrantExpression/pipeline/resource/chr_UCSC_NCBI.txt | tr '
' '|')
        fi

        # write coverage from idxstats into file
        count=$(samtools idxstats /Users/00104561/drop_demo/Data/rna_bam/HG00126.1.M_111124_8_chr21.bam | grep -E "^($chrNames)" |                 cut -f3 | paste -sd+ - | bc)

        echo -e "HG00126.1.M_111124_8   ${count}" > /Users/00104561/drop_demo/Output/processed_data/aberrant_expression/v29/coverage/HG00126.1.M_111124_8.tsv
        
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message

任何帮助将不胜感激!我对生物信息学很陌生!

【问题讨论】:

  • “严格模式”实际上并不存在,但它是一些工具所说的打开一系列选项,指示 shell 在任何命令发生时失败。 (不幸的是,其中一些选项有不必要的副作用,一般来说是一个坏主意——请参阅BashFAQ #105 中的练习,特别展示了set -e 如何使一些 shell 的行为让读者非常惊讶,并且还减少了跨版本边界的可移植性)。
  • 例如,如果“严格模式”的snakemake理念同时包含pipefailerrexit,那么您在管道中某处包含的任何grep都会导致整个命令被视为如果甚至没有匹配项,则失败 - 即使您考虑将空字符串作为输出作为完全可以接受的结果。
  • 无论如何,我建议将 set -x 放入 shell 脚本中,然后读取记录到 stderr 的跟踪以查看它停止的确切位置。
  • 看起来您正在使用来自 shell 部分的 bash 脚本。 Snakemake 不支持 bash:您需要将脚本提取到 .sh 文件中并从 shell 运行。

标签: bash snakemake drop rna-seq


【解决方案1】:

消息“其中一个命令以非零退出代码退出”表示shell命令已成功启动,但它报告了错误(非零退出代码)。

所以你让snakemake运行的命令出了点问题。尝试不使用snakemake直接从命令行运行报告的命令,这样调试可能更容易。

最近对类似问题的回答很好地解释了这一点:https://stackoverflow.com/a/67176454/663466

【讨论】:

  • 这是很好的指导,但我不确定它是否真的构成了答案。无法回答的问题(f / e,因为它们没有minimal reproducible example)应该被评论并可能关闭(直到编辑以改进),而不是给出适用性/实用性的半答案'无法保证。
猜你喜欢
  • 2021-02-19
  • 1970-01-01
  • 2011-06-28
  • 2020-10-28
  • 1970-01-01
  • 2021-12-10
  • 2020-10-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多