diff --git a/modules/nf-core/mobsuite/typer/environment.yml b/modules/nf-core/mobsuite/typer/environment.yml new file mode 100644 index 000000000000..76393f3a972e --- /dev/null +++ b/modules/nf-core/mobsuite/typer/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::mob_suite=3.1.9" diff --git a/modules/nf-core/mobsuite/typer/main.nf b/modules/nf-core/mobsuite/typer/main.nf new file mode 100644 index 000000000000..ca682932c55b --- /dev/null +++ b/modules/nf-core/mobsuite/typer/main.nf @@ -0,0 +1,75 @@ +process MOBSUITE_TYPER { + tag "${meta.id}" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/mob_suite:3.1.9--pyhdfd78af_0' + : 'quay.io/biocontainers/mob_suite:3.1.9--pyhdfd78af_0'}" + + input: + tuple val(meta), path(fasta) + path db + path plasmid_mash_db + path plasmid_meta_txt + path plasmid_replicons_fas + path repetitive_mask_fas + path plasmid_mob_faa + path plasmid_mpf_faa + path plasmid_orit_fas + val generate_biomarker_report + val generate_mge_report + + output: + tuple val(meta), path("*.txt"), emit: report + tuple val(meta), path("*_biomarker_report.txt"), optional: true, emit: biomarker_report + tuple val(meta), path("*_mge_report.txt"), optional: true, emit: mge_report + tuple val("${task.process}"), val('mobsuite'), eval("mob_typer --version | sed 's/mob_typer //g'"), topic: versions, emit: versions_mobsuite + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def biomarker_report_cmd = generate_biomarker_report ? "--biomarker_report_file ${prefix}_biomarker_report.txt" : '' + def mge_report_cmd = generate_mge_report ? "--mge_report_file ${prefix}_mge_report.txt" : '' + def plasmid_mash_db_cmd = plasmid_mash_db ? "-d ${plasmid_mash_db}" : '' + def plasmid_meta_cmd = plasmid_meta_txt ? "-m ${plasmid_meta_txt}" : '' + def plasmid_replicons_cmd = plasmid_replicons_fas ? "--plasmid_replicons ${plasmid_replicons_fas}" : '' + def repetitive_mask_cmd = repetitive_mask_fas ? "--repetitive_mask ${repetitive_mask_fas}" : '' + def plasmid_mob_cmd = plasmid_mob_faa ? "--plasmid_mob ${plasmid_mob_faa}" : '' + def plasmid_mpf_cmd = plasmid_mpf_faa ? "--plasmid_mpf ${plasmid_mpf_faa}" : '' + def plasmid_orit_fas_cmd = plasmid_orit_fas ? "--plasmid_orit ${plasmid_orit_fas}" : '' + def db_cmd = db ? "-d ${db}" : '' + """ + mob_typer \\ + -n ${task.cpus} \\ + -s ${prefix} \\ + ${args} \\ + -i ${fasta} \\ + ${plasmid_mash_db_cmd} \\ + ${plasmid_meta_cmd} \\ + ${plasmid_replicons_cmd} \\ + ${repetitive_mask_cmd} \\ + ${plasmid_mob_cmd} \\ + ${plasmid_mpf_cmd} \\ + ${plasmid_orit_fas_cmd} \\ + ${db_cmd} \\ + -o ${prefix}.txt \\ + ${biomarker_report_cmd} \\ + ${mge_report_cmd} + + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + echo ${args} + + touch ${prefix}.txt + touch ${prefix}_biomarker_report.txt + touch ${prefix}_mge_report.txt + """ +} diff --git a/modules/nf-core/mobsuite/typer/meta.yml b/modules/nf-core/mobsuite/typer/meta.yml new file mode 100644 index 000000000000..80d2f0da1531 --- /dev/null +++ b/modules/nf-core/mobsuite/typer/meta.yml @@ -0,0 +1,139 @@ +name: "mobsuite_typer" +description: Bacterial plasmid typing and mobility prediction +keywords: + - bacteria + - plasmid + - typing + - genomics +tools: + - "mobsuite": + description: "MOB-suite is a set of tools for finding, typing and reconstruction + of plasmids from draft and complete genome assemblies." + homepage: "https://github.com/phac-nml/mob-suite/blob/master/README.md" + documentation: "https://github.com/phac-nml/mob-suite/blob/master/README.md" + tool_dev_url: "https://github.com/phac-nml/mob-suite" + doi: "10.1099/mgen.0.000435" + licence: + - "Apache-2.0" + identifier: biotools:mob_suite +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - fasta: + type: file + description: A bacterial genome assembly in FASTA format + pattern: "*.{fasta,fa,fna}" + ontologies: + - edam: "http://edamontology.org/format_1929" + - db: + type: directory + description: Optional local copy of MOB-suite database directory + pattern: "databases/" + - plasmid_mash_db: + type: file + description: Optional Companion Mash database of reference database + pattern: "*.msh" + ontologies: + - edam: http://edamontology.org/format_3911 + - plasmid_meta_txt: + type: file + description: MOB-cluster plasmid cluster formatted file matched to the reference + plasmid db + pattern: "*.txt" + ontologies: [] + - plasmid_replicons_fas: + type: file + description: Optional nucleotide FASTA file of plasmid replicons + pattern: "*.{fasta,fna,fa,fas}" + ontologies: + - edam: "http://edamontology.org/format_1929" + - repetitive_mask_fas: + type: file + description: Optional nucleotide FASTA file of known repetitive elements + pattern: "*.{fasta,fna,fa,fas}" + ontologies: + - edam: "http://edamontology.org/format_1929" + - plasmid_mob_faa: + type: file + description: Optional protein FASTA file of plasmid mobility proteins + pattern: "*.{fasta,faa,fa,fas}" + ontologies: + - edam: "http://edamontology.org/format_1929" + - plasmid_mpf_faa: + type: file + description: Optional protein FASTA file of plasmid mating pair formation proteins + pattern: "*.{fasta,faa,fa,fas}" + ontologies: + - edam: "http://edamontology.org/format_1929" + - plasmid_orit_fas: + type: file + description: Optional nucleotide FASTA file of known plasmid oriT dna sequences + pattern: "*.{fasta,fna,fa,fas}" + ontologies: + - edam: "http://edamontology.org/format_1929" + - generate_biomarker_report: + type: boolean + description: Whether to generate a biomarker report file + - generate_mge_report: + type: boolean + description: Whether to generate a mobile genetic element (MGE) report file +output: + report: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.txt": + type: file + description: MOB-suite typer report file + pattern: "*.txt" + ontologies: [] + biomarker_report: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*_biomarker_report.txt": + type: file + description: MOB-suite biomarker report file + pattern: "*_biomarker_report.txt" + mge_report: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*_mge_report.txt": + type: file + description: MOB-suite mobile genetic element (MGE) report file + pattern: "*_mge_report.txt" + versions_mobsuite: + - - ${task.process}: + type: string + description: The name of the process + - mobsuite: + type: string + description: The name of the tool + - mob_typer --version | sed 'mob_typer '/: + type: eval + description: The expression to obtain the version of the tool +topics: + versions: + - - ${task.process}: + type: string + description: The name of the process + - mobsuite: + type: string + description: The name of the tool + - mob_typer --version | sed 'mob_typer '/: + type: eval + description: The expression to obtain the version of the tool +authors: + - "@jfy133" +maintainers: + - "@jfy133" diff --git a/modules/nf-core/mobsuite/typer/tests/main.nf.test b/modules/nf-core/mobsuite/typer/tests/main.nf.test new file mode 100644 index 000000000000..acc5338a2788 --- /dev/null +++ b/modules/nf-core/mobsuite/typer/tests/main.nf.test @@ -0,0 +1,81 @@ +nextflow_process { + + name "Test Process MOBSUITE_TYPER" + script "../main.nf" + process "MOBSUITE_TYPER" + + tag "modules" + tag "modules_nfcore" + tag "mobsuite" + tag "mobsuite/typer" + + test("sarscov2 - fasta") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[1] = [] + input[2] = [] + input[3] = [] + input[4] = [] + input[5] = [] + input[6] = [] + input[7] = [] + input[8] = [] + input[9] = true + input[10] = true + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot( + process.out, + process.out.findAll { key, val -> key.startsWith('versions') } + ).match() } + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[1] = [] + input[2] = [] + input[3] = [] + input[4] = [] + input[5] = [] + input[6] = [] + input[7] = [] + input[8] = [] + input[9] = true + input[10] = true + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/mobsuite/typer/tests/main.nf.test.snap b/modules/nf-core/mobsuite/typer/tests/main.nf.test.snap new file mode 100644 index 000000000000..fa49124a90dd --- /dev/null +++ b/modules/nf-core/mobsuite/typer/tests/main.nf.test.snap @@ -0,0 +1,161 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e", + "test_biomarker_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e", + "test_mge_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test_biomarker_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test_mge_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + "MOBSUITE_TYPER", + "mobsuite", + "3.1.9" + ] + ], + "biomarker_report": [ + [ + { + "id": "test" + }, + "test_biomarker_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "mge_report": [ + [ + { + "id": "test" + }, + "test_mge_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "report": [ + [ + { + "id": "test" + }, + [ + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e", + "test_biomarker_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e", + "test_mge_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "versions_mobsuite": [ + [ + "MOBSUITE_TYPER", + "mobsuite", + "3.1.9" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.10.4" + }, + "timestamp": "2026-05-17T17:14:59.584190491" + }, + "sarscov2 - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "test.txt:md5,b3e2a4ff64fd91e0cf33b963d1f27536", + "test_biomarker_report.txt:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test_biomarker_report.txt:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "2": [ + + ], + "3": [ + [ + "MOBSUITE_TYPER", + "mobsuite", + "3.1.9" + ] + ], + "biomarker_report": [ + [ + { + "id": "test" + }, + "test_biomarker_report.txt:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "mge_report": [ + + ], + "report": [ + [ + { + "id": "test" + }, + [ + "test.txt:md5,b3e2a4ff64fd91e0cf33b963d1f27536", + "test_biomarker_report.txt:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "versions_mobsuite": [ + [ + "MOBSUITE_TYPER", + "mobsuite", + "3.1.9" + ] + ] + }, + { + "versions_mobsuite": [ + [ + "MOBSUITE_TYPER", + "mobsuite", + "3.1.9" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.10.4" + }, + "timestamp": "2026-05-17T18:38:37.549682074" + } +} \ No newline at end of file