diff --git a/modules/nf-core/staphscan/environment.yml b/modules/nf-core/staphscan/environment.yml new file mode 100644 index 00000000000..25e6e0a4b9d --- /dev/null +++ b/modules/nf-core/staphscan/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::staphscan=0.3.1 diff --git a/modules/nf-core/staphscan/main.nf b/modules/nf-core/staphscan/main.nf new file mode 100644 index 00000000000..a1b527e5ed0 --- /dev/null +++ b/modules/nf-core/staphscan/main.nf @@ -0,0 +1,46 @@ +process STAPHSCAN { + 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/staphscan:0.3.1--pyhdfd78af_0' : + 'quay.io/biocontainers/staphscan:0.3.1--pyhdfd78af_0' }" + + input: + tuple val(meta), path(fastas) + + output: + tuple val(meta), path("*.tsv"), emit: tsv + path "versions.yml", topic: versions, emit: versions_staphscan + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + staphscan \\ + $args \\ + -o ${prefix}_outdir \\ + --report ${prefix}_summary.tsv \\ + -i $fastas + mv ${prefix}_outdir/*.tsv . || true + cat <<-END_VERSIONS > versions.yml + "${task.process}": + staphscan: \$( echo \$(staphscan --version | sed 's/staphscan v//;')) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}_summary.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + staphscan: \$( echo \$(staphscan --version | sed 's/staphscan v//;')) + END_VERSIONS + """ +} diff --git a/modules/nf-core/staphscan/meta.yml b/modules/nf-core/staphscan/meta.yml new file mode 100644 index 00000000000..220ec5d79d7 --- /dev/null +++ b/modules/nf-core/staphscan/meta.yml @@ -0,0 +1,67 @@ +name: staphscan +description: staphscan is a tool to screen genome assemblies of Staphylococcus + aureus +keywords: + - screen + - assembly + - Staphylococcus + - aureus +tools: + - staphscan: + description: a genomic surveillance framework for Staphylococcus aureus + homepage: https://github.com/riccabolla/StaphSCAN + documentation: https://staphscan.readthedocs.io/en/latest/ + tool_dev_url: https://github.com/riccabolla/StaphSCAN + doi: 10.5281/zenodo.18458858 + licence: + - "MIT" + identifier: biotools:staphscan +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fastas: + type: list + description: Staphylococcus aureus genome assemblies to be screened + pattern: "*.fasta" +output: + tsv: + - - meta: + type: string + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.tsv": + type: file + description: Result file generated after screening + pattern: "*.tsv" + ontologies: + - edam: http://edamontology.org/format_3475 + versions_staphscan: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 +topics: + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 +authors: + - "@riccabolla" +maintainers: + - "@riccabolla" +versions_staphscan: + - - versions.yml: null + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 diff --git a/modules/nf-core/staphscan/tests/main.nf.test b/modules/nf-core/staphscan/tests/main.nf.test new file mode 100644 index 00000000000..072636b870b --- /dev/null +++ b/modules/nf-core/staphscan/tests/main.nf.test @@ -0,0 +1,65 @@ + +nextflow_process { + + name "Test Process STAPHSCAN" + script "../main.nf" + process "STAPHSCAN" + + tag "modules" + tag "modules_nfcore" + tag "staphscan" + + test("test-staphscan") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true) + ] + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + } + + test("test-staphscan-stub") { + options '-stub' + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true) + ] + ] + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(sanitizeOutput(process.out)).match() } + ) + } + } + +} diff --git a/modules/nf-core/staphscan/tests/main.nf.test.snap b/modules/nf-core/staphscan/tests/main.nf.test.snap new file mode 100644 index 00000000000..0d24fe35801 --- /dev/null +++ b/modules/nf-core/staphscan/tests/main.nf.test.snap @@ -0,0 +1,48 @@ +{ + "test-staphscan": { + "content": [ + { + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test_summary.tsv:md5,c13d6d7e15052d80610185e3546113bd" + ] + ], + "versions_staphscan": [ + "versions.yml:md5,b5af7928d06c090353c94a54c70f1672" + ] + } + ], + "timestamp": "2026-05-09T15:21:42.171023636", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } + }, + "test-staphscan-stub": { + "content": [ + { + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test_summary.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_staphscan": [ + "versions.yml:md5,b5af7928d06c090353c94a54c70f1672" + ] + } + ], + "timestamp": "2026-05-09T15:31:04.888855131", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } + } +}