Celltype_Annotation_PerCell: Annotate Seurat Object with Per-Cell SlimR Predictions

View source: R/Celltype_Annotation_PerCell.R

Celltype_Annotation_PerCellR Documentation

Annotate Seurat Object with Per-Cell SlimR Predictions

Description

This function assigns SlimR per-cell predicted cell types directly to individual cells in a Seurat object's meta.data slot.

Usage

Celltype_Annotation_PerCell(
  seurat_obj,
  SlimR_percell_result,
  plot_UMAP = TRUE,
  annotation_col = "Cell_type_PerCell_SlimR",
  plot_confidence = FALSE
)

Arguments

seurat_obj

A Seurat object.

SlimR_percell_result

List generated by Celltype_Calculate_PerCell() containing Cell_annotations data.frame with Cell_barcode and Predicted_cell_type columns.

plot_UMAP

Logical; if TRUE, plot the UMAP with cell type annotations. Default: TRUE.

annotation_col

Column name to write in meta.data. Default: "Cell_type_PerCell_SlimR".

plot_confidence

Logical; if TRUE, also plot a UMAP colored by confidence scores. Default: FALSE.

Value

A Seurat object with updated meta.data containing:

  • annotation_col: Predicted cell type for each cell

  • paste0(annotation_col, "_score"): Max score for each cell

  • paste0(annotation_col, "_confidence"): Confidence score for each cell

Note

If plot_UMAP = TRUE, this function will print UMAP plot(s) as a side effect.

See Also

Other Section_3_Automated_Annotation: Celltype_Annotation(), Celltype_Calculate(), Celltype_Calculate_PerCell(), Celltype_Verification(), Celltype_Verification_PerCell(), Parameter_Calculate(), percell_workflow

Examples

## Not run: 
# Run per-cell annotation
result <- Celltype_Calculate_PerCell(
    seurat_obj = sce,
    gene_list = Markers_list,
    species = "Human"
)

# Annotate Seurat object
sce <- Celltype_Annotation_PerCell(
    seurat_obj = sce,
    SlimR_percell_result = result,
    plot_UMAP = TRUE,
    annotation_col = "Cell_type_PerCell_SlimR"
)

## End(Not run)


SlimR documentation built on Feb. 5, 2026, 5:08 p.m.