This function utilizes rrmlg
to calculate multilocus genotypes
and then subsets each locus by the resulting MLGs to calculate the
roundrobin allele frequencies used for pgen and psex.
1 2 
gid 
a genind or genclone object 
pop 
either a formula to set the population factor from the

res 
either "list" (default), "vector", or "data.frame". 
by_pop 
When this is 
correction 
a logical indicating whether or not zerovalued allele
frequencies should be corrected using the methods outlined in
correcting rare alleles.
(Default: 
... 
options from correcting rare alleles. The default is to correct allele frequencies to 1/n 
Calculating allele frequencies for clonal populations is a difficult task. Frequencies calculated on nonclonecorrected data suffer from bias due to nonindependent samples. On the other hand, frequencies calculated on clonecorrected data artificially increases the significance of rare alleles. The method of roundrobin allele frequencies as presented in Parks and Werth (1993) provides a method of calculating allele frequencies in a way that minimizes both of these effects.
Allele frequencies at a given locus are
calculated based on samples that are clone corrected without that
locus. When this happens, rare alleles have a high likelihood of dropping
out, giving them a frequency of "0". For some analyses, this is a perfectly
fine outcome, but for analyses such as pgen
and
psex
, this could result in undefined values. Setting
correction = TRUE
will allow you to control how these zerovalued
allele frequencies are corrected. For details, please see the documentation
on correcting rare alleles and examples.
a vector or list of allele frequencies
When by_pop = TRUE
, the output will be a matrix of allele
frequencies. Additionally, when the argument pop
is not NULL
,
by_pop
is automatically TRUE
.
Zhian N. Kamvar, Jonah Brooks, Stacy A. KruegerHadfield, Erik Sotka
ArnaudHaond, S., Duarte, C. M., Alberto, F., & SerrĂ£o, E. A. 2007. Standardizing methods to address clonality in population studies. Molecular Ecology, 16(24), 51155139.
Parks, J. C., & Werth, C. R. 1993. A study of spatial features of clones in a population of bracken fern, Pteridium aquilinum (Dennstaedtiaceae). American Journal of Botany, 537544.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47  data(Pram)
# Round robin allele frequencies, correcting zerovalued frequencies to 1/nInd(Pram)
rraf(Pram)
## Not run:
## 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)))
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.