# create a simple allele frequency table
# (usually done with simpleFreq or deSilvaFreq)
myfreq <- data.frame(row.names=c("popA","popB"), Genomes=c(120,100),
locG.152=c(0.1,0.4), locG.156=c(0.5, 0.3),
locG.160=c(0.4, 0.3), locK.179=c(0.15, 0.25),
locK.181=c(0.35, 0.6), locK.183=c(0.5, 0.15))
myfreq
# convert to adegenet format
gpfreq <- freq.to.genpop(myfreq)
gpfreq
if (FALSE) {
# If you have adegenet installed, you can now make this into a
# genpop object.
require(adegenet)
mygenpop <- genpop(gpfreq, ploidy=as.integer(4), type="codom")
# examine the object that has been created
mygenpop
popNames(mygenpop)
mygenpop@tab
mygenpop@all.names
# Perform a distance calculation with the object
dist.genpop(mygenpop)
}
Run the code above in your browser using DataLab