add.gene.embedding | R Documentation |
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.
add.gene.embedding(seu, adjm, reduction.name = "caesar", assay = NULL)
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. |
The modified Seurat object with the computed gene embeddings added to the specified dimensional reduction ('reduction.name').
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.