MEGATRON is a Python package to process and interactively visualize clonal trajectories and based on the idea of metaclones. Briefly, metaclones are groups of clones that share similar transcriptomic or epigenomic profiles across time points and developmental trajectories. Based on this grouping we can create consensus trajectories, i.e. trajectories that summarize similar clones with shared fates. We have tested this method on recent lineage tracing technologies (LARRY, CellTagging, and profiling of mitochrondial mutations in scATAC-seq) that simultaneously track clonal relationships and transcriptional or chromatin accessibility states.
MEGATRON also enables the dection of important genes or transcription factor binding events associated with each metaclone or diverging between two selected metaclones. Importantly, metaclones can partially overlap in the same embedding space, therefore potential enabling to discover of early events associated with cell fate not detacable by current discrete clusetering analyses.
pip install git+https://github.com/pinellolab/MEGATRONMegatron provides a variety of algorithms to compute distance between individual clonal trajectories. Each algorithm is designed to consider the dimensions provided and quantify distances between clonal trajectories. The specifics of each approach make some better suited for different data and explain the distribution of computational load each will require. Megatron will provide users with the option to attempt different algorithms to observe which is best suited for their unique data.
In the following sections, we will define how calculate the distance
As an initial naive solution, we first propose the centroids distance. Under this distance,
The Wasserstein distance relies on the 1-dimensional earth mover's distance (denoted as
For every dimension, this distance calculates
For all cells, the MNN distance first computes either a k-nearest neighbors graph or a radius graph from the embedding data (the parameters for k or exact radius should be provided by the user, although we provide sensible defaults). This neighbors network is then queried for all
We first calculate the fraction of
Geodesic distance is a graph-based method for calculating the distance between clones. It can leverage the temporal information (if such information is not available, cells are considered to be of the same timepoint). Geodesic distance consists of four major steps:
- building a connected k-nearest neighbor (KNN) graph. Briefly, cells are first over-clustered. Then an initial KNN graph is built on these clusters. To ensure that it is a connected graph, Kruskal’s algorithm is used to build a minimum spanning tree (MST) on the complete graph of these clusters. Finally, both the KNN graph and MST are combined to build a connected KNN graph;
- converting clones of cells into clones of nodes (clusters). Each clone will be represented by a set of nodes for the purpose of robustness and computational efficiency. For each node of each clone, the temporal labels of cells belonging to it will be preserved and the label of this node will be decided by a majority vote algorithm;
- searching for the peer nodes. Given a pair of clones, for each node of one clone, its peer node is defined as the nearest node of the closest timepoint from the other clone;
- calculating the final distance. For each node, Dijkstra's algorithm is used to compute the length of the shortest path from this node to its peer node. Within each timepoint, its distance is calculated as the sum of all nodes’ lengths divided by the total number of nodes; The final distance is calculated as the sum of each timepoint’s distance divided by the number of timepoints.
- Complete LARRY dataset (Lineage & RNA recovery)
- 130,887 cells across 5,864 clones
- Subset of LARRY
- 3,221 cells across 365 clones
- CellTagging
- 18,076 cells across 510 clones
- mtscATAC-CD34invitro
- 18,259 cells across 197 clones
