Skip to content

Commit 4e451b8

Browse files
committed
update ONT post-alignment QC optionality
1 parent 863782f commit 4e451b8

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

wdl/pipelines/ONT/Preprocessing/ONTFlowcellWGSuBAM.wdl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ workflow ONTFlowcellWGSuBAM {
8383
Array[String] uBAM_tags_to_preserve = ['MM', 'ML']
8484

8585
# args for optional QC subworkflows
86-
File? qc_metrics_config_json
86+
File qc_metrics_config_json
8787
String? fingerprint_sample_id
8888
String? expected_sex_type
8989

@@ -102,9 +102,10 @@ workflow ONTFlowcellWGSuBAM {
102102
File aligned_bai = FinalizeAlignedBai.gcs_path
103103

104104
Float wgs_cov = QCandMetrics.wgs_cov
105-
Map[String, Float] nanoplot_summ = QCandMetrics.nanoplot_summ
106105
Map[String, Float] sam_flag_stats = QCandMetrics.sam_flag_stats
107106

107+
Map[String, Float]? nanoplot_summ = QCandMetrics.nanoplot_summ
108+
108109
Map[String, Float]? seqkit_stats = FASTQstats.stats
109110

110111
Map[String, String]? read_len_summaries = DystPeaker.read_len_summaries
@@ -152,13 +153,15 @@ workflow ONTFlowcellWGSuBAM {
152153
###################################################################################
153154
# QC
154155
String readgroup_id = bam_SM_ID + "." + flowcell
155-
AlignedBamQCnMetricsConfig qcm_config = read_json(select_first([qc_metrics_config_json]))
156+
AlignedBamQCnMetricsConfig qcm_config = read_json(qc_metrics_config_json)
156157
call QCMetrics.Work as QCandMetrics { input:
157158
bam = ALN.aligned_bam,
158159
bai = ALN.aligned_bai,
159160
160161
tech = "ONT",
161162
163+
run_nanoplot = qcm_config.run_nanoplot,
164+
162165
cov_bed = qcm_config.cov_bed,
163166
cov_bed_descriptor = qcm_config.cov_bed_descriptor,
164167

wdl/pipelines/TechAgnostic/Utility/AlignedBamQCandMetrics.wdl

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ workflow Work {
8080

8181
String tech
8282

83+
Boolean run_nanoplot = true
84+
8385
File? cov_bed
8486
String? cov_bed_descriptor
8587

@@ -100,9 +102,11 @@ workflow Work {
100102

101103
output {
102104
Float wgs_cov = MosDepthWGS.wgs_cov
103-
Map[String, Float] nanoplot_summ = NanoPlotFromBam.stats_map
104105
Map[String, Float] sam_flag_stats = ParseFlagStatsJson.qc_pass_reads_SAM_flag_stats
105106

107+
# nanoplot
108+
Map[String, Float]? nanoplot_summ = NanoPlotFromBam.stats_map
109+
106110
# fingerprint
107111
Map[String, String]? fingerprint_check = fp_res
108112

@@ -160,12 +164,14 @@ workflow Work {
160164
161165
################################
162166
# nanoplot
163-
call NP.NanoPlotFromBam { input: bam = bam, bai = bai, disk_type = disk_type }
164-
FinalizationManifestLine b = object
165-
{files_to_save: flatten([[NanoPlotFromBam.stats], NanoPlotFromBam.plots]),
166-
is_singleton_file: false,
167-
destination: metrics_output_dir + "/nanoplot",
168-
output_attribute_name: "nanoplot"}
167+
if (run_nanoplot) {
168+
call NP.NanoPlotFromBam { input: bam = bam, bai = bai, disk_type = disk_type }
169+
FinalizationManifestLine b = object
170+
{files_to_save: flatten([[NanoPlotFromBam.stats], NanoPlotFromBam.plots]),
171+
is_singleton_file: false,
172+
destination: metrics_output_dir + "/nanoplot",
173+
output_attribute_name: "nanoplot"}
174+
}
169175

170176
###################################################################################
171177
# OPTIONAL QC/METRICS
@@ -255,6 +261,8 @@ struct AlignedBamQCnMetricsConfig {
255261
File? cov_bed # An optional BED file on which coverage will be collected (a mean value for each interval)
256262
String? cov_bed_descriptor # A short description of the BED provided for targeted coverage estimation; will be used in naming output files.
257263
264+
Boolean? run_nanoplot # if false or omitted, will NOT run nanoplot, which typically takes a long time to run
265+
258266
String? fingerprint_vcf_store # A GCS 'folder' holding fingerprint VCF files
259267
260268
File? vbid2_config_json # A config json to for running the VBID2 contamination estimation sub-workflow;

wdl/pipelines/TechAgnostic/Utility/SaveFilesToDestination.wdl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,17 @@ workflow SaveFilestoDestination {
9292
call GU.CoerceArrayOfPairsToMap as collect { input: keys = attr, values = final_path }
9393
9494
if (defined(already_finalized)) {
95-
scatter(mm in select_first([already_finalized])) {
96-
call GU.MapToTsv { input: m = mm}
97-
}
98-
call GU.ConcatenateFiles { input: af = MapToTsv.tsv, out_name = "does_not_matter.tsv" }
95+
if (0!=length(select_all([already_finalized]))) {
96+
scatter(mm in select_first([already_finalized])) {
97+
call GU.MapToTsv { input: m = mm}
98+
}
99+
call GU.ConcatenateFiles { input: af = MapToTsv.tsv, out_name = "does_not_matter.tsv" }
99100
100-
Map[String, String] pack_one = read_map(ConcatenateFiles.merged)
101+
Map[String, String] pack_one = read_map(ConcatenateFiles.merged)
101102
102-
call GU.MergeMaps as PackAllSavings { input:
103-
one = pack_one, two = collect.output_map
103+
call GU.MergeMaps as PackAllSavings { input:
104+
one = pack_one, two = collect.output_map
105+
}
104106
}
105107
}
106108
}

0 commit comments

Comments
 (0)