Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GRIDSS variant calling #185

Merged
merged 15 commits into from
Nov 20, 2024
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]
### Added
- Add GRIDSS2 variant calling
- Add GRIDSS2 assembly
- Add GRIDSS2 preprocessing
- Add supported Nextflow version to `README.md`
Expand Down
11 changes: 11 additions & 0 deletions config/F16.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ process {
}
}

withName: call_sSV_GRIDSS {
cpus = 8
memory = 15.GB
retry_strategy {
memory {
strategy = 'exponential'
operand = 2
}
}
}
yashpatel6 marked this conversation as resolved.
Show resolved Hide resolved

withName: call_sSV_Delly {
cpus = 1
memory = 16.GB
Expand Down
5 changes: 2 additions & 3 deletions config/F2.config
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ process {
}
}
}

withName: call_sSV_Manta {
cpus = 1
memory = 3.GB
Expand All @@ -47,5 +47,4 @@ process {
}
}
}
}

}
19 changes: 17 additions & 2 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ include { call_sSV_Delly; filter_sSV_Delly } from './module/delly' addParams(
include { call_sSV_Manta } from './module/manta' addParams(
workflow_output_dir: "${params.output_dir_base}/Manta-${params.manta_version}"
)
include { preprocess_BAM_GRIDSS; run_assembly_GRIDSS } from './module/gridss' addParams(
include { preprocess_BAM_GRIDSS; run_assembly_GRIDSS; call_sSV_GRIDSS } from './module/gridss' addParams(
workflow_output_dir: "${params.output_dir_base}/GRIDSS-${params.gridss_version}"
)
include { generate_sha512 as generate_sha512_BCFtools } from './module/sha512' addParams(
Expand Down Expand Up @@ -217,6 +217,21 @@ workflow {
gridss_reference_files,
params.gridss_blacklist
)
}

gridss_assembly_dir = run_assembly_GRIDSS.out.gridss_assembly
.flatten()
.map { parentdir -> parentdir.getParent() }
.unique()
.collect()

call_sSV_GRIDSS(
input_paired_bams_ch,
gridss_preprocess_dir,
gridss_assembly_dir,
run_assembly_GRIDSS.out.gridss_assembly_bam,
params.gridss_reference_fasta,
gridss_reference_files,
params.gridss_blacklist
)
}
}
68 changes: 67 additions & 1 deletion module/gridss.nf
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ process run_assembly_GRIDSS {

output:
path "${tumor_id}.assembly.bam", emit: gridss_assembly_bam
path "${tumor_id}.assembly.bam.gridss.working/*"
path "${tumor_id}.assembly.bam.gridss.working/*", emit: gridss_assembly
path ".command.*"

script:
Expand Down Expand Up @@ -118,3 +118,69 @@ process run_assembly_GRIDSS {
${tumor_bam}
"""
}

process call_sSV_GRIDSS {
container params.docker_image_gridss

publishDir "${params.workflow_output_dir}/output/",
pattern: "${tumor_id}.{vcf,vcf.idx}",
mode: "copy",
saveAs: {
"${output_filename}.${sanitize_string(file(it).getName().replace("${tumor_id}.", ""))}"
yashpatel6 marked this conversation as resolved.
Show resolved Hide resolved
}

publishDir "${params.workflow_output_dir}/intermediate/${task.process.replace(':', '/')}",
pattern: "${tumor_id}.vcf.gridss.working/*",
mode: "copy",
saveAs: {
"${output_filename}.vcf.gridss.working/${output_filename}.${sanitize_string(file(it).getName().replace("${tumor_id}.", ""))}"
}
yashpatel6 marked this conversation as resolved.
Show resolved Hide resolved

publishDir "${params.log_output_dir}/process-log",
pattern: ".command.*",
mode: "copy",
saveAs: { "${task.process.replace(':', '/')}/log${file(it).getName()}" }

input:
tuple(val(tumor_id), path(tumor_bam), path(tumor_bai), path(normal_bam), path(normal_bai))
path(gridss_preprocess_dir)
path(gridss_assembly_dir)
path(gridss_assembly_bam)
path(gridss_reference_fasta)
path(gridss_reference_files)
path(gridss_blacklist)

output:
path "${tumor_id}.vcf", emit: gridss_vcf
path "${tumor_id}.vcf.idx", emit: gridss_vcf_idx
path "${tumor_id}.vcf.gridss.working/*", emit: gridss_vcf_dir
path ".command.*"

script:
otherjvmheap = 4.GB
yashpatel6 marked this conversation as resolved.
Show resolved Hide resolved
gridss_otherjvmheap = "${otherjvmheap.toGiga()}g"
gridss_jvmheap = "${(task.memory - otherjvmheap).toGiga()}g"
gridss_jar = "/usr/local/share/gridss-${params.gridss_version}-1/gridss.jar"
output_filename = generate_standard_filename(
"GRIDSS2-${params.gridss_version}",
params.dataset_id,
tumor_id,
[:]
)

"""
set -euo pipefail
gridss \
-r ${gridss_reference_fasta} \
-j ${gridss_jar} \
-s call \
-t ${task.cpus} \
--jvmheap ${gridss_jvmheap} \
--otherjvmheap ${gridss_otherjvmheap} \
-b ${gridss_blacklist} \
-a ${gridss_assembly_bam} \
--output ${tumor_id}.vcf \
${normal_bam} \
${tumor_bam}
"""
}