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 {
}
}
}
}

}
11 changes: 11 additions & 0 deletions config/F32.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 = 30.GB
retry_strategy {
memory {
strategy = 'exponential'
operand = 2
}
}
}

withName: call_sSV_Delly {
cpus = 1
memory = 30.GB
Expand Down
11 changes: 11 additions & 0 deletions config/F72.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 = 30.GB
retry_strategy {
memory {
strategy = 'exponential'
operand = 2
}
}
}

withName: call_sSV_Delly {
cpus = 1
memory = 30.GB
Expand Down
11 changes: 11 additions & 0 deletions config/M64.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 = 120.GB
retry_strategy {
memory {
strategy = 'exponential'
operand = 2
}
}
}

withName: call_sSV_Delly {
cpus = 1
memory = 120.GB
Expand Down
1 change: 1 addition & 0 deletions config/template.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ params {
// GRCh38 blacklist - /hot/resource/tool-specific-input/GRIDSS-2.13.2/GRCh38-BI-20160721/ENCFF356LFX.bed
gridss_blacklist = "/hot/resource/tool-specific-input/GRIDSS-2.13.2/GRCh38-BI-20160721/ENCFF356LFX.bed"
gridss_reference_fasta = "/hot/resource/tool-specific-input/GRIDSS-2.13.2/GRCh38-BI-20160721/Homo_sapiens_assembly38.fasta"
other_jvm_heap = 4.GB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Let's move this to default.config and document it in the README; typically users won't need to change it so it can live in default and user can add it if they need to change it


exclusion_file = "/hot/resource/tool-specific-input/Delly/hg38/human.hg38.excl.tsv"

Expand Down
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
)
}
}
74 changes: 72 additions & 2 deletions module/gridss.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ process preprocess_BAM_GRIDSS {
container params.docker_image_gridss

publishDir "${params.workflow_output_dir}/intermediate/${task.process.replace(':', '/')}",
enabled: params.save_intermediate_files,
pattern: "${bam_name}.gridss.working/*",
mode: "copy",
saveAs: {
Expand Down Expand Up @@ -61,13 +62,15 @@ process run_assembly_GRIDSS {
container params.docker_image_gridss

publishDir "${params.workflow_output_dir}/intermediate/${task.process.replace(':', '/')}",
enabled: params.save_intermediate_files,
pattern: "${tumor_id}.assembly.bam",
mode: "copy",
saveAs: {
"${output_filename}_${sanitize_string(file(it).getName().replace("${tumor_id}.", ""))}"
}

publishDir "${params.workflow_output_dir}/intermediate/${task.process.replace(':', '/')}",
enabled: params.save_intermediate_files,
pattern: "${tumor_id}.assembly.bam.gridss.working/*",
mode: "copy",
saveAs: {
Expand All @@ -88,11 +91,11 @@ 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:
otherjvmheap = 4.GB
otherjvmheap = params.other_jvm_heap
gridss_otherjvmheap = "${otherjvmheap.toGiga()}g"
gridss_jvmheap = "${(task.memory - otherjvmheap).toGiga()}g"
gridss_jar = "/usr/local/share/gridss-${params.gridss_version}-1/gridss.jar"
Expand All @@ -118,3 +121,70 @@ 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(':', '/')}",
enabled: params.save_intermediate_files,
pattern: "${tumor_id}.vcf.gridss.working/*",
mode: "copy",
saveAs: {
"${output_filename}.vcf.gridss.working/${output_filename}.${sanitize_string(file(it).getName().replace("${tumor_id}.", ""))}"
}

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 = params.other_jvm_heap
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}
"""
}