PolyGenius
Contents

reduction

Tag a matrix as an ordered-basis embedding

Tags value so that study$samples$<name> <- value files it as an embedding rather than as a plain table member. compute$populationStructure() and compute$embedding$samples() attach the tag themselves, so the common path never calls reduction() directly.

Usage

reduction(value, method = NULL, source = NULL)

Arguments

ArgumentDescription
valueA matrix or matrix-like object. Embedding coordinates, one row per sample, in the study's own sample order.
methodCharacter scalar, or NULL (default). Reduction method, e.g. "pca" or "umap".
sourceCharacter scalar, or NULL (default). What the reduction was computed against -- a reference-panel id, or "self" for an in-sample computation.

Value

value, unchanged apart from a reduction attribute carrying list(method = method, source = source).

Examples

pcs <- matrix(rnorm(20), nrow = 10, dimnames = list(NULL, c("PC1", "PC2")))
attr(reduction(pcs, method = "pca", source = "1000G"), "reduction")

See Also