View source: R/AllelesToTriangular.R
AllelesToTriangular | R Documentation |
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).
AllelesToTriangular(A1, A2 = NULL, given=NULL)
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. |
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.
A lower triangular matrix with genotype counts.
Jan Graffelman jan.graffelman@upc.edu
Graffelman, J. (2015) Exploring Diallelic Genetic Markers: The HardyWeinberg Package. Journal of Statistical Software 64(3): 1-23. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v064.i03")}.
toTriangular
data(NistSTRs)
A1 <- NistSTRs[,1]
A2 <- NistSTRs[,2]
GM <- AllelesToTriangular(A1,A2)
print(GM)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.