| compute_lisi | R Documentation |
Compute per-cell Local Inverse Simpson's Index (LISI) scores for one or more categorical variables.
This is a clean-room reimplementation of the immunogenomics/LISI.
compute_lisi(
X,
meta_data,
label_colnames,
perplexity = 30,
tol = 1e-05,
max_iter = 50
)
X |
A matrix-like object with cells in rows and embedding/features in columns. |
meta_data |
A data frame with one row per cell. |
label_colnames |
Character vector of column names in |
perplexity |
Effective neighborhood size. Defaults to |
tol |
Tolerance used in the binary search for the target perplexity.
Defaults to |
max_iter |
Maximum number of binary-search iterations.
Defaults to |
A data frame with one row per cell and one column per label.
Korsunsky I, Millard N, Fan J, et al. Fast, sensitive and accurate integration of single-cell data with Harmony. Nature Methods (2019). https://www.nature.com/articles/s41592-019-0619-0
LISI reference implementation: https://github.com/immunogenomics/LISI
set.seed(1)
X <- rbind(
matrix(stats::rnorm(100, mean = -1), ncol = 2),
matrix(stats::rnorm(100, mean = 1), ncol = 2)
)
meta_data <- data.frame(
batch = rep(c("A", "B"), each = 50),
group = sample(c("g1", "g2"), 100, replace = TRUE)
)
res <- compute_lisi(
X, meta_data,
c("batch", "group"),
perplexity = 10
)
head(res)
boxplot(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.