Skip to content

Instantly share code, notes, and snippets.

@explodecomputer
Last active August 29, 2015 14:16
Show Gist options
  • Save explodecomputer/525fecb0a8371f88f25d to your computer and use it in GitHub Desktop.
Save explodecomputer/525fecb0a8371f88f25d to your computer and use it in GitHub Desktop.
simulate phenotypes
#!/bin/bash
# name of binary plink filename (excluding .bed/.bim/.fam suffix)
plinkfile=""
# output filename
outname=""
# number of causal variants
nvar=1000
# simulated h2
h2=0.8
# number of simulations
nsim=10
# Get random set of SNPs
shuf -n ${nvar} ${plinkfile}.bim | awk '{ print $2 }' > ${outname}.selectedsnps
# Use gcta to simulate some phenotypes
gcta64 \
--bfile ${plinkfile} \
--simu-qt \
--simu-causal-loci ${outname}.selectedsnps \
--simu-hsq ${h2} \
--simu-rep ${nsim} \
--out ${outname}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment