Seurat - Interaction Tips
Compiled: July 26, 2017
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”.
library(Seurat) library(dplyr) 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 = email@example.com), replace = TRUE), row.names = firstname.lastname@example.org) 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)