Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/nf-core/gridss/assemble/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::gridss=2.13.2
66 changes: 66 additions & 0 deletions modules/nf-core/gridss/assemble/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
process GRIDSS_ASSEMBLE {
tag "$meta.id"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/gridss:2.13.2--h50ea8bc_3':
'quay.io/biocontainers/gridss:2.13.2--h50ea8bc_3' }"

input:
tuple val(meta), path(bam), path(bai), path(preprocess_dir)
tuple val(meta2), path(fasta), path(fasta_fai), path(bwa_index)
tuple val(meta3), path(gridss_config)

output:
tuple val(meta), path("*.gridss.working"), path("*.sv.assembly.bam"), emit: assemble_dir
tuple val("${task.process}"), val('gridss'), eval("CallVariants --version 2>&1 | sed 's/-gridss//'") , topic: versions, emit: versions_gridss

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def arg_config = gridss_config ? "-c ${gridss_config}" : ""

def bam_list = bam instanceof List ? bam : [bam]
def index_files = bwa_index instanceof List ? bwa_index : [bwa_index]
// GRIDSS requires all BWA index files to have the exact same basename as the reference fasta
def link_cmds = index_files.collect { idx -> "ln -sf ${idx} ./${fasta}.${idx.extension}" }.join('\n')
"""
${link_cmds}

gridss ${args} \\
--jvmheap ${Math.round(task.memory.bytes * 0.95)} \\
--steps assemble \\
--reference ${fasta} \\
--workingdir "." \\
--assembly ${prefix}.sv.assembly.bam \\
--threads ${task.cpus} \\
${arg_config} \\
${bam_list.join(' ')}

"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"

"""
mkdir -p ${prefix}.sv.assembly.bam.gridss.working

touch ${prefix}.sv.assembly.bam
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.cigar_metrics
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.coverage.blacklist.bed
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.downsampled_0.bed
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.excluded_0.bed
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.idsv_metrics
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.mapq_metrics
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.quality_distribution_metrics
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.subsetCalled_0.bed
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.sv.bam
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.sv.bam.bai
touch ${prefix}.sv.assembly.bam.gridss.working/${prefix}.sv.assembly.bam.tag_metrics

"""
}
115 changes: 115 additions & 0 deletions modules/nf-core/gridss/assemble/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: "gridss_assemble"
description: Assemble breakend contigs for GRIDSS structural variant calling
keywords:
- bam
- assembly
- structural variants
- gridss
- breakend
- variant calling
tools:
- gridss:
description: "GRIDSS: the Genomic Rearrangement IDentification Software Suite"
homepage: "https://github.com/PapenfussLab/gridss"
documentation: "https://github.com/PapenfussLab/gridss/wiki/GRIDSS-Documentation"
tool_dev_url: "https://github.com/PapenfussLab/gridss"
doi: "10.1186/s13059-021-02423-x"
licence:
- "GPL v3"
identifier: biotools:gridss
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- bam:
type: file
description: Input BAM file(s)
pattern: "*.bam"
ontologies:
- edam: http://edamontology.org/format_2572
- bai:
type: file
description: BAM index file(s)
pattern: "*.bam.bai"
ontologies: []
- preprocess_dir:
type: directory
description: GRIDSS preprocessing working directories from the
GRIDSS_PREPROCESS step
pattern: "*.gridss.working/"
- - meta2:
type: map
description: |
Groovy Map containing reference genome information
e.g. `[ id:'genome' ]`
- fasta:
type: file
description: Reference genome FASTA file
pattern: "*.{fasta,fa,fna}"
ontologies:
- edam: http://edamontology.org/format_1929
- fasta_fai:
type: file
description: Reference genome FASTA index file
pattern: "*.fai"
ontologies: []
- bwa_index:
type: directory
description: Directory containing the GRIDSS/BWA index files for the
reference genome
pattern: "*"
- - meta3:
type: map
description: |
Groovy Map containing GRIDSS configuration information
e.g. `[ id:'gridss_config' ]`
- gridss_config:
type: file
description: Optional GRIDSS configuration file
pattern: "*.{properties,config}"
ontologies: []
output:
assemble_dir:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "*.gridss.working":
type: directory
description: GRIDSS assembly working directory containing assembled
breakend contigs
pattern: "*.gridss.working"
- "*.sv.assembly.bam":
type: file
description: BAM file containing the assembled breakend contigs
pattern: "*.sv.assembly.bam"
ontologies:
- edam: http://edamontology.org/format_2572
versions_gridss:
- - ${task.process}:
type: string
description: The process
- gridss:
type: string
description: The tool name
- CallVariants --version 2>&1 | sed 's/-gridss//':
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The process
- gridss:
type: string
description: The tool name
- CallVariants --version 2>&1 | sed 's/-gridss//':
type: eval
description: The expression to obtain the version of the tool
authors:
- "@imsarath"
maintainers:
- "@imsarath"
115 changes: 115 additions & 0 deletions modules/nf-core/gridss/assemble/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "bwa/index"
tag "gridss"
tag "gridss/preprocess"
tag "gridss/assemble"

setup {
run("BWA_INDEX") {
script "../../../bwa/index/main.nf"
process {
"""
input[0] = [
[ id: 'fasta' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
"""
}
}

run("GRIDSS_PREPROCESS") {
script "../../preprocess/main.nf"
process {
"""
input[0] = [
[ id:'test' ],
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)
]
input[1] = channel.of([
[id:'fasta'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]).join(BWA_INDEX.out.index)
"""
}
}
}

test("human - bam") {

when {
process {
"""
input[0] = channel.of([
[ id:'test' ],
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)
]).join(GRIDSS_PREPROCESS.out.preprocess_dir)
input[1] = channel.of([
[id:'fasta'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]).join(BWA_INDEX.out.index)
input[2] = channel.of([
[id:'gridss_config'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gridss/gridss.properties', checkIfExists: true)
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.assemble_dir.collect { meta, working, assembly ->
[meta, file(working).list().sort(), file(assembly).name]
},
process.out.findAll { key, val -> key.startsWith("versions") }
).match() }
)
}
}

test("human - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = channel.of([
[ id:'test' ],
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)
]).join(GRIDSS_PREPROCESS.out.preprocess_dir)
input[1] = channel.of([
[id:'fasta'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]).join(BWA_INDEX.out.index)
input[2] = channel.of([
[id:'gridss_config'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gridss/gridss.properties', checkIfExists: true)
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}
}

}
80 changes: 80 additions & 0 deletions modules/nf-core/gridss/assemble/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"human - bam - stub": {
"content": [
{
"assemble_dir": [
[
{
"id": "test"
},
[
"test.sv.assembly.bam.cigar_metrics:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.coverage.blacklist.bed:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.downsampled_0.bed:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.excluded_0.bed:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.idsv_metrics:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.mapq_metrics:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.quality_distribution_metrics:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.subsetCalled_0.bed:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.sv.bam:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.sv.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e",
"test.sv.assembly.bam.tag_metrics:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"test.sv.assembly.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions_gridss": [
[
"GRIDSS_ASSEMBLE",
"gridss",
"2.13.2"
]
]
}
],
"timestamp": "2026-07-24T10:34:32.103764795",
"meta": {
"nf-test": "0.9.4",
"nextflow": "26.04.3"
}
},
"human - bam": {
"content": [
[
[
{
"id": "test"
},
[
"test.sv.assembly.bam.cigar_metrics",
"test.sv.assembly.bam.coverage.blacklist.bed",
"test.sv.assembly.bam.downsampled_0.bed",
"test.sv.assembly.bam.excluded_0.bed",
"test.sv.assembly.bam.idsv_metrics",
"test.sv.assembly.bam.mapq_metrics",
"test.sv.assembly.bam.quality_distribution_metrics",
"test.sv.assembly.bam.subsetCalled_0.bed",
"test.sv.assembly.bam.sv.bam",
"test.sv.assembly.bam.sv.bam.bai",
"test.sv.assembly.bam.tag_metrics"
],
"test.sv.assembly.bam"
]
],
{
"versions_gridss": [
[
"GRIDSS_ASSEMBLE",
"gridss",
"2.13.2"
]
]
}
],
"timestamp": "2026-07-24T10:34:17.884396972",
"meta": {
"nf-test": "0.9.4",
"nextflow": "26.04.3"
}
}
}