mkdir -p HCC1395_BL/HCC1395_BL.md/
cat xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed altera_v3_targets_postQC_hg38.bed altera_v3_targets_coding_postQC_hg38.bed altera_v3_targets_noncoding_postQC_hg38.bed xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed FINAL_hotspot_list_07302025_hg38_sorted.bed foresight_clarity_targets_hg38.bed | cut -f 1-3 | bedtools sort -g Homo_sapiens_assembly38.fasta.fai | bedtools merge > HCC1395_BL/HCC1395_BL.md/full_bed.bed
saturation_plot -bams HCC1395_BL.md.bam -region chr20 -output HCC1395_BL/HCC1395_BL.md/saturation_plot.png -threads 1
seqtool depth -bam HCC1395_BL.md.bam -bed HCC1395_BL/HCC1395_BL.md/full_bed.bed -threads 4 -bam_threads 2 | bgzip -c > HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz
seqtool saturation_metric -at 1000000 -region chr20 -bam_threads 1 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/saturation_qc.tsv
fragment_size -bams HCC1395_BL.md.bam -region chr20 -output_prefix HCC1395_BL/HCC1395_BL.md/fragsize -threads 1
samtools mpileup -B --min-MQ 60 --min-BQ 30 -f Homo_sapiens_assembly38.fasta -l dbsnp_hg38_contam_sites.bed HCC1395_BL.md.bam > HCC1395_BL.md.mpileup && contamination -input HCC1395_BL.md.mpileup -dbsnp_vcf Homo_sapiens_assembly38.dbsnp138.vcf.gz > HCC1395_BL/HCC1395_BL.md/contamination.tsv
seqtool noise -bam HCC1395_BL.md.bam -ref Homo_sapiens_assembly38.fasta -region chr20 -include_bed HCC1395_BL/HCC1395_BL.md/full_bed.bed -exclude_bed dbsnp138_hg38_common.bed -threads 1 > HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.noise_summary.tsv
tabix -s 1 -b 2 -e 2 HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz
seqtool depth_hist -nbins 500 HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz > HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth_hist.tsv
cat HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth_hist.tsv | plot -x 0 -xlabel Depth -ylabel "Number of Sites" -xlim 0 2000 -title HCC1395_BL.md -output HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.png
seqtool read_qc -bed xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed -n_threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/read_qc.xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed.tsv
seqtool reads_per_target -bed xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/reads_per_target.xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed.tsv
seqtool depth_stats -bed xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz> HCC1395_BL/HCC1395_BL.md/depth_stats.xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed.tsv
seqtool gc_bias -reference Homo_sapiens_assembly38.fasta -bed xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed -bin_size 0.05 -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/gc_bias_qc.xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed.tsv
seqtool read_qc -bed xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed -n_threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/read_qc.xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed.tsv
seqtool reads_per_target -bed xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/reads_per_target.xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed.tsv
seqtool depth_stats -bed xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz> HCC1395_BL/HCC1395_BL.md/depth_stats.xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed.tsv
seqtool gc_bias -reference Homo_sapiens_assembly38.fasta -bed xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed -bin_size 0.05 -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/gc_bias_qc.xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed.tsv
seqtool read_qc -bed altera_v3_targets_postQC_hg38.bed -n_threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/read_qc.altera_v3_targets_postQC_hg38.bed.tsv
seqtool reads_per_target -bed altera_v3_targets_postQC_hg38.bed -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/reads_per_target.altera_v3_targets_postQC_hg38.bed.tsv
seqtool depth_stats -bed altera_v3_targets_postQC_hg38.bed HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz> HCC1395_BL/HCC1395_BL.md/depth_stats.altera_v3_targets_postQC_hg38.bed.tsv
seqtool gc_bias -reference Homo_sapiens_assembly38.fasta -bed altera_v3_targets_postQC_hg38.bed -bin_size 0.05 -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/gc_bias_qc.altera_v3_targets_postQC_hg38.bed.tsv
seqtool read_qc -bed altera_v3_targets_coding_postQC_hg38.bed -n_threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/read_qc.altera_v3_targets_coding_postQC_hg38.bed.tsv
seqtool reads_per_target -bed altera_v3_targets_coding_postQC_hg38.bed -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/reads_per_target.altera_v3_targets_coding_postQC_hg38.bed.tsv
seqtool depth_stats -bed altera_v3_targets_coding_postQC_hg38.bed HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz> HCC1395_BL/HCC1395_BL.md/depth_stats.altera_v3_targets_coding_postQC_hg38.bed.tsv
seqtool gc_bias -reference Homo_sapiens_assembly38.fasta -bed altera_v3_targets_coding_postQC_hg38.bed -bin_size 0.05 -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/gc_bias_qc.altera_v3_targets_coding_postQC_hg38.bed.tsv
seqtool read_qc -bed altera_v3_targets_noncoding_postQC_hg38.bed -n_threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/read_qc.altera_v3_targets_noncoding_postQC_hg38.bed.tsv
seqtool reads_per_target -bed altera_v3_targets_noncoding_postQC_hg38.bed -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/reads_per_target.altera_v3_targets_noncoding_postQC_hg38.bed.tsv
seqtool depth_stats -bed altera_v3_targets_noncoding_postQC_hg38.bed HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz> HCC1395_BL/HCC1395_BL.md/depth_stats.altera_v3_targets_noncoding_postQC_hg38.bed.tsv
seqtool gc_bias -reference Homo_sapiens_assembly38.fasta -bed altera_v3_targets_noncoding_postQC_hg38.bed -bin_size 0.05 -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/gc_bias_qc.altera_v3_targets_noncoding_postQC_hg38.bed.tsv
seqtool read_qc -bed xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed -n_threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/read_qc.xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed.tsv
seqtool reads_per_target -bed xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/reads_per_target.xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed.tsv
seqtool depth_stats -bed xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz> HCC1395_BL/HCC1395_BL.md/depth_stats.xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed.tsv
seqtool gc_bias -reference Homo_sapiens_assembly38.fasta -bed xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed -bin_size 0.05 -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/gc_bias_qc.xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed.tsv
seqtool read_qc -bed FINAL_hotspot_list_07302025_hg38_sorted.bed -n_threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/read_qc.FINAL_hotspot_list_07302025_hg38_sorted.bed.tsv
seqtool reads_per_target -bed FINAL_hotspot_list_07302025_hg38_sorted.bed -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/reads_per_target.FINAL_hotspot_list_07302025_hg38_sorted.bed.tsv
seqtool depth_stats -bed FINAL_hotspot_list_07302025_hg38_sorted.bed HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz> HCC1395_BL/HCC1395_BL.md/depth_stats.FINAL_hotspot_list_07302025_hg38_sorted.bed.tsv
seqtool gc_bias -reference Homo_sapiens_assembly38.fasta -bed FINAL_hotspot_list_07302025_hg38_sorted.bed -bin_size 0.05 -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/gc_bias_qc.FINAL_hotspot_list_07302025_hg38_sorted.bed.tsv
seqtool read_qc -bed foresight_clarity_targets_hg38.bed -n_threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/read_qc.foresight_clarity_targets_hg38.bed.tsv
seqtool reads_per_target -bed foresight_clarity_targets_hg38.bed -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/reads_per_target.foresight_clarity_targets_hg38.bed.tsv
seqtool depth_stats -bed foresight_clarity_targets_hg38.bed HCC1395_BL/HCC1395_BL.md/HCC1395_BL.md.depth.gz> HCC1395_BL/HCC1395_BL.md/depth_stats.foresight_clarity_targets_hg38.bed.tsv
cat HCC1395_BL/HCC1395_BL.md/gc_bias_qc.FINAL_hotspot_list_07302025_hg38_sorted.bed.tsv | plot -x 0 -header infer -ylim 0 2 -title "HCC1395_BL.md" -suptitle "FINAL_hotspot_list_07302025_hg38_sorted.bed" -output "HCC1395_BL/HCC1395_BL.md/gc_bias.FINAL_hotspot_list_07302025_hg38_sorted.bed.png" -ylabel "Fold enrichment / depletion" -xlabel "GC Quantile"
seqtool gc_bias -reference Homo_sapiens_assembly38.fasta -bed foresight_clarity_targets_hg38.bed -bin_size 0.05 -threads 1 -bam_threads 2 HCC1395_BL.md.bam > HCC1395_BL/HCC1395_BL.md/gc_bias_qc.foresight_clarity_targets_hg38.bed.tsv
cat HCC1395_BL/HCC1395_BL.md/gc_bias_qc.altera_v3_targets_coding_postQC_hg38.bed.tsv | plot -x 0 -header infer -ylim 0 2 -title "HCC1395_BL.md" -suptitle "altera_v3_targets_coding_postQC_hg38.bed" -output "HCC1395_BL/HCC1395_BL.md/gc_bias.altera_v3_targets_coding_postQC_hg38.bed.png" -ylabel "Fold enrichment / depletion" -xlabel "GC Quantile"
cat HCC1395_BL/HCC1395_BL.md/gc_bias_qc.altera_v3_targets_noncoding_postQC_hg38.bed.tsv | plot -x 0 -header infer -ylim 0 2 -title "HCC1395_BL.md" -suptitle "altera_v3_targets_noncoding_postQC_hg38.bed" -output "HCC1395_BL/HCC1395_BL.md/gc_bias.altera_v3_targets_noncoding_postQC_hg38.bed.png" -ylabel "Fold enrichment / depletion" -xlabel "GC Quantile"
cat HCC1395_BL/HCC1395_BL.md/gc_bias_qc.altera_v3_targets_postQC_hg38.bed.tsv | plot -x 0 -header infer -ylim 0 2 -title "HCC1395_BL.md" -suptitle "altera_v3_targets_postQC_hg38.bed" -output "HCC1395_BL/HCC1395_BL.md/gc_bias.altera_v3_targets_postQC_hg38.bed.png" -ylabel "Fold enrichment / depletion" -xlabel "GC Quantile"
cat HCC1395_BL/HCC1395_BL.md/gc_bias_qc.foresight_clarity_targets_hg38.bed.tsv | plot -x 0 -header infer -ylim 0 2 -title "HCC1395_BL.md" -suptitle "foresight_clarity_targets_hg38.bed" -output "HCC1395_BL/HCC1395_BL.md/gc_bias.foresight_clarity_targets_hg38.bed.png" -ylabel "Fold enrichment / depletion" -xlabel "GC Quantile"
cat HCC1395_BL/HCC1395_BL.md/gc_bias_qc.xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed.tsv | plot -x 0 -header infer -ylim 0 2 -title "HCC1395_BL.md" -suptitle "xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed" -output "HCC1395_BL/HCC1395_BL.md/gc_bias.xgen-exome-hyb-panel-v2-targets-hg38_minus_altera_v3_targets_postQC_hg38.bed.png" -ylabel "Fold enrichment / depletion" -xlabel "GC Quantile"
cat HCC1395_BL/HCC1395_BL.md/gc_bias_qc.xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed.tsv | plot -x 0 -header infer -ylim 0 2 -title "HCC1395_BL.md" -suptitle "xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed" -output "HCC1395_BL/HCC1395_BL.md/gc_bias.xgen-exome-hyb-panel-v2-targets-hg38_AND_altera_v3_targets_postQC_hg38_AND_foresight_clarity.bed.png" -ylabel "Fold enrichment / depletion" -xlabel "GC Quantile"
cat HCC1395_BL/HCC1395_BL.md/gc_bias_qc.xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed.tsv | plot -x 0 -header infer -ylim 0 2 -title "HCC1395_BL.md" -suptitle "xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed" -output "HCC1395_BL/HCC1395_BL.md/gc_bias.xgen-exome-hyb-panel-v2_AND_altera_v3_probes_short_hg38_AND_cdx_spike_custom30off4x_hg38_AND_foresight_clarity_footprint.bed.png" -ylabel "Fold enrichment / depletion" -xlabel "GC Quantile"
echo `date` > HCC1395_BL/HCC1395_BL.md/qc_complete.txt