Skip to content

Instantly share code, notes, and snippets.

@explodecomputer
Last active October 27, 2015 16:54
Show Gist options
  • Save explodecomputer/e4438771d04534e058ad to your computer and use it in GitHub Desktop.
Save explodecomputer/e4438771d04534e058ad to your computer and use it in GitHub Desktop.
pca analysis
($1 == 1) && ($4 >= 48287981) && ($4 <= 52287979) {print $2}
($1 == 2) && ($4 >= 86088343) && ($4 <= 101041482) {print $2}
($1 == 2) && ($4 >= 134666269) && ($4 <= 138166268) {print $2}
($1 == 2) && ($4 >= 183174495) && ($4 <= 190174494) {print $2}
($1 == 3) && ($4 >= 47524997) && ($4 <= 50024996) {print $2}
($1 == 3) && ($4 >= 83417311) && ($4 <= 86917310) {print $2}
($1 == 3) && ($4 >= 88917311) && ($4 <= 96017310) {print $2}
($1 == 5) && ($4 >= 44464244) && ($4 <= 50464243) {print $2}
($1 == 5) && ($4 >= 97972101) && ($4 <= 100472101) {print $2}
($1 == 5) && ($4 >= 128972102) && ($4 <= 131972101) {print $2}
($1 == 5) && ($4 >= 135472102) && ($4 <= 138472101) {print $2}
($1 == 6) && ($4 >= 25392022) && ($4 <= 33392022) {print $2}
($1 == 6) && ($4 >= 56892042) && ($4 <= 63942041) {print $2}
($1 == 6) && ($4 >= 139958308) && ($4 <= 142458307) {print $2}
($1 == 7) && ($4 >= 55225792) && ($4 <= 66555850) {print $2}
($1 == 8) && ($4 >= 7962591) && ($4 <= 11962591) {print $2}
($1 == 8) && ($4 >= 42880844) && ($4 <= 49837447) {print $2}
($1 == 8) && ($4 >= 111930825) && ($4 <= 114930824) {print $2}
($1 == 10) && ($4 >= 36959995) && ($4 <= 43679994) {print $2}
($1 == 11) && ($4 >= 46043425) && ($4 <= 57243424) {print $2}
($1 == 11) && ($4 >= 87860353) && ($4 <= 90860352) {print $2}
($1 == 12) && ($4 >= 33108734) && ($4 <= 41713733) {print $2}
($1 == 12) && ($4 >= 111037281) && ($4 <= 113537280) {print $2}
($1 == 20) && ($4 >= 32536340) && ($4 <= 35066586) {print $2}
cd ~/data/deprecated/gib/alspac_genotypes/data/bestguess/data
# pairwise LD pruning
plink1.90 --bfile data --indep-pairwise 10000 5 0.1 --out ~/indep
plink1.90 --bfile data --extract ~/indep.prune.in --make-bed --out ~/indep
# remove high ld regions
awk -f highldregionsb37.awk ~/indep.bim > ~/highldregions.txt
plink1.90 --bfile ~/indep --exclude ~/highldregions.txt --make-bed --out ~/indep_ld
# Get mother IDs
awk '{ print $1, $2 }' data.fam | grep "M" > ~/mothers.txt
# Do PCA
plink1.90 --bfile ~/indep_ld --keep ~/mothers.txt --pca 20 --out ~/indep_ld_mothers
plink1.90 --bfile ~/indep_ld --remove ~/mothers.txt --pca 20 --out ~/indep_ld_kids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment