impute_snps

impute_snps

OMICS

1 Description

Fills NA entries in SNP data by computing column or row means of non-missing values. Intended for 0/1/2-coded diploid genotype matrices.

2 Usage

impute_snps(x, ...)

3 Arguments

Parameter Description
x An containing SNP data with NAs.
out_group Output group. = same as input (default).
out_dataset Output dataset name. = same as input (default, in-place).
by_cols Logical. Impute by columns (, default) or rows.
threads Integer. Number of threads (-1 = auto).
overwrite Logical. Overwrite existing output. Default .

4 Value

pointing to the imputed dataset.

5 Examples

\donttest{
tmp <- tempfile(fileext = ".h5")

# SNP data: 0/1/2 coded, 3 = missing (not NA)
snps <- matrix(sample(c(0L, 1L, 2L, 3L), 100 * 20,
                       replace = TRUE,
                       prob    = c(0.3, 0.3, 0.3, 0.1)),
               nrow = 100, ncol = 20)

X   <- hdf5_create_matrix(tmp, "geno/raw", data = snps)
imp <- impute_snps(X, out_group = "geno", out_dataset = "imputed")
dim(imp)

hdf5_close_all()
unlink(tmp)
}