mungeData: mungeData

Description Usage Arguments Details Examples

Description

Utility functions for handling genotype counts and arranging data

remove missing alleles

converts matrix to vector

Clears upper-right of matrix

Usage

 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 = "/")

Arguments

gmat

a matrix of non-negative integers representing genotype counts. In a matrix of genotype counts, a[i,j] and a[j,i] both represent the same heterozygote. Only the lower-left half of gmat is used. Numbers along the diagonal represent counts of the homozygotes.

gvec

vector containing k(k+1)/2 genotype counts. All non-negative integers. Genotype counts should be in the order: a11, a21, a22, a31, a32, ..., akk

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 “/”

Details

Interconvert between different formats for genotype counts.

Let k be the number of alleles:

none

none

Examples

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)

HWxtest documentation built on May 31, 2019, 9:04 a.m.

Related to mungeData in HWxtest...