Skip to content

Commit f7be3c4

Browse files
author
kevinmhadi
committed
Fixes to passing normal id to purple process. Also harmonizing pbrun fq2bam settings, providing GATK best practices -K flag.
1 parent 5d7240f commit f7be3c4

7 files changed

Lines changed: 47 additions & 14 deletions

File tree

conf/modules.config

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ process {
197197
}
198198

199199
withName: '.*PARABRICKS_FQ2BAM.*' {
200+
ext.args = '--bwa-options "-Y -K 100000000"'
200201
publishDir = [
201202
mode: params.publish_dir_mode,
202203
path: {
@@ -292,8 +293,9 @@ process {
292293
}
293294

294295
withName: 'BWAMEM.*_MEM|SENTIEON_BWAMEM' {
295-
// Using -B 3 for tumor samples
296-
ext.args = { meta.status.toString() == "1" ? "-K 100000000 -Y -B 3 -R ${meta.read_group}" : "-K 100000000 -Y -R ${meta.read_group}" }
296+
// // Using -B 3 for tumor samples
297+
// ext.args = { meta.status.toString() == "1" ? "-K 100000000 -Y -B 3 -R ${meta.read_group}" : "-K 100000000 -Y -R ${meta.read_group}" }
298+
ext.args = { meta.status.toString() == "1" ? "-K 100000000 -Y -R ${meta.read_group}" : "-K 100000000 -Y -R ${meta.read_group}" }
297299
}
298300

299301
withName: 'MERGE_BAM|INDEX_MERGE_BAM' {

conf/resource.config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ process {
8383
memory = { check_max( 64.GB * task.attempt, 'memory' ) }
8484
time = { check_max( 48.h * task.attempt, 'time' ) }
8585
}
86+
87+
withName: '.*PURPLE.*' {
88+
cpus = { check_max( 2 * task.attempt, 'cpus' ) }
89+
memory = { check_max( 48.GB * task.attempt, 'memory' ) }
90+
time = { check_max( 4.h * task.attempt, 'time' ) }
91+
}
92+
8693
withName: 'GRIDSS_GRIDSS' {
8794
cpus = { check_max( 8 * task.attempt, 'cpus' ) }
8895
memory = { check_max( 32.GB * task.attempt, 'memory' ) }

modules/local/gridss/somaticFilter/main.nf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ process GRIPSS_SOMATIC_FILTER {
2525
task.ext.when == null || task.ext.when
2626

2727
script:
28+
def reference_arg = meta.containsKey('normal_id') ? "-reference ${meta.normal_id}" : ''
2829
def args = task.ext.args ?: ''
2930
def prefix = task.ext.prefix ?: "${meta.id}"
3031
def VERSION = '2.3.4' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
@@ -41,7 +42,9 @@ process GRIPSS_SOMATIC_FILTER {
4142
-ref_genome ${fasta} \\
4243
-ref_genome_version ${pon_gridss_ref_genome_version} \\
4344
-output_dir ./ \\
44-
-sample ${meta.sample}
45+
-sample ${meta.sample} \\
46+
${reference_arg} \\
47+
${args} \\
4548
4649
cat <<-END_VERSIONS > versions.yml
4750
"${task.process}":

nextflow.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ params {
241241
vep_spliceregion = null // spliceregion plugin disabled within VEP
242242

243243
// Signatures
244-
filter_ffpe_impact = false // Default is to not run FFPE impact signatures
244+
filter_ffpe_impact = false // Default is to not filter out FFPE impact signatures
245245

246246

247247
// MultiQC options

subworkflows/local/bam_svcalling_gridss/main.nf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ workflow BAM_SVCALLING_GRIDSS {
4747
workflow GRIDSS_SOMATIC_FILTER_STEP {
4848
take:
4949
vcf
50+
inputs_unlaned
5051

5152
main:
5253
// pondir_gridss = WorkflowNfcasereports.create_file_channel(params.pon_gridss)
@@ -61,6 +62,26 @@ workflow GRIDSS_SOMATIC_FILTER_STEP {
6162
somatic_all = Channel.empty()
6263
somatic_high_confidence = Channel.empty()
6364

65+
vcf = vcf.map { it ->
66+
[ it[0].patient, [ it[0], it[1], it[2] ] ] // meta.patient, [vcf, vcf_index]
67+
}
68+
.join(
69+
inputs_unlaned.filter {it -> it.meta.status.toString() == "0"}.map { it -> [ it.meta.patient, [ it.meta + [ normal_id: it.meta.sample ] ] ]}.unique(),
70+
remainder: true
71+
)
72+
.dump(tag: "right after join vcf_joined_with_inputs for GRIDSS_SOMATIC_FILTER_STEP", pretty: true)
73+
.map { it -> // patient, [ meta (vcf), vcf (vcf), vcf_tbi (vcf) ], [ meta with normal id (inputs) ]
74+
def (_key, existing, meta_input_lst) = (it + [null, null])[0..2]
75+
def (meta_existing, vcf_existing, tbi_existing) = existing ?: [null, null, null]
76+
def meta_input = meta_input_lst ? meta_input_lst[0] : null // should only be one entry in the list since we unique by patient, but just in case we take the first
77+
if (meta_input != null) {
78+
meta_existing = meta_existing + [ normal_id: meta_input.normal_id ]
79+
}
80+
[ meta_existing, vcf_existing, tbi_existing ]
81+
}
82+
.dump(tag: "vcf_joined_with_inputs for GRIDSS_SOMATIC_FILTER_STEP", pretty: true)
83+
.filter { it -> it[0] != null } // filter out any entries that don't have meta (shouldn't be any since we join with remainder: true, but just in case)
84+
6485
GRIPSS_SOMATIC_FILTER(
6586
vcf,
6687
pon_gridss_bedpe_svs,

subworkflows/local/steps.nf

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,6 @@ workflow PURPLE_STEP {
19851985

19861986
// need a channel with patient and meta for merging with rest
19871987
purple_inputs_for_merge = inputs_unlaned
1988-
.filter { it -> it.meta.status.toString() == "1" }
19891988
.filter { it ->
19901989
(it.ploidy instanceof List && it.ploidy.isEmpty())
19911990
|| (it.purity instanceof List && it.purity.isEmpty())
@@ -2037,15 +2036,15 @@ workflow PURPLE_STEP {
20372036
}
20382037
.dump(tag: "meta_purple merged", pretty: true)
20392038

2040-
purple_inputs_cobalt_dir = purple_inputs_for_merge
2039+
purple_inputs_cobalt_dir = meta_purple_branched.tumor
20412040
.join(cobalt_dir_for_merge)
20422041
.map { it -> [ it[0], it[2] ] } // patient, cobalt_dir
20432042

2044-
purple_inputs_amber_dir = purple_inputs_for_merge
2043+
purple_inputs_amber_dir = meta_purple_branched.tumor
20452044
.join(amber_dir_for_merge)
20462045
.map { it -> [ it[0], it[2] ] } // patient, amber_dir
20472046

2048-
purple_inputs_sv = purple_inputs_for_merge.map { it -> [ it[0], [], [] ] }.unique{ it -> it[0] }
2047+
purple_inputs_sv = meta_purple_branched.tumor.map { it -> [ it[0], [], [] ] }.unique{ it -> it[0] }
20492048
if (params.purple_use_svs) {
20502049
sample_purple_use_svs = inputs_unlaned
20512050
.filter { it -> it.meta.status.toString() == "1" }
@@ -2069,7 +2068,7 @@ workflow PURPLE_STEP {
20692068
println "purple_use_svs for sample ${it.meta.sample} set to ${value}"
20702069
[ it.meta.patient, [ value ] ]
20712070
}
2072-
purple_inputs_sv = purple_inputs_for_merge.map { it -> [ it[0], [ it[1] ] ] } // patient, [meta]
2071+
purple_inputs_sv = meta_purple_branched.tumor.filter { it -> it[1].status.toString() == "1" }.map { it -> [ it[0], [ it[1] ] ] } // patient, [meta]
20732072
.join(vcf_from_sv_calling_for_merge.map { it -> [ it[0] ] + [ it[1..-1] ] })
20742073
.join(sample_purple_use_svs)
20752074
.map { it -> // patient, meta, vcftbi_list, use_svs_list
@@ -2087,18 +2086,18 @@ workflow PURPLE_STEP {
20872086
// .map { it -> [ it[0], it[2], it[3] ] } // patient, vcf, tbi
20882087
}
20892088

2090-
purple_inputs_snv = purple_inputs_for_merge.map { it -> [ it[0], [], [] ] }.unique{ it -> it[0] }
2089+
purple_inputs_snv = meta_purple_branched.tumor.map { it -> [ it[0], [], [] ] }.unique{ it -> it[0] }
20912090
if (params.purple_use_smlvs) {
20922091
println "Using Purple small variants"
2093-
purple_inputs_snv = purple_inputs_for_merge
2092+
purple_inputs_snv = meta_purple_branched.tumor.filter { it -> it[1].status.toString() == "1" }
20942093
.join(filtered_somatic_vcf_for_merge)
20952094
.map { it -> [ it[0], it[2], it[3] ] } // patient, vcf, tbi
20962095
}
20972096

2098-
purple_inputs_snv_germline = purple_inputs_for_merge.map { it -> [ it[0], [], [] ] }.unique{ it -> it[0] }
2097+
purple_inputs_snv_germline = meta_purple_branched.tumor.map { it -> [ it[0], [], [] ] }.unique{ it -> it[0] }
20992098

21002099
if (! params.tumor_only && params.purple_use_smlvs) {
2101-
purple_inputs_snv_germline = purple_inputs_for_merge
2100+
purple_inputs_snv_germline = meta_purple_branched.tumor.filter { it -> it[1].status.toString() == "1" }
21022101
.join(germline_vcf_for_merge)
21032102
.map { it -> [ it[0], it[2], it[3] ] } // patient, vcf, tbi
21042103
}

workflows/main_workflow.nf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,8 @@ workflow NFGOS {
909909
// }
910910

911911
GRIDSS_SOMATIC_FILTER_STEP(
912-
vcf_raw_from_gridss_gridss
912+
vcf_raw_from_gridss_gridss,
913+
inputs_unlaned
913914
)
914915

915916
versions = versions.mix(GRIDSS_SOMATIC_FILTER_STEP.out.versions)

0 commit comments

Comments
 (0)