entropy | R Documentation |
entropy
entropy(
sce,
group,
k,
dim_red = "PCA",
assay_name = "logcounts",
n_dim = 10,
res_name = NULL
)
sce |
|
group |
Character. Name of group/batch variable.
Needs to be one of |
k |
Numeric. Number of k-nearest neighbours (knn) to use. |
dim_red |
Character. Name of embeddings to use as subspace for distance distributions. Default is "PCA". |
assay_name |
Character. Name of the assay to use for PCA.
Only relevant if no existing 'dim_red' is provided.
Must be one of |
n_dim |
Numeric. Number of dimensions to include to define the subspace. |
res_name |
Character. Appendix of the result score's name (e.g. method used to combine batches). |
The entropy function calculates the Shannon entropy of the group variable within each cell's k-nearest neighbourhood. For balanced batches a Shannon entropy close to 1 indicates high randomness and mixing. For unbalanced batches entropy should be interpreted with caution, but could work as a relative measure in a comparative setting.
A SingleCellExperiment
with the entropy score within colData.
library(SingleCellExperiment)
sim_list <- readRDS(system.file("extdata/sim50.rds", package = "CellMixS"))
sce <- sim_list[[1]][, c(1:15, 400:420, 16:30)]
sce <- entropy(sce, "batch", k = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.