File size: 1,427 Bytes
765c2b7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | set -uo pipefail
module load bcftools/1.16 >/dev/null 2>&1
R=/ibex/project/c2041/hany0c/bench_h2h_20260915/real
V=$R/raw/1kGP_high_coverage_Illumina.chr2.filtered.SNV_INDEL_SV_phased_panel.vcf.gz
echo "start $(date -u +%FT%TZ) host $(hostname)"
echo "== GT values chr2:10000000-10100000 (all 3202 samples)"
bcftools query -r chr2:10000000-10100000 -f "[%GT\n]" $V 2>/dev/null | sort | uniq -c
echo "== samples VCF vs ped"
bcftools query -l $V > $R/logs/.vcf_samples.tmp
awk "NR>1{print \$2}" $R/ref/20130606_g1k_3202_samples_ped_population.txt | sort > $R/logs/.ped_samples.tmp
sort $R/logs/.vcf_samples.tmp | comm -3 - $R/logs/.ped_samples.tmp | wc -l
rm -f $R/logs/.vcf_samples.tmp $R/logs/.ped_samples.tmp
echo "== whole-file site scan (no genotypes)"
bcftools query -f "%POS\t%FILTER\t%TYPE\t%N_ALT\t%INFO/AC\n" $V 2>/dev/null | awk -F"\t" "
{n++; filt[\$2]++; typ[\$3]++;
if(\$3==\"snp\" && \$4==1){bs++; if(\$5==1)ac1++; if(\$5<mn||mn==\"\")mn=\$5; pc[\$1]++}
if(\$3==\"snp\") snpany[\$1]++}
END{print \"records\",n; for(k in filt)print \"FILTER\",k,filt[k]; for(k in typ)print \"TYPE\",k,typ[k];
print \"biallelic_snv\",bs,\"AC_min\",mn,\"AC==1\",ac1+0;
d=0; dr=0; for(p in pc) if(pc[p]>1){d++; dr+=pc[p]}; print \"biallelic_snv positions with >1 biallelic snv record\",d,\"records\",dr;
e=0; for(p in snpany) if(snpany[p]>1)e++; print \"positions with >1 SNV record (any N_ALT)\",e}"
echo "end $(date -u +%FT%TZ)"
|