Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nanopore medaka processing fails with error if model name, not model file, provided #281

Closed
pvanheus opened this issue Feb 18, 2022 · 1 comment · Fixed by nf-core/modules#1326
Labels
bug Something isn't working

Comments

@pvanheus
Copy link

Description of the bug

When a medaka model is specified by model name, not path to model file, viralrecon will fail with an error. The error (see below) seems to come from this line of code.

When a model filename is passed (I extracted the models from the Singularity image) the command runs to completion.

Command used and terminal output

$ nextflow run nf-core/viralrecon --input samplesheet.csv --platform nanopore --genome MN908947.3 --primer_set_version 3 --fastq_dir fastq_pass --artic_minion_caller medaka --artic_minion_medaka_model r941_min_high_g360
...
Error executing process > 'NFCORE_VIRALRECON:NANOPORE:ARTIC_MINION (Sample_01)'

Caused by:
  Argument of `file` function cannot be empty

Source block:
  def args = task.ext.args   ?: ''
  prefix   = task.ext.prefix ?: "${meta.id}"
  def version  = scheme_version.toString().toLowerCase().replaceAll('v','')
  def fast5    = fast5_dir ? "--fast5-directory $fast5_dir"             : ""
  def summary  = sequencing_summary ? "--sequencing-summary $sequencing_summary" : ""
  def model    = ""
  if (args.tokenize().contains('--medaka')) {
          fast5   = ""
          summary = ""
          model = file(medaka_model).exists() ? "--medaka-model ./$medaka_model" : "--medaka-model $medaka_model"
      }
  def hd5_plugin_path = task.ext.hd5_plugin_path ? "export HDF5_PLUGIN_PATH=" + task.ext.hd5_plugin_path : "export HDF5_PLUGIN_PATH=/usr/local/lib/python3.6/site-packages/ont_fast5_api/vbz_plugin"
  """
      $hd5_plugin_path
  
      artic \\
          minion \\
          $args \\
          --threads $task.cpus \\
          --read-file $fastq \\
          --scheme-directory ./primer-schemes \\
          --scheme-version $version \\
          $model \\
          $fast5 \\
          $summary \\
          $scheme \\
          $prefix
  
      cat <<-END_VERSIONS > versions.yml
      "${task.process}":
          artic: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//')
      END_VERSIONS
      """

Relevant files

No response

System information

Nextflow version: 22.01.0-edge
Hardware: HPC
Executor: slurm
Container engine: Singularity
OS: Ubuntu 18.04
Version of nf-core/viralrecon: 2.3.1 (97bebf8)

@pvanheus pvanheus added the bug Something isn't working label Feb 18, 2022
drpatelh added a commit to drpatelh/nf-core-viralrecon that referenced this issue Feb 18, 2022
drpatelh added a commit to drpatelh/nf-core-viralrecon that referenced this issue Feb 18, 2022
@drpatelh
Copy link
Member

Thanks for reporting @pvanheus ! This will be fixed when #282 is merged into dev. It was a bit of an edge case bug because artic minion can accept a model as either a file or a string and if the model is a file then we need to stage it properly as an input. Things broke when I tidied up the module to remove any params definitions but I have added a CI test for this now so we should be able to pick it up in the future!

Be great if you are able to test once #282 is merged:

nextflow pull nf-core/viralrecon

nextflow run nf-core/viralrecon \
    --input samplesheet.csv \
    --platform nanopore \
    --genome MN908947.3 \
    --primer_set_version 3 \
    --fastq_dir fastq_pass \
    --artic_minion_caller medaka \
    --artic_minion_medaka_model r941_min_high_g360 \
    -r dev

I will create a patch release when you have confirmed.

Have a good weekend!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants