Skip to content

Commit

Permalink
Add irescue module (#6691)
Browse files Browse the repository at this point in the history
* Add irescue module

* Fix meta.yml not matching main.nf

* Fix linting

* Better tools description

* Apply suggestions from code review

Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>

* Remove trailing whitespaces

---------

Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>
  • Loading branch information
bepoli and sateeshperi authored Oct 25, 2024
1 parent dfd8939 commit 7face45
Show file tree
Hide file tree
Showing 5 changed files with 287 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/nf-core/irescue/environment.yml
Original file line number Diff line number Diff line change
@@ -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"
64 changes: 64 additions & 0 deletions modules/nf-core/irescue/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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
"""
}
95 changes: 95 additions & 0 deletions modules/nf-core/irescue/meta.yml
Original file line number Diff line number Diff line change
@@ -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"
71 changes: 71 additions & 0 deletions modules/nf-core/irescue/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -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() }
)
}

}

}
50 changes: 50 additions & 0 deletions modules/nf-core/irescue/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 7face45

Please sign in to comment.