Learn R Programming

HardyWeinberg (version 1.7.8)

AllelesToTriangular: Calculate triangular genotype matrix for vector(s) of alleles.

Description

AllelesToTriangular constructs a lower triangular matrix of genotype counts from one or two vectors of alleles. It is particularly useful to create genotype counts for microsatellite data (STRs).

Usage

AllelesToTriangular(A1, A2 = NULL, given=NULL)

Value

A lower triangular matrix with genotype counts.

Arguments

A1

The first allele of each individual, or a vector with all alleles, two consecutive ones for each individual.

A2

The second allele of each individual (optional).

given

A vector of known alleles (optional). This argument can be used to specify alleles that may not exist in the data.

Author

Jan Graffelman jan.graffelman@upc.edu

Details

If the data is a single column vector with two succesive alleles for each individual, then specify A1 only. If data consists of two columns, each holding one allele of each individual, then specify A1 and A2. Typical STR data that comes in the format of two repeat lengths for a set of individuals can be transformed into a lower triangular matrix with genotype counts. See the examples below.

References

Graffelman, J. (2015) Exploring Diallelic Genetic Markers: The HardyWeinberg Package. Journal of Statistical Software 64(3): 1-23. tools:::Rd_expr_doi("10.18637/jss.v064.i03").

See Also

toTriangular

Examples

Run this code
data(NistSTRs)
A1 <- NistSTRs[,1]
A2 <- NistSTRs[,2]
GM <- AllelesToTriangular(A1,A2)
print(GM)

Run the code above in your browser using DataLab