nloci <- 100
q <- runif(nloci,min=0.05,max=0.95)
# g7---g8
# _|_
# | |
# g9 g10---g11
# __|_
# | /\
# g12 g13 g14
#
nids <- 8
sex <- c(1,0,0,1,0,0,0,0)
names(sex) <- paste("g",c(7:14),sep="")
gt <- matrix(ncol=nloci,nrow=nids)
rownames(gt) <- paste("g",c(7:14),sep="")
gt["g7",] <- rbinom(nloci,2,q)
gt["g8",] <- rbinom(nloci,2,q)
gt["g11",] <- rbinom(nloci,2,q)
gt["g9",] <- generateOffspring(gt["g7",],gt["g8",],q=q)
gt["g10",] <- generateOffspring(gt["g7",],gt["g8",],q=q)
gt["g12",] <- generateOffspring(gt["g10",],gt["g11",],q=q)
gt["g13",] <- generateOffspring(gt["g10",],gt["g11",],q=q)
gt["g14",] <- gt["g13",]
aa<-findRelatives(gt,q=q,nmei=c(1:2))
aa$guess
aaPed <- reconstructNPs(aa$guess,sex)
aaPed
Run the code above in your browser using DataLab