Description Usage Arguments Details Examples
Utility functions for handling genotype counts and arranging data
remove missing alleles
converts matrix to vector
Clears upper-right of matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 | fillUpper(gmat)
alleleCounts(gmat)
vec.to.matrix(gvec, alleleNames = "")
remove.missing.alleles(gmat)
matrix.to.vec(gmat)
clearUpper(gmat)
df.to.matrices(df, sep = "/")
|
gmat |
a matrix of non-negative integers representing genotype counts. In a matrix of genotype counts, |
gvec |
vector containing |
alleleNames |
an optional list of names for the alleles. The length should be k |
df |
a dataframe containing individual genotypes. Each row represents an individual. The first column, named “pop” names the population. Each other column is named for a particular locus. The genotypes are as “123/124” |
sep |
For a dataframe, this is the separator character. typically “/” |
Interconvert between different formats for genotype counts.
Let k
be the number of alleles:
clearUpper
fills the upper-right half of the k x k matrix with NA
fillUpper
makes the k x k matrix symmetrical by filling the upper-right half with numbers from the lower half.
vec.to.matrix
converts genotype counts in vector form and returns a matrix. The vector must have k(k+1)/2 non-negative integers.
matrix.to.vec
converts a k x k matrix of genotype counts to a vector of length k(k+1)/2
alleleCounts
returns a vector of length k containing the numbers of each allele. The sum of this vector will be twice the number of diploids in the sample.
remove.missing.alleles
returns a matrix with no 0
's for allele counts
df.to.matrices
converts a data frame to a list of genotype count matrices. The data frame should be of the kind produced in the package adegenet
with genind2df
none
none
1 2 3 | gvec <- c(0,3,1,5,18,1,3,7,5,2)
gmat <- vec.to.matrix(gvec, alleleNames=letters[1:4])
alleleCounts(gmat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.