Skip to content

Instantly share code, notes, and snippets.

@jodyphelan
Created August 6, 2019 11:35
Show Gist options
  • Save jodyphelan/e58425d7e317a5e2fdd9eb0cca65a81b to your computer and use it in GitHub Desktop.
Save jodyphelan/e58425d7e317a5e2fdd9eb0cca65a81b to your computer and use it in GitHub Desktop.
# VCF file = test.filt.vcf.gz
# replace where necessary
(printf "chr\npos\nref\n"; bcftools query -l test.filt.vcf.gz) | datamash transpose > test.filt.mat.bin
bcftools query -f '%CHROM\t%POS\t%REF[\t%GT]\n' test.filt.vcf.gz | tr '|' '/' | sed 's/\.\/\./N/g' | sed 's/0\/0/0/g' | sed 's/.\/./1/g' >> test.filt.mat.bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment