diff --git a/modules/nf-core/mifaser/environment.yml b/modules/nf-core/mifaser/environment.yml new file mode 100644 index 00000000000..05ab4d7d03b --- /dev/null +++ b/modules/nf-core/mifaser/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::mifaser=1.60 diff --git a/modules/nf-core/mifaser/main.nf b/modules/nf-core/mifaser/main.nf new file mode 100644 index 00000000000..b5ee22e40c4 --- /dev/null +++ b/modules/nf-core/mifaser/main.nf @@ -0,0 +1,48 @@ +process MIFASER { + tag "${meta.id}" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container 'ghcr.io/vdblab/mifaser:1.64d' + + input: + tuple val(meta), path(reads) + path db + + output: + tuple val(meta), path("*multi_ec.tsv"), emit: multi_ec + tuple val(meta), path("*analysis.tsv"), emit: analysis + tuple val(meta), path("*ec_count.tsv"), emit: ec_counts + tuple val("${task.process}"), val('mi-faser'), eval("mifaser --version 2>&1 | sed 's/* v//'"), emit: versions_mifaser, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def input_flag = meta.single_end ? "-f" : "-l" + """ + mifaser \\ + ${args} \\ + ${input_flag} ${reads} \\ + --threads 1 \\ + --cpu ${task.cpus} \\ + --databasefolder ${db} \\ + --outputfolder mifaser-${prefix}/ + + for suf in multi_ec.tsv analysis.tsv ec_count.tsv; do + mv mifaser-${prefix}/\${suf} ${prefix}_\${suf} + done + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + echo ${args} + for suf in multi_ec.tsv analysis.tsv ec_count.tsv; do + touch ${prefix}_\${suf} + done + """ +} diff --git a/modules/nf-core/mifaser/meta.yml b/modules/nf-core/mifaser/meta.yml new file mode 100644 index 00000000000..932e4163b6b --- /dev/null +++ b/modules/nf-core/mifaser/meta.yml @@ -0,0 +1,91 @@ +name: "mifaser" +description: Functional annotation of metagenomic reads by assigning enzyme + commission (EC) numbers +keywords: + - metagenomics + - functional annotation + - EC numbers + - fastq +tools: + - "mifaser": + description: "mi-faser: microsecond functional annotation of sequences, a massive + scalability upgrade" + homepage: "https://sourceforge.net/projects/mifaser/" + documentation: "https://sourceforge.net/projects/mifaser/" + tool_dev_url: "https://sourceforge.net/projects/mifaser/" + doi: "10.1093/nar/gkx1209" + licence: + - "NPOSL-3.0" + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:true ]` + - reads: + type: file + description: | + Single-end or paired-end FASTQ files. Use meta.single_end to indicate input type. + pattern: "*.{fastq,fastq.gz,fq,fq.gz}" + ontologies: + - edam: "http://edamontology.org/format_1930" + - db: + type: directory + description: Path to the mi-faser database folder +output: + multi_ec: + - - meta: + type: map + description: Groovy Map containing sample information + - "*multi_ec.tsv": + type: file + description: TSV file with multi-EC functional assignments per read + pattern: "*multi_ec.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 + analysis: + - - meta: + type: map + description: Groovy Map containing sample information + - "*analysis.tsv": + type: file + description: TSV file with per-sample functional analysis summary + pattern: "*analysis.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 + ec_counts: + - - meta: + type: map + description: Groovy Map containing sample information + - "*ec_count.tsv": + type: file + description: TSV file with EC number counts + pattern: "*ec_count.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 + versions_mifaser: + - - "${task.process}": + type: string + description: Process name + - "mi-faser": + type: string + description: Tool name + - "mifaser --version 2>&1 | sed 's/* v//'": + type: eval + description: mifaser version string +topics: + versions: + - - "${task.process}": + type: string + description: Process name + - "mi-faser": + type: string + description: Tool name + - "mifaser --version 2>&1 | sed 's/* v//'": + type: eval + description: mifaser version string +authors: + - "@nickp60" +maintainers: + - "@nickp60" diff --git a/modules/nf-core/mifaser/tests/main.nf.test b/modules/nf-core/mifaser/tests/main.nf.test new file mode 100644 index 00000000000..d8805c4fca2 --- /dev/null +++ b/modules/nf-core/mifaser/tests/main.nf.test @@ -0,0 +1,73 @@ +nextflow_process { + + name "Test Process MIFASER" + script "../main.nf" + process "MIFASER" + tag "modules" + tag "modules_nfcore" + tag "mifaser" + tag "untar" + + setup { + run("UNTAR") { + script "modules/nf-core/untar/main.nf" + process { + """ + input[0] = Channel.of([ + [], + file( + 'https://github.com/nf-core/test-datasets/raw/refs/heads/funcprofiler/data/database/mifaser/GS-24-all.tar.gz', + checkIfExists: true + ) + ]) + """ + } + } + } + + test("sarscov2 - single-end fastq") { + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ] + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.multi_ec, + process.out.analysis, + process.out.ec_counts, + process.out.findAll { key, val -> key.startsWith('versions') } + ).match() } + ) + } + } + + test("sarscov2 - single-end fastq - stub") { + options "-stub" + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ] + ] + input[1] = UNTAR.out.untar.map{ it[1] } + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/mifaser/tests/main.nf.test.snap b/modules/nf-core/mifaser/tests/main.nf.test.snap new file mode 100644 index 00000000000..ede2fdc4233 --- /dev/null +++ b/modules/nf-core/mifaser/tests/main.nf.test.snap @@ -0,0 +1,126 @@ +{ + "sarscov2 - single-end fastq - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_multi_ec.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test_analysis.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": true + }, + "test_ec_count.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + "MIFASER", + "mi-faser", + "mifaser 1.64 (07/21/25)" + ] + ], + "analysis": [ + [ + { + "id": "test", + "single_end": true + }, + "test_analysis.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "ec_counts": [ + [ + { + "id": "test", + "single_end": true + }, + "test_ec_count.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "multi_ec": [ + [ + { + "id": "test", + "single_end": true + }, + "test_multi_ec.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_mifaser": [ + [ + "MIFASER", + "mi-faser", + "mifaser 1.64 (07/21/25)" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.10.4" + }, + "timestamp": "2026-05-12T14:06:57.628532" + }, + "sarscov2 - single-end fastq": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test_multi_ec.tsv:md5,08ad0cac1771a190e63cd76a3b3ab686" + ] + ], + [ + [ + { + "id": "test", + "single_end": true + }, + "test_analysis.tsv:md5,722399e3bfd7af4273b36779a111db8a" + ] + ], + [ + [ + { + "id": "test", + "single_end": true + }, + "test_ec_count.tsv:md5,195e3e0db1dd8b603a7e8d91e85e480d" + ] + ], + { + "versions_mifaser": [ + [ + "MIFASER", + "mi-faser", + "mifaser 1.64 (07/21/25)" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.10.4" + }, + "timestamp": "2026-05-12T14:06:46.076826" + } +} \ No newline at end of file