Skip to content

Verifybamid2 does not allow for reference files ending with '.fa' #5021

@mwhamgenomics

Description

@mwhamgenomics

Have you checked the docs?

Description of the bug

In the VERIFYBAMID_VERIFYBAMID2 module, when the value of the references input has a '.fa' suffix, I get a 'FATAL ERROR - --Reference is required' error. This happens because of the preamble before the script block:

def reference_args = ("$references".endsWith('.fasta')) ? "--Reference ${references}" : ''

Also if I do some tweaking of the module, e.g. to remove the refvcf, I can end up with garbled command line args due to a parsing bug in verifybamid:

The following parameters are available.  Ones with "[]" are in effect:

Available Options
    Input/Output Files:
        --BamFile [Empty],
        --PileupFile [Empty],
        --Reference [Empty],
        --SVDPrefix [/usr/local/share/verifybamid2-2.0.1-6/resource/--NumThread.2.--BamFile.vcf.gz.dat],
        --Output [HG003-recal-verifybamid]
        ...

FATAL ERROR -
  Problems encountered parsing command line:

  Cannot correspond command line parameter HG003-recal.bam (#3) to any of the options

Do we need the endsWith check when creating reference_args?

Command used and terminal output

$ mkdir test_verifybamid
$ cd test_verifybamid
$ conda create -y -c bioconda verifybamid2 -p ./conda  # for verifybamid resources
$ nf-core create  # example empty pipeline with verifybamid2
$ cd test-pipeline
$ nf-core modules install verifybamid/verifybamid2
$ rm workflows/pipeline.nf  # simplify down to a single workflow script that calls the module
$ vi main.nf
$ cat main.nf
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { VERIFYBAMID_VERIFYBAMID2 } from './modules/nf-core/verifybamid/verifybamid2/main'                                          

workflow {
  ch_bam = Channel.fromPath(params.bam, checkIfExists: true)
  ch_bai = Channel.fromPath(params.bai, checkIfExists: true)
  VERIFYBAMID_VERIFYBAMID2(
    ch_bam.combine(ch_bai).map({bam, bai -> [[id: bam.name], bam, bai]}),                                                        
    Channel.value(
      [
        file(params.svd_ud, checkIfExists: true),
        file(params.svd_mu, checkIfExists: true),
        file(params.svd_bed, checkIfExists: true)
      ]
    ),
    Channel.fromPath(params.ref_vcf, checkIfExists: true),
    Channel.fromPath(params.ref_fasta, checkIfExists: true)
  )
}
$ nextflow run main.nf -profile singularity \
  --ref_vcf path/to/ref.vcf.gz \
  --ref_fasta path/to/hg38.fa \
  --svd_ud path/to/conda/share/verifybamid2-2.0.1-10/resource/1000g.phase3.10k.b38.vcf.gz.dat.UD \
  --svd_mu path/to/conda/share/verifybamid2-2.0.1-10/resource/1000g.phase3.10k.b38.vcf.gz.dat.mu \
  --svd_bed path/to/conda/share/verifybamid2-2.0.1-10/resource/1000g.phase3.10k.b38.vcf.gz.dat.bed \
  --bam path/to/test.bam \
  --bai path/to/test.bam.bai

N E X T F L O W  ~  version 23.04.1
Launching `main.nf` [shrivelled_gauss] DSL2 - revision: 6f25f6a1e6
executor >  slurm (1)
...
ERROR ~ Error executing process > 'VERIFYBAMID_VERIFYBAMID2 (${meta.id})'

Caused by:
  Process `VERIFYBAMID_VERIFYBAMID2 (${meta.id})` terminated with an error exit status (255)

Command executed:

  verifybamid2 \
      --NumThread 2 \
      --SVDPrefix 1000g.phase3.10k.b38.vcf.gz.dat \
      --BamFile test.bam \
       \
        \
       \
      > test.bam.log

  cat <<-END_VERSIONS > versions.yml
  "VERIFYBAMID_VERIFYBAMID2":
      verifybamid: $(echo $(verifybamid2 --help 2>&1 | sed -e '3p;d' | sed -e 's/ Version://'))
  END_VERSIONS

Command exit status:
  255

Command output:
  (empty)

Command error:
  VerifyBamID2: A robust tool for DNA contamination estimation from sequence reads using ancestry-agnostic method.

   Version:2.0.1
   Copyright (c) 2009-2020 by Hyun Min Kang and Fan Zhang
   This project is licensed under the terms of the MIT license.

  The following parameters are available.  Ones with "[]" are in effect:

  Available Options
                      Input/Output Files : --BamFile [test.bam],
                                           --PileupFile [Empty],
                                           --Reference [Empty],
                                           --SVDPrefix [1000g.phase3.10k.b38.vcf.gz.dat],
                                           --Output [result]
                 Model Selection Options : --WithinAncestry,
                                           --DisableSanityCheck, --NumPC [2],
                                           --FixPC [Empty],
                                           --FixAlpha [-1.0e+00],
                                           --KnownAF [Empty], --NumThread [2],
                                           --Seed [12345], --Epsilon [1.0e-08],
                                           --OutputPileup, --Verbose
     Construction of SVD Auxiliary Files : --RefVCF [Empty]
                          Pileup Options : --min-BQ [13], --min-MQ [2],
                                           --adjust-MQ [40], --max-depth [8000],
                                           --no-orphans, --incl-flags [1040],
                                           --excl-flags [1796]
                      Deprecated Options : --UDPath [Empty], --MeanPath [Empty],
                                           --BedPath [Empty]

  FATAL ERROR -
  --Reference is required

    Exiting due to ERROR:
        Exception was thrown

Work dir:
  /mnt/e1000/home/u035/u035/mwham2/test-verifybamid/nf-core/test-testpipeline/work/60/9a4a0eb1a469967e6aa5fc8e3b7ab0

Tip: you can try to figure out what's wrong by changing to the process work dir and showing the script file named `.command.sh`

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

Relevant files

No response

System information

  • Nextflow: 23.04.1
  • Hardware: HPC
  • Executor: Slurm
  • Container engine: Singularity
  • OS: RHEL 8.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Bumped

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions