Skip to contents

compareTransitionMatrices computes distances between a list of transition matrices.

Usage

compareTransitionMatrices(
  matrix_list,
  SeuratObj,
  cells,
  group.by = "seurat_clusters",
  n_realisation = 1000,
  n_step = 1000,
  distance_metric = "KL"
)

Arguments

matrix_list

list of transition matrices to be compared.

SeuratObj

Seurat object. Considered only if csr_transitions is NULL.

cells

vector of cell identifiers corresponding to the row/column order in the transition matrices. (Assumed that all supplied transition matrices have exactly the same row/column ordering.)

group.by

column in the Seurat object metadata on which cells are grouped. (Default: 'seurat_clusters')

n_realisation

number of trajectories ('realisations') to be sampled from the Markov model defined using each transition matrix. (Default: 1000)

n_step

number of time-steps in each trajectory/realisation to be sampled. (Default: 1000)

distance_metric

the distance metric to be calculated. Either "KL" (for Kullback-Leibler divergence) or "JSD" (Jensen-Shannon divergence). (Default: "KL")

Value

A list of two entries:

distance

distance (distance_metric) between the trajectories sampled from each possible pair of transition matrix.

sampled_transitions

list of trajectories sampled from the transition matrices.

Details

compareTransitionMatrices takes the list of transition matrices given in matrix_list, and sample realisations from the Markov chain defined using the transition matrix. It then compares the similarity of these sampled trajectories using either the Kullback-Leibler divergence (distance_metric == "KL") or the Jensen-Shannon divergence (distance_metric == "JSD"). Both can be interpreted the same way (the larger this number, the more different two transition matrices and their realisations are), although the Jensen-Shannon divergence is scaled between 0 and 1.