Computes the LMD score of each gene given an expression matrix and cell space.

LMD(
  expression,
  feature_space = NULL,
  knn = 5,
  kernel = FALSE,
  max_time = 2^20,
  adjust_bridge = TRUE,
  self_loop = 1,
  score_correction = FALSE,
  largeData = TRUE,
  highres = FALSE,
  min_cell = 5,
  kernel_used = NULL,
  alpha = 10,
  coef = 1,
  epsilon = 0.001,
  graph.affinity = NULL
)

Arguments

expression

matrix; the gene by cell expression matrix.

feature_space

matrix; the cell by coordinate matrix (e.g., 20 principal components).

knn

integer; the number of nearest neighbors for constructing the graph. Default is 5.

kernel

logical; if TRUE, uses a Gaussian kernel. Otherwise, uses a kNN binarized graph. Default is FALSE.

max_time

integer; the maximum diffusion time. The actual maximum diffusion time may be shorter if all genes converge beforehand. Default is 2^20.

adjust_bridge

logical; if TRUE, connects disconnected components of the graph using Minimum Spanning Trees. Default is TRUE.

self_loop

integer; the weight for self-connections. Default is 1.

score_correction

logical; if TRUE, adjusts the LMD profile by delta correction. Default is FALSE.

largeData

logical; if TRUE, uses functions optimized for large matrix multiplication. Default is TRUE.

highres

logical; if TRUE, uses fine time scales (0, 1, 2, 3, ...). If FALSE, uses dyadic time scales (0, 2, 4, ...). Default is FALSE.

min_cell

integer; removes genes expressing in fewer than this number of cells. Default is 5.

kernel_used

character; kernel type used when kernel = TRUE. Options are "Gaussian" or "SNN".

alpha

numeric; exponent used in the alpha-decaying Gaussian kernel

coef

numeric; coefficient for adaptive bandwidth. Default is 1.

epsilon

numeric; threshold below which edge weights are set to zero to sparsify the graph. Default is 1e-3.

graph.affinity

matrix; user-supplied cell-cell affinity matrix. If provided, feature_space and graph construction parameters are ignored.

Value

A list containing:

score_profile

data frame; the computed score profile for different diffusion times.

cumulative_score

numeric vector; the LMD score for each gene.