Skip to content

Commit b92aca7

Browse files
committed
Add new component: gridss/preprocess
1 parent 6e6274f commit b92aca7

6 files changed

Lines changed: 364 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::gridss=2.13.2"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
process GRIDSS_PREPROCESS {
2+
tag "$meta.id"
3+
label 'process_medium'
4+
5+
conda "${moduleDir}/environment.yml"
6+
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
7+
'https://depot.galaxyproject.org/singularity/gridss:2.13.2--h50ea8bc_3':
8+
'quay.io/biocontainers/gridss:2.13.2--h50ea8bc_3' }"
9+
10+
input:
11+
tuple val(meta), path(bam), path(bai)
12+
tuple val(meta2), path(fasta)
13+
tuple val(meta3), path(fasta_fai)
14+
tuple val(meta4), path(bwa_index)
15+
16+
output:
17+
tuple val(meta), path("*.gridss.working"), emit: preprocess_dir
18+
tuple val("${task.process}"), val('gridss'), eval("CallVariants --version 2>&1 | sed 's/-gridss\$//'"), topic: versions, emit: versions_gridss
19+
20+
when:
21+
task.ext.when == null || task.ext.when
22+
23+
script:
24+
def args = task.ext.args ?: ''
25+
def prefix = task.ext.prefix ?: "${meta.id}"
26+
27+
"""
28+
ln -s \$(find -L ${bwa_index} -regex '.*\\.\\(amb\\|ann\\|pac\\|gridsscache\\|sa\\|bwt\\|img\\|alt\\)') ./
29+
30+
gridss \\
31+
--threads ${task.cpus} \\
32+
--steps preprocess \\
33+
--jvmheap ${task.memory.toGiga() - 1}g \\
34+
--otherjvmheap ${task.memory.toGiga() - 1}g \\
35+
--reference ${fasta} \\
36+
${args} \\
37+
${bam}
38+
39+
"""
40+
41+
stub:
42+
def args = task.ext.args ?: ''
43+
def prefix = task.ext.prefix ?: "${meta.id}"
44+
45+
"""
46+
mkdir -p ${prefix}.gridss.working/
47+
48+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.cigar_metrics
49+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.computesamtags.changes.tsv
50+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.coverage.blacklist.bed
51+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.idsv_metrics
52+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.insert_size_histogram.pdf
53+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.insert_size_metrics
54+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.mapq_metrics
55+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.sv.bam
56+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.sv.bam.csi
57+
touch ${prefix}.gridss.working/${prefix}.gridss.targeted.bam.tag_metrics
58+
"""
59+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: "gridss_preprocess"
2+
description: Run the preprocess step of GRIDSS to extract multiple Picard
3+
metrics (insert size, MAPQ, CIGAR, IDSV, tag and coverage metrics) from an
4+
input BAM file prior to assembly and variant calling.
5+
keywords:
6+
- gridss
7+
- preprocess
8+
- picard metrics
9+
- structural variants
10+
- bam
11+
tools:
12+
- gridss:
13+
description: "GRIDSS: the Genomic Rearrangement IDentification Software Suite"
14+
homepage: "https://github.com/PapenfussLab/gridss"
15+
documentation: "https://github.com/PapenfussLab/gridss/wiki/GRIDSS-Documentation"
16+
tool_dev_url: "https://github.com/PapenfussLab/gridss"
17+
doi: "10.1186/s13059-021-02423-x"
18+
licence:
19+
- "GPL v3"
20+
identifier: biotools:gridss
21+
input:
22+
- - meta:
23+
type: map
24+
description: |
25+
Groovy Map containing sample information
26+
e.g. [ id:'test' ]
27+
- bam:
28+
type: file
29+
description: Input BAM file
30+
pattern: "*.bam"
31+
ontologies:
32+
- edam: http://edamontology.org/format_2572
33+
- bai:
34+
type: file
35+
description: Index of the input BAM file
36+
pattern: "*.bai"
37+
ontologies: []
38+
- - meta2:
39+
type: map
40+
description: |
41+
Groovy Map containing reference information
42+
- fasta:
43+
type: file
44+
description: The reference fasta
45+
pattern: "*.{fa,fna,fasta}"
46+
ontologies: []
47+
- - meta3:
48+
type: map
49+
description: |
50+
Groovy Map containing reference information
51+
- fasta_fai:
52+
type: file
53+
description: The index of the reference fasta
54+
pattern: "*.fai"
55+
ontologies: []
56+
- - meta4:
57+
type: map
58+
description: |
59+
Groovy Map containing reference information
60+
- bwa_index:
61+
type: directory
62+
description: The BWA index created from the reference fasta, will be
63+
generated by Gridss in the setupreference step
64+
output:
65+
preprocess_dir:
66+
- - meta:
67+
type: map
68+
description: |
69+
Groovy Map containing sample information
70+
e.g. [ id:'test' ]
71+
- "*.gridss.working":
72+
type: directory
73+
description: The working directory produced by the GRIDSS preprocess
74+
step containing Picard metrics (insert size, MAPQ, CIGAR, IDSV, tag,
75+
coverage) and SV-relevant reads used by downstream GRIDSS steps
76+
pattern: "*.gridss.working"
77+
versions_gridss:
78+
- - ${task.process}:
79+
type: string
80+
description: The process
81+
- gridss:
82+
type: string
83+
description: The tool name
84+
- CallVariants --version 2>&1 | sed 's/-gridss\$//':
85+
type: eval
86+
description: The expression to obtain the version of the tool
87+
topics:
88+
versions:
89+
- - ${task.process}:
90+
type: string
91+
description: The process
92+
- gridss:
93+
type: string
94+
description: The tool name
95+
- CallVariants --version 2>&1 | sed 's/-gridss\$//':
96+
type: eval
97+
description: The expression to obtain the version of the tool
98+
authors:
99+
- "@imsarath"
100+
maintainers:
101+
- "@imsarath"
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
nextflow_process {
2+
3+
name "Test Process GRIDSS_PREPROCESS"
4+
script "../main.nf"
5+
config "./nextflow.config"
6+
process "GRIDSS_PREPROCESS"
7+
8+
tag "modules"
9+
tag "modules_nfcore"
10+
tag "gridss"
11+
tag "gridss/preprocess"
12+
tag "bwa/index"
13+
14+
setup {
15+
16+
run("BWA_INDEX") {
17+
script "../../../bwa/index/main.nf"
18+
process {
19+
"""
20+
input[0] = [ [id:'fasta'],
21+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
22+
]
23+
"""
24+
}
25+
}
26+
}
27+
28+
test("human - bam - bwa") {
29+
30+
when {
31+
process {
32+
"""
33+
input[0] = [
34+
[ id:'test' ],
35+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
36+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
37+
]
38+
input[1] = [ [id:'fasta'],
39+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
40+
]
41+
input[2] = [ [id:'fasta_fai'],
42+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
43+
]
44+
input[3] = BWA_INDEX.out.index
45+
"""
46+
}
47+
}
48+
49+
then {
50+
def workdir = process.out.preprocess_dir[0][1]
51+
def prefix = "test.paired_end.sorted.bam"
52+
// Picard `# Started on:` and R's PDF `/CreationDate` add per-run timestamps,
53+
// and `sv.bam` BGZF blocks are non-reproducible — snapshot only stable parts.
54+
def stripPicardHeaderMd5 = { f -> "${file(f).name}:md5,${listToMD5(path(f).readLines().findAll { !it.startsWith("#") })}" }
55+
56+
assertAll(
57+
{ assert process.success },
58+
{ assert snapshot(
59+
process.out.preprocess_dir.collect { meta, dir -> [meta, file(dir).list().findAll { it.startsWith(prefix) }.sort()] },
60+
path("${workdir}/${prefix}.computesamtags.changes.tsv"),
61+
path("${workdir}/${prefix}.coverage.blacklist.bed"),
62+
path("${workdir}/${prefix}.sv.bam.csi"),
63+
stripPicardHeaderMd5("${workdir}/${prefix}.cigar_metrics"),
64+
stripPicardHeaderMd5("${workdir}/${prefix}.idsv_metrics"),
65+
stripPicardHeaderMd5("${workdir}/${prefix}.insert_size_metrics"),
66+
stripPicardHeaderMd5("${workdir}/${prefix}.mapq_metrics"),
67+
stripPicardHeaderMd5("${workdir}/${prefix}.tag_metrics"),
68+
process.out.findAll { key, val -> key.startsWith("versions") }
69+
).match() }
70+
)
71+
}
72+
}
73+
74+
test("human - bam - stub") {
75+
76+
options "-stub"
77+
78+
when {
79+
process {
80+
"""
81+
input[0] = [
82+
[ id:'test' ],
83+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
84+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
85+
]
86+
input[1] = [ [id:'fasta'],
87+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
88+
]
89+
input[2] = [ [id:'fasta_fai'],
90+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
91+
]
92+
input[3] = [ [], [] ]
93+
"""
94+
}
95+
}
96+
97+
then {
98+
assertAll(
99+
{ assert process.success },
100+
{ assert snapshot(
101+
process.out.preprocess_dir,
102+
process.out.findAll { key, val -> key.startsWith("versions") }
103+
).match() }
104+
)
105+
}
106+
}
107+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"human - bam - stub": {
3+
"content": [
4+
[
5+
[
6+
{
7+
"id": "test"
8+
},
9+
[
10+
"test.gridss.targeted.bam.cigar_metrics:md5,d41d8cd98f00b204e9800998ecf8427e",
11+
"test.gridss.targeted.bam.computesamtags.changes.tsv:md5,d41d8cd98f00b204e9800998ecf8427e",
12+
"test.gridss.targeted.bam.coverage.blacklist.bed:md5,d41d8cd98f00b204e9800998ecf8427e",
13+
"test.gridss.targeted.bam.idsv_metrics:md5,d41d8cd98f00b204e9800998ecf8427e",
14+
"test.gridss.targeted.bam.insert_size_histogram.pdf:md5,d41d8cd98f00b204e9800998ecf8427e",
15+
"test.gridss.targeted.bam.insert_size_metrics:md5,d41d8cd98f00b204e9800998ecf8427e",
16+
"test.gridss.targeted.bam.mapq_metrics:md5,d41d8cd98f00b204e9800998ecf8427e",
17+
"test.gridss.targeted.bam.sv.bam:md5,d41d8cd98f00b204e9800998ecf8427e",
18+
"test.gridss.targeted.bam.sv.bam.csi:md5,d41d8cd98f00b204e9800998ecf8427e",
19+
"test.gridss.targeted.bam.tag_metrics:md5,d41d8cd98f00b204e9800998ecf8427e"
20+
]
21+
]
22+
],
23+
{
24+
"versions_gridss": [
25+
[
26+
"GRIDSS_PREPROCESS",
27+
"gridss",
28+
"2.13.2"
29+
]
30+
]
31+
}
32+
],
33+
"timestamp": "2026-06-12T12:49:58.032375609",
34+
"meta": {
35+
"nf-test": "0.9.4",
36+
"nextflow": "25.10.4"
37+
}
38+
},
39+
"human - bam - bwa": {
40+
"content": [
41+
[
42+
[
43+
{
44+
"id": "test"
45+
},
46+
[
47+
"test.paired_end.sorted.bam.cigar_metrics",
48+
"test.paired_end.sorted.bam.computesamtags.changes.tsv",
49+
"test.paired_end.sorted.bam.coverage.blacklist.bed",
50+
"test.paired_end.sorted.bam.idsv_metrics",
51+
"test.paired_end.sorted.bam.insert_size_histogram.pdf",
52+
"test.paired_end.sorted.bam.insert_size_metrics",
53+
"test.paired_end.sorted.bam.mapq_metrics",
54+
"test.paired_end.sorted.bam.sv.bam",
55+
"test.paired_end.sorted.bam.sv.bam.csi",
56+
"test.paired_end.sorted.bam.tag_metrics"
57+
]
58+
]
59+
],
60+
"test.paired_end.sorted.bam.computesamtags.changes.tsv:md5,ce0a87ccee35f990cd878e12a8a84bae",
61+
"test.paired_end.sorted.bam.coverage.blacklist.bed:md5,63a1da1606bf23357ad6b1b166c21651",
62+
"test.paired_end.sorted.bam.sv.bam.csi:md5,cc1f8720e292f8470b608d7ae9547311",
63+
"test.paired_end.sorted.bam.cigar_metrics:md5,29b9a700b9da9f2cb23e199e8c15af31",
64+
"test.paired_end.sorted.bam.idsv_metrics:md5,eeee010100dcea8b9f9eeeac44f8d142",
65+
"test.paired_end.sorted.bam.insert_size_metrics:md5,4a7d860f1073a82c093373bdbdbd6bf3",
66+
"test.paired_end.sorted.bam.mapq_metrics:md5,dff79a95a8f9b40de520ef438c9fab59",
67+
"test.paired_end.sorted.bam.tag_metrics:md5,486bf2bab6f506dd20f98e7fa05ae39c",
68+
{
69+
"versions_gridss": [
70+
[
71+
"GRIDSS_PREPROCESS",
72+
"gridss",
73+
"2.13.2"
74+
]
75+
]
76+
}
77+
],
78+
"timestamp": "2026-06-12T12:49:48.647470086",
79+
"meta": {
80+
"nf-test": "0.9.4",
81+
"nextflow": "25.10.4"
82+
}
83+
}
84+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
process {
2+
withName: BWA_INDEX {
3+
// GRIDSS requires the BWA index to be prefixed with full name - "genome.fasta"
4+
ext.prefix = { "genome.fasta" }
5+
}
6+
}

0 commit comments

Comments
 (0)