diff --git a/modules/nf-core/sylphtax/taxprof/environment.yml b/modules/nf-core/sylphtax/taxprof/environment.yml new file mode 100644 index 00000000000..f35891d9ae0 --- /dev/null +++ b/modules/nf-core/sylphtax/taxprof/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::sylph-tax=1.1.2" diff --git a/modules/nf-core/sylphtax/taxprof/main.nf b/modules/nf-core/sylphtax/taxprof/main.nf new file mode 100644 index 00000000000..95f197bafae --- /dev/null +++ b/modules/nf-core/sylphtax/taxprof/main.nf @@ -0,0 +1,50 @@ + +process SYLPHTAX_TAXPROF { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/sylph-tax:1.1.2--pyhdfd78af_0': + 'biocontainers/sylph-tax:1.1.2--pyhdfd78af_0' }" + + input: + tuple val(meta), path(sylph_results) + path taxonomy + + output: + tuple val(meta), path("*.sylphmpa"), emit: taxprof_output + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + sylph-tax \\ + taxprof \\ + $sylph_results \\ + $args \\ + -o ${prefix}.sylphmpa \\ + -t $taxonomy + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sylph-tax: \$(sylph-tax --version 2>&1 | sed -n 's/.*\\([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\).*/\\1/p' | head -n 1) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.sylphmpa + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sylph-tax: \$(sylph-tax --version 2>&1 | sed -n 's/.*\\([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\).*/\\1/p' | head -n 1) + END_VERSIONS + """ +} diff --git a/modules/nf-core/sylphtax/taxprof/meta.yml b/modules/nf-core/sylphtax/taxprof/meta.yml new file mode 100644 index 00000000000..e4ee39ba0db --- /dev/null +++ b/modules/nf-core/sylphtax/taxprof/meta.yml @@ -0,0 +1,51 @@ +name: sylphtax_taxprof +description: Incorporates taxonomy into sylph metagenomic classifier +keywords: +- taxonomy +- sylph +- metagenomics +tools: +- sylphtax: + description: Integrating taxonomic information into the sylph metagenome profiler. + homepage: https://github.com/bluenote-1577/sylph-tax?tab=readme-ov-file + documentation: https://sylph-docs.github.io/sylph-tax/ + licence: ["MIT"] + identifier: '' +input: +- - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - sylph_results: + type: file + description: Output results from sylph classifier. The database file(s) used to create this file with sylph must be the same as those of the taxonomy input channel of this module. + pattern: "*.{tsv}" +- - taxonomy: + type: file + description: A list of sylph-tax identifiers (e.g. GTDB_r220 or IMGVR_4.1). + Multiple taxonomy metadata files can be input. Custom taxonomy files are also + possible. +output: +- taxprof_output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + pattern: "*{.sylphmpa}" + - '*.sylphmpa': + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + pattern: "*{.sylphmpa}" +- versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: +- "@sofstam" +maintainers: +- "@sofstam" diff --git a/modules/nf-core/sylphtax/taxprof/tests/main.nf.test b/modules/nf-core/sylphtax/taxprof/tests/main.nf.test new file mode 100644 index 00000000000..e0d4805251a --- /dev/null +++ b/modules/nf-core/sylphtax/taxprof/tests/main.nf.test @@ -0,0 +1,91 @@ +nextflow_process { + + name "Test Process SYLPHTAX_TAXPROF" + script "../main.nf" + process "SYLPHTAX_TAXPROF" + + tag "modules" + tag "modules_nfcore" + tag "sylph" + tag "sylph/profile" + tag "sylphtax" + tag "sylphtax/taxprof" + + + test("sarscov2 illumina single-end [fastq_gz]") { + setup { + run("SYLPH_PROFILE") { + script "../../../sylph/profile/main.nf" + process { + """ + input[0] = [ [ id:'test' ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ] + input[1] = file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + """ + } + } + } + when { + process { + """ + input[0] = SYLPH_PROFILE.out.profile_out + input[1] = file('https://github.com/nf-core/test-datasets/raw/taxprofiler/data/database/sylph/test_taxonomy.tsv.gz', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.taxprof_output + ).match() } + ) + } + + } + + test("stub sarscov2 illumina single-end [fastq_gz]") { + + options '-stub' + + setup { + run("SYLPH_PROFILE") { + script "../../../sylph/profile/main.nf" + process { + """ + input[0] = [ [ id:'test' ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ] + input[1] = file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + """ + } + } + } + when { + process { + """ + input[0] = SYLPH_PROFILE.out.profile_out + input[1] = file('https://github.com/nf-core/test-datasets/raw/taxprofiler/data/database/sylph/test_taxonomy.tsv.gz', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.taxprof_output + ).match() } + ) + } + } + +} diff --git a/modules/nf-core/sylphtax/taxprof/tests/main.nf.test.snap b/modules/nf-core/sylphtax/taxprof/tests/main.nf.test.snap new file mode 100644 index 00000000000..d5db49e44dd --- /dev/null +++ b/modules/nf-core/sylphtax/taxprof/tests/main.nf.test.snap @@ -0,0 +1,42 @@ +{ + "stub sarscov2 illumina single-end [fastq_gz]": { + "content": [ + [ + "versions.yml:md5,976fae8d146f4f3087e2a090703f09b9" + ], + [ + [ + { + "id": "test" + }, + "test.sylphmpa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-13T13:27:49.708058346" + }, + "sarscov2 illumina single-end [fastq_gz]": { + "content": [ + [ + "versions.yml:md5,976fae8d146f4f3087e2a090703f09b9" + ], + [ + [ + { + "id": "test" + }, + "test.sylphmpatest_1.fastq.gz.sylphmpa:md5,797e3463eeb9a2e8f91de9b842cd421d" + ] + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-13T13:22:19.31463228" + } +} \ No newline at end of file