pedigrees<-list()
pedigrees[[1]]<-matrix(
c(1,2,3,4,
0,0,1,1,
0,0,2,2,
1,0,0,1,
3,3,1,2),
ncol=5)
pedigrees[[2]]<-matrix(
c(1,2,3,
0,0,1,
0,0,2,
1,0,0,
1,3,2),
ncol=5)
pedigrees[[3]]<-matrix(
c(1:8,
0,0,1,0,3,3,3,3,
0,0,2,0,4,4,4,4,
1,0,1,0,1,1,0,0,
1,1,3,3,1,1,2,1),
ncol=5)
pedigrees[[4]]<-matrix(
c(1,2,3,
0,0,1,
0,0,2,
1,0,0,
3,1,2),
ncol=5)
FamilyNames<-list()
IndNames<-list()
for(ip in 1:length(pedigrees)){
FamilyNames[[ip]]<-paste("苗字",ip,sep="")
IndNames[[ip]]<-list()
for(j in 1:length(pedigrees[[ip]][,1])){
IndNames[[ip]][[j]]<-paste(FamilyNames[[ip]],j,"太郎花子")
}
}
Alleles<-AllelesId
Probs<-ProbsIDYoshidaFreq2
NL<-length(Alleles)
genotypesFamily<-list()
genotypesFamilyFull<-list()
for(ip in 1:length(pedigrees)){
tmppedigree<-MakePedigreeFromFamilyInfo(pedigrees[[ip]])
plot(tmppedigree)
p<-pedigrees[[ip]]
G<-RandomGenotypeFamily(p,NL,Alleles,Probs)
G2<-G
G2[which(p[,5]==2),,]<-0
G2[which(p[,5]==3),,]<-0
genotypesFamily[[ip]]<-G2
genotypesFamilyFull[[ip]]<-G
}
Np<-1000
Gpool<-RandomGenotype(Np,NL,Alleles,Probs)
Npool<-length(Gpool[,1,1])
tmpNpool<-0
for(ip in 1:length(pedigrees)){
tmpNpool<-tmpNpool+length(which(pedigrees[[ip]][,5]!=1))
}
Npool<-Npool+tmpNpool
Gpool2<-array(0,c(Npool,2,NL))
cnt<-1
for(ip in 1:length(pedigrees)){
tmp<-which(pedigrees[[ip]][,5]!=1)
tmplen<-length(which(pedigrees[[ip]][,5]!=1))
tmpG<-genotypesFamilyFull[[ip]][tmp,,]
if(length(which(pedigrees[[ip]][,5]!=1))==1)tmpG<-array(tmpG,c(1,2,NL))
Gpool2[cnt:(cnt+length(tmpG[,1,1])-1),,]<-tmpG
cnt<-cnt+tmplen
}
Gpool2[cnt:Npool,,]<-Gpool
candidatesList<-list()
for(ip in 1:length(pedigrees)){
candidatesList[[ip]]<-list()
for(j in 1:length(pedigrees[[ip]][,1])){
if(pedigrees[[ip]][j,5]==2){
candidatesList[[ip]][[j]]<-c(sample(1:tmpNpool,1),sample((tmpNpool+1):Npool,1))
}else{
candidatesList[[ip]][[j]]<-c()
}
}
}