cell_group: Add manual cell group labels to SingleCellExperiment

View source: R/cell_group.R

cell_groupR Documentation

Add manual cell group labels to SingleCellExperiment

Description

Add manually created cell group labels in a data.frame to SingleCellExperiment.

Usage

cell_group(sce, df.group, cell, cell.group)

Arguments

sce

A SingleCellExperiment.

df.group

A data.frame of manually created single cell groups. At least two columns are required, corresponding to cell identifiers that are present in rownames(colData(sce)) and the manually created group labels respectively.

cell

The column name in df.group indicating cells.

cell.group

The column name in df.group indicating cell group labels.

Value

An object of SingleCellExperiment.

Author(s)

Jianhai Zhang jzhan067@ucr.edu
Dr. Thomas Girke thomas.girke@ucr.edu

References

Morgan M, Obenchain V, Hester J, Pagès H (2022). SummarizedExperiment: SummarizedExperiment container. R package version 1.26.1, https://bioconductor.org/packages/SummarizedExperiment

Examples

set.seed(10); library(SummarizedExperiment)
# Read single cell data.
sce.pa <- system.file("extdata/shinyApp/data", "cell_mouse_brain.rds", package="spatialHeatmap")
sce <- readRDS(sce.pa)
# Quality control, normalization, dimensionality reduction on the single cell data.
sce.dimred <- process_cell_meta(sce, qc.metric=list(subsets=list(Mt=rowData(sce)$featureType=='mito'), threshold=1))
# Read manual cell group labels.
manual.clus.mus.sc.pa <- system.file("extdata/shinyApp/data", "manual_cluster_mouse_brain.txt", package="spatialHeatmap") 
manual.clus.mus.sc <- read.table(manual.clus.mus.sc.pa, header=TRUE, sep='\t')
# Include manual cell group labels in "SingleCellExperiment".
sce.clus <- cell_group(sce=sce.dimred, df.group=manual.clus.mus.sc, cell='cell', cell.group='cluster')

jianhaizhang/spatialHeatmap documentation built on July 31, 2024, 2:59 a.m.