% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/S3_omics.R
\name{impute_snps}
\alias{impute_snps}
\alias{impute_snps.HDF5Matrix}
\title{Impute missing SNP values in an HDF5Matrix}
\usage{
impute_snps(x, ...)

\method{impute_snps}{HDF5Matrix}(
  x,
  out_group = NULL,
  out_dataset = NULL,
  by_cols = TRUE,
  threads = -1L,
  overwrite = FALSE,
  ...
)
}
\arguments{
\item{x}{An \code{HDF5Matrix} containing SNP data with NAs.}

\item{...}{Ignored.}

\item{out_group}{Output group. \code{NULL} = same as input (default).}

\item{out_dataset}{Output dataset name. \code{NULL} = same as input (default, in-place).}

\item{by_cols}{Logical. Impute by columns (\code{TRUE}, default) or rows.}

\item{threads}{Integer. Number of threads (-1 = auto).}

\item{overwrite}{Logical. Overwrite existing output. Default \code{FALSE}.}
}
\value{
\code{HDF5Matrix} pointing to the imputed dataset.
}
\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.
}
\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)
}

}
