用非零退出代码退出的命令之一;请注意,snakemake使用bash严格模式,我不确定为什么会出现此错误

时间:2019-12-05 15:13:50

标签: snakemake

我遇到以下错误:

one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!

我的snakefile如下所示:

#!/miniconda/bin/python

workdir: config["path_to_files"]
wildcard_constraints:
    separator = config["separator"],
    extension = config["file_extension"],
    sample = '|' .join(config["samples"])

rule all:
    input:
        expand("antismash-output/{sample}/{sample}.txt", sample = config["samples"])

# merging the paired end reads (either fasta or fastq) as prodigal only takes single end reads
rule pear:
    input:
        forward = f"{{sample}}{config['separator']}1.{{extension}}",
        reverse = f"{{sample}}{config['separator']}2.{{extension}}"

    output:
        "merged_reads/{sample}.{extension}"

    #conda:
        #"/home/lamma/env-export/antismash.yaml"

    shell:
        """
        set+u;source ~/miniconda3/etc/profile.d/conda.sh; set -u ;
        set+u;conda activate antismash; set -u ;
        pear -f {input.forward} -r {input.reverse} -o {output} -t 21
        """

# If single end then move them to merged_reads directory
rule move:
    input:
        "{sample}.{extension}"

    output:
        "merged_reads/{sample}.{extension}"

    shell:
        "cp {path}/{sample}.{extension} {path}/merged_reads/"

# Setting the rule order on the 3 above rules which should be treated equally and only one run.
ruleorder: pear > move
# annotating the metagenome with prodigal#. Can be done inside antiSMASH but prefer to do it out
rule prodigal:
    input:
        f"merged_reads/{{sample}}.{config['file_extension']}"

    output:
        gbk_files = "annotated_reads/{sample}.gbk",
        protein_files = "protein_reads/{sample}.faa"

    #conda:
        #"/home/lamma/env-export/antismash.yaml"

    shell:
        """
        set+u;source ~/miniconda3/etc/profile.d/conda.sh; set -u ;
        set+u;conda activate antismash; set -u ;
        prodigal -i {input} -o {output.gbk_files} -a {output.protein_files} -p meta
        """

# running antiSMASH on the annotated metagenome
rule antiSMASH:
    input:
        "annotated_reads/{sample}.gbk"

    output:
        touch("antismash-output/{sample}/{sample}.txt")

    #conda:
        #"/home/lamma/env-export/antismash.yaml"

    shell:
        """
        set+u;source ~/miniconda3/etc/profile.d/conda.sh; set -u ;
        set+u;conda activate antismash; set -u ;
        antismash --knownclusterblast --subclusterblast --full-hmmer --smcog --outputfolder antismash-output/{wildcards.sample}/ {input}
        """

对于我为什么会出现此错误的任何帮助都将适用。我认为这与我如何激活conda环境有关,使用conda: path/to/yaml对我不起作用,因为出现版本错误,snakemake似乎无法满足yaml提出的版本要求文件。

编辑:

完整的错误消息如下:

Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 16
Rules claiming more threads will be scaled down.
Job counts:
        count   jobs
        1       pear
        1

[Thu Dec  5 16:05:37 2019]
rule pear:
    input: Unmap_41_1.fastq, Unmap_41_2.fastq
    output: merged_reads/Unmap_41.fastq
    jobid: 0
    wildcards: sample=Unmap_41, extension=fastq

/usr/bin/bash: set+u: command not found
[Thu Dec  5 16:05:37 2019]
Error in rule pear:
    jobid: 0
    output: merged_reads/Unmap_41.fastq
    shell:

        set+u;source ~/miniconda3/etc/profile.d/conda.sh; set -u ;
        set+u;conda activate antismash; set -u ;
        pear -f Unmap_41_1.fastq -r Unmap_41_2.fastq -o merged_reads/Unmap_41.fastq -t 21

        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

似乎也是set + u;是一个未知命令,但据我了解,这是一个蛇形命令。

1 个答案:

答案 0 :(得分:0)

我无法发表评论,因此冒着答案的风险:

似乎不是set + u要set +u。 (set + u被视为命令,但可能不是)。由于您正在设置和取消设置-u,因此最好在rule pear:中使用

    set +u;source ~/miniconda3/etc/profile.d/conda.sh; 
    conda activate antismash; set -u ;
    prodigal -i {input} -o {output.gbk_files} -a {output.protein_files} -p meta

或更简单

    set +u
    source ~/miniconda3/etc/profile.d/conda.sh
    conda activate antismash
    prodigal -i {input} -o {output.gbk_files} -a {output.protein_files} -p meta