#!/bin/bash # Phase P5 bundle on the 1000 Genomes Omni2.5 set (2141 samples): # 1. P4 re-check with --preset autocall-1.6.2 (expect byte-identical GTCs except the K-009 samples); # 2. `simurg genotype` (legacy preset, GTC v5 so BAF exists) with control tables and cohort QC; # 3. P5 validation against the 1000G pedigree and VCF (scripts/validate_p5_large.py). # Args: set -uo pipefail D=$1; OUT=$2 SRC=s3://1000genomes/release/20130502/supporting/hd_genotype_chip mkdir -p $OUT/p4 $OUT/p5 $D/egt cp $D/HumanOmni2.5-4v1-Multi_B.egt $D/egt/ echo "=== P4 preset re-check $(date -u +%T) ===" /usr/bin/time -v .venv/bin/python scripts/validate_p4_large.py --root $D/data --bpm $D/HumanOmni2.5-4v1-Multi_B.bpm \ --egt-dir $D/egt --out $OUT/p4/summary.json --workers "$(nproc)" 2> $OUT/p4/time.txt \ || echo "P4 validation reported differences" tail -22 $OUT/p4/time.txt echo "=== P5 genotype + QC $(date -u +%T) ===" GT=/work/gt /usr/bin/time -v .venv/bin/simurg genotype --bpm $D/HumanOmni2.5-4v1-Multi_B.bpm --egt $D/HumanOmni2.5-4v1-Multi_B.egt \ --idats $D/data --out $GT --preset autocall-1.6.2 --gtc-version 5 --autocall-date "1/1/2026 12:00:00 AM" \ --qc-profile genotyping --threads "$(nproc)" --quiet 2> $OUT/p5/genotype_time.txt || echo "genotype exit $?" tail -22 $OUT/p5/genotype_time.txt cp $GT/sample_summary.tsv $GT/controls_qc.tsv $GT/relatedness.tsv $GT/run_manifest.json $OUT/p5/ 2>/dev/null cp $GT/mendel.tsv $OUT/p5/ 2>/dev/null cp -r $GT/logs $OUT/p5/ 2>/dev/null gzip -c $GT/controls_raw.tsv > $OUT/p5/controls_raw.tsv.gz 2>/dev/null df -h /work | tail -1 echo "=== P5 validation $(date -u +%T) ===" aws s3 cp --no-sign-request "$SRC/broad_intensities/Omni25_genotypes_2141_samples.b37.v2.vcf.gz" /work/ --only-show-errors aws s3 cp --no-sign-request "s3://1000genomes/release/20130502/integrated_call_samples.20130502.ALL.ped" /work/ --only-show-errors /usr/bin/time -v .venv/bin/python scripts/validate_p5_large.py --gt-dir $GT --bpm $D/HumanOmni2.5-4v1-Multi_B.bpm \ --vcf /work/Omni25_genotypes_2141_samples.b37.v2.vcf.gz --ped /work/integrated_call_samples.20130502.ALL.ped \ --out $OUT/p5/summary.json --workers "$(nproc)" 2> $OUT/p5/validate_time.txt || echo "P5 validation reported differences" tail -22 $OUT/p5/validate_time.txt echo "=== task done $(date -u +%T) ==="