About Install Get Started Frequently Asked Questions Frequently Requested Vignettes Contact
Seurat - Interaction Tips

Load in the data

This vignette demonstrates some useful features for interacting with the Seurat object. For demonstration purposes, we will be using the 2,700 PBMC object that is created in the first guided tutorial. You can download the pre-computed object here. To simulate the scenario where we have two replicates, we will randomly assign half the cells in each cluster to be from “rep1” and other half from “rep2”.

load(file = "~/Projects/datasets/pbmc3k_final.Rda")

# pretend that cells were originally assigned to one of two replicates (we
# assign randomly here) if your cells do belong to multiple replicates, and
# you want to add this info to the Seurat object create a data frame with
# this information (similar to replicate.info below)
set.seed(seed = 42)
replicate.info <- data.frame(replicate = sample(x = c("rep1", "rep2"), size = length(x = pbmc@cell.names), 
    replace = TRUE), row.names = pbmc@cell.names)
pbmc <- AddMetaData(object = pbmc, metadata = replicate.info)

Switch identity class between cluster ID and replicate

# Plot tSNE, coloring cells by cell type (currently stored in object@ident)
TSNEPlot(object = pbmc)