CFIA-NCFAD / nf-flu

Influenza genome analysis Nextflow workflow
MIT License
14 stars 9 forks source link

[BUG]: Cannot run VADR process with Singularity/Apptainer due to PERL5LIB not being set properly #79

Open nascimento-jean opened 2 weeks ago

nascimento-jean commented 2 weeks ago

Is there an existing issue for this?

Description of the Bug/Issue

I am trying to run the pipeline to analyze my data; however, I am facing difficulties in executing the NF_FLU:ILLUMINA process.

What could be causing this error? How can I solve this problem? I am running the pipeline on WSL, Ubuntu 22.04.

Captura de tela 2024-09-21 102225

Nextflow command-line

nextflow run CFIA-NCFAD/nf-flu --input lacenal_flu.csv --platform illumina -profile singularity --outdir ./FLU_Lacen/NF-Flu_results --low_coverage 20 --max_top_blastn 5 --max_cpus 15 --max_memory 64.GB --max_time 6.h -resume lacenal_analysis

Error Message

Oops... Pipeline execution stopped with the following message: INFO:    Converting SIF file to temporary sandbox...
Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/5.32/site_perl/Bio/Easel/MSA.pm line 60.
Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/5.32/site_perl/Bio/Easel/SqFile.pm line 59.
Can't locate vadr.pm in @INC (you may need to install the vadr module) (@INC contains: /usr/local/lib/perl5/5.32/site_perl /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/vendor_perl /usr/local/lib/perl5/vendor_perl /usr/local/lib/perl5/5.32/core_perl /usr/local/lib/perl5/core_perl .) at /usr/local/bin/v-annotate.pl line 13.
INFO:    Cleaning up image...
ERROR ~ Error executing process > 'NF_FLU:ILLUMINA:VADR (0549)'

Caused by:
  Process `NF_FLU:ILLUMINA:VADR (0549)` terminated with an error exit status (2)

Command executed:

  v-annotate.pl \
    --mkey flu -r --atgonly --xnocomp --nomisc --alt_fail extrant5,extrant3 \
    --mdir vadr-model \
    0549.irma.consensus.fasta \
    0549

  cat <<-END_VERSIONS > versions.yml
  "NF_FLU:ILLUMINA:VADR":
      vadr: $(v-annotate.pl -h | perl -ne 'print "$1\n" if /^# VADR (\d+\.\d+\.\d+)/')
  END_VERSIONS

Command exit status:
  2

Command output:
  (empty)

Command error:
  INFO:    Converting SIF file to temporary sandbox...
  Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/5.32/site_perl/Bio/Easel/MSA.pm line 60.
  Use of uninitialized value in subroutine entry at /usr/local/lib/perl5/5.32/site_perl/Bio/Easel/SqFile.pm line 59
  Can't locate vadr.pm in @INC (you may need to install the vadr module) (@INC contains: /usr/local/lib/perl5/5.32/site_perl /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/vendor_perl /usr/local/lib/perl5/vendor_perl /usr/local/lib/perl5/5.32/core_perl /usr/local/lib/perl5/core_perl .) at /usr/local/bin/v-annotate.pl line 13.
  INFO:    Cleaning up image...

Work dir:
  /home/lacenal/work/a4/5fd5abf3e18a849457d9838c8880f0

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

Workflow Version

Version 3.4.1

Nextflow Executor

local

Nextflow Version

version 24.04.4

Java Version

openjdk 21-internal 2023-09-19 OpenJDK Runtime Environment (build 21-internal-adhoc.conda.src) OpenJDK 64-Bit Server VM (build 21-internal-adhoc.conda.src, mixed mode, sharing)

Hardware

Desktop

Operating System (OS)

Ubuntu LTS 22.04 - WSL

Conda/Container Engine

Singularity

Additional context

No response

peterk87 commented 2 weeks ago

Thank you @nascimento-jean for creating this issue! This seems to be an issue with how the VADR Bioconda recipe is configured to set the necessary shell environment variables for running VADR and how Nextflow executes commands when running with Singularity/Apptainer. I've let the developers of VADR know there's an issue (see https://github.com/ncbi/vadr/issues/87). This issue might affect other Perl tools in Bioconda when trying to use them in Nextflow pipelines with Singularity.

You could try running the workflow with -profile docker or -profile conda to use Docker or Conda instead of Singularity.

Another workaround is to use the staph-b/vadr 1.6.3-hav-flu2 container instead of the Bioconda/Biocontainers one by supplying Nextflow with a custom config file:

vadr-custom.config:

process {
  withName '.*VADR.*' {
    container 'staphb/vadr:1.6.3-hav-flu2'
  }
}

Re-run your Nextflow command with -c vadr-custom.config:

nextflow run CFIA-NCFAD/nf-flu \
  -c vadr-custom.config \
  --input lacenal_flu.csv \
  --platform illumina \
  -profile singularity \
  --outdir ./FLU_Lacen/NF-Flu_results \
  --low_coverage 20 \
  --max_top_blastn 5 \
  --max_cpus 15 --max_memory 64.GB --max_time 6.h \
  -resume

Hope that helps while we try to find a permanent solution!

Also, it's great to hear that the pipeline can be used on Windows with WSL!