Skip to content

Instantly share code, notes, and snippets.

@brentp
Created January 18, 2019 23:48
Show Gist options
  • Save brentp/583552a9b29064ae26c01d4a95019fc3 to your computer and use it in GitHub Desktop.
Save brentp/583552a9b29064ae26c01d4a95019fc3 to your computer and use it in GitHub Desktop.
import hts/vcf
import os
var gnomad_path = commandLineParams()[0]
var
gvcf:VCF
total:int
mid:int
if not open(gvcf, gnomad_path, threads=3):
quit "could not open vcf"
var af = newSeq[float32](1)
for v in gvcf:
if v.info.get("AF", af) != Status.OK: continue
total += 1
if af[0] > 0.05: mid += 1
echo "> 0.05:", mid
echo "count:", total
echo "pct:", 100'f64 * (mid / total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment