ohsu-cedar-comp-hub / WGS-nextflow-workflow

Apache License 2.0
3 stars 1 forks source link

trimmomatic docker/sif #38

Closed rlancaster96 closed 5 months ago

rlancaster96 commented 5 months ago

Command run:

nextflow run /home/groups/CEDAR/lancasru/WGS_COH_NF/WGS-nextflow-workflow/workflows/trimmomatic/trimmomatic.nf \
-params-file /home/groups/CEDAR/lancasru/WGS_COH_NF/nextflow_test/references/params_files/synapse_tumor.json \
-c /home/groups/CEDAR/lancasru/WGS_COH_NF/config_sif/nextflow.config \
-with-singularity /home/groups/CEDAR/lancasru/WGS_COH_NF/config_sif/trimmomatic.sif

Expected behavior: Run nextflow with singularity to perform the trimmomatic step.

Actual behavior:

Output:

[13/873ea4] process > trimmomaticPE [100%] 1 of 1, failed: 1 ✘
ERROR ~ Error executing process > 'trimmomaticPE'

Caused by:
  Process `trimmomaticPE` terminated with an error exit status (127)

Command executed:

  trimmomatic      PE -phred33      merged.tumor.R1.fq.gz      merged.tumor.R2.fq.gz      merged.tumor.R1.fq_1P.fastq.gz      merged.tumor.R1.fq_1U.fastq.gz      merged.tumor.R2.fq_2P.fastq.gz      merged.tumor.R2.fq_2U.fastq.gz      ILLUMINACLIP:"TruSeq3-PE.fa":2:30:10 LEADING:3 TRAILING:3 SLIDINGWINDOW:4:20 MINLEN:50

Command exit status:
  127

Command output:
  (empty)

Command error:
  .command.sh: line 2: trimmomatic: command not found

Work dir:
  /home/users/lancasru/work/13/873ea4990b5c59c7a8bd781874c5cd

Tip: you can replicate the issue by changing to the process work dir and entering the command `bash .command.run`

 -- Check '.nextflow.log' file for details

Tried adding environmental variable to Dockerfile, error persits. Path determined by running a whereis when running the singularity container.

(nextflow_only) [lancasru@exanode-11-30 ~]$ singularity exec /home/groups/CEDAR/lancasru/WGS_COH_NF/config_sif/trimmomatic.sif whereis trimmomatic
trimmomatic: /usr/bin/trimmomatic.jar
(nextflow_only) [lancasru@exanode-11-30 ~]$ singularity exec /home/groups/CEDAR/lancasru/WGS_COH_NF/config_sif/trimmomatic.sif trimmomatic
FATAL:   "trimmomatic": executable file not found in $PATH

Dockerfile contents

FROM ubuntu:20.04 AS builder

ARG VERSION=0.38

ENV URL=http://www.usadellab.org/cms/uploads/supplementary/Trimmomatic/Trimmomatic-${VERSION}.zip

RUN mkdir -p /usr/share/man/man1 \
    && apt-get update \
      && apt-get install -y \
          wget \
          openjdk-11-jre-headless \
          unzip \
      && apt-get clean \
      && rm -rf /var/lib/apt/lists/*

WORKDIR /opt

RUN wget $URL \
    && unzip Trimmomatic-${VERSION}.zip \
    && ln -s /opt/Trimmomatic-${VERSION}/trimmomatic-${VERSION}.jar /bin/trimmomatic.jar \
    && rm Trimmomatic-${VERSION}.zip

ENV PATH="/usr/bin/:$PATH"
rlancaster96 commented 5 months ago

It looks like solving this issue can't be done by managing environmental variables in the Dockerfile. "This software is a Java executable .jar file; thus, it is not possible to add to the PATH environment variable." This issue is commonly solved by setting an environmental variable, eg $TRIMMOMATIC when running trimmomatic to point to the location of the .jar file.

Solution: I modified the nextflow script call for trimmomatic and the issue was solved.

trimmomatic changed to java -jar /bin/trimmomatic.jar.

This means the script will be executable with singularity but may no longer be executable in a conda environment.