private_alleles {poppr} | R Documentation |
Tabulate alleles the occur in only one population.
Description
Tabulate alleles the occur in only one population.
Usage
private_alleles(
gid,
form = alleles ~ .,
report = "table",
level = "population",
count.alleles = TRUE,
drop = FALSE
)
Arguments
gid |
a adegenet::genind or genclone object. |
form |
a |
report |
one of |
level |
one of |
count.alleles |
|
drop |
|
Details
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.
Value
a matrix, data.frame, or vector defining the populations or individuals containing private alleles. If vector is chosen, alleles are not defined.
Author(s)
Zhian N. Kamvar
Examples
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)