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)
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)
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)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.