This vigettte demonstrates how to run fastMNN on Seurat objects. Parameters and commands are based off of the fastMNN help page. If you use fastMNN, please cite:

Batch effects in single-cell RNA-sequencing data are corrected by matching mutual nearest neighbors

Laleh Haghverdi, Aaron T L Lun, Michael D Morgan & John C Marioni

Nature Biotechnology, 2018

doi: 10.1038/nbt.4091

Bioconductor: https://bioconductor.org/packages/release/bioc/html/batchelor.html

knitr::opts_chunk$set(
  tidy = TRUE,
  tidy.opts = list(width.cutoff = 95),
  message = FALSE,
  warning = FALSE
)
options(timeout = 1000)

Prerequisites to install:

library(Seurat)
library(SeuratData)
library(SeuratWrappers)

{.tabset .tabset-pills}

Systematic comparative analysis of human PBMC

To learn more about this dataset, type ?pbmcsca

InstallData("pbmcsca")
data("pbmcsca")
pbmcsca <- NormalizeData(pbmcsca)
pbmcsca <- FindVariableFeatures(pbmcsca)
pbmcsca <- RunFastMNN(object.list = SplitObject(pbmcsca, split.by = 'Method'))
pbmcsca <- RunUMAP(pbmcsca, reduction = 'mnn', dims = 1:30)
pbmcsca <- FindNeighbors(pbmcsca, reduction = 'mnn', dims = 1:30)
pbmcsca <- FindClusters(pbmcsca)
DimPlot(pbmcsca, group.by = c('Method', 'ident',"CellType"), ncol = 3)
rm(pbmcsca)
gc(verbose = FALSE)

Interferon-stimulated and control PBMC

To learn more about this dataset, type ?ifnb

InstallData("ifnb")
data("ifnb")
ifnb <- NormalizeData(ifnb)
ifnb <- FindVariableFeatures(ifnb)
ifnb <- RunFastMNN(object.list = SplitObject(ifnb, split.by = 'stim'))
ifnb <- RunUMAP(ifnb, reduction = 'mnn', dims = 1:30)
ifnb <- FindNeighbors(ifnb, reduction = 'mnn', dims = 1:30)
ifnb <- FindClusters(ifnb)
DimPlot(ifnb, group.by = c('stim', 'ident', 'seurat_annotations'), ncol = 3)
rm(ifnb)
gc(verbose = FALSE)

Eight human pancreatic islet datasets

To learn more about this dataset, type ?panc8

InstallData("panc8")
data("panc8")
panc8 <- NormalizeData(panc8)
panc8 <- FindVariableFeatures(panc8)
panc8 <- RunFastMNN(object.list = SplitObject(panc8, split.by = 'replicate')[c("celseq", "celseq2", "fluidigmc1", "smartseq2")])
panc8 <- RunUMAP(panc8, reduction = 'mnn', dims = 1:30)
panc8 <- FindNeighbors(panc8, reduction = 'mnn', dims = 1:30)
panc8 <- FindClusters(panc8)
DimPlot(panc8, group.by = c('replicate', 'ident', 'celltype'), ncol = 3) 


satijalab/seurat-wrappers documentation built on April 10, 2024, 3:25 p.m.