View source: R/Index_calculations.r
private_alleles | R Documentation |
Tabulate alleles the occur in only one population.
private_alleles(
gid,
form = alleles ~ .,
report = "table",
level = "population",
count.alleles = TRUE,
drop = FALSE
)
gid |
a adegenet::genind or genclone object. |
form |
a |
report |
one of |
level |
one of |
count.alleles |
|
drop |
|
the argument form
allows for control over the strata at which
private alleles should be computed. It takes a form where the left hand
side of the formula can be either "allele", "locus", or "loci". The right
hand of the equation, by default is ".". If you change it, it must
correspond to strata located in the adegenet::strata()
slot.
Note, that the right hand side is disabled for genpop objects.
a matrix, data.frame, or vector defining the populations or individuals containing private alleles. If vector is chosen, alleles are not defined.
Zhian N. Kamvar
data(Pinf) # Load P. infestans data.
private_alleles(Pinf)
## Not run:
# Analyze private alleles based on the country of interest:
private_alleles(Pinf, alleles ~ Country)
# Number of observed alleles per locus
private_alleles(Pinf, locus ~ Country, count.alleles = TRUE)
# Get raw number of private alleles per locus.
(pal <- private_alleles(Pinf, locus ~ Country, count.alleles = FALSE))
# Get percentages.
sweep(pal, 2, nAll(Pinf)[colnames(pal)], FUN = "/")
# An example of how these data can be displayed.
library("ggplot2")
Pinfpriv <- private_alleles(Pinf, report = "data.frame")
ggplot(Pinfpriv) + geom_tile(aes(x = population, y = allele, fill = count))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.