diff --git a/modules/nf-core/ribodetector/environment.yml b/modules/nf-core/ribodetector/environment.yml new file mode 100644 index 00000000000..1eaa4e82555 --- /dev/null +++ b/modules/nf-core/ribodetector/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::ribodetector=0.3.1" diff --git a/modules/nf-core/ribodetector/main.nf b/modules/nf-core/ribodetector/main.nf new file mode 100644 index 00000000000..68e612efdaa --- /dev/null +++ b/modules/nf-core/ribodetector/main.nf @@ -0,0 +1,61 @@ +process RIBODETECTOR { + 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/ribodetector:0.3.1--pyhdfd78af_0': + 'biocontainers/ribodetector:0.3.1--pyhdfd78af_0' }" + + input: + tuple val(meta), path(fastq) + val length + + output: + tuple val(meta), path("*.nonrna*.fastq.gz"), emit: fastq + tuple val(meta), path("*.log") , emit: log + 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}" + ribodetector_bin = task.accelerator ? "ribodetector" : "ribodetector_cpu" + ribodetector_mem = task.accelerator ? "-m $task.memory.toGiga()" : "" + output = meta.single_end ? "${prefix}.nonrna.fastq.gz" : "${prefix}.nonrna.1.fastq.gz ${prefix}.nonrna.2.fastq.gz" + + """ + ${ribodetector_bin} \\ + -i ${fastq} \\ + -o ${output} \\ + -l ${length} \\ + -t ${task.cpus} \\ + --log ${prefix}.log \\ + ${ribodetector_mem} \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + ribodetector: \$(ribodetector --version | sed 's/ribodetector //g') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + echo $args + + echo | gzip > ${prefix}.nonrna.1.fastq.gz + echo | gzip > ${prefix}.nonrna.2.fastq.gz + touch ${prefix}.log + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + ribodetector: \$(ribodetector --version | sed 's/ribodetector //g') + END_VERSIONS + """ +} diff --git a/modules/nf-core/ribodetector/meta.yml b/modules/nf-core/ribodetector/meta.yml new file mode 100644 index 00000000000..cd3d0dd5f7b --- /dev/null +++ b/modules/nf-core/ribodetector/meta.yml @@ -0,0 +1,75 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "ribodetector" +description: Accurate and rapid RiboRNA sequences Detector based on deep + learning +keywords: +- RNA +- RNAseq +- rRNA +- ribosomal RNA +- rRNA depletion +- rRNA removal +- rRNA filtering +- deep learning +- Riboseq +- genomics +tools: +- "ribodetector": + description: "Accurate and rapid RiboRNA sequences detector based on deep learning" + homepage: "https://github.com/hzi-bifo/RiboDetector" + documentation: "https://github.com/hzi-bifo/RiboDetector" + tool_dev_url: "https://github.com/hzi-bifo/RiboDetector" + doi: "10.1093/nar/gkac112" + licence: ['GPL v3-or-later'] + identifier: biotools:ribodetector + +input: +- - meta: + type: map + description: | + Groovy Map containing riboseq sample information + e.g. `[ id:'sample1', single_end:false ] + - fastq: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + ontologies: + - edam: http://edamontology.org/format_1930 # fastq format +- length: + type: integer + description: | + Sequencing read length (mean length). Note: the accuracy reduces for reads shorter than 40 + pattern: "integer >= 1" +output: + fastq: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.nonrna*.fastq.gz": + type: file + description: rRNA depleted FastQ files + pattern: "*.nonrna*.fastq.gz" + ontologies: + - edam: http://edamontology.org/format_1930 # fastq format + - edam: http://edamontology.org/format_3989 # GZIP format + log: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.log": + type: file + description: Log file from RiboDetector + pattern: "*.log" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: versions.yml + ontologies: + - edam: http://edamontology.org/format_3750 # YAML +authors: +- "@maxibor" +maintainers: +- "@maxibor" diff --git a/modules/nf-core/ribodetector/tests/main.nf.test b/modules/nf-core/ribodetector/tests/main.nf.test new file mode 100644 index 00000000000..9d595b44efb --- /dev/null +++ b/modules/nf-core/ribodetector/tests/main.nf.test @@ -0,0 +1,67 @@ +nextflow_process { + + name "Test Process RIBODETECTOR" + script "../main.nf" + process "RIBODETECTOR" + + tag "modules" + tag "modules_nfcore" + tag "ribodetector" + + test("ribodetector - rnaseq PE input") { + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = 150 + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.fastq }, + { assert process.out.log }, + { assert path(process.out.log[0][1]).getText().contains("Writing output non-rRNA sequences") }, + { assert snapshot(process.out.versions).match("versions") } + ) + } + + } + + test("ribodetector - stub rnaseq PE input") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_rnaseq_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = 150 + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/ribodetector/tests/main.nf.test.snap b/modules/nf-core/ribodetector/tests/main.nf.test.snap new file mode 100644 index 00000000000..6200ddf1514 --- /dev/null +++ b/modules/nf-core/ribodetector/tests/main.nf.test.snap @@ -0,0 +1,73 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,f98df8f0eaa704e4db74785adc9cc791" + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-10-27T10:12:20.183608" + }, + "ribodetector - stub rnaseq PE input": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.nonrna.1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test.nonrna.2.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,f98df8f0eaa704e4db74785adc9cc791" + ], + "fastq": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.nonrna.1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test.nonrna.2.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,f98df8f0eaa704e4db74785adc9cc791" + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-10-27T10:12:59.627863" + } +} \ No newline at end of file