@@ -2,6 +2,7 @@ version 1.0
22
33import "ProcessOnInstrumentDemuxedChunk.wdl" as TreatPerReadGroup
44
5+ import "../../../tasks/Utility/Utils.wdl" as U
56import "../../../tasks/Utility/BAMutils.wdl" as BU
67import "../../../tasks/Utility/GeneralUtils.wdl" as GU
78import "../../../tasks/Utility/Finalize.wdl" as FF
@@ -54,16 +55,16 @@ workflow ProcessOnDownsampledMultiReadgroupUBAM {
5455 output {
5556 String last_processing_date = today .yyyy_mm_dd
5657
57- Array [File ] readgroup_aligned_bams = eachRG .aligned_bam
58- Array [File ] readgroup_aligned_bais = eachRG .aligned_bai
59- Array [File ] readgroup_aligned_pbis = eachRG .aligned_pbi
60- Array [String ] readgroup_meta_movies = eachRG .movie
61- Array [Float ] readgroup_metrics_contam = select_all (eachRG .contamination_est )
58+ Array [File ] readgroup_aligned_bams = select_all ( eachRG .aligned_bam )
59+ Array [File ] readgroup_aligned_bais = select_all ( eachRG .aligned_bai )
60+ Array [File ] readgroup_aligned_pbis = select_all ( eachRG .aligned_pbi )
61+ Array [String ] readgroup_meta_movies = select_all ( eachRG .movie )
62+ Array [Float ] readgroup_metrics_contam = select_all (select_all ( eachRG .contamination_est ) )
6263
63- Array [Map [String , String ]?] readgroup_metrics_optional_fingerprint_check = eachRG .fingerprint_check
64- Array [Map [String , String ]?] readgroup_metrics_optional_inferred_sex_info = eachRG .inferred_sex_info
65- Array [Map [String , String ]?] readgroup_metrics_optional_methyl_tag_simple_stats = eachRG .methyl_tag_simple_stats
66- Array [Map [String , String ]] readgroup_metrics_optional_aBAM_metrics_files = eachRG .aBAM_metrics_files
64+ Array [Map [String , String ]?] readgroup_metrics_optional_fingerprint_check = select_all ( eachRG .fingerprint_check )
65+ Array [Map [String , String ]?] readgroup_metrics_optional_inferred_sex_info = select_all ( eachRG .inferred_sex_info )
66+ Array [Map [String , String ]?] readgroup_metrics_optional_methyl_tag_simple_stats = select_all ( eachRG .methyl_tag_simple_stats )
67+ Array [Map [String , String ]] readgroup_metrics_optional_aBAM_metrics_files = select_all ( eachRG .aBAM_metrics_files )
6768 }
6869
6970 # split by read group
@@ -77,23 +78,28 @@ workflow ProcessOnDownsampledMultiReadgroupUBAM {
7778 # align by each read group
7879 Array [Pair [String , File ]] readgroup_2_bam = zip (SplitByRG .rg_ids , SplitByRG .split_bam )
7980 scatter (pair in readgroup_2_bam ) {
80- call TreatPerReadGroup .ProcessOnInstrumentDemuxedChunk as eachRG { input :
81- gcs_out_root_dir = gcs_out_root_dir ,
81+ call U .CountBamRecords as PreventEmptyBam { input :
82+ bam = pair .right
83+ }
84+ if (PreventEmptyBam .num_records != 0 ) {
85+ call TreatPerReadGroup .ProcessOnInstrumentDemuxedChunk as eachRG { input :
86+ gcs_out_root_dir = gcs_out_root_dir ,
8287
83- uBAM = pair .right ,
88+ uBAM = pair .right ,
8489
85- readgroup_id = pair .left ,
86- bam_SM_field = bam_SM_field ,
90+ readgroup_id = pair .left ,
91+ bam_SM_field = bam_SM_field ,
8792
88- platform = 'Revio' , # non-critical lie, this parameter was used for setting bam size lower bound threshold for failing QC
93+ platform = 'Revio' , # non-critical lie, this parameter was used for setting bam size lower bound threshold for failing QC
8994
90- # args for optional QC subworkflows
91- qc_metrics_config_json = qc_metrics_config_json ,
92- fingerprint_sample_id = fingerprint_sample_id ,
93- expected_sex_type = expected_sex_type ,
95+ # args for optional QC subworkflows
96+ qc_metrics_config_json = qc_metrics_config_json ,
97+ fingerprint_sample_id = fingerprint_sample_id ,
98+ expected_sex_type = expected_sex_type ,
9499
95- ref_map_file = ref_map_file ,
96- disk_type = disk_type
100+ ref_map_file = ref_map_file ,
101+ disk_type = disk_type
102+ }
97103 }
98104 }
99105
0 commit comments