Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is_het

Query genotypes for heterozygotes


Description

Query a matrix of genotypes for heterozygotes

Usage

is_het(x, na_is_false = TRUE)

is.het(x, na_is_false = TRUE)

Arguments

x

a matrix of genotypes

na_is_false

should missing data be returned as NA (FALSE) or FALSE (TRUE)

Details

This function was designed to identify heterozygous positions in a matrix of genotypes. The matrix of genotypes can be created with extract.gt. Because the goal was to identify heterozygotes it may be reasonable to ignore missing values by setting na_is_false to TRUE so that the resulting matrix will consist of only TRUE and FALSE. In order to preserve missing data as missing na_is_false can be set to FALSE where if at least one allele is missing NA is returned.

See Also

Examples

data(vcfR_test)
gt <- extract.gt(vcfR_test)
hets <- is_het(gt)
# Censor non-heterozygous positions.
is.na(vcfR_test@gt[,-1][!hets]) <- TRUE

vcfR

Manipulate and Visualize VCF Data

v1.12.0
GPL-3
Authors
Brian J. Knaus [cre, aut] (<https://orcid.org/0000-0003-1665-4343>), Niklaus J. Grunwald [aut] (<https://orcid.org/0000-0003-1656-7602>), Eric C. Anderson [ctb], David J. Winter [ctb], Zhian N. Kamvar [ctb] (<https://orcid.org/0000-0003-1458-7108>), Javier F. Tabima [ctb] (<https://orcid.org/0000-0002-3603-2691>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.