nf-core / methylseq

Methylation (Bisulfite-Sequencing) analysis pipeline using Bismark or bwa-meth + MethylDackel
https://nf-co.re/methylseq
MIT License
137 stars 137 forks source link

Error when providing a bwameth index (MethylSeq v2.4.0 and v2.5.0) #353

Open bioinfoMMS opened 10 months ago

bioinfoMMS commented 10 months ago

Description of the bug

I am running into an error regarding bwameth indexing/aligning. I am trying to get the bwameth pipeline to work with an existing bwameth index. Looks like there have been similar problems, but I haven't seen how to fix this.

Command used and terminal output

#Command:

nextflow run nf-core/methylseq -r 2.4.0 --input samplesheet.csv --outdir /corestore/mmacd/nextflow --fasta /corestore/mmacd/nextflow/methylation_twist_panel/references/hg38.fa --fasta_index /corestore/mmacd/nextflow/methylation_twist_panel/references/hg38.fa.fai -profile singularity --aligner bwameth --bwa_meth_index /corestore/mmacd/nextflow/methylation_twist_panel/references/ 

#Output:

[81/febf49] process > NFCORE_METHYLSEQ:METHYLSEQ:... [100%] 1 of 1, cached: 1 ✔
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[46/23f6ee] process > NFCORE_METHYLSEQ:METHYLSEQ:... [100%] 1 of 1, cached: 1 ✔
[75/9f7dc9] process > NFCORE_METHYLSEQ:METHYLSEQ:... [100%] 1 of 1, cached: 1 ✔
[7a/1c6b36] process > NFCORE_METHYLSEQ:METHYLSEQ:... [  0%] 0 of 1 ✔
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
[-        ] process > NFCORE_METHYLSEQ:METHYLSEQ:... -
ERROR ~ Error executing process > 'NFCORE_METHYLSEQ:METHYLSEQ:BWAMETH:BWAMETH_ALIGN (TB-19-067)'

Caused by:
  Process `NFCORE_METHYLSEQ:METHYLSEQ:BWAMETH:BWAMETH_ALIGN (TB-19-067)` terminated with an error exit status (1)

Command executed:

  INDEX=`find -L references -name "*.bwameth.c2t" | sed 's/\.bwameth.c2t$//'`

  # Modify the timestamps so that bwameth doesn't complain about building the index
  # See https://github.com/nf-core/methylseq/pull/217
  touch -c -- *

  bwameth.py \
       \
       \
      -t 12 \
      --reference $INDEX \
      TB-19-067_1_val_1.fq.gz TB-19-067_2_val_2.fq.gz \
      | samtools view  -@ 12 -bhS -o TB-19-067.bam -

  cat <<-END_VERSIONS > versions.yml
  "NFCORE_METHYLSEQ:METHYLSEQ:BWAMETH:BWAMETH_ALIGN":
      bwameth: $(echo $(bwameth.py --version 2>&1) | cut -f2 -d" ")
  END_VERSIONS

Command exit status:
  1

Command output:
  (empty)

Command error:
  INFO:    Environment variable SINGULARITYENV_TMPDIR is set, but APPTAINERENV_TMPDIR is preferred
  INFO:    Environment variable SINGULARITYENV_NXF_TASK_WORKDIR is set, but APPTAINERENV_NXF_TASK_WORKDIR is preferred
  INFO:    Environment variable SINGULARITYENV_NXF_DEBUG is set, but APPTAINERENV_NXF_DEBUG is preferred
  WARNING: Skipping mount /var/apptainer/mnt/session/etc/resolv.conf [files]: /etc/resolv.conf doesn't exist in container
  Traceback (most recent call last):
    File "/usr/local/bin/bwameth.py", line 4, in <module>
      __import__('pkg_resources').run_script('bwameth==0.2.2', 'bwameth.py')
    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 657, in run_script
      self.require(requires)[0].run_script(script_name, ns)
    File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1437, in run_script
      exec(code, namespace, namespace)
    File "/usr/local/lib/python3.7/site-packages/bwameth-0.2.2-py2.7.egg-info/scripts/bwameth.py", line 509, in <module>
      main(sys.argv[1:])
    File "/usr/local/lib/python3.7/site-packages/bwameth-0.2.2-py2.7.egg-info/scripts/bwameth.py", line 506, in main
      set_as_failed=args.set_as_failed)
    File "/usr/local/lib/python3.7/site-packages/bwameth-0.2.2-py2.7.egg-info/scripts/bwameth.py", line 315, in bwa_mem
      raise BWAMethException("first run bwameth.py index %s" % fa)
  __main__.BWAMethException: first run bwameth.py index references/hg38.fa

Work dir:
  /corestore/mmacd/nextflow/methylation_twist_panel/work/7a/1c6b36ac478190a235043c548a2aaa

Tip: when you have fixed the problem you can continue the execution adding the option `-resume` to the run command line
 -- Check '.nextflow.log' file for details

Relevant files

No response

System information

MethylSeq pipeline v2.4.0 Nextflow: v23.10.0 Hardware: HPC Executor: Slurm Container: Singularity

oliviapetrillo commented 4 months ago

@bioinfoMMS Not sure if you are still facing this issue, but I also ran into this, and think it is related to the fact that we both have our reference files in a subfolder (e.g. references). The touch command as is isn't recursing through the references subfolder and modifying the timestamps.

I resolved this by fixing the line with the touch command to this:

touch -c -- references/*