is_het | R Documentation |
Query a matrix of genotypes for heterozygotes
is_het(x, na_is_false = TRUE)
is.het(x, na_is_false = TRUE)
x |
a matrix of genotypes |
na_is_false |
should missing data be returned as NA (FALSE) or FALSE (TRUE) |
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.
extract.gt
data(vcfR_test)
gt <- extract.gt(vcfR_test)
hets <- is_het(gt)
# Censor non-heterozygous positions.
is.na(vcfR_test@gt[,-1][!hets]) <- TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.