#!/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