Learn R Programming

CAESAR.Suite (version 0.1.0)

add.gene.embedding: Add Gene Embedding to Seurat Object

Description

This function computes and adds gene embeddings to a Seurat object based on a provided adjacency matrix of spatial information and an existing cell embedding. It allows for the integration of gene-level information into the dimensional reduction of the Seurat object.

Usage

add.gene.embedding(seu, adjm, reduction.name = "caesar", assay = NULL)

Value

The modified Seurat object with the computed gene embeddings added to the specified dimensional reduction (`reduction.name`).

Arguments

seu

A Seurat object. The Seurat object should contain pre-computed cell embeddings for dimensional reduction and expression data for genes.

adjm

A spatial adjacency matrix that represents relationships between cells or spots in the spatial transcriptomic data. This matrix is used to calculate the gene embeddings.

reduction.name

A character string specifying the name of the dimensional reduction method used for the cell embeddings (e.g., "ncfm", "caesar", etc.). The computed gene embeddings will be added to this slot. Default is "caesar".

assay

A character string specifying which assay to use from the Seurat object. If NULL, the function will use the default assay set in the Seurat object.

Examples

Run this code
data(toydata)

seu <- toydata$seu
pos <- toydata$pos

adjm <- ProFAST::AddAdj(as.matrix(pos), radius.upper = 200)
seu <- add.gene.embedding(
    seu = seu,
    adjm = adjm,
    reduction.name = "caesar",
    assay = "RNA"
)
print(seu)

Run the code above in your browser using DataLab