calcHet: Calculate fraction of hets for each SNP in a genotype table.

Description Usage Arguments Value Author(s) Examples

Description

Takes a recoded (0,1,2) data.table and returns a vector of fraction of het SNPs for each row Calculates fraction of called SNPs that were called as heterozygous (value of 1) Doesn't include NA calls in calculation

Usage

1
calcHet(genoTable)

Arguments

genoTable

Data table where SNPs are rows and lines are columns, no metadata columns. Coded as 0,1,2.

Value

Returns of vector of same length as input with translated values.

Author(s)

Greg Ziegler

Examples

1
2
3
4
5
6
7
alleleTable <- cbind(snpInfo,calcHet(genoTable))
hetThreshold <- 0.1 #change hets to NA for a snp if there are higher than this percentage of hets
length(alleleTable$FracHet[which(alleleTable$FracHet>=0.1)])
alleleTable[,discard := (FracHet>=hetThreshold)]

GenotypeData[which(alleleTable$discard==TRUE)][GenotypeData[which(alleleTable$discard==TRUE)]==1] <- NA
alleleTable[, discard := NULL]

gziegler/ionomicsUtils documentation built on June 20, 2019, 8:04 p.m.