Learn R Programming

tidypopgen (version 0.4.3)

gt_impute_simple: Simple imputation based on allele frequencies

Description

This function provides a very simple imputation algorithm for gen_tibble objects by using the mode, mean or sampling from the allele frequencies. Each locus is imputed independently (and thus linkage information is ignored).

Usage

gt_impute_simple(x, method = c("mode", "mean0", "random"), n_cores = 1)

Value

a gen_tibble with imputed genotypes

Arguments

x

a gen_tibble with missing data

method

one of

  • 'mode': the most frequent genotype

  • 'mean0': the mean rounded to the nearest integer

  • 'random': randomly sample a genotype based on the observed allele frequencies

n_cores

the number of cores to be used

Details

This function is a wrapper around bigsnpr::snp_fastImputeSimple().

See Also

bigsnpr::snp_fastImputeSimple() which this function wraps.

Examples

Run this code
if (FALSE) { # all(rlang::is_installed(c("RhpcBLASctl", "data.table")))
# \dontshow{
data.table::setDTthreads(2)
RhpcBLASctl::blas_set_num_threads(2)
RhpcBLASctl::omp_set_num_threads(2)
# }
example_gt <- load_example_gt("gen_tbl")

# Impute the gen_tibble
example_gt <- example_gt %>% gt_impute_simple()

# And we can check it has been imputed
example_gt %>% gt_has_imputed()
}

Run the code above in your browser using DataLab