Skip to content

Commit

Permalink
Merge pull request #1280 from drpatelh/versions
Browse files Browse the repository at this point in the history
 Update modules in pipeline template with new versions syntax
  • Loading branch information
drpatelh authored Oct 1, 2021
2 parents 9a8572b + a56dca3 commit 770fa1b
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 26 deletions.
6 changes: 3 additions & 3 deletions nf_core/module-template/modules/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ process {{ tool_name_underscore|upper }} {
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels
{{ 'tuple val(meta), path("*.bam")' if has_meta else 'path "*.bam"' }}, emit: bam
// TODO nf-core: List additional required output channels/values here
path "versions.yml" , emit: version
path "versions.yml" , emit: versions

script:
{% if has_meta -%}
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
{%- endif %}
// TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10
// If the software is unable to output a version number on the command-line then it can be manually specified
Expand All @@ -80,7 +80,7 @@ process {{ tool_name_underscore|upper }} {
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
samtools: \$( samtools --version 2>&1 | sed 's/^.*samtools //; s/Using.*\$//' )
${getSoftwareName(task.process)}: \$( samtools --version 2>&1 | sed 's/^.*samtools //; s/Using.*\$//' )
END_VERSIONS
"""
}
4 changes: 2 additions & 2 deletions nf_core/module-template/modules/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ output:
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
{% endif -%}
- version:
- versions:
type: file
description: File containing software version
description: File containing software versions
pattern: "versions.yml"
## TODO nf-core: Delete / customise this example output
- bam:
Expand Down
6 changes: 3 additions & 3 deletions nf_core/pipeline-template/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"repos": {
"nf-core/modules": {
"custom/dumpsoftwareversions": {
"git_sha": "22ec5c6007159d441585ef54bfa6272b6f93c78a"
"git_sha": "7b3315591a149609e27914965f858c9a7e071564"
},
"fastqc": {
"git_sha": "ab67a1d41b63bf52fd7c147f7f8f6e8d167590b5"
"git_sha": "7b3315591a149609e27914965f858c9a7e071564"
},
"multiqc": {
"git_sha": "ab67a1d41b63bf52fd7c147f7f8f6e8d167590b5"
"git_sha": "7b3315591a149609e27914965f858c9a7e071564"
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions nf_core/pipeline-template/modules/local/samplesheet_check.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Import generic module functions
include { saveFiles } from './functions'
include { saveFiles; getProcessName } from './functions'

params.options = [:]

Expand All @@ -20,12 +20,18 @@ process SAMPLESHEET_CHECK {
path samplesheet

output:
path '*.csv'
path '*.csv' , emit: csv
path "versions.yml", emit: versions

script: // This script is bundled with the pipeline, in {{ name }}/bin/
"""
check_samplesheet.py \\
$samplesheet \\
samplesheet.valid.csv
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ process CUSTOM_DUMPSOFTWAREVERSIONS {
path versions

output:
path 'software_versions.yml' , emit: yml
path 'software_versions_mqc.yml', emit: mqc_yml
path 'versions.yml' , emit: versions
path "software_versions.yml" , emit: yml
path "software_versions_mqc.yml", emit: mqc_yml
path "versions.yml" , emit: versions

script:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ process FASTQC {
output:
tuple val(meta), path("*.html"), emit: html
tuple val(meta), path("*.zip") , emit: zip
path "versions.yml" , emit: version
path "versions.yml" , emit: versions

script:
// Add soft-links to original FastQs for consistent naming in pipeline
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
if (meta.single_end) {
"""
[ ! -f ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz
fastqc $options.args --threads $task.cpus ${prefix}.fastq.gz
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
${getSoftwareName(task.process)}: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
} else {
Expand All @@ -47,7 +47,7 @@ process FASTQC {
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
${getSoftwareName(task.process)}: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ process MULTIQC {
path "*multiqc_report.html", emit: report
path "*_data" , emit: data
path "*_plots" , optional:true, emit: plots
path "versions.yml" , emit: version
path "versions.yml" , emit: versions

script:
def software = getSoftwareName(task.process)
"""
multiqc -f $options.args .
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
${getSoftwareName(task.process)}: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
}
4 changes: 3 additions & 1 deletion nf_core/pipeline-template/subworkflows/local/input_check.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ workflow INPUT_CHECK {

main:
SAMPLESHEET_CHECK ( samplesheet )
.csv
.splitCsv ( header:true, sep:',' )
.map { create_fastq_channels(it) }
.set { reads }

emit:
reads // channel: [ val(meta), [ reads ] ]
reads // channel: [ val(meta), [ reads ] ]
versions = SAMPLESHEET_CHECK.out.versions // channel: [ versions.yml ]
}

// Function to get list of [ meta, [ fastq_1, fastq_2 ] ]
Expand Down
11 changes: 6 additions & 5 deletions nf_core/pipeline-template/workflows/pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,26 @@ def multiqc_report = []

workflow {{ short_name|upper }} {

ch_software_versions = Channel.empty()
ch_versions = Channel.empty()

//
// SUBWORKFLOW: Read in samplesheet, validate and stage input files
//
INPUT_CHECK (
ch_input
)
ch_versions = ch_versions.mix(INPUT_CHECK.out.versions)

//
// MODULE: Run FastQC
//
FASTQC (
INPUT_CHECK.out.reads
)
ch_software_versions = ch_software_versions.mix(FASTQC.out.version.first().ifEmpty(null))
ch_versions = ch_versions.mix(FASTQC.out.versions.first())

CUSTOM_DUMPSOFTWAREVERSIONS (
ch_software_versions.collectFile()
ch_versions.collectFile()
)

//
Expand All @@ -104,8 +105,8 @@ workflow {{ short_name|upper }} {
MULTIQC (
ch_multiqc_files.collect()
)
multiqc_report = MULTIQC.out.report.toList()
ch_software_versions = ch_software_versions.mix(MULTIQC.out.version.ifEmpty(null))
multiqc_report = MULTIQC.out.report.toList()
ch_versions = ch_versions.mix(MULTIQC.out.versions)
}

/*
Expand Down

0 comments on commit 770fa1b

Please sign in to comment.