add.meta.data: Add metadata to a Seurat object from a data frame

View source: R/seurat_helpers.R

add.meta.dataR Documentation

Add metadata to a Seurat object from a data frame

Description

When creating a Seurat object with, for example, Read10X, no metadata is loaded automatically, even though cellranger aggregate gives you a nice aggregation csv. The cell barcodes just contain a numerical suffix to indicate which library they're from. It's useful to have all the metadata associated with each library as part of the Seurat object, so this function parses each cell barcode to figure out what gem group the cell came from, and then applies gem-group-level metadata contained in a table to the cell.

Usage

add.meta.data(seurat, meta.data)

Arguments

seurat

A seurat object.

meta.data

A table containing gem-group-level metadata to be added to seurat@meta.data. Rows must be in order of gem group, as output by cellranger aggregate.

Value

The seurat object with metadata added.

Examples

meta.data <- read.csv('aggregation.csv')
seurat <- add.meta.data(seurat, meta.data)

WarrenLab/single-cell documentation built on June 10, 2022, 1:50 a.m.