# set up the genotype object (usually done by reading a file)
mysamples <- c("Mal", "Inara", "Kaylee", "Simon", "River", "Zoe",
"Wash", "Jayne", "Book")
myloci <- c("loc1", "loc2")
mygendata <- array(list(-9), dim=c(9,2), dimnames=list(mysamples,
myloci))
mygendata[,"loc1"] <- list(c(304,306), c(302,310), c(306), c(312,314),
c(312,314), c(308,310), c(312), c(302,308,310), c(-9))
mygendata[,"loc2"] <- list(c(118,133), c(121,130), c(122,139),
c(124,133), c(118,124), c(121,127), c(124,136), c(124,127,136),
c(121,130))
# make the vector of nucleotide repeat lengths
myusatnts <- c(2,3)
names(myusatnts) <- myloci
# set up population info (some or all of this might also be read from a file)
mypopnames <- c("Core","Outer Rim")
mypopinfo <- c(rep(1,4) ,rep(2,6))
names(mypopinfo) <- c("Simon", "River", "Inara", "Book", "Kaylee",
"Mal", "Wash", "Zoe", "Badger", "Jayne")
# write files (use file="" to display in console instead)
write.GenoDive(mygendata, usatnts=myusatnts, popnames=mypopnames,
popinfo=mypopinfo, digits=2, commentline="Serenity crew",
file="testGenoDive2.txt")
write.GenoDive(mygendata, usatnts=myusatnts, popnames=mypopnames,
popinfo=mypopinfo, digits=3, commentline="Serenity crew",
file="testGenoDive3.txt")
Run the code above in your browser using DataLab