vcfR (version 1.8.0)

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

extract.gt

Examples

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

# }

Run the code above in your browser using DataCamp Workspace