View source: R/population_stats.R
alleleDiversity | R Documentation |
alleleDiversity
returns the number of unique alleles and/or a
list of vectors of all unique alleles, indexed by locus and population.
alleleDiversity(genobject, samples = Samples(genobject), loci = Loci(genobject), alleles = TRUE, counts = TRUE)
genobject |
An object of the class |
samples |
Optional. A character or numeric vector indicating samples to include in the analysis. |
loci |
Optional. A character or numeric vector indicating loci to include in the analysis. |
alleles |
Boolean, indicating whether or not to return the alleles themselves. |
counts |
Boolean, indicating whether or not to return the number of unique alleles. |
Under default settings, a list is returned:
alleles |
A two dimensional list. The first dimension is indexed
by population, with the additional element “overall”
representing the entire dataset. The second dimension is indexed by
locus. Each element of the list is a vector, containing all unique
alleles found for that population and locus.
|
counts |
A matrix, indexed in the same way as |
If the argument alleles
or counts
is set to FALSE
,
then only one of the above list elements is returned.
Lindsay V. Clark
genotypeDiversity
# generate a dataset for this example mygen <- new("genambig", samples=c("a","b","c","d"), loci=c("E","F")) PopInfo(mygen) <- c(1,1,2,2) Genotypes(mygen, loci="E") <- list(c(122,132),c(122,124,140), c(124,130,132),c(132,136)) Genotypes(mygen, loci="F") <- list(c(97,99,111),c(113,115), c(99,113),c(111,115)) # look at unique alleles myal <- alleleDiversity(mygen) myal$counts myal$alleles myal$alleles[["Pop1","E"]] myal$alleles[["overall","F"]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.