diff --git a/modules/nf-core/motus/preplong/environment.yml b/modules/nf-core/motus/preplong/environment.yml new file mode 100644 index 00000000000..b8ef520eaa2 --- /dev/null +++ b/modules/nf-core/motus/preplong/environment.yml @@ -0,0 +1,5 @@ +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::motus=3.1.0 diff --git a/modules/nf-core/motus/preplong/main.nf b/modules/nf-core/motus/preplong/main.nf new file mode 100644 index 00000000000..3fffc149648 --- /dev/null +++ b/modules/nf-core/motus/preplong/main.nf @@ -0,0 +1,53 @@ +process MOTUS_PREPLONG { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/motus:3.1.0--pyhdfd78af_0': + 'biocontainers/motus:3.1.0--pyhdfd78af_0' }" + + input: + tuple val(meta), path(reads) + path db + + output: + tuple val(meta), path("*.gz"), emit: out + 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}" + def refdb = db ? "-db ${db}" : "" + + """ + motus \\ + prep_long \\ + $args \\ + -i $reads \\ + $refdb \\ + -t $task.cpus \\ + -o ${prefix}.gz \\ + 2> >(tee ${prefix}.log >&2) + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + motus: \$(motus --version 2>&1 | sed 's/.* \\([0-9]*\\.[0-9]*\\.[0-9]*\\) .*/\\1/') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + echo '' | gzip > ${prefix}.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + motus: \$(motus --version 2>&1 | sed 's/.* \\([0-9]*\\.[0-9]*\\.[0-9]*\\) .*/\\1/') + END_VERSIONS + """ +} diff --git a/modules/nf-core/motus/preplong/meta.yml b/modules/nf-core/motus/preplong/meta.yml new file mode 100644 index 00000000000..6ef63949a04 --- /dev/null +++ b/modules/nf-core/motus/preplong/meta.yml @@ -0,0 +1,52 @@ +name: "motus_preplong" +description: Taxonomic meta-omics profiling using universal marker genes +keywords: + - classify + - metagenomics + - fastq + - taxonomic profiling +tools: + - "motus": + description: "Marker gene-based operational taxonomic unit (mOTU) profiling" + homepage: "https://motu-tool.org/" + documentation: "https://github.com/motu-tool/mOTUs/wiki" + tool_dev_url: "https://github.com/motu-tool/mOTUs" + doi: "10.1186/s40168-022-01410-z" + licence: ["GPL v3"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - reads: + type: file + description: Long read file to convert, can be fasta(.gz) or fastq(.gz) + pattern: "*.{gz}" + - - db: + type: directory + description: | + mOTUs database downloaded by `motus downloadDB` + pattern: "db_mOTU/" +output: + - out: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.gz": + type: file + description: converted file (gzipped), ready to be used by motus profile + pattern: "*.gz" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@sofstam" +maintainers: + - "@sofstam" diff --git a/modules/nf-core/motus/preplong/tests/main.nf.test b/modules/nf-core/motus/preplong/tests/main.nf.test new file mode 100644 index 00000000000..5ad8e7487f1 --- /dev/null +++ b/modules/nf-core/motus/preplong/tests/main.nf.test @@ -0,0 +1,75 @@ +nextflow_process { + + name "Test Process MOTUS_PREPLONG" + script "../main.nf" + process "MOTUS_PREPLONG" + + tag "modules" + tag "modules_nfcore" + tag "motus" + tag "motus/downloaddb" + tag "motus/preplong" + + setup { + run("MOTUS_DOWNLOADDB") { + script "modules/nf-core/motus/downloaddb/main.nf" + process { + """ + input[0] = Channel.of([ + file('https://raw.githubusercontent.com/motu-tool/mOTUs/master/motus/downloadDB.py') + ]) + """ + } + } + } + + test("sarscov2 - fasta") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test_2.fastq.gz', checkIfExists: true) + ] + input[1] = MOTUS_DOWNLOADDB.out.db + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test_2.fastq.gz', checkIfExists: true) + ] + input[1] = MOTUS_DOWNLOADDB.out.db + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + + } + +} diff --git a/modules/nf-core/motus/preplong/tests/main.nf.test.snap b/modules/nf-core/motus/preplong/tests/main.nf.test.snap new file mode 100644 index 00000000000..5ed72ec8a9a --- /dev/null +++ b/modules/nf-core/motus/preplong/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,8fc614f9fe354b0811def13c772bc6fb" + ], + "out": [ + [ + { + "id": "test", + "single_end": false + }, + "test.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,8fc614f9fe354b0811def13c772bc6fb" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.1" + }, + "timestamp": "2024-09-06T16:29:18.602046" + }, + "sarscov2 - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.gz:md5,37be4a7321bcb2fdae60affb21a1737c" + ] + ], + "1": [ + "versions.yml:md5,8fc614f9fe354b0811def13c772bc6fb" + ], + "out": [ + [ + { + "id": "test", + "single_end": false + }, + "test.gz:md5,37be4a7321bcb2fdae60affb21a1737c" + ] + ], + "versions": [ + "versions.yml:md5,8fc614f9fe354b0811def13c772bc6fb" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.1" + }, + "timestamp": "2024-09-06T15:55:48.439664" + } +} \ No newline at end of file diff --git a/modules/nf-core/motus/preplong/tests/tags.yml b/modules/nf-core/motus/preplong/tests/tags.yml new file mode 100644 index 00000000000..bdaae3b2032 --- /dev/null +++ b/modules/nf-core/motus/preplong/tests/tags.yml @@ -0,0 +1,2 @@ +motus/preplong: + - "modules/nf-core/motus/preplong/**"