matrix.snp_unphased: Creates a SNP unphased matrix.

View source: R/matrix.R

matrix.snp_unphasedR Documentation

Creates a SNP unphased matrix.

Description

Creates a SNP unphased matrix.

Usage

matrix.snp_unphased(io, n_threads = 1)

Arguments

io

IO handler.

n_threads

Number of threads.

Value

SNP unphased matrix.

Examples

n <- 123
s <- 423
filename <- paste(tempdir(), "snp_unphased_dummy.snpdat", sep="/")
handle <- io.snp_unphased(filename)
mat <- matrix(
    as.integer(sample.int(
        3, n * s,
        replace=TRUE,
        prob=c(0.7, 0.2, 0.1)
    ) - 1),
    n, s
)
impute <- double(s)
handle$write(mat, "mean", impute, 1)
out <- matrix.snp_unphased(handle)
file.remove(filename)

adelie documentation built on Sept. 11, 2024, 6:36 p.m.