seu.Make.Cl.Label.per.cell: Create Cluster Labels for Each Cell

View source: R/Seurat.Utils.R

seu.Make.Cl.Label.per.cellR Documentation

Create Cluster Labels for Each Cell

Description

Generates labels for each cell by combining gene names and cluster IDs. This function takes a named vector, typically representing top genes for clusters (values) and their corresponding cluster IDs (names), along with a vector of cell IDs. It then creates a new vector where each cell is labeled with its top gene and cluster ID in the format "GeneName.ClusterID".

Usage

seu.Make.Cl.Label.per.cell(TopGenes, clID.per.cell)

Arguments

TopGenes

A named vector with gene names as values and cluster IDs as names, representing the top or defining gene for each cluster.

clID.per.cell

A vector of cluster IDs for each cell, used to match each cell with its corresponding top gene from TopGenes.

Value

A vector where each element corresponds to a cell labeled with both its defining gene name and cluster ID, in the format "GeneName.ClusterID".

Examples

## Not run: 
if (interactive()) {
  # Assuming `TopGenes.Classic` is a named vector of top genes and cluster IDs,
  # and `metaD.CL.colname` is a column in metadata with cluster IDs per cell
  cellLabels <- seu.Make.Cl.Label.per.cell(
    TopGenes = TopGenes.Classic,
    clID.per.cell = getMetadataColumn(ColName.metadata = metaD.CL.colname)
  )
  # `cellLabels` now contains labels for each cell in the format "GeneName.ClusterID"
}

## End(Not run)


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.