diff --git a/modules/nf-core/cmaple/main.nf b/modules/nf-core/cmaple/main.nf index 07eabadd2454..67a1d427f004 100644 --- a/modules/nf-core/cmaple/main.nf +++ b/modules/nf-core/cmaple/main.nf @@ -13,27 +13,27 @@ process CMAPLE { output: tuple val(meta), path("*.treefile"), emit: treefile tuple val(meta), path("*.log") , emit: log - path "versions.yml" , emit: versions + tuple val("${task.process}"), val("cmaple"), eval('cmaple --help | grep -m1 -oE "[0-9]+(\\.[0-9]+)+"'), topic: versions, emit: versions_cmaple when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def tree_arg = newick ? "-t ${newick}" : "" + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def is_compressed = aln.getExtension() == "gz" + def aln_name = is_compressed ? aln.getBaseName() : aln + def uncompress_input = is_compressed ? "gzip -c -d ${aln} > ${aln_name}" : '' + def tree_arg = newick ? "-t ${newick}" : "" """ + $uncompress_input + cmaple-aa \\ $args \\ -nt $task.cpus \\ --prefix ${prefix} \\ ${tree_arg} \\ - -aln $aln - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - cmaple: \$(cmaple --help | grep -m1 'CMAPLE version' | sed -E 's/.*version ([0-9.]+).*/\\1/') - END_VERSIONS + -aln $aln_name """ stub: @@ -44,10 +44,5 @@ process CMAPLE { touch ${prefix}.treefile touch ${prefix}.log - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - cmaple: \$(cmaple --help | grep -m1 'CMAPLE version' | sed -E 's/.*version ([0-9.]+).*/\\1/') - END_VERSIONS """ } diff --git a/modules/nf-core/cmaple/meta.yml b/modules/nf-core/cmaple/meta.yml index 733e8581bf78..81546a7c4e3a 100644 --- a/modules/nf-core/cmaple/meta.yml +++ b/modules/nf-core/cmaple/meta.yml @@ -33,8 +33,15 @@ input: e.g. `[ id:'sample1', single_end:false ]` - aln: type: file - description: Multiple sequence alignment file in FASTA, PHYLIP, or MAPLE format - pattern: "*.{fa,fasta,faa,fna,fas,aln,afa,phy,phylip,maple}" + description: | + Multiple sequence alignment file in FASTA, PHYLIP, or MAPLE format. + Can be gzipped on uncompressed. + pattern: "*.{fa,fasta,faa,fna,fas,aln,afa,phy,phylip,maple}{.gz,}" + ontologies: + - edam: http://edamontology.org/data_0863 # Sequence alignment + - edam: http://edamontology.org/format_1929 # FASTA + - edam: http://edamontology.org/format_1997 # PHYLIP format + - edam: http://edamontology.org/format_3989 # GZIP format - newick: type: file description: A Newick formatted tree based on multiple sequence alignment @@ -68,13 +75,28 @@ output: ontologies: - edam: "http://edamontology.org/format_2330" # Textual format + versions_cmaple: + - - ${task.process}: + type: string + description: The name of the process + - cmaple: + type: string + description: The name of the tool + - cmaple --help | grep -m1 -oE "[0-9]+(\.[0-9]+)+": + 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 + - cmaple: + type: string + description: The name of the tool + - cmaple --help | grep -m1 -oE "[0-9]+(\.[0-9]+)+": + type: eval + description: The expression to obtain the version of the tool authors: - "@vagkaratzas" diff --git a/modules/nf-core/cmaple/tests/main.nf.test b/modules/nf-core/cmaple/tests/main.nf.test index 836a4f6c024c..e30e419d6abf 100644 --- a/modules/nf-core/cmaple/tests/main.nf.test +++ b/modules/nf-core/cmaple/tests/main.nf.test @@ -7,7 +7,6 @@ nextflow_process { tag "modules" tag "modules_nfcore" tag "cmaple" - tag "gunzip" test("seatoxin - aa - aln") { @@ -27,39 +26,25 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.log[0][1]).name, process.out.treefile, - process.out.versions.collect{ path(it).yaml } + file(process.out.log[0][1]).name, + process.out.findAll { key, val -> key.startsWith("versions")} ).match() } ) } } - test("haemophilus_influenzae - dna - newick - aln") { - - setup { - run("GUNZIP") { - script "../../gunzip/main.nf" - process { - """ - input[0] = [ - [ id: 'test_gunzip' ], - file(params.modules_testdata_base_path + 'genomics/prokaryotes/haemophilus_influenzae/genome/genome.aln.gz', checkIfExists: true) - ] - """ - } - } - } + test("haemophilus_influenzae - dna - newick - aln.gz") { when { process { """ - input[0] = GUNZIP.out.gunzip.map{[ + input[0] = [ [ id: 'test_dna' ], - it[1], + file(params.modules_testdata_base_path + 'genomics/prokaryotes/haemophilus_influenzae/genome/genome.aln.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/prokaryotes/haemophilus_influenzae/genome/genome.aln.nwk', checkIfExists: true) - ]} + ] """ } } @@ -68,9 +53,9 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.log[0][1]).name, process.out.treefile, - process.out.versions.collect{ path(it).yaml } + file(process.out.log[0][1]).name, + process.out.findAll { key, val -> key.startsWith("versions")} ).match() } ) } @@ -96,8 +81,12 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot( + process.out.treefile, + process.out.log, + process.out.findAll { key, val -> key.startsWith("versions")} + ).match() }, + ) } diff --git a/modules/nf-core/cmaple/tests/main.nf.test.snap b/modules/nf-core/cmaple/tests/main.nf.test.snap index bf874d7e414b..fd95cb05ae74 100644 --- a/modules/nf-core/cmaple/tests/main.nf.test.snap +++ b/modules/nf-core/cmaple/tests/main.nf.test.snap @@ -1,113 +1,90 @@ { "seatoxin - aa - aln - stub": { "content": [ + [ + [ + { + "id": "test_stub" + }, + "test_stub.treefile:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "test_stub" + }, + "test_stub.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], { - "0": [ - [ - { - "id": "test_stub" - }, - "test_stub.treefile:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "1": [ - [ - { - "id": "test_stub" - }, - "test_stub.log:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "2": [ - "versions.yml:md5,975773bfb5d2679d2d0a78e1c5e1444a" - ], - "log": [ + "versions_cmaple": [ [ - { - "id": "test_stub" - }, - "test_stub.log:md5,d41d8cd98f00b204e9800998ecf8427e" + "CMAPLE", + "cmaple", + "1.1.0" ] - ], - "treefile": [ - [ - { - "id": "test_stub" - }, - "test_stub.treefile:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions": [ - "versions.yml:md5,975773bfb5d2679d2d0a78e1c5e1444a" ] } ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.04.8" + "nextflow": "25.10.2" }, - "timestamp": "2025-10-16T13:44:33.656447134" + "timestamp": "2025-12-17T09:47:20.755458285" }, - "haemophilus_influenzae - dna - newick - aln": { + "seatoxin - aa - aln": { "content": [ - "test_dna.log", [ [ { - "id": "test_dna" + "id": "test_aa" }, - "test_dna.treefile:md5,bbc5f987e523bda0335ae7a2d70b982c" + "test_aa.treefile:md5,e8d45477e64ac8aae9ebda4859acdaf1" ] ], - [ - { - "CMAPLE": { - "cmaple": "1.1.0" - } - } - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.04.8" - }, - "timestamp": "2025-10-16T13:44:26.501246515" - }, - "versions": { - "content": [ - [ - "versions.yml:md5,975773bfb5d2679d2d0a78e1c5e1444a" - ] + "test_aa.log", + { + "versions_cmaple": [ + [ + "CMAPLE", + "cmaple", + "1.1.0" + ] + ] + } ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.04.8" + "nextflow": "25.10.2" }, - "timestamp": "2025-10-16T13:44:33.677485714" + "timestamp": "2025-12-17T09:47:03.948254024" }, - "seatoxin - aa - aln": { + "haemophilus_influenzae - dna - newick - aln.gz": { "content": [ - "test_aa.log", [ [ { - "id": "test_aa" + "id": "test_dna" }, - "test_aa.treefile:md5,e8d45477e64ac8aae9ebda4859acdaf1" + "test_dna.treefile:md5,bbc5f987e523bda0335ae7a2d70b982c" ] ], - [ - { - "CMAPLE": { - "cmaple": "1.1.0" - } - } - ] + "test_dna.log", + { + "versions_cmaple": [ + [ + "CMAPLE", + "cmaple", + "1.1.0" + ] + ] + } ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.04.8" + "nextflow": "25.10.2" }, - "timestamp": "2025-10-16T13:44:18.090278163" + "timestamp": "2025-12-17T09:47:12.9837875" } } \ No newline at end of file