Skip to contents

The function runPCA is used to run PCA dimensionality reduction.

Usage

runPCA(
  obj,
  npcs = 15,
  pca.method = c("APCA", "PCA", "WPCA"),
  reduction.name = "pca",
  seed = 1
)

# S3 method for iSCMEBObj
runPCA(
  obj,
  npcs = 15,
  pca.method = c("APCA", "PCA", "WPCA"),
  reduction.name = "pca",
  seed = 1
)

# S3 method for list
runPCA(
  obj,
  npcs = 15,
  pca.method = c("APCA", "PCA", "WPCA"),
  reduction.name = "pca",
  seed = 1
)

Arguments

obj

A seuList or iSCMEBObj object or matrix list.

npcs

Total Number of PCs to compute and store (15 by default).

pca.method

A string, specify which kind of PCA to be used. Supporting "APCA" (the approximate PCA), "PCA" (the classical PCA) and "WPCA" (the weighted PCA). Default method is APCA.

reduction.name

Dimensional reduction name, pca by default

seed

The random seed for APCA method. 1 by default.

Value

Returns a revised iSCMEBObj object when input a iSCMEBObj.

Returns a revised list when input a seuList or matrix list.

Details

seuList is a list with Seurat object as component, and each Seurat object includes the raw expression count matrix, spatial coordinates and meta data for each data batch, where the spatial coordinates information must be saved in the metadata of Seurat, named "row" and "col" for each data batch. matrix list is a list of log-transformed expression matrix, element of which has same columns.

See also

Examples

data(iSCMEBObj_toy)
#> Warning: data set 'iSCMEBObj_toy' not found
library(Seurat)
## For convenience, we show the iSCMEBObj for perform dimension reduction. 
## Users can use PCA method or WPCA.
iSCMEBObj_toy2 <- runPCA(iSCMEBObj_toy)
## seulist <- iSCMEBObj_toy$seulist
## seulist <- runPCA(seulist)