run_entropy.Rd
This function computes gene-level entropy across neighboring cells for a specified assay in a Seurat object. It optionally saves the entropy matrix to file and/or adds it as a new assay named `"assay_entropy"`.
run_entropy(
seu,
assay,
nn_list = NULL,
nn.name = NULL,
output_path = NULL,
add_assay = TRUE,
k.param = 15,
npca = 20,
nfeatures = 3000
)
A Seurat object.
Character. Name of the assay to use.
Optional named list of neighbor cell indices or names per cell. If NULL, neighbors are computed using PCA.
Optional character. If neighbors are already present in the Seurat object, this specifies the name of the neighbor graph to use (e.g. `"SCT"` or `"RNA"`).
Optional character string. If provided, saves the full entropy matrix to this file (using `qs::qsave()`).
Logical. If TRUE (default), adds the entropy matrix to the Seurat object as a new assay called `"assay_entropy"`.
Integer. Number of nearest neighbors to use when computing the neighbor graph. Default is 15.
Integer. Number of PCA dimensions to use when computing neighbors. Default is 20.
Integer. Number of variable features to select before PCA and neighbor finding. Default is 3000.
If `add_assay = TRUE`, returns the modified Seurat object with a new assay named `"assay_entropy"`. If `add_assay = FALSE`, returns a data frame of mean entropy values per cell.
# Assuming `pbmc` is a Seurat object with an "RNA" assay:
run_entropy(pbmc_small, assay = "RNA", k.param = 15)
#> INFO [2025-04-30 12:01:58] Starting entropy estimation for assay: RNA
#> Error: object 'pbmc_small' not found