Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

alleleDiversity

Retrieve and Count Unique Alleles


Description

alleleDiversity returns the number of unique alleles and/or a list of vectors of all unique alleles, indexed by locus and population.

Usage

alleleDiversity(genobject, samples = Samples(genobject),
                loci = Loci(genobject), alleles = TRUE, counts = TRUE)

Arguments

genobject

An object of the class "genambig".

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.

Value

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. Missing(genobject) is not counted as an allele.

counts

A matrix, indexed in the same way as alleles. Each element of the matrix is an integer indicating how many alleles were found at that population and locus.

If the argument alleles or counts is set to FALSE, then only one of the above list elements is returned.

Author(s)

Lindsay V. Clark

See Also

Examples

# 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"]]

polysat

Tools for Polyploid Microsatellite Analysis

v1.7-4
GPL-2
Authors
Lindsay V. Clark [aut, cre] (<https://orcid.org/0000-0002-3881-9252>), Alistair J. Hall [ctb] (<https://orcid.org/0000-0001-9293-8909>), Handunnethi Nihal de Silva [ctb], Tyler William Smith [ctb] (<https://orcid.org/0000-0001-7683-2653>)
Initial release
2019-03-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.