filter_maf

filter_maf

OMICS

1 Description

Removes columns or rows whose Minor Allele Frequency (MAF) exceeds maf_threshold. Designed for 0/1/2-coded diploid genotype matrices.

When out_group/out_dataset are NULL (default) the result is written alongside the input dataset with suffix "_maf_filtered".

2 Usage

filter_maf(x, ...)

3 Arguments

Parameter Description
x An containing SNP data.
out_group Output group. (default) = same group as input.
out_dataset Output dataset name. (default) = input name + .
maf_threshold Numeric in [0, 0.5]. MAF threshold (default ). SNPs with MAF above this value are removed.
by_cols Logical. Process by columns (, default) or rows.
block_size Integer. Block size for I/O. Default .
overwrite Logical. Overwrite existing output. Default .

4 Value

pointing to the filtered dataset.

5 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)
}