knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

scRobustPCA

Performs robust PCA with modified PCs on Seurat objects for scRNA-Seq dimensionality reduction.

Installation

You can install scRobustPCA from github with:

# install.packages("devtools")
devtools::install_github("gmstanle/scRobustPCA")

Working example on 80 PBMCs

Intended only to demonstrate a functional workflow. pbmc_small is a subsetted dataset with 80 cells and 230 genes included in the Seurat package.

Calculate rPCA

require(Seurat)
require(scRobustPCA)
pcs.use=1:5
pbmc_small <- FindVariableGenes(pbmc_small, do.plot = F) # optional
pbmc_small <- RunRobPCA(pbmc_small, npcs=max(pcs.use), use.modified.pcscores = T)

Plot pairwise combinations of PCs

pairs(GetCellEmbeddings(pbmc_small, reduction.type = 'rpca'))

Calculate TSNE

pbmc_small <- RunTSNE(pbmc_small, reduction.use = 'rpca', dims.use = pcs.use,perplexity=10)

Cluster cells

Note: need to set dims.use = pcs.use parameter or FindClusters seems to default to using 'pca' dimensionality reduction.

pbmc_small <- FindClusters(pbmc_small, reduction.type = 'rpca', dims.use = pcs.use, print.output = F)
TSNEPlot(pbmc_small)


gmstanle/scRobustPCA documentation built on May 10, 2019, 10:01 a.m.