xCell2GetLineage: Identify Cell Type Lineage Dependencies

View source: R/xCell2GetLineage.R

xCell2GetLineageR Documentation

Identify Cell Type Lineage Dependencies

Description

Identifies cell type dependencies based on the Cell Ontology, including both descendants and ancestors for each cell type. Enables manual inspection and refinement of lineage relationships to improve biological accuracy in xCell2 analyses.

Usage

xCell2GetLineage(labels, outFile = NULL)

Arguments

labels

A data frame with the following required columns:

  • "ont": Cell type ontology ID (e.g., "CL:0000545"). Use NA if unavailable. Ontologies can be accessed via EBI Ontology Lookup Service (OLS) or the ontologyIndex package.

  • "label": Cell type name (e.g., "T-helper 1 cell").

  • "sample": Sample or cell identifier matching column names in the gene expression matrix.

  • "dataset": Dataset or subject source. Use a constant value if not applicable.

outFile

Optional. Output file name for saving dependencies as a TSV file. The file includes columns for "ont", "label", "descendants", and "ancestors". Suitable for manual inspection and refinement before use in downstream analyses.

Details

The xCell2GetLineage function generates lineage relationships for cell types based on the Cell Ontology. These relationships refine lineage-based dependencies, improving the biological relevance of gene signatures. Users can:

  • Use the generated TSV file for manual adjustments before training custom references via xCell2Train.

  • Skip this step entirely, allowing xCell2Train to infer dependencies automatically.

If no ontology IDs ("ont") are provided, the function outputs empty dependencies with a message for user guidance.

Relationship with Other Functions:

  • xCell2Train: Incorporates lineage relationships during reference training.

  • xCell2Analysis: Uses trained references for enrichment analysis.

Value

If outFile is:

  • NULL: Returns a list of dependencies for each cell type, with descendants and ancestors as components.

  • Specified: Writes a TSV file and warns the user to inspect and validate results manually.

Author(s)

Almog Angel and Dvir Aran

See Also

xCell2Train for training custom references with lineage data. xCell2Analysis for enrichment analysis using trained references. AnnotationHub to access ontology data. ontologyIndex to programmatically explore ontologies.

Examples

# For detailed examples, see the xCell2 vignette.

library(xCell2)

# Load demo reference object
data(dice_demo_ref, package = "xCell2")

# Prepare labels data frame
dice_labels <- SummarizedExperiment::colData(dice_demo_ref)
dice_labels <- as.data.frame(dice_labels)
dice_labels$ont <- NA
dice_labels$sample <- colnames(dice_demo_ref)
dice_labels$dataset <- "DICE"

# Assign ontology IDs
dice_labels[dice_labels$label == "B cells", ]$ont <- "CL:0000236"
dice_labels[dice_labels$label == "Monocytes", ]$ont <- "CL:0000576"
dice_labels[dice_labels$label == "NK cells", ]$ont <- "CL:0000623"
dice_labels[dice_labels$label == "T cells, CD8+", ]$ont <- "CL:0000625"
dice_labels[dice_labels$label == "T cells, CD4+", ]$ont <- "CL:0000624"
dice_labels[dice_labels$label == "T cells, CD4+, memory", ]$ont <- "CL:0000897"

# Generate cell type lineage dependencies
xCell2::xCell2GetLineage(labels = dice_labels)

# Manually inspect and adjust saved dependencies for refined lineage relationships
# Use the adjusted file as input to xCell2Train via the `lineageFile` parameter.


AlmogAngel/xCell2 documentation built on Jan. 24, 2025, 10:39 a.m.