0

I am getting the following error:

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

My snakefile looks like the following:

#!/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}
        """

Any help as to why I am getting this error would be appriciated. I think it is something to do with how I am activating the conda environments, using the conda: path/to/yaml has not worked for me as I get version errors, where it seems snakemake can't satisfy the version requierments set out by the yaml file.

Edit:

The full error message is as follows:

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!)

It also seems set+u; is an unknow command but to my understanding it is a snakemake command.

Lamma
  • 895
  • 1
  • 12
  • 26
  • 1
    I would start with figuring out which rule is causing this error. Presenting minimal snakefile that still causes this problem would help us narrowing down the issue. – Manavalan Gajapathy Dec 05 '19 at 19:42
  • 2
    I would also advice to use the `--printshellcmds` flag and run the shown shell commands manually checking which one fails. – Dmitry Kuzminov Dec 05 '19 at 20:15
  • The error is comming from `rule pear` I have edited with the full error message above now. – Lamma Dec 09 '19 at 08:04

1 Answers1

-1

I can't comment so I'm risking an answer:

It seems that instead of set+u want set +u . (set+u is regarded as a command, which it probably isn't). Since you are setting and un-setting -u , you might be better off with (in 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

or even simpler

    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
gutorm
  • 99
  • 6