diff --git a/modules/nf-core/pmdtools/filter/environment.yml b/modules/nf-core/pmdtools/filter/environment.yml index 056c22dd7e61..77053ebdf6cd 100644 --- a/modules/nf-core/pmdtools/filter/environment.yml +++ b/modules/nf-core/pmdtools/filter/environment.yml @@ -6,3 +6,4 @@ channels: dependencies: - bioconda::pmdtools=0.60 - bioconda::samtools=1.14 + - conda-forge::python=3.9.7 diff --git a/modules/nf-core/pmdtools/filter/main.nf b/modules/nf-core/pmdtools/filter/main.nf index 97f2b5b72e05..aecd390a263b 100644 --- a/modules/nf-core/pmdtools/filter/main.nf +++ b/modules/nf-core/pmdtools/filter/main.nf @@ -14,7 +14,8 @@ process PMDTOOLS_FILTER { output: tuple val(meta), path("*.bam"), emit: bam - path "versions.yml" , emit: versions + tuple val("${task.process}"), val('pmdtools'), eval("pmdtools --version | sed 's/.*v//'") , topic: versions, emit: versions_pmdtools + tuple val("${task.process}"), val('samtools'), eval("samtools version | sed '1!d;s/.* //'"), topic: versions, emit: versions_samtools when: task.ext.when == null || task.ext.when @@ -25,45 +26,33 @@ process PMDTOOLS_FILTER { def args3 = task.ext.args3 ?: '' def split_cpus = Math.floor(task.cpus/2) def prefix = task.ext.prefix ?: "${meta.id}" - if ("$bam" == "${prefix}.bam") error "[pmdtools/filter] Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + if ("${bam}" == "${prefix}.bam") error "[pmdtools/filter] Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" //threshold and header flags activate filtering function of pmdtools """ samtools \\ calmd \\ - $bam \\ - $reference \\ - $args \\ + ${bam} \\ + ${reference} \\ + ${args} \\ -@ ${split_cpus} \\ | pmdtools \\ - --threshold $threshold \\ + --threshold ${threshold} \\ --header \\ - $args2 \\ + ${args2} \\ | samtools \\ view \\ - $args3 \\ + ${args3} \\ -Sb \\ - \\ -@ ${split_cpus} \\ -o ${prefix}.bam - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - pmdtools: \$( pmdtools --version | cut -f2 -d ' ' | sed 's/v//') - samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') - END_VERSIONS """ stub: def prefix = task.ext.prefix ?: "${meta.id}" - if ("$bam" == "${prefix}.bam") error "[pmdtools/filter] Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + if ("${bam}" == "${prefix}.bam") error "[pmdtools/filter] Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" //threshold and header flags activate filtering function of pmdtools """ touch ${prefix}.bam - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - pmdtools: \$( pmdtools --version | cut -f2 -d ' ' | sed 's/v//') - samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') - END_VERSIONS """ } diff --git a/modules/nf-core/pmdtools/filter/meta.yml b/modules/nf-core/pmdtools/filter/meta.yml index 05da0dc434cf..e780d4a35409 100644 --- a/modules/nf-core/pmdtools/filter/meta.yml +++ b/modules/nf-core/pmdtools/filter/meta.yml @@ -12,7 +12,8 @@ tools: documentation: https://github.com/pontussk/PMDtools tool_dev_url: https://github.com/pontussk/PMDtools doi: "10.1073/pnas.1318934111" - licence: ["GPL v3"] + licence: + - "GPL v3" identifier: "" input: - - meta: @@ -50,13 +51,50 @@ output: description: Filtered BAM file pattern: "*.bam" ontologies: [] + versions_pmdtools: + - - ${task.process}: + type: string + description: The name of the process + - pmdtools: + type: string + description: The name of the tool + - pmdtools --version | sed 's/.*v//': + type: eval + description: The expression to obtain the version of the tool + + versions_samtools: + - - ${task.process}: + type: string + description: The name of the process + - samtools: + type: string + description: The name of the tool + - samtools version | sed '1!d;s/.* //': + type: eval + description: The expression to obtain the version of the tool + +topics: versions: - - versions.yml: - type: file - description: File containing software versions - pattern: "versions.yml" - ontologies: - - edam: http://edamontology.org/format_3750 # YAML + - - ${task.process}: + type: string + description: The name of the process + - pmdtools: + type: string + description: The name of the tool + - pmdtools --version | sed 's/.*v//': + type: eval + description: The expression to obtain the version of the tool + + - - ${task.process}: + type: string + description: The name of the process + - samtools: + type: string + description: The name of the tool + - samtools version | sed '1!d;s/.* //': + type: eval + description: The expression to obtain the version of the tool + authors: - "@alexandregilardet" maintainers: diff --git a/modules/nf-core/pmdtools/filter/tests/main.nf.test b/modules/nf-core/pmdtools/filter/tests/main.nf.test index d8fa6a13cf99..2631b539c20b 100644 --- a/modules/nf-core/pmdtools/filter/tests/main.nf.test +++ b/modules/nf-core/pmdtools/filter/tests/main.nf.test @@ -16,13 +16,12 @@ nextflow_process { process { """ input[0] = [ - [ id:'test', single_end:false ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) ], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) ] + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) ] - input[1] = 3 - input[2] = [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ] - + input[1] = 3 + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) """ } } @@ -31,11 +30,9 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - bam(process.out.bam[0][1]).getReadsMD5(), - process.out.versions, - file(process.out.versions[0]).readLines()[1..2].collect { it.trim() } // Trap to catch conda version mismatches - ).match() - } + bam(process.out.bam[0][1]).getReadsMD5(), + sanitizeOutput(process.out, unstableKeys:["bam"]) + ).match()} ) } } @@ -47,13 +44,12 @@ nextflow_process { process { """ input[0] = [ - [ id:'test', single_end:false ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) ], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) ] + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) ] - input[1] = 3 - input[2] = [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ] - + input[1] = 3 + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) """ } } @@ -61,7 +57,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot(sanitizeOutput(process.out)).match() } ) } } diff --git a/modules/nf-core/pmdtools/filter/tests/main.nf.test.snap b/modules/nf-core/pmdtools/filter/tests/main.nf.test.snap index 9746297980a3..c53fd0d06f82 100644 --- a/modules/nf-core/pmdtools/filter/tests/main.nf.test.snap +++ b/modules/nf-core/pmdtools/filter/tests/main.nf.test.snap @@ -2,53 +2,68 @@ "test-pmdtools-filter": { "content": [ "665610db11378e0a02ab7d407a9d54c1", - [ - "versions.yml:md5,877c304e79e6d045661081ddd47bddd6" - ], - [ - "pmdtools: 0.50", - "samtools: 1.14" - ] + { + "bam": [ + [ + { + "id": "test" + }, + "test.bam" + ] + ], + "versions_pmdtools": [ + [ + "PMDTOOLS_FILTER", + "pmdtools", + "0.50" + ] + ], + "versions_samtools": [ + [ + "PMDTOOLS_FILTER", + "samtools", + "1.14" + ] + ] + } ], + "timestamp": "2026-08-06T15:52:16.062661885", "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-08-29T12:54:08.428303" + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } }, "test-pmdtools-filter-stub": { "content": [ { - "0": [ + "bam": [ [ { - "id": "test", - "single_end": false + "id": "test" }, "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], - "1": [ - "versions.yml:md5,877c304e79e6d045661081ddd47bddd6" - ], - "bam": [ + "versions_pmdtools": [ [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + "PMDTOOLS_FILTER", + "pmdtools", + "0.50" ] ], - "versions": [ - "versions.yml:md5,877c304e79e6d045661081ddd47bddd6" + "versions_samtools": [ + [ + "PMDTOOLS_FILTER", + "samtools", + "1.14" + ] ] } ], + "timestamp": "2026-08-06T15:52:22.821082671", "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-08-29T12:40:43.138953" + "nf-test": "0.9.5", + "nextflow": "26.04.6" + } } } \ No newline at end of file