Created
August 25, 2013 17:11
-
-
Save coleoguy/6335059 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data <- as.numeric(read.table("rosalind_iprb.txt")) | |
k<-data[1] | |
m<-data[2] | |
n<-data[3] | |
t<-sum(data) | |
# Sire is AA Dam is anything | |
t.prob <- k/(t) | |
# Sire is Aa Dam is AA, Aa, aa | |
t.prob <- t.prob + (((m/(t)) * (k/(t-1))) + #Aa x AA | |
((m/(t)) * ((m-1)/(t-1)) * .75) + #Aa x Aa | |
(m/(t)) * (n/(t-1) * .5)) #Aa x aa | |
# Sire is aa Dam is AA, Aa | |
t.prob <- t.prob + (((n/(t)) * (k/(t-1)) * 1) + #aa x AA | |
((n/(t)) * (m/(t-1)) *.5)) #aa x Aa | |
cat(t.prob) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment