CN: noise-corrected BAF split and complete-loss MF (CYTO-041); Pi tuning harness

Mosaic fraction from the BAF split now subtracts the heterozygous BAF noise (median |BAF-0.5| of unsplit
hets = 0.6745 sigma_b), and a mosaic loss lacking its expected heterozygotes gets MF 1 and is promoted to a
constitutional DEL (CYTO-020). Adds scripts/v2/cn_tune.sh + cn_tune_report.py (GSE165845 rounds on the Pi).
This commit is contained in:
kemal committed 2026-09-29 10:30:12 +01:00
1 parent 086b191442
commit 310a70f63d
6 files changed
+140 -8

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# CN tuning round on the Pi (GSE165845): reference = replicate-3 arrays of all 120 individuals, test = replicates 1
# and 2 of the first N individuals; truth = NYGC SV rows (data/v2cn/cloud1/truth.tsv).
# bash scripts/v2/cn_tune.sh TAG [extra `simurg cn call` options...] (env: N=20, MODEL=...)
set -euo pipefail
cd "$(dirname "$0")/../.."
TAG=${1:?tag}; shift
N=${N:-20}
G=data/v2cn/gse_gt; M=data/v2cn/gse_idats/samples_map.tsv; W=data/v2cn/tune
BPM=data/p8/gsa1/GSA-24v1-0_C2.bpm
mkdir -p $W/ref $W/test
if [[ ! -f $W/.dirs ]]; then
inds=$(tail -n +2 $M | cut -f3 | awk '!s[$0]++' | head -n "$N")
tail -n +2 $M | while IFS=$'\t' read -r sid gsm ind rep; do
[[ $rep == 3 ]] && ln -sfn "$(realpath $G/samples/$sid)" $W/ref/$sid
if [[ $rep != 3 ]] && grep -qx "$ind" <<< "$inds"; then ln -sfn "$(realpath $G/samples/$sid)" $W/test/$sid; fi
done
touch $W/.dirs
fi
MODEL=${MODEL:-$W/ref.simurg-cyto}
if [[ ! -f $MODEL ]]; then
MEM=${MEM:-5G} MIN_FREE_MB=1500 bash scripts/pi_run.sh .venv/bin/simurg cn build-model --bpm $BPM --fasta data/p6/GRCh38.primary.fa \
--egt data/p8/gsa1/GSA-24v1-0_C1_ClusterFile.egt --reference-gtcs $W/ref --max-reference 120 --out $MODEL --quiet
fi
MEM=${MEM:-5G} MIN_FREE_MB=1500 bash scripts/pi_run.sh .venv/bin/simurg cn call --bpm $BPM --model $MODEL --gtcs $W/test \
--summary $G/sample_summary.tsv --out $W/$TAG --threads 3 --force --quiet "$@"
.venv/bin/python scripts/v2/cn_validate_truth.py --calls $W/$TAG --map $M --truth data/v2cn/cloud1/truth.tsv --bpm $BPM \
--min-qual 20 --out $W/$TAG/val > /dev/null
.venv/bin/python scripts/v2/cn_tune_report.py $W/$TAG $M