Description Usage Arguments Value Examples
View source: R/helper_functions.R
CID.entropy
calculates the normalized Shannon entropy of labels for each cell
among k-nearest neighbors less than four-degrees apart, and then sets cells with statistically
significant large Shannon entropy to be "Unclassified."
1 | CID.entropy(ac, distM)
|
ac |
a character vector of cell type labels |
distM |
the distance matrix, see ?CID.GetDistMat |
A character vector like 'ac' but with cells type labels set to "Unclassified" if there was high normalized Shannon entropy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
# load data classified previously (see \code{SignacFast})
P <- readRDS("celltypes.rds")
S <- readRDS("pbmcs.rds")
# get edges from default assay from Seurat object
default.assay <- Seurat::DefaultAssay(S)
edges = S@graphs[[which(grepl(paste0(default.assay, "_nn"), names(S@graphs)))]]
# get distance matrix
D = CID.GetDistMat(edges)
# entropy-based unclassified labels labels
entropy = CID.entropy(ac = P$L2, distM = D)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.