#!/bin/bash -Ceuo pipefail # Write manifest JSON file cat << 'EOF' > manifest.json {"samtools":["Sig_18_Blood",["Sig_18_Blood.stats"],"HCC1395_tumor",["HCC1395_tumor.stats"],"HCC1395_BL",["HCC1395_BL.stats"],"Sig_18_tissue",["Sig_18_tissue.stats"]],"mosdepth":["Sig_18_Blood",["Sig_18_Blood.mosdepth.summary.txt"],"HCC1395_tumor",["HCC1395_tumor.mosdepth.summary.txt"],"HCC1395_BL",["HCC1395_BL.mosdepth.summary.txt"],"Sig_18_tissue",["Sig_18_tissue.mosdepth.summary.txt"]],"sentieon_insert":["Sig_18_Blood",["Sig_18_Blood.sentieon.insert_size_metrics"],"HCC1395_BL",["HCC1395_BL.sentieon.insert_size_metrics"],"HCC1395_tumor",["HCC1395_tumor.sentieon.insert_size_metrics"],"Sig_18_tissue",["Sig_18_tissue.sentieon.insert_size_metrics"]],"sentieon_hs":["Sig_18_Blood",["Sig_18_Blood_altera_v3_targets_postQC_hg38.sentieon.hs_metrics","Sig_18_Blood_altera_v3_targets_coding_postQC_hg38.sentieon.hs_metrics","Sig_18_Blood_xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.sentieon.hs_metrics","Sig_18_Blood_xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.sentieon.hs_metrics","Sig_18_Blood_altera_v3_targets_noncoding_postQC_hg38.sentieon.hs_metrics","Sig_18_Blood_xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.sentieon.hs_metrics","Sig_18_Blood_FINAL_hotspot_list_07302025_hg38_sorted.sentieon.hs_metrics","Sig_18_Blood_foresight_clarity_targets_hg38.sentieon.hs_metrics"],"HCC1395_tumor",["HCC1395_tumor_xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.sentieon.hs_metrics","HCC1395_tumor_xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.sentieon.hs_metrics","HCC1395_tumor_altera_v3_targets_postQC_hg38.sentieon.hs_metrics","HCC1395_tumor_altera_v3_targets_coding_postQC_hg38.sentieon.hs_metrics","HCC1395_tumor_altera_v3_targets_noncoding_postQC_hg38.sentieon.hs_metrics","HCC1395_tumor_xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.sentieon.hs_metrics","HCC1395_tumor_FINAL_hotspot_list_07302025_hg38_sorted.sentieon.hs_metrics","HCC1395_tumor_foresight_clarity_targets_hg38.sentieon.hs_metrics"],"HCC1395_BL",["HCC1395_BL_xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.sentieon.hs_metrics","HCC1395_BL_altera_v3_targets_postQC_hg38.sentieon.hs_metrics","HCC1395_BL_altera_v3_targets_coding_postQC_hg38.sentieon.hs_metrics","HCC1395_BL_altera_v3_targets_noncoding_postQC_hg38.sentieon.hs_metrics","HCC1395_BL_xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.sentieon.hs_metrics","HCC1395_BL_xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.sentieon.hs_metrics","HCC1395_BL_FINAL_hotspot_list_07302025_hg38_sorted.sentieon.hs_metrics","HCC1395_BL_foresight_clarity_targets_hg38.sentieon.hs_metrics"],"Sig_18_tissue",["Sig_18_tissue_xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.sentieon.hs_metrics","Sig_18_tissue_altera_v3_targets_postQC_hg38.sentieon.hs_metrics","Sig_18_tissue_xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.sentieon.hs_metrics","Sig_18_tissue_altera_v3_targets_coding_postQC_hg38.sentieon.hs_metrics","Sig_18_tissue_altera_v3_targets_noncoding_postQC_hg38.sentieon.hs_metrics","Sig_18_tissue_FINAL_hotspot_list_07302025_hg38_sorted.sentieon.hs_metrics","Sig_18_tissue_xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.sentieon.hs_metrics","Sig_18_tissue_foresight_clarity_targets_hg38.sentieon.hs_metrics"]],"seqtool":["Sig_18_Blood",["Sig_18_Blood_full_basic_stats.tsv"],"Sig_18_tissue",["Sig_18_tissue_full_basic_stats.tsv"],"HCC1395_tumor",["HCC1395_tumor_full_basic_stats.tsv"],"HCC1395_BL",["HCC1395_BL_full_basic_stats.tsv"]]} EOF cat << 'EOF' > panel_mapping.json {"xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed":"all_targets","xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed":"all_probes","altera_v3_targets_postQC_hg38.bed":"boosted_depth","altera_v3_targets_coding_postQC_hg38.bed":"coding_depth","altera_v3_targets_noncoding_postQC_hg38.bed":"noncoding_depth","xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed":"non_boosted_depth","FINAL_hotspot_list_07302025_hg38_sorted.bed":"hotspot_depth","foresight_clarity_targets_hg38.bed":"foresight_depth"} EOF # Run aggregation script (outputs single JSON) aggregate_qc_metrics.py \ --mode postdedup \ --manifest manifest.json \ --panel-mapping panel_mapping.json \ --files-dir . \ --output postdedup_qc.json \ --no-summary cat <<-END_VERSIONS > versions.yml "DAQ:AGGREGATE_POSTDEDUP_QC": python: $(python --version | sed 's/Python //g') aggregate_qc_metrics: 1.0.0 END_VERSIONS