% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/S3_omics.R
\name{filter_maf}
\alias{filter_maf}
\alias{filter_maf.HDF5Matrix}
\title{Remove SNPs by Minor Allele Frequency from an HDF5Matrix}
\usage{
filter_maf(x, ...)

\method{filter_maf}{HDF5Matrix}(
  x,
  out_group = NULL,
  out_dataset = NULL,
  maf_threshold = 0.05,
  by_cols = FALSE,
  block_size = 100L,
  overwrite = FALSE,
  ...
)
}
\arguments{
\item{x}{An \code{HDF5Matrix} containing SNP data.}

\item{...}{Ignored.}

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

\item{out_dataset}{Output dataset name. \code{NULL} (default) = input name + \code{"_maf_filtered"}.}

\item{maf_threshold}{Numeric in [0, 0.5]. MAF threshold (default \code{0.05}).
SNPs with MAF \strong{above} this value are removed.}

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

\item{block_size}{Integer. Block size for I/O. Default \code{100L}.}

\item{overwrite}{Logical. Overwrite existing output. Default \code{FALSE}.}
}
\value{
\code{HDF5Matrix} pointing to the filtered dataset.
}
\description{
Removes columns or rows whose Minor Allele Frequency (MAF) exceeds
\code{maf_threshold}. Designed for 0/1/2-coded diploid genotype matrices.

When \code{out_group}/\code{out_dataset} are \code{NULL} (default) the
result is written alongside the input dataset with suffix \code{"_maf_filtered"}.
}
\examples{
\donttest{
fn <- tempfile(fileext = ".h5")
snps <- matrix(sample(c(0, 1, 2), 200, replace = TRUE,
                       prob = c(.6, .3, .1)), 20, 10)
X   <- hdf5_create_matrix(fn, "geno/raw", data = snps)

# Filter with auto output path (adds "_maf_filtered" suffix)
out <- filter_maf(X, maf_threshold = 0.05)

# Filter with explicit output
out2 <- filter_maf(X, out_group = "geno",
                   out_dataset = "maf_filtered", overwrite = TRUE)
hdf5_close_all()
unlink(fn)
}

}
