data(map)
data(Cattle)
dir <- system.file("extdata", package = "optiSel")
GTfile <- file.path(dir, paste("Chr", unique(map$Chr), ".phased", sep=""))
Freq <- haplofreq(GTfile, Cattle, map, thisBreed="Angler", refBreeds="others", minSNP=20)$freq
fIBDN <- segIBDandN(GTfile, Freq<0.01, map=map, minSNP=20)
mean(fIBDN)
#[1] 0.01032261
# \donttest{
fIBDN <- segIBDandN(GTfile, Freq<0.01, map=map, minSNP=20, cores=NA)
mean(fIBDN)
#[1] 0.01032261
# }
## using files:
# \donttest{
wdir <- file.path(tempdir(),"HaplotypeEval")
chr <- unique(map$Chr)
GTfile <- file.path( dir, paste("Chr", chr, ".phased", sep=""))
file <- haplofreq(GTfile, Cattle, map, thisBreed="Angler", minSNP=20, ubFreq=0.01, w.dir=wdir)
fIBDN <- segIBDandN(GTfile, file$match, map=map, minSNP=20)
mean(fIBDN)
#[1] 0.01032261
fIBDN <- segIBDandN(GTfile, file$match, map=map, minSNP=20, cores=NA)
mean(fIBDN)
#[1] 0.01032261
#unlink(wdir, recursive = TRUE)
# }
Run the code above in your browser using DataLab