Learn R Programming

Seurat (version 2.3.4)

AddMetaData: Add Metadata

Description

Adds additional data for single cells to the Seurat object. Can be any piece of information associated with a cell (examples include read depth, alignment rate, experimental batch, or subpopulation identity). The advantage of adding it to the Seurat object is so that it can be analyzed/visualized using FetchData, VlnPlot, GenePlot, SubsetData, etc.

Usage

AddMetaData(object, metadata, col.name = NULL)

Arguments

object

Seurat object

metadata

Data frame where the row names are cell names (note : these must correspond exactly to the items in object@cell.names), and the columns are additional metadata items.

col.name

Name for metadata if passing in single vector of information

Value

Seurat object where the additional metadata has been added as columns in object@meta.data

Examples

Run this code
# NOT RUN {
cluster_letters <- LETTERS[pbmc_small@ident]
pbmc_small <- AddMetaData(
  object = pbmc_small,
  metadata = cluster_letters,
  col.name = 'letter.idents'
)
head(x = pbmc_small@meta.data)

# }

Run the code above in your browser using DataLab