Skip to content

Instantly share code, notes, and snippets.

@nuada
Created March 6, 2015 12:37
Show Gist options
  • Save nuada/e37f9ce91db918a19752 to your computer and use it in GitHub Desktop.
Save nuada/e37f9ce91db918a19752 to your computer and use it in GitHub Desktop.
Calculate kinship coefficient for set of samples in VCF
#!/bin/bash
bcftools norm -Ou -m -any $1 | # Split multi-allelic alleles
bcftools norm -Ou -f /resources/hg19/ucsc.hg19.fasta | # Normalize
bcftools annotate -Ob -x ID -I +'%CHROM:%POS:%REF:%ALT' | # Replace IDs with unique ID
plink --bcf /dev/stdin --keep-allele-order --double-id --allow-extra-chr 0 --make-bed --out variants
king -b variants.bed --kinship --prefix kinship
king -b variants.bed --individual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment