annotate_seurat: Annotate a Seurat object from ImmunData (by barcode)

View source: R/operations_external_annotate_seurat.R

annotate_seuratR Documentation

Annotate a Seurat object from ImmunData (by barcode)

Description

Copy selected columns from idata$annotations to Seurat metadata using the cell barcode. This is the simplest way to transfer data from immundata to Seurat object, e.g., for plotting data on UMAP.

Usage

annotate_seurat(idata, sdata, cols)

Arguments

idata

An ImmunData object.

sdata

A Seurat object (cells are columns; barcodes are colnames(sdata)).

cols

Character vector with column names to transfer from idata$annotations. Typical choices: "clonal_prop_bin" or "clonal_rank_bin".

Details

See functions annotate_clonality_rank and annotate_clonality_prop in immunarch package.

Value

The updated Seurat object with new metadata columns.

See Also

ImmunData, SeuratObject::AddMetaData

Examples

## Not run: 
# After annotating receptors:
idata <- annotate_clonality_prop(idata)

# Transfer the clonality bin to Seurat and plot:
sdata <- annotate_seurat(idata, sdata, cols = "clonal_prop_bin")
Seurat::DimPlot(sdata, reduction = "umap", group.by = "clonal_prop_bin", shuffle = TRUE)

# Alternative: rank bins
idata <- annotate_clonality_rank(idata, bins = c(10, 100))
sdata <- annotate_seurat(idata, sdata, cols = "clonal_rank_bin")

## End(Not run)


immundata documentation built on April 4, 2026, 9:09 a.m.