data(Pram)
# Round robin allele frequencies, correcting zero-valued frequencies to 1/nInd(Pram)
rraf(Pram)
if (FALSE) {
## Round robin allele frequencies will be different than observed
# Compare to without round robin:
PrLoc <- seploc(Pram, res = "mat") # get locus by matrix
lapply(PrLoc, colMeans, na.rm = TRUE)
# Without round robin, clone corrected:
Pcc <- clonecorrect(Pram, strata = NA) # indiscriminantly clone correct
PccLoc <- seploc(Pcc, res = "mat")
lapply(PccLoc, colMeans, na.rm = TRUE)
## Different methods of obtaining round robin allele frequencies
# Get vector output.
rraf(Pram, res = "vector")
# Getting the output as a data frame allows us to use ggplot2 to visualize
(Prdf <- rraf(Pram, res = "data.frame"))
library("ggplot2")
ggplot(Prdf, aes(y = allele, x = frequency)) +
geom_point() +
facet_grid(locus ~ ., scale = "free_y", space = "free")
## Round Robin allele frequencies by population (matrix only)
# By default, allele frequencies will be corrected by 1/n per population
(Prbp <- rraf(Pram, by_pop = TRUE))
# This might be problematic because populations like PistolRSF_OR has a
# population size of four.
# By using the 'e' argument to rare_allele_correction, this can be set to a
# more reasonable value.
(Prbp <- rraf(Pram, by_pop = TRUE, e = 1/nInd(Pram)))
}
Run the code above in your browser using DataLab