nf-core / modules

Repository to host tool-specific module files for the Nextflow DSL2 community!
https://nf-co.re/modules
MIT License
258 stars 651 forks source link

Use `eval` to collect version #5834

Open ewels opened 2 weeks ago

ewels commented 2 weeks ago

Nextflow 22.04 brings with it two new features which should give much cleaner syntax for collecting tool versions: channel topics using topic (see https://github.com/nf-core/modules/issues/4517) and eval. They are designed to work together nicely, but are technically separate features.

The blog post contains a basic example of how this can be used to collect versions:

process FASTQC {
  input:
  tuple val(meta), path(reads)

  output:
  tuple val(meta), path('*.html'), emit: html
  tuple val("${task.process}"), val('fastqc'), eval('fastqc --version'), topic: versions 

  """
  fastqc $reads
  """
}

workflow {
  Channel.topic('versions') 
    | unique()
    | collectFile(name: 'collated_versions.yml')
    | CUSTOM_DUMPSOFTWAREVERSIONS
}

Needs some thought about how we approach these changes - may be best to do a bulk change everywhere in one go, as it affects multiple code locations (modules and pipelines).

muffato commented 2 weeks ago

Nextflow 22.04 brings with it

Did you mean 24.04 ?

ewels commented 6 days ago

See comment: https://github.com/nf-core/modules/issues/4517#issuecomment-2194150864