Skip to content

Commit

Permalink
add alignmentSieve (nf-core#6693)
Browse files Browse the repository at this point in the history
* add alignmentSieve

* longer keywords

* add three keywords

* possible solution with size

* using logs instead of bam files

* fix meta

* Update modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test

Co-authored-by: Simon Pearce <[email protected]>

* update snapshot

* fix keywords

Co-authored-by: Jose Espinosa-Carrasco <[email protected]>

* fix authors

Co-authored-by: Jose Espinosa-Carrasco <[email protected]>

* fix authors names

Co-authored-by: Jose Espinosa-Carrasco <[email protected]>

* add to maintainers

Co-authored-by: Jose Espinosa-Carrasco <[email protected]>

---------

Co-authored-by: Alexander Peltzer <[email protected]>
Co-authored-by: Simon Pearce <[email protected]>
Co-authored-by: Jose Espinosa-Carrasco <[email protected]>
  • Loading branch information
4 people authored and Helle Rus Povlsen committed Oct 2, 2024
1 parent 01baaa9 commit 56c7396
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/nf-core/deeptools/alignmentsieve/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::deeptools=3.5.5
- bioconda::samtools=1.20
49 changes: 49 additions & 0 deletions modules/nf-core/deeptools/alignmentsieve/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process DEEPTOOLS_ALIGNMENTSIEVE {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-eb9e7907c7a753917c1e4d7a64384c047429618a:41defd13a6f2ce014549fcc05d0b051f655777f9-0':
'biocontainers/mulled-v2-eb9e7907c7a753917c1e4d7a64384c047429618a:41defd13a6f2ce014549fcc05d0b051f655777f9-0' }"

input:
tuple val(meta), path(input), path(input_index)

output:
tuple val(meta), path("*_as.bam") , emit: bam
path "versions.yml" , emit: versions
path "*_log.txt" , emit: logs

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
alignmentSieve \\
$args \\
-b $input \\
-o ${prefix}_as.bam \\
--filterMetrics ${prefix}_log.txt \\
--numberOfProcessors $task.cpus
cat <<-END_VERSIONS > versions.yml
"${task.process}":
deeptools: \$(alignmentSieve --version | sed -e "s/alignmentSieve //g")
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}_as.bam
touch ${prefix}_log.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
deeptools: \$(alignmentSieve --version | sed -e "s/alignmentSieve //g")
END_VERSIONS
"""
}
56 changes: 56 additions & 0 deletions modules/nf-core/deeptools/alignmentsieve/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: deeptools_alignmentSieve
description: This tool filters alignments in a BAM/CRAM file according the the specified parameters.
keywords:
- ATACseq
- filter
- shift
- ATACshift
tools:
- deeptools:
description: A set of user-friendly tools for normalization and visualzation of
deep-sequencing data
homepage: https://deeptools.readthedocs.io/en/develop/content/tools/alignmentSieve.html
documentation: https://deeptools.readthedocs.io/en/develop/content/tools/alignmentSieve.html
tool_dev_url: https://github.com/deeptools/deepTools/
doi: "10.1093/nar/gkw257"
licence: ["GPL v3"]
identifier: biotools:deeptools
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- input:
type: file
description: BAM file
pattern: "*.{bam}"
- input_index:
type: file
description: BAM index file
pattern: "*.{bai}"
output:
- bam:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*_as.bam":
type: file
description: BAM file
pattern: "*.bam"
- logs:
- "*_log.txt":
type: file
description: TXT file
pattern: "*.txt"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@lpantano"
maintainers:
- "@lpantano"
60 changes: 60 additions & 0 deletions modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
nextflow_process {

name "Test Process DEEPTOOLS_ALIGNMENTSIEVE"
script "../main.nf"
process "DEEPTOOLS_ALIGNMENTSIEVE"

tag "modules"
tag "modules_nfcore"
tag "deeptools"
tag "deeptools/alignmentsieve"

test("homo_sampiens - bam") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.logs,
bam(process.out.bam[0][1]).getReadsMD5(),
process.out.versions)
.match()
}
)
}
}
test("homo_sampiens - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
59 changes: 59 additions & 0 deletions modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"homo_sampiens - bam": {
"content": [
[
"test_log.txt:md5,39f97a6a2ff83330d5c93411113df63a"
],
"463ac3b905fbf4ddf113a94dbfa8d69f",
[
"versions.yml:md5,baf8080ab016b89a27483809252bc803"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-26T12:59:06.183167"
},
"homo_sampiens - bam - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test_as.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,baf8080ab016b89a27483809252bc803"
],
"2": [
"test_log.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"bam": [
[
{
"id": "test",
"single_end": false
},
"test_as.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"logs": [
"test_log.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"versions": [
"versions.yml:md5,baf8080ab016b89a27483809252bc803"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-26T12:59:10.273315"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/deeptools/alignmentsieve/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deeptools/bamcoverage:
- "modules/nf-core/deeptools/alignmentsieve/**"

0 comments on commit 56c7396

Please sign in to comment.