runPca: Run Principal Component Analysis

runPCAR Documentation

Run Principal Component Analysis

Description

Takes the data matrix of choice and passes it to irlba::prcomp_irlba().

Usage

runPCA(
  object,
  n_pcs = 30,
  variables = NULL,
  mtr_name = activeMatrix(object),
  assay_name = activeAssay(object),
  ...
)

runPca(...)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

n_pcs

Numeric value. Denotes the number of principal components to be computed.

variables

Character vector or NULL. If character, subsets the data matrix by variable/molecule names such that only the specified ones are used for dimensional reduction. If NULL, the unsubstted matrix denoted in mtr_name is used.

mtr_name

Character value. The name of the matrix of interest. Defaults to the active matrix of the assay, as denoted by activateMatrix().

assay_name

Only relevant if the SPATA2 object contains more than one assay: Denotes the assay of interest and thus the molecular modality to use. Defaults to the active assay as set by activateAssay().

...

Additional arguments given to irlba::prcomp_irlba().

Value

The updated input object, containing the added, removed or computed results.

See Also

identifyVariableMolecules(), plotPcaElbow()

Examples

library(SPATA2)

data("example_data")

object <- example_data$object_UKF269T_diet

object <- runPCA(object)
object <- runTSNE(object)
object <- runUMAP(object)

plotPCA(object, color_by = "histology")
plotTSNE(object, color_by = "histology")
plotUMAP(object, color_by = "histology")


theMILOlab/SPATA2 documentation built on Feb. 8, 2025, 11:41 p.m.