From 2ab116166a01e7defe255aea1c56a4e4b1c70b1f Mon Sep 17 00:00:00 2001 From: "Kevin L. Keys" Date: Thu, 7 Oct 2021 16:53:54 -0700 Subject: [PATCH 1/6] updated module git SHA keys --- modules.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules.json b/modules.json index fec24384..beaad357 100644 --- a/modules.json +++ b/modules.json @@ -4,35 +4,35 @@ "repos": { "nf-core/modules": { "cat/fastq": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "fastqc": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "multiqc": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "samtools/flagstat": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "samtools/idxstats": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "samtools/index": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "samtools/sort": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "samtools/stats": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "samtools/view": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" }, "trimgalore": { - "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" + "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" } } } -} \ No newline at end of file +} From 7f4bf3871553358360edd784c2925402d3f3fe78 Mon Sep 17 00:00:00 2001 From: "Kevin L. Keys" Date: Thu, 7 Oct 2021 17:16:04 -0700 Subject: [PATCH 2/6] force reinstalled modules to update --- modules.json | 22 ++++---- modules/local/get_software_versions.nf | 1 + modules/local/samplesheet_check.nf | 1 + .../modules/samtools/flagstat/functions.nf | 54 +++++++++++-------- .../nf-core/modules/samtools/flagstat/main.nf | 10 ++-- .../modules/samtools/flagstat/meta.yml | 6 +-- .../modules/samtools/idxstats/functions.nf | 54 +++++++++++-------- .../nf-core/modules/samtools/idxstats/main.nf | 10 ++-- .../modules/samtools/idxstats/meta.yml | 6 +-- .../modules/samtools/index/functions.nf | 54 +++++++++++-------- .../nf-core/modules/samtools/index/main.nf | 10 ++-- .../nf-core/modules/samtools/index/meta.yml | 6 +-- .../modules/samtools/sort/functions.nf | 54 +++++++++++-------- modules/nf-core/modules/samtools/sort/main.nf | 10 ++-- .../nf-core/modules/samtools/sort/meta.yml | 6 +-- .../modules/samtools/stats/functions.nf | 54 +++++++++++-------- .../nf-core/modules/samtools/stats/main.nf | 10 ++-- .../nf-core/modules/samtools/stats/meta.yml | 6 +-- 18 files changed, 218 insertions(+), 156 deletions(-) diff --git a/modules.json b/modules.json index beaad357..fec24384 100644 --- a/modules.json +++ b/modules.json @@ -4,35 +4,35 @@ "repos": { "nf-core/modules": { "cat/fastq": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "fastqc": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "multiqc": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "samtools/flagstat": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "samtools/idxstats": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "samtools/index": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "samtools/sort": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "samtools/stats": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "samtools/view": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" }, "trimgalore": { - "git_sha": "f479d4fb8d634b5ac5bd1c879917dc285abc076d" + "git_sha": "49da8642876ae4d91128168cd0db4f1c858d7792" } } } -} +} \ No newline at end of file diff --git a/modules/local/get_software_versions.nf b/modules/local/get_software_versions.nf index 6297eaa8..e1bd764d 100644 --- a/modules/local/get_software_versions.nf +++ b/modules/local/get_software_versions.nf @@ -2,6 +2,7 @@ include { saveFiles } from './functions' params.options = [:] +options = initOptions(params.options) process GET_SOFTWARE_VERSIONS { label 'process_low' diff --git a/modules/local/samplesheet_check.nf b/modules/local/samplesheet_check.nf index 8330038d..6b539886 100644 --- a/modules/local/samplesheet_check.nf +++ b/modules/local/samplesheet_check.nf @@ -2,6 +2,7 @@ include { saveFiles } from './functions' params.options = [:] +options = initOptions(params.options) process SAMPLESHEET_CHECK { label 'process_low' diff --git a/modules/nf-core/modules/samtools/flagstat/functions.nf b/modules/nf-core/modules/samtools/flagstat/functions.nf index da9da093..85628ee0 100644 --- a/modules/nf-core/modules/samtools/flagstat/functions.nf +++ b/modules/nf-core/modules/samtools/flagstat/functions.nf @@ -9,6 +9,13 @@ def getSoftwareName(task_process) { return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() } +// +// Extract name of module from process name using $task.process +// +def getProcessName(task_process) { + return task_process.tokenize(':')[-1] +} + // // Function to initialise default values and to generate a Groovy Map of available options for nf-core modules // @@ -37,32 +44,35 @@ def getPathFromList(path_list) { // Function to save/publish module results // def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_meta) { - def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta - for (key in key_list) { - if (args.meta && key instanceof String) { - def path = key - if (args.meta.containsKey(key)) { - path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] - } - path = path instanceof String ? path : '' - path_list.add(path) + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + + // Do not publish versions.yml unless running from pytest workflow + if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) { + return null + } + if (ioptions.publish_by_meta) { + def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta + for (key in key_list) { + if (args.meta && key instanceof String) { + def path = key + if (args.meta.containsKey(key)) { + path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] } + path = path instanceof String ? path : '' + path_list.add(path) } } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" } } diff --git a/modules/nf-core/modules/samtools/flagstat/main.nf b/modules/nf-core/modules/samtools/flagstat/main.nf index d4852c66..f9115c6b 100644 --- a/modules/nf-core/modules/samtools/flagstat/main.nf +++ b/modules/nf-core/modules/samtools/flagstat/main.nf @@ -1,5 +1,5 @@ // Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' +include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions' params.options = [:] options = initOptions(params.options) @@ -23,12 +23,14 @@ process SAMTOOLS_FLAGSTAT { output: tuple val(meta), path("*.flagstat"), emit: flagstat - path "*.version.txt" , emit: version + path "versions.yml" , emit: versions script: - def software = getSoftwareName(task.process) """ samtools flagstat $bam > ${bam}.flagstat - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + cat <<-END_VERSIONS > versions.yml + ${getProcessName(task.process)}: + ${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS """ } diff --git a/modules/nf-core/modules/samtools/flagstat/meta.yml b/modules/nf-core/modules/samtools/flagstat/meta.yml index 8414bf54..d408cb76 100644 --- a/modules/nf-core/modules/samtools/flagstat/meta.yml +++ b/modules/nf-core/modules/samtools/flagstat/meta.yml @@ -40,9 +40,9 @@ output: type: file description: File containing samtools flagstat output pattern: "*.{flagstat}" - - version: + - versions: type: file - description: File containing software version - pattern: "*.{version.txt}" + description: File containing software versions + pattern: "versions.yml" authors: - "@drpatelh" diff --git a/modules/nf-core/modules/samtools/idxstats/functions.nf b/modules/nf-core/modules/samtools/idxstats/functions.nf index da9da093..85628ee0 100644 --- a/modules/nf-core/modules/samtools/idxstats/functions.nf +++ b/modules/nf-core/modules/samtools/idxstats/functions.nf @@ -9,6 +9,13 @@ def getSoftwareName(task_process) { return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() } +// +// Extract name of module from process name using $task.process +// +def getProcessName(task_process) { + return task_process.tokenize(':')[-1] +} + // // Function to initialise default values and to generate a Groovy Map of available options for nf-core modules // @@ -37,32 +44,35 @@ def getPathFromList(path_list) { // Function to save/publish module results // def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_meta) { - def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta - for (key in key_list) { - if (args.meta && key instanceof String) { - def path = key - if (args.meta.containsKey(key)) { - path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] - } - path = path instanceof String ? path : '' - path_list.add(path) + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + + // Do not publish versions.yml unless running from pytest workflow + if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) { + return null + } + if (ioptions.publish_by_meta) { + def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta + for (key in key_list) { + if (args.meta && key instanceof String) { + def path = key + if (args.meta.containsKey(key)) { + path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] } + path = path instanceof String ? path : '' + path_list.add(path) } } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" } } diff --git a/modules/nf-core/modules/samtools/idxstats/main.nf b/modules/nf-core/modules/samtools/idxstats/main.nf index 14a07cfb..b005088a 100644 --- a/modules/nf-core/modules/samtools/idxstats/main.nf +++ b/modules/nf-core/modules/samtools/idxstats/main.nf @@ -1,5 +1,5 @@ // Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' +include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions' params.options = [:] options = initOptions(params.options) @@ -23,12 +23,14 @@ process SAMTOOLS_IDXSTATS { output: tuple val(meta), path("*.idxstats"), emit: idxstats - path "*.version.txt" , emit: version + path "versions.yml" , emit: versions script: - def software = getSoftwareName(task.process) """ samtools idxstats $bam > ${bam}.idxstats - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + cat <<-END_VERSIONS > versions.yml + ${getProcessName(task.process)}: + ${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS """ } diff --git a/modules/nf-core/modules/samtools/idxstats/meta.yml b/modules/nf-core/modules/samtools/idxstats/meta.yml index 530d0772..f4cb613f 100644 --- a/modules/nf-core/modules/samtools/idxstats/meta.yml +++ b/modules/nf-core/modules/samtools/idxstats/meta.yml @@ -41,9 +41,9 @@ output: type: file description: File containing samtools idxstats output pattern: "*.{idxstats}" - - version: + - versions: type: file - description: File containing software version - pattern: "*.{version.txt}" + description: File containing software versions + pattern: "versions.yml" authors: - "@drpatelh" diff --git a/modules/nf-core/modules/samtools/index/functions.nf b/modules/nf-core/modules/samtools/index/functions.nf index da9da093..85628ee0 100644 --- a/modules/nf-core/modules/samtools/index/functions.nf +++ b/modules/nf-core/modules/samtools/index/functions.nf @@ -9,6 +9,13 @@ def getSoftwareName(task_process) { return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() } +// +// Extract name of module from process name using $task.process +// +def getProcessName(task_process) { + return task_process.tokenize(':')[-1] +} + // // Function to initialise default values and to generate a Groovy Map of available options for nf-core modules // @@ -37,32 +44,35 @@ def getPathFromList(path_list) { // Function to save/publish module results // def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_meta) { - def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta - for (key in key_list) { - if (args.meta && key instanceof String) { - def path = key - if (args.meta.containsKey(key)) { - path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] - } - path = path instanceof String ? path : '' - path_list.add(path) + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + + // Do not publish versions.yml unless running from pytest workflow + if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) { + return null + } + if (ioptions.publish_by_meta) { + def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta + for (key in key_list) { + if (args.meta && key instanceof String) { + def path = key + if (args.meta.containsKey(key)) { + path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] } + path = path instanceof String ? path : '' + path_list.add(path) } } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" } } diff --git a/modules/nf-core/modules/samtools/index/main.nf b/modules/nf-core/modules/samtools/index/main.nf index e1966fb3..febbc11c 100644 --- a/modules/nf-core/modules/samtools/index/main.nf +++ b/modules/nf-core/modules/samtools/index/main.nf @@ -1,5 +1,5 @@ // Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' +include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions' params.options = [:] options = initOptions(params.options) @@ -24,12 +24,14 @@ process SAMTOOLS_INDEX { output: tuple val(meta), path("*.bai"), optional:true, emit: bai tuple val(meta), path("*.csi"), optional:true, emit: csi - path "*.version.txt" , emit: version + path "versions.yml" , emit: versions script: - def software = getSoftwareName(task.process) """ samtools index $options.args $bam - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + cat <<-END_VERSIONS > versions.yml + ${getProcessName(task.process)}: + ${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS """ } diff --git a/modules/nf-core/modules/samtools/index/meta.yml b/modules/nf-core/modules/samtools/index/meta.yml index 5d076e3b..5f4dd3fb 100644 --- a/modules/nf-core/modules/samtools/index/meta.yml +++ b/modules/nf-core/modules/samtools/index/meta.yml @@ -38,10 +38,10 @@ output: type: file description: CSI index file pattern: "*.{csi}" - - version: + - versions: type: file - description: File containing software version - pattern: "*.{version.txt}" + description: File containing software versions + pattern: "versions.yml" authors: - "@drpatelh" - "@ewels" diff --git a/modules/nf-core/modules/samtools/sort/functions.nf b/modules/nf-core/modules/samtools/sort/functions.nf index da9da093..85628ee0 100644 --- a/modules/nf-core/modules/samtools/sort/functions.nf +++ b/modules/nf-core/modules/samtools/sort/functions.nf @@ -9,6 +9,13 @@ def getSoftwareName(task_process) { return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() } +// +// Extract name of module from process name using $task.process +// +def getProcessName(task_process) { + return task_process.tokenize(':')[-1] +} + // // Function to initialise default values and to generate a Groovy Map of available options for nf-core modules // @@ -37,32 +44,35 @@ def getPathFromList(path_list) { // Function to save/publish module results // def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_meta) { - def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta - for (key in key_list) { - if (args.meta && key instanceof String) { - def path = key - if (args.meta.containsKey(key)) { - path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] - } - path = path instanceof String ? path : '' - path_list.add(path) + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + + // Do not publish versions.yml unless running from pytest workflow + if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) { + return null + } + if (ioptions.publish_by_meta) { + def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta + for (key in key_list) { + if (args.meta && key instanceof String) { + def path = key + if (args.meta.containsKey(key)) { + path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] } + path = path instanceof String ? path : '' + path_list.add(path) } } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" } } diff --git a/modules/nf-core/modules/samtools/sort/main.nf b/modules/nf-core/modules/samtools/sort/main.nf index 0a6b7048..b30f6f45 100644 --- a/modules/nf-core/modules/samtools/sort/main.nf +++ b/modules/nf-core/modules/samtools/sort/main.nf @@ -1,5 +1,5 @@ // Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' +include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions' params.options = [:] options = initOptions(params.options) @@ -23,13 +23,15 @@ process SAMTOOLS_SORT { output: tuple val(meta), path("*.bam"), emit: bam - path "*.version.txt" , emit: version + path "versions.yml" , emit: versions script: - def software = getSoftwareName(task.process) def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" """ samtools sort $options.args -@ $task.cpus -o ${prefix}.bam -T $prefix $bam - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + cat <<-END_VERSIONS > versions.yml + ${getProcessName(task.process)}: + ${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS """ } diff --git a/modules/nf-core/modules/samtools/sort/meta.yml b/modules/nf-core/modules/samtools/sort/meta.yml index 704e8c1f..cd47c86d 100644 --- a/modules/nf-core/modules/samtools/sort/meta.yml +++ b/modules/nf-core/modules/samtools/sort/meta.yml @@ -34,10 +34,10 @@ output: type: file description: Sorted BAM/CRAM/SAM file pattern: "*.{bam,cram,sam}" - - version: + - versions: type: file - description: File containing software version - pattern: "*.{version.txt}" + description: File containing software versions + pattern: "versions.yml" authors: - "@drpatelh" - "@ewels" diff --git a/modules/nf-core/modules/samtools/stats/functions.nf b/modules/nf-core/modules/samtools/stats/functions.nf index da9da093..85628ee0 100644 --- a/modules/nf-core/modules/samtools/stats/functions.nf +++ b/modules/nf-core/modules/samtools/stats/functions.nf @@ -9,6 +9,13 @@ def getSoftwareName(task_process) { return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() } +// +// Extract name of module from process name using $task.process +// +def getProcessName(task_process) { + return task_process.tokenize(':')[-1] +} + // // Function to initialise default values and to generate a Groovy Map of available options for nf-core modules // @@ -37,32 +44,35 @@ def getPathFromList(path_list) { // Function to save/publish module results // def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_meta) { - def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta - for (key in key_list) { - if (args.meta && key instanceof String) { - def path = key - if (args.meta.containsKey(key)) { - path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] - } - path = path instanceof String ? path : '' - path_list.add(path) + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + + // Do not publish versions.yml unless running from pytest workflow + if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) { + return null + } + if (ioptions.publish_by_meta) { + def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta + for (key in key_list) { + if (args.meta && key instanceof String) { + def path = key + if (args.meta.containsKey(key)) { + path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key] } + path = path instanceof String ? path : '' + path_list.add(path) } } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" } } diff --git a/modules/nf-core/modules/samtools/stats/main.nf b/modules/nf-core/modules/samtools/stats/main.nf index 8c72d725..6218dd2d 100644 --- a/modules/nf-core/modules/samtools/stats/main.nf +++ b/modules/nf-core/modules/samtools/stats/main.nf @@ -1,5 +1,5 @@ // Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' +include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions' params.options = [:] options = initOptions(params.options) @@ -23,12 +23,14 @@ process SAMTOOLS_STATS { output: tuple val(meta), path("*.stats"), emit: stats - path "*.version.txt" , emit: version + path "versions.yml" , emit: versions script: - def software = getSoftwareName(task.process) """ samtools stats $bam > ${bam}.stats - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + cat <<-END_VERSIONS > versions.yml + ${getProcessName(task.process)}: + ${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS """ } diff --git a/modules/nf-core/modules/samtools/stats/meta.yml b/modules/nf-core/modules/samtools/stats/meta.yml index b549ff5c..d75d73e2 100644 --- a/modules/nf-core/modules/samtools/stats/meta.yml +++ b/modules/nf-core/modules/samtools/stats/meta.yml @@ -39,9 +39,9 @@ output: type: file description: File containing samtools stats output pattern: "*.{stats}" - - version: + - versions: type: file - description: File containing software version - pattern: "*.{version.txt}" + description: File containing software versions + pattern: "versions.yml" authors: - "@drpatelh" From 66cb3d8a1c38c1d58d7536ac23566d33c88b0eba Mon Sep 17 00:00:00 2001 From: "Kevin L. Keys" Date: Thu, 7 Oct 2021 17:17:54 -0700 Subject: [PATCH 3/6] fixed file formatting issue with .nf-core.yml --- .nf-core.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.nf-core.yml b/.nf-core.yml index 27e3032a..b3adb635 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -1,2 +1,5 @@ +lint: + - actions_awsfulltest: False + - pipeline_todos: False: files_unchanged: - lib/NfcoreSchema.groovy From dc5ac2507c3837cf7afb55382a63a7d6d9bd484b Mon Sep 17 00:00:00 2001 From: "Kevin L. Keys" Date: Thu, 7 Oct 2021 17:18:16 -0700 Subject: [PATCH 4/6] fixed file formatting issue with .nf-core.yml --- .nf-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nf-core.yml b/.nf-core.yml index b3adb635..eb44ee6d 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -1,5 +1,5 @@ lint: - actions_awsfulltest: False - - pipeline_todos: False: + - pipeline_todos: False files_unchanged: - lib/NfcoreSchema.groovy From 453cf74b4750a70b2054c92ebf67c588f15bcdd0 Mon Sep 17 00:00:00 2001 From: "Kevin L. Keys" Date: Fri, 8 Oct 2021 06:23:46 -0700 Subject: [PATCH 5/6] overwriting changes to .nf-core.yml to harmonize with nf-core/rnaseq --- .nf-core.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.nf-core.yml b/.nf-core.yml index eb44ee6d..25f2b4c3 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -1,5 +1,14 @@ lint: - actions_awsfulltest: False - pipeline_todos: False + files_unchanged: + - .markdownlint.yml + - assets/email_template.html + - assets/email_template.txt + - lib/NfcoreTemplate.groovy + - assets/multiqc_config.yaml + files_exist: + - bin/scrape_software_versions.py + - modules/local/get_software_versions.nf files_unchanged: - lib/NfcoreSchema.groovy From 540f8054aa11634411e3a9a000fccdb81b918c7e Mon Sep 17 00:00:00 2001 From: "Kevin L. Keys" Date: Fri, 8 Oct 2021 06:26:58 -0700 Subject: [PATCH 6/6] previous commit failed? harmonizing .nf-core.yml with nf-core/rnaseq --- .nf-core.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.nf-core.yml b/.nf-core.yml index 25f2b4c3..daf3ed01 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -1,6 +1,4 @@ lint: - - actions_awsfulltest: False - - pipeline_todos: False files_unchanged: - .markdownlint.yml - assets/email_template.html @@ -10,5 +8,3 @@ lint: files_exist: - bin/scrape_software_versions.py - modules/local/get_software_versions.nf -files_unchanged: - - lib/NfcoreSchema.groovy