cellembedding_matrix: Compute Spatial-Aware Cell Embeddings

View source: R/caesar.R

cellembedding_matrixR Documentation

Compute Spatial-Aware Cell Embeddings

Description

This function computes low-dimensional cell embeddings from a gene-by-cell matrix. The method initializes cell embeddings using approximate PCA and refines them through a linear factor model nested a intrinsical conditional autoregressive model.

Usage

cellembedding_matrix(X, adjm, q = 50, reduction.name = "caesar", ...)

Arguments

X

A gene-by-cell matrix (e.g., the 'data' slot from a Seurat object) that serves as the input data for dimensional reduction.

adjm

A spatial adjacency matrix representing the relationships between cells or spots in spatial transcriptomic data.

q

An integer specifying the number of dimensions to reduce to. Default is 50.

reduction.name

A character string specifying the name of the dimensional reduction method. Default is 'caesar'.

...

Additional parameters passed to 'ProFAST::FAST_run'.

Value

A matrix containing the computed cell embeddings. The number of rows corresponds to the number of cells, and the number of columns corresponds to the specified number of dimensions ('q').

See Also

FAST_run for the main FAST dimensionality reduction algorithm.

Examples

data(toydata)

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

adjm <- ProFAST::AddAdj(as.matrix(pos), radius.upper = 200)
X <- Seurat::GetAssayData(object = seu, slot = "data", assay = "RNA")
cellembedding <- cellembedding_matrix(
    X = X,
    adjm = adjm
)
print(cellembedding[1:3, 1:3])

CAESAR.Suite documentation built on April 3, 2025, 10:32 p.m.