Skip to content

Commit b27f53c

Browse files
lbeltrameimsarath
authored andcommitted
Add the finaletoolkit/aggbw module (#11975)
* Add the finaletoolkit/aggbw module From the upstream project: Aggregates a bigWig signal over constant-length intervals defined in a BED file. * Fix lint * Remove line (not relevant, copy-paste error) * Export the matplotlib configuration in the script block It is not removed yet from the tests as the other modules depend on it: follow up changes will clean that up * Remove unrelated keyword * Address concerns raised during review
1 parent 79a3af1 commit b27f53c

6 files changed

Lines changed: 305 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
3+
channels:
4+
- conda-forge
5+
- bioconda
6+
dependencies:
7+
- "bioconda::finaletoolkit=0.11.1"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
process FINALETOOLKIT_AGGBW {
2+
tag "${meta.id}"
3+
label 'process_low'
4+
5+
conda "${moduleDir}/environment.yml"
6+
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container
7+
? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/34/34f01d128ed135aedc33ddb62fced3911bef6d1a909694291b7184bf83719402/data'
8+
: 'community.wave.seqera.io/library/finaletoolkit:0.11.1--8fe5ba6ec9e2ec95'}"
9+
10+
input:
11+
tuple val(meta), path(bigwig)
12+
tuple val(meta2), path(intervals)
13+
14+
output:
15+
tuple val(meta), path("${prefix}.wig"), emit: wig
16+
tuple val("${task.process}"), val('finaletoolkit'), eval("finaletoolkit --version | sed 's/FinaleToolkit //g'"), topic: versions, emit: versions_finaletoolkit
17+
18+
when:
19+
task.ext.when == null || task.ext.when
20+
21+
script:
22+
def args = task.ext.args ?: ''
23+
prefix = task.ext.prefix ?: "${meta.id}_agg"
24+
"""
25+
export MPLCONFIGDIR=.
26+
27+
finaletoolkit \\
28+
agg-bw \\
29+
${bigwig} \\
30+
${intervals} \\
31+
${args} \\
32+
-o "${prefix}.wig"
33+
"""
34+
35+
stub:
36+
def args = task.ext.args ?: ''
37+
prefix = task.ext.prefix ?: "${meta.id}_agg"
38+
"""
39+
echo ${args}
40+
41+
touch "${prefix}.wig"
42+
"""
43+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: "finaletoolkit_aggbw"
2+
description: |
3+
Aggregates a bigWig signal over constant-length intervals
4+
defined in a BED file.
5+
keywords:
6+
- genomics
7+
- aggregation
8+
- fragmentomics
9+
tools:
10+
- "finaletoolkit":
11+
description: "Extract cfDNA fragmentation features from sequencing data."
12+
homepage: "https://epifluidlab.github.io/FinaleToolkit/"
13+
documentation: "https://epifluidlab.github.io/FinaleToolkit/documentation/index.html"
14+
tool_dev_url: "https://github.com/epifluidlab/FinaleToolkit"
15+
doi: "10.1093/bioadv/vbaf236"
16+
licence:
17+
- "MIT"
18+
identifier: biotools:finaletoolkit
19+
input:
20+
- - meta:
21+
type: map
22+
description: |
23+
Groovy Map containing sample information
24+
e.g. `[ id:'sample1' ]`
25+
- bigwig:
26+
type: file
27+
description: BigWig file containing signals to aggregate
28+
pattern: "*.bw"
29+
ontologies:
30+
- edam: "http://edamontology.org/format_3006"
31+
- - meta2:
32+
type: map
33+
description: |
34+
Groovy Map containing sample information
35+
e.g. `[ id:'sample1' ]`
36+
- intervals:
37+
type: file
38+
pattern: "*.bed"
39+
description: |
40+
BED file containing intervals to aggregate for
41+
ontologies:
42+
- edam: "http://edamontology.org/format_3003"
43+
output:
44+
wig:
45+
- - meta:
46+
type: map
47+
description: |
48+
Groovy Map containing sample information
49+
e.g. `[ id:'sample1' ]`
50+
- "${prefix}.wig":
51+
type: file
52+
pattern: "*.wig"
53+
description: |
54+
Wiggle file containing aggregated scores over the itnervals
55+
ontologies:
56+
- edam: "http://edamontology.org/format_3005"
57+
versions_finaletoolkit:
58+
- - ${task.process}:
59+
type: string
60+
description: The name of the process
61+
- finaletoolkit:
62+
type: string
63+
description: The name of the tool
64+
- finaletoolkit --version | sed 's/FinaleToolkit //g':
65+
type: eval
66+
description: The expression to obtain the version of the tool
67+
topics:
68+
versions:
69+
- - ${task.process}:
70+
type: string
71+
description: The name of the process
72+
- finaletoolkit:
73+
type: string
74+
description: The name of the tool
75+
- finaletoolkit --version | sed 's/FinaleToolkit //g':
76+
type: eval
77+
description: The expression to obtain the version of the tool
78+
authors:
79+
- "@lbeltrame"
80+
maintainers:
81+
- "@lbeltrame"
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
nextflow_process {
2+
3+
name "Test Process FINALETOOLKIT_AGGBW"
4+
script "../main.nf"
5+
process "FINALETOOLKIT_AGGBW"
6+
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "finaletoolkit"
10+
tag "finaletoolkit/wps"
11+
tag "finaletoolkit/adjustwps"
12+
tag "finaletoolkit/aggbw"
13+
14+
test("homo_sapiens - bigwig") {
15+
16+
setup {
17+
18+
config "./nextflow.config"
19+
run("FINALETOOLKIT_WPS") {
20+
script("../../wps/main.nf")
21+
process {
22+
"""
23+
input[0] = [
24+
[ id:'test' ],
25+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr22.bam', checkIfExists: true),
26+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr22.bam.bai', checkIfExists: true),
27+
]
28+
input[1] = [
29+
[id: 'tss' ],
30+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome_tss.bed', checkIfExists: true),
31+
]
32+
input[2] = [
33+
[id: 'sizes' ],
34+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.sizes', checkIfExists: true),
35+
]
36+
"""
37+
}
38+
}
39+
run("FINALETOOLKIT_ADJUSTWPS") {
40+
script("../../adjustwps/main.nf")
41+
process {
42+
"""
43+
input[0] = FINALETOOLKIT_WPS.out.bigwig
44+
input[1] = [
45+
[id: 'tss' ],
46+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome_tss.bed', checkIfExists: true),
47+
]
48+
input[2] = Channel.of('chr22\t50818468')
49+
.collectFile(name: 'chr22.sizes', newLine: true)
50+
.map { sizes -> [[id: 'sizes' ], sizes] }
51+
"""
52+
53+
}
54+
}
55+
}
56+
57+
when {
58+
59+
process {
60+
61+
config "./nextflow.config"
62+
63+
"""
64+
input[0] = FINALETOOLKIT_ADJUSTWPS.out.bigwig
65+
input[1] = [
66+
[id: 'tss' ],
67+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome_tss.bed', checkIfExists: true),
68+
]
69+
"""
70+
}
71+
}
72+
73+
then {
74+
assert process.success
75+
assertAll(
76+
{ assert snapshot(sanitizeOutput(process.out)).match() }
77+
)
78+
79+
}
80+
81+
}
82+
83+
test("homo_sapiens - stub") {
84+
85+
options "-stub"
86+
87+
88+
when {
89+
90+
process {
91+
92+
config "./nextflow.config"
93+
94+
"""
95+
input[0] = [
96+
[ id: 'test'],
97+
[]
98+
]
99+
input[1] = [
100+
[id: 'tss' ],
101+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome_tss.bed', checkIfExists: true),
102+
]
103+
"""
104+
}
105+
}
106+
107+
then {
108+
assert process.success
109+
assertAll(
110+
{ assert snapshot(sanitizeOutput(process.out)).match() }
111+
)
112+
113+
}
114+
115+
}
116+
117+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"homo_sapiens - bigwig": {
3+
"content": [
4+
{
5+
"versions_finaletoolkit": [
6+
[
7+
"FINALETOOLKIT_AGGBW",
8+
"finaletoolkit",
9+
"0.11.1"
10+
]
11+
],
12+
"wig": [
13+
[
14+
{
15+
"id": "test"
16+
},
17+
"test_agg.wig:md5,edd66f4a1fe6b5be7364e0d33bc50737"
18+
]
19+
]
20+
}
21+
],
22+
"meta": {
23+
"nf-test": "0.9.3",
24+
"nextflow": "25.10.4"
25+
},
26+
"timestamp": "2026-06-11T10:03:04.701891909"
27+
},
28+
"homo_sapiens - stub": {
29+
"content": [
30+
{
31+
"versions_finaletoolkit": [
32+
[
33+
"FINALETOOLKIT_AGGBW",
34+
"finaletoolkit",
35+
"0.11.1"
36+
]
37+
],
38+
"wig": [
39+
[
40+
{
41+
"id": "test"
42+
},
43+
"test_agg.wig:md5,d41d8cd98f00b204e9800998ecf8427e"
44+
]
45+
]
46+
}
47+
],
48+
"meta": {
49+
"nf-test": "0.9.3",
50+
"nextflow": "25.10.4"
51+
},
52+
"timestamp": "2026-06-11T10:01:38.292828848"
53+
}
54+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
env {
2+
MPLCONFIGDIR = './tmp'
3+
}

0 commit comments

Comments
 (0)