diff --git a/modules/nf-core/irescue/environment.yml b/modules/nf-core/irescue/environment.yml new file mode 100644 index 00000000000..30766a63c50 --- /dev/null +++ b/modules/nf-core/irescue/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::irescue=1.1.2" diff --git a/modules/nf-core/irescue/main.nf b/modules/nf-core/irescue/main.nf new file mode 100644 index 00000000000..daca7cb651d --- /dev/null +++ b/modules/nf-core/irescue/main.nf @@ -0,0 +1,62 @@ +process IRESCUE { + 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/irescue:1.1.2--pyhdfd78af_0': + 'biocontainers/irescue:1.1.2--pyhdfd78af_0' }" + + input: + tuple val(meta), path(bam) + val genome + path bed + + output: + tuple val(meta), path("${prefix}") , emit: results + tuple val(meta), path("${prefix}/counts") , emit: counts + tuple val(meta), path("${prefix}/irescue.log"), emit: log + tuple val(meta), path("${prefix}/tmp") , emit: tmp, optional: true + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + def reference = bed ? "--regions $bed" : '' + def genome_assembly = reference ? '' : "--genome $genome" + """ + mkdir -p $prefix + irescue \\ + --bam $bam \\ + $reference \\ + $genome_assembly \\ + --outdir $prefix \\ + --threads $task.cpus \\ + $args 2> >(tee -a ${prefix}/irescue.log >&2) + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + irescue: \$(irescue --version |& sed '1!d ; s/IRescue //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir -p ${prefix}/counts + touch \\ + ${prefix}/counts/matrix.mtx \\ + ${prefix}/counts/barcodes.tsv \\ + ${prefix}/counts/features.tsv \\ + ${prefix}/irescue.log + gzip ${prefix}/counts/* + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + irescue: \$(irescue --version |& sed '1!d ; s/IRescue //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/irescue/meta.yml b/modules/nf-core/irescue/meta.yml new file mode 100644 index 00000000000..81e98b011cb --- /dev/null +++ b/modules/nf-core/irescue/meta.yml @@ -0,0 +1,95 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "irescue" +description: Quantification of transposable elements expression in scRNA-seq +keywords: + - scRNA-seq + - transposons + - repeats +tools: + - "irescue": + description: "IRescue is a tool for uncertainty-aware quantification of transposable elements expression in scRNA-seq" + homepage: "https://pypi.org/project/IRescue" + documentation: "https://pypi.org/project/IRescue" + tool_dev_url: "https://github.com/bodegalab/irescue" + doi: "10.1093/nar/gkae793" + licence: ["MIT"] + identifier: biotools:irescue + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - bam: + type: file + description: Sorted BAM file + pattern: "*.bam" + ontologies: + - edam: "http://edamontology.org/format_2572" + - - genome: + type: string + description: | + Genome assembly symbol. Not used when bed file is provided. + In this case, it can be any value or an empty string. + - - bed: + type: file + description: Bed file of repeats genomic coordinates (optional). + pattern: "*.bed" + ontologies: + - edam: "http://edamontology.org/format_3003" + +output: + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + - results: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ${prefix}: + type: directory + description: Folder containing count matrices and logs + pattern: "${prefix}" + - counts: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ${prefix}/counts: + type: directory + description: Folder containing count matrices + pattern: "${prefix}/counts" + - log: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ${prefix}/irescue.log: + type: file + description: Text file contianing run informations + pattern: "${prefix}/irescue.log" + - tmp: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ${prefix}/tmp: + type: directory + description: | + Folder containing temporary files, + if kept using the "--keeptmp" argument (optional). + pattern: "${prefix}/tmp" + +authors: + - "@bepoli" +maintainers: + - "@bepoli" diff --git a/modules/nf-core/irescue/tests/main.nf.test b/modules/nf-core/irescue/tests/main.nf.test new file mode 100644 index 00000000000..f69965eb4e0 --- /dev/null +++ b/modules/nf-core/irescue/tests/main.nf.test @@ -0,0 +1,71 @@ +nextflow_process { + + name "Test Process IRESCUE" + script "../main.nf" + process "IRESCUE" + + tag "modules" + tag "modules_nfcore" + tag "irescue" + + test("homo_sapiens 10xgenomics - bam") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/10x_cr12.bam', checkIfExists: true) + ] + input[1] = 'test' + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.counts, + process.out.versions + ).match() + }, + { assert file(process.out.log.get(0).get(1)).exists() } + ) + } + + } + + test("homo_sapiens 10xgenomics - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/10x_cr12.bam', checkIfExists: true) + ] + input[1] = 'test' + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.counts, + process.out.versions + ).match() + }, + { assert file(process.out.log.get(0).get(1)).exists() } + ) + } + + } + +} diff --git a/modules/nf-core/irescue/tests/main.nf.test.snap b/modules/nf-core/irescue/tests/main.nf.test.snap new file mode 100644 index 00000000000..83065e545ce --- /dev/null +++ b/modules/nf-core/irescue/tests/main.nf.test.snap @@ -0,0 +1,50 @@ +{ + "homo_sapiens 10xgenomics - bam": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "barcodes.tsv.gz:md5,5c151d3b6f48e4919687c47684c62395", + "features.tsv.gz:md5,473997691921db70febf048bcdd20848", + "matrix.mtx.gz:md5,8a3e6634400dd455f3199a6de258d526" + ] + ] + ], + [ + "versions.yml:md5,5097199e8c09d02a961b2277b2a91c9f" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-25T09:34:16.073380434" + }, + "homo_sapiens 10xgenomics - bam - stub": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "barcodes.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e", + "features.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e", + "matrix.mtx.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + [ + "versions.yml:md5,5097199e8c09d02a961b2277b2a91c9f" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-25T09:34:27.46106643" + } +} \ No newline at end of file