#!/bin/bash -Ceuo pipefail SHARD1="chr1,chr4,chr15,chr19,chr22,chrY" SHARD2="chr2,chr8,chr9,chr17,chr18,chr20" SHARD3="chr3,chr5,chr10,chr11,chr13,chr14" SHARD4="chr6,chr7,chr12,chr16,chr21,chrX" probe_counts -m frac -t 1 -r "$SHARD1" HCC1395_BL.recal.bam xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_chr21.bed \ "sample_id=HCC1395_BL" "specimen_id=HCC1395_tumor_vs_HCC1395_BL" \ "flowcell=unknown" "sample_type=normal" > counts_s1.tsv & probe_counts -m frac -t 1 -r "$SHARD2" HCC1395_BL.recal.bam xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_chr21.bed \ "sample_id=HCC1395_BL" "specimen_id=HCC1395_tumor_vs_HCC1395_BL" \ "flowcell=unknown" "sample_type=normal" > counts_s2.tsv & probe_counts -m frac -t 1 -r "$SHARD3" HCC1395_BL.recal.bam xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_chr21.bed \ "sample_id=HCC1395_BL" "specimen_id=HCC1395_tumor_vs_HCC1395_BL" \ "flowcell=unknown" "sample_type=normal" > counts_s3.tsv & probe_counts -m frac -t 1 -r "$SHARD4" HCC1395_BL.recal.bam xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_chr21.bed \ "sample_id=HCC1395_BL" "specimen_id=HCC1395_tumor_vs_HCC1395_BL" \ "flowcell=unknown" "sample_type=normal" > counts_s4.tsv & wait { head -1 counts_s1.tsv | cut -f2-; for f in counts_s*.tsv; do tail -n +2 "$f"; done | sort -t' ' -k1,1n | cut -f2-; } | gzip > HCC1395_BL_probes.tsv.gz cat <<-END_VERSIONS > versions.yml "NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:SOMATIC_CNV_CALLING:SOMA_CNV_PROBE_COUNTS": soma-cnv: 20260604-348e5b5 END_VERSIONS