Skip to content

Instantly share code, notes, and snippets.

@seandavi
Created December 8, 2010 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seandavi/733260 to your computer and use it in GitHub Desktop.
Save seandavi/733260 to your computer and use it in GitHub Desktop.
Calculate genotype probabilities
phat <-
function(x,n,error=0.01,hetprob=0.001) {
#doesn't work as expected yet
prv=hetprob
pvv=(1-hetprob)/2
phet = pbinom(x,n,0.5)*prv
phomref=pbinom(x,n,error)*(1-prv-pvv)
phomvar=pbinom(x,n,1-error)*pvv
return(c(phomvar=phomvar,phet=phet,phomref=phomref))}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment