Abstract
Understanding and comparing tumor evolutionary histories is fundamental to cancer genomics. Clonal trees, used to model tumor progression, are rooted, unordered trees in which each node represents a subclone labeled by a set of distinct mutations.
To compare two clonal trees, we introduce omlta, the optimal multi-label tree alignment, which removes the minimum number of mutation labels from the trees, so that the remaining trees are isomorphic. Computing omlta is NP-hard. Here, we present an algorithm to compute the omlta, with a running time of where is the total number of mutation labels occurring in the input trees and is the minimum possible number of mutation labels that need to be removed for the alignment.
Our implementation (https://github.com/algo-cancer/omlta) is the first computational tool for determining the optimal alignment between clonal trees. We applied omlta to 126 cases from the TRACERx study on non-small cell lung cancers and some melanoma single-cell data.
1. Introduction
A sequence - an ordered list of labels (characters/symbols) - is a fundamental data type in computational biology; in fact, aligning two sequences was among the very first computational problems tackled in biology (1; 2; 3). At its core, the sequence alignment problem asks to compute the maximum number of matching labels which appear in the same sequential order in both input sequences. In this form, sequence alignment corresponds to the longest common subsequence of the two input sequences. More generalized forms of alignment may give different weights to different aligned label pairs including mismatched labels.
The dual problem to sequence alignment is the edit distance, which can be defined as the minimum number of label deletions from the input sequences so that the remaining sequences are identical. This definition is equivalent to the more commonly used definition of the edit distance as the minimum number of label insertions and deletions to be applied to a sequence to transform it to another sequence. Another related measure, the Levenshtein edit distance, differs slightly by permitting label substitutions in addition to insertions and deletions (1). It is well known that one can compute the optimal alignment of two sequences in time quadratic with their length (2). Any algorithm that computes the sequence alignment, implicitly computes the edit distance as well.
Trees, another data type commonly used in computational biology, generalize sequences by allowing branching, e.g., to model evolutionary history. One can generalize sequence alignment to alignment of rooted, node-labeled unordered (i.e., sibling nodes in the trees have no left-to-right ordering), trees as follows. Given two such trees, the tree alignment problem seeks the maximum-size subset of labeled nodes that induce a pair of isomorphic trees after all nodes and labels not in the output tree alignment set are deleted from the two input trees.
In this work, we are interested in aligning the evolutionary histories of tumor cells, which are commonly represented by clonal trees of tumor progression. In a clonal tree, each node corresponds to a genetically distinct population of cells, referred to as a (sub)clone. Formally, a clonal tree is a node-labeled tree where (i) the sibling nodes are unordered, (ii) each node can be labeled with 0,1, or more mutations, and (iii) each mutation label appears once in the tree. The labels of a given node represents the set of mutations which were acquired for the first time by its corresponding (sub)clone - without homoplasy. This follows from the observation that independent acquisition of an existing mutation in the tumor by another cell is rare (4). For some algorithms on clonal trees, it is necessary to assume that the root has no mutation labels as it may correspond to a set of normal cells that predated any somatic alterations, but we do not make such an assumption.
Our main contributions.
We introduce omlta, the optimal multi-label tree alignment for a pair of clonal trees (as well as any other tree type where a node can have any number of labels, provided that each label in the tree is unique) as the alignment which deletes the minimum possible number of labels so that the resulting trees are isomorphic (subject to empty node removals and node expansions; see Section 4.1 for the formal definition). Because omlta identifies structural features (e.g., subtrees) shared between input trees, it can be employed for making robust biological inferences through the use of clonal trees inferred via different methods on the same input data, or using different data obtained from the same sample, or using different samples from the same tumor.
We provide the first algorithm to compute the omlta between two clonal trees and and an implementation. The running time of our algorithm is , where is the total number of distinct mutation labels in and , and is the value of the optimal multi-label tree edit distance (omltd) between and , i.e., the number of mutation labels deleted by omlta. We can assume that , so that is defined, because there would be no reason to construct a clonal tree for a tumor with no mutations. In our primary application, the trees and necessarily have the same mutation and label set, but that will not be the case for all uses of our method. Therefore, we point out that any mutation label occurring in exactly one of the two trees must be deleted as part of the alignment and hence must be at least as large as the symmetric difference of the two sets of mutation labels. This running time is polynomial when is bounded by a constant and hence we show that the omlta problem is fixed parameter tractable (FPT). Since we also show that computing omlta (and omltd) is NP-hard, an FPT algorithm such as ours is qualitatively the best one can hope for with respect to efficiency. (See Section 4 and the Supplementary Information for the algorithm and some running time analysis.) The exponential term, , in the running time of our algorithm is strictly better than the term in the running time of the state-of-the-art unordered tree edit distance algorithm for general (i.e., including, but not necessarily unique labeled) trees (5) where is the number of nodes.
We applied omlta to clonal trees inferred from both multi-sample bulk and single cell sequencing data. (a) On a cohort of 126 metastatic non-small cell lung cancer tumors from the TRACERx project (6), our algorithm could compute the omlta of clonal trees inferred by CONIPHER (7) (the method employed by the TRACERx project) and PairTree (8) (another popular method for clonal tree inference) on the same tumor quickly, often within seconds. We used omlta to assess the concordance between the trees inferred by these two methods, which we observed to vary substantially across the two major subtypes of NSCLC, namely LUAD (LUng ADenocarcinoma) and LUSC (LUng Squamous Cell carcinoma). Specifically, omltd values tend to be larger for the LUAD cases than the LUSC cases, implying that the trees inferred for LUAD cases are less reliable for downstream interpretation. Importantly we observed that omltd is negatively associated with the mean cancer cell fraction (CCF) among mutations in a tumor - implying that trees for tumors with lower CCF tend to be less robust to the choice of tree inference method. (b) Our algorithm could also efficiently compute the omlta of the clonal trees for the B2905 preclinical melanoma cell line (9) inferred (i) on data obtained by two distinct single cell sequencing technologies, or (ii) on data from the cell line before and after it was subjected to immunotherapy, or (iii) using different tree inference methods. As can be expected, the trees obtained from single cell data turned out to be more robust than those obtained from bulk data, even when the mutations were identified through transcriptome sequencing (see Section 2).
We also demonstrated the robustness of omlta/omltd compared to alternative similarity measures (see Sections A.6 and A.7). Our implementation is available at https://github.com/algo-cancer/omlta.
1.1. Related Works
Alignment Trees vs Consensus Trees.
While we provide the first clonal tree alignment algorithm, omlta is related to frequently studied consensus trees (10; 11; 12; 13; 14; 15). Given a set of input trees, the consensus tree is the tree that minimizes the sum of distances to each input tree. A key difference between consensus tree algorithms and tree alignments is that typically, in an effort to make runtimes tractable, the considered distance for a consensus tree often counts only parent-child or ancestor-descendant relationships as in (10; 11; 15) whereas alignment trees are derived from the dual problem of omltd (see Section A.7 for a comparison of omltd to other distance measures). A further difference is that consensus trees must include all shared mutations across all input trees. As a consequence, given two input trees, and , that are isomorphic except for the placement of a single mutation - located on node in and on its descendant in - the consensus tree may collapse all nodes between and into a single node, thereby losing the ancestor–descendant relationships among the associated mutations that and otherwise share (14). In contrast, the alignment tree contains precisely those mutations that agree in ancestor-descendant relationship and topological location such that the induced trees are isomorphic; e.g., the omlta of and above excludes but keeps all remaining mutations and their relative ordering.
Alternative Measures of Clonal Tree Similarity/Distance.
For clonal tree similarity, the closest measure to omltd in the prior literature is multi-label tree dissimilarity (MLTD) proposed in (16). However, MLTD allows only leaf label deletions. One feature of MLTD is an edit operation denoted node expansion, which replaces a chosen node by a linear chain of two or more nodes and distributes its mutation labels among the nodes in the chain. Both MLTD and omltd permit the node expansion operation free of cost since trees of tumor progression inferred through the use of different sequencing technologies and/or methods may have varying levels of granularity/coverage. For example, while trees inferred from bulk sequencing data usually contain fewer numbers of nodes with multiple mutations per node (17; 18), trees inferred from single-cell data can be as detailed as a fully resolved clonal tree, also known as a mutation tree, containing only one mutation label per node (19; 20). By allowing node expansions at no cost, MLTD (and omltd) compute the similarity between clonal trees while reconciling such differences between them without penalty. The algorithms for computing MLTD and omlta can be modified to charge a penalty for this operation; they can also be modified to forbid node expansions, without any increase in asymptotic runtime.
In (16), the general tree edit distance was noted to be NP-hard, and MLTD was offered as a restricted but practical variant, solvable in polynomial time. Later in (20), a different version of the tree edit distance, between a clonal tree (representing an inferred phylogeny) and a mutation tree (where each node is assigned a single unique label) was considered and reduced to the general tree edit distance problem. Our algorithm for omltd is the first efficient solution to the unordered tree edit distance problem for two clonal trees allowing general node deletions and node expansions.
There are other measures of similarity based on the relative placement of labels, especially for species trees, including the well-known Robinson-Foulds distance (21). Because in species trees only the leaves are labeled - each with a single label representing a species, the measures defined to compare species trees are not commonly used to compare clonal trees (22). We include one such distance in our later comparisons, namely the Bourque distance (23), which is a generalization of Robinson-Foulds for clonal trees. Other approaches for comparing clonal trees (22; 24) are not based on a single measure but use a complementary pair of measures (e.g., ancestor-descendant and different-lineage measures). Furthermore, they lack the concreteness of the similarity evidence provided by the tree alignment itself. See Section A.6 for a detailed description of these similarity measures and Section A.7 for their comparison with omltd on simulated data.
Available Algorithms for Tree Edit Distance.
The dual problems of tree alignment and tree edit distance, first proposed by (25), have been studied in many contexts. For rooted, ordered trees, several polynomial-time approaches have been developed (26; 27; 28; 29), and the state-of-the-art is a sub-cubic polynomial time algorithm (30). Computing the alignment and edit distance between unordered trees (such as clonal trees) however is NP-hard (31). Several works in the literature have proposed various workarounds to avoid intractable computation times for unordered tree edit distance (5; 32; 33; 34; 35). On the theoretical side, some families of trees which admit polynomial-time solutions have been identified and several fixed-parameter tractable algorithms have been proposed. Akutsu et al. (5) provided an -time dynamic programming solution for unordered tree edit distance where the is the actual tree edit distance of the input trees and is the size of the input trees. Additionally, they showed that there is a polynomial-time solution when the maximum degree of the input trees is constant. The runtime and setting of (5) is most similar to our own; we provide an in-depth discussion of it and other theoretical unordered tree edit distance literature in Section A.1.
Alignment Tree vs Maximum Agreement Subtree.
The omltd problem we study is also related to a well-studied problem called the Maximum Agreement Subtree problem (36; 37; 38). To our knowledge, this problem has been rarely studied in the context of cancer (39), but it has several non-cancer biological applications in its own right. We discuss in Section A.2 why the tree alignment and maximum agreement subtree problems are distinct and why algorithms for maximum agreement subtree do not transfer to our setting.
2. Results
We present applications of omlta to multi-sample bulk sequenced (bWES) lung cancer and single-cell sequenced (SCS) melanoma data sets. Additional results on simulated data (Section A.7), runtime (Section A.8), and a comparison of omltd to other measures (Sections A.6 and A.7) are available in Supplementary Materials.
2.1. Application to bWES trees: TRACERx non-small cell lung cancer cohort
Dataset and experimental setup
Al Bakir et. al presented clonal trees inferred for a cohort of n=126 metastatic non-small cell lung cancers (NSCLC) from the TRACERx project (6). The cohort includes both lung adenocarcinoma (LUAD) and lung squamous cell carcinoma (LUSC) cases (Fig. 3a). For each case, multiple spatially distinct samples from both primary and metastatic sites were subjected to bulk whole exome sequencing (bWES). The mutations in each case were clustered using PyClone (40) with some additional pre-processing (e.g., for removing “biologically improbable” clusters) and a clonal tree was inferred on these clusters using CONIPHER (7). Briefly, CONIPHER executes topological search through first performing subgraph pruning, then exhaustive enumeration and scoring of remaining trees towards finding an optimal-scoring solution. Several alternative models, objectives, and inference methods can, however, yield different tree reconstructions. Previous work (7) attempted to explore this variability by comparing the CONIPHER inferred tree for a single case from the NSCLC cohort to those inferred by three alternative methods, namely PairTree (8), CITUP (17), and LICHeE (41), and assessing the level of their similarity. However, since no method for tree alignment was available at that time, the study did not identify where the trees agreed exactly.
Figure 3:
a. Metastatic tumors from the TRACERx NSCLC cohort, consists of 56 LUAD cases and 36 LUSC cases; the cohort also includes an additional 24 cases of other subtypes and 10 cases with no subtype annotation. b. For each case, omlta between the trees inferred by CONIPHER and PairTree was obtained and their concordance was measured as the proportion of robust mutational placements, i.e., 1 - omltd/number of mutations. The panel depicts all cases with a subtype annotation (only a subset of cases are labeled explicitly due to limited space) sorted based on the concordance values: LUSC cases tend to have higher concordance values and thus are more robust. c-d. A comparison between the distribution of LUAD and LUSC cases with respect to c concordance values, and d mean CCF of the mutations harbored: both distributions reveal a significant difference between the two subtypes. e. Pearson correlation between the mean CCF and tree concordance values among LUAD and LUSC cases: higher mean CCF values among LUSC cases may explain why their inferred trees tend to have higher concordance. f-g. For the two NSCLC subtypes, f LUAD and g LUSC, scatterplots show the number of cases in which a gene is mutated (y-axis) against the number of cases in which a mutation within that gene has discordant placement between CONIPHER and PairTree trees (x-axis). Genes with known “role in cancer” (in orange) are shown separately from genes with no putative role (in gray). The points for outlier genes are labeled to the extent that labels could be added without overlaps.
Here, we use omlta on all 126 metastatic NSCLC cases to align each tree obtained by CONIPHER to those by PairTree - the most recently developed method among the three alternative approaches employed in the original study, which was also reported to differ from CONIPHER the most (7). On simulated data, it was reported that CONIPHER agreed best with CITUP - with LICHeE being a close second (7). These two tools are now more than 10 years old and CONIPHER was developed to address their limitations, especially with respect to scalability: e.g., the number of mutation clusters that could be handled by CITUP is restricted to 10 and many of the cases in the TRACERx cohort have larger number of clusters.
We provide an in-depth exploration of the concordance between these two methods and the robustness of the clonal trees reported by the TRACERx NSCLC study (6). PairTree is methodologically distinct from CONIPHER as it performs sampling to search through the space of trees for maximizing the posterior probability of mutation pairs with ancestor-descendant relationship. For each case in the cohort, the input we provided to PairTree was exactly the same set of mutational clusters used for CONIPHER. Then we used PairTree to obtain the top 10 trees with the highest reported likelihood, and aligned each tree with that obtained by CONIPHER via omlta, to identify the tree with the lowest “discordance”, defined as the omltd normalized by the number of mutations observed in the tumor, for further consideration. Our choice to compare the PairTree tree that had the smallest omltd to the corresponding tree inferred by CONIPHER was to give the most favorable outcome to both tools; even in comparing the most similar trees between these methods, they still differ substantially.
See Fig. 1 for an example tumor with the top 10 trees obtained by PairTree, their pairwise discordances, as well as their discordances with the CONIPHER tree. As shown, the 10 trees inferred by PairTree differ not only from the tree obtained by CONIPHER but also from one another. These 10 trees appear to form two distinct clusters, within which the discordance among trees is lower than that between clusters: {3,4,5,7,8,10} and {1,2,6,9}. The latter cluster also exhibits lower discordance with the CONIPHER tree.
Figure 1:
For each of the 126 metastatic NSCLC cases in the TRACERx cohort (6), we used PairTree to obtain an alternative tree to that reported by CONIPHER on the same set of mutational clusters employed by CONIPHER in the original study. a. First, for each case, all PairTree produced trees were evaluated and the top 10 trees according to their reported likelihood were identified: the left panel depicts the top 10 trees for case CRUK0412 (out of 1795 trees sampled by PairTree) - on each node, the number of mutations in the cluster assigned to that node is provided. The right panel depicts the discordance between each pair of trees - defined as the omltd normalized by the total number of mutation labels. b. Next, each of the top 10 PairTree trees for each case is aligned with the CONIPHER tree, and the one with the lowest discordance is identified. The panel shows for case CRUK0412, the discordance between each PairTree tree and the CONIPHER tree. Since, with respect to its reported likelihood, tree 2 has the lowest discordance, it is identified as the PairTree alternative for this case.
Inferred topological structures and their biological implications vary among alternative tools
CONIPHER and PairTree inferred trees vastly differ in their overall topology (Section A.4). Using the average node depth of a tree (more precisely, - where is the depth of a node ) as a measure of “tree imbalance” (42), we found that CONIPHER trees are significantly more imbalanced than the corresponding PairTree trees (Wilcoxon signed-rank test, ; Fig. 2b). This is likely due to CONIPHER‘s subgraph pruning approach, which strongly preserves the nested structure of mutational clusters and thereby favors imbalanced trees. In contrast, PairTree‘s sampling-based approach imposes less stringent hierarchical constraints.
Figure 2:
a. Distribution of mutations across the metastatic NSCLC cases from the TRACERx cohort. Top panel: a mutation is either in a gene with a “putative role in cancer” (i.e., is a oncogene or tumor suppressor - colored orange) or with “no putative role in cancer” (colored gray). Orthogonally, the placement of the mutation is either concordant (i.e., is preserved in the omlta of the trees inferred by CONIPHER and PairTree for the case - solid color) or discordant (i.e., is deleted in the omlta - shaded color). The proportion of discordant mutations are higher among those in genes with a role in cancer. Bottom panel: the proportion of concordantly placed mutations among tumor suppressor genes are similar to that among oncogenes. b. For any given case, the “imbalance” of a clonal tree, measured as the mean node depth (distance from the root), is typically higher if inferred by CONIPHER. E.g., for case CRUK0337, the imbalance of the tree inferred by CONIPHER is 3, but the imbalance of the tree inferred by PairTree is 1.625. (Blue nodes in the trees represent the mutational clusters preserved in their omlta.) c. The inferred timing of metastatic branching (6) differs between the CONIPHER and PairTree trees for case CRUK0733. Left panel: In the CONIPHER inferred tree, the metastatic branching is characterized as “late” whereas in the PairTree tree for the same case, it is characterized as “early”. Middle panel: The timing of metastatic branching differs significantly between CONIPHER and PairTree trees: PairTree typically places the metastatic branching closer to the root. Right panel: The number of cases for which CONIPHER and PairTree agree/disagree with respect to the timing of metastatic branching; additionally, the timing of the metastatic branching based on omlta trees (given in parentheses) agree with CONIPHER more often.
Topological differences can substantially affect biological interpretation. For example, analysis of the structure of subclones in a cancer may guide combination therapy (43) and may yield insights about changes in the rate and types of mutations in later (lower in the tree) subclones (44; 45). For these data, the TRACERx NSCLC study (46) classified each metastatic branching (i.e., seeding) event as either “early” or “late” based on whether mutations “clonal” across primary tumor samples were respectively absent from (early) or shared with (late) the corresponding metastatic sample. Hong and colleagues first showed that different methods of tumor phylogenetic inference on the same input data can yield different interpretations about metastasis in a patient (47). While the study did not differentiate mutations with respect to their clonality beyond whether they are present (or not) in all primary samples, one can use the inferred clonal tree to categorize all mutations that are on the trunk of the tree, i.e., prior to any branching within the primary tumor, as “clonal”. This allows a more refined temporal characterization of metastatic branching events (as early vs. late clonal) based on the node on the trunk of the tree for the primary tumor from which the metastatic sample branches out. (See, e.g., Fig. 2c, left panel). In trees inferred by PairTree, metastatic branching typically occurs closer to the root compared to trees inferred by CONIPHER (Fig. 2c, middle panel). There are 59 cases where metastatic branching would be characterized as ‘late’ using CONIPHER trees but would be characterized as ‘early’ using PairTree trees. A more robust characterization is possible via the alignment trees: omlta trees characterize 47 of these 59 cases as late (in agreement with CONIPHER) and characterize the remaining 12 as early (in agreement with PairTree). Interestingly, an additional six cases characterized as ‘early’ by CONIPHER are characterized as ‘late’ by PairTree; the omlta classification agrees with PairTree in all six. There are two remaining cases which were not characterized as ‘early’ or ‘late’ by by PairTree because their trees had no metastasis specific branch from the trunk of the tree. (Fig. 2c, right panel; see Supplementary Table S1 for details.)
Robustness of mutational placement in clonal trees vary across tumors
We investigated mutational placements that are robust to the choice of inference method by aligning trees obtained from the same case by CONIPHER and PairTree. Pairwise alignment is a label-preserving bijection between subsets of vertices of two labeled trees that induces isomorphic subtrees on the set of preserved labels while minimizing the number of omitted labels. For clonal trees, preserved and omitted mutational labels respectively correspond to ‘concordant’ and ‘discordant’ mutational placements.
We used omlta to quantify the robustness of mutational placements between trees inferred by CONIPHER and PairTree on each tumor from the TRACERx dataset (6; 46). When stratified by histological subtype of NSCLC, the trees obtained by CONIPHER and PairTree exhibited significantly higher discordance for LUAD cases than LUSC cases (Mann-Whitney U test, ; Fig. 3b and 3c). To identify the basis of this difference, we first considered the cancer cell fraction (CCF) of mutations across the cases of each subtype. We observed that LUAD cases typically harbor a larger fraction of low CCF (typically subclonal) mutations than LUSC cases; e.g., in several LUAD cases more than half of all mutations had CCF ≤ 0.3 (See Supplementary Fig. S5, top panel). This was consistent with the findings of the TRACERx study (46): “in LUAD, the majority of frequently mutated cancer genes were subject to significant positive subclonal selection … no significant positive selection was detectable in truncal mutations.”
Next, we explored whether topological differences between the trees inferred by either method, as well as the omlta trees can explain the differences between LUAD and LUSC cases. For any given case, the tree inferred by CONIPHER was typically more imbalanced than the tree inferred by PairTree - with their omlta falling in between. However within the trees inferred by each method (CONIPHER, PairTree or their omlta), the imbalance distribution for LUAD cases was similar to that for LUSC cases. (See Supplementary Fig. S6.) Likewise, the imbalance difference between the CONIPHER tree and the PairTree tree is distributed similarly among LUAD cases and LUSC cases.
The concordance between the trees inferred by CONIPHER and PairTree for a given case is strongly associated with the subtype (Mann-Whitney U test, ; Fig. 3c); however, this association can be attributed to LUAD cases harboring a higher proportion of low CCF mutations (Mann-Whitney U test, ; Fig. 3d), which are typically subclonal. In fact, there is a strong association between mean CCF and tree concordance (Pearson’s Correlation coefficient = 0.78, ; Fig. 3e). While it is possible to infer the temporal ordering of clonal mutations robustly, the placement of a subclonal mutation may differ among inference methods, especially if they are based on different assumptions and parameter settings. As a result, cases with higher mean CCF appear to be more robust to the choice of tree inference method.
Robustness of mutational placement in clonal trees vary among genes with distinct roles in cancer
Next, we evaluated the robustness of mutational placements according to the known roles of the genes harboring them in the context of cancer. The genes that harbor these mutations are annotated using a combination of two cancer gene censuses, Catalogue Of Somatic Mutations In Cancer (COSMIC) (48) and OncoKB (49; 50). Below, we refer to mutations by their genes and do not distinguish different mutations in a case - primarily for compactness of display. If a gene harbors more than one mutation in a case, we regard the gene as having unstable placement if any of its mutations were deleted from the omlta.
An earlier study from the TRACERx consortium showed that driver mutations among such consensus cancer genes are typically clonal - with exceptions (51). On the other hand the CONIPHER tool used in the TRACERx NSCLC study does not utilize annotations of genes harboring the mutations in their placement. Thus, we perform a post-hoc analysis of the placement of mutations harbored by genes with a role in cancer.
Genes previously characterized as an oncogene and/or tumor suppressor gene, or as a gene fusion are collectively referred to as genes having a ‘role in cancer’ and are distinguished from those with ‘no putative role’ in tumor initiation, proliferation, or metastasis. In aggregate, 56.9% of genes (3.4% ‘role in cancer’ and 53.5% ‘no putative role’) had discordant inferred placements in at least one case in the NSCLC cohort. It is expected that genes which implicated in tumor progression are associated with clonal expansion—implying that all topological orderings that include such mutations should consistently assign them to more clonal nodes in a tree, and thereby be robust across multiple solutions. Yet such genes exhibited discordant mutational placement between trees in our comparisons with a 1.65-fold higher rate than other genes. Specifically, genes with a ‘role in cancer’ had disproportionately more discordant placements between trees (discordant:concordant ratio of 2.13:1; 3.4% vs 1.6%) compared to genes without an established functional role in cancer (discordant:concordant ratio of 1.29:1; 53.5% vs 41.5%). There was not a discernible difference in the relative number of discordantly placed genes between oncogenes and tumor suppressor genes (Fig. 2a).
Subsequently, we examine whether frequently mutated genes have robust inferred mutational placements. As can be expected, the number of cases in the TRACERx cohort in which a mutated gene is discordantly placed by PairTree and CONIPHER (i.e., the x-axes in Fig. 3f,g) increases with the number of cases in which that gene is mutated (i.e., the y-axes in Fig. 3f,g). Furthermore, commonly mutated genes with a role in cancer (colored orange) are as likely (about one in four) to be discordantly placed as other commonly mutated genes (colored gray). A subset of these genes likely represent key mutations in lung cancer. Interestingly, TP53 which is commonly mutated in NSCLC cases is not often placed discordantly (it was placed discordantly in only 6/89 cases) possibly because it is typically mutated clonally.
A key purpose of inferring clonal trees is to aid oncologists in designing combination therapies such that each major subclone is treated. Among the commonly mutated genes labeled in Fig. 3f,g, somatic mutations in several genes have been associated with response to different treatments. For example, presence of a mutation in either MUC16 (52) or LRP1B (53; 54) is directly associated with better response to immune checkpoint blockade. Such associations with treatment response make correct placement of subclonal mutations essential to suggest how immune checkpoint inhibitors should be combined with targeted therapies to target subclonal variations in disjoint subtrees (43). Several of the genes labeled in Fig. 3f,g have been shown to be associated with higher tumor mutational burden (TMB) including LRP1B, TP53, CSMD3, MUC16, RYR2, TTN, but not KRAS (55; 56). The associations with high TMB for RYR2 and TTN, which are not among the cancer related genes in COSMIC or OncoKB, serve as a reminder that these curated sources have very strict rules for which genes are classified as having a role in cancer, but including other genes in tumor phylogenetics analysis has value.
The quest to identify subtrees that have gained a ”mutator phenotype” (57) with a particular high rate of some types of mutations, such as microsatellite instability (58; 59), was one of the motivating problems for the field of tumor phylogenetics at its inception at the end of the 20th century (59). Therefore, the association with high TMB for certain mutated genes above is important to test assumptions about which subtrees have low or high mutation rates. The association with high TMB is also important clinically since higher TMB also predicts response to immune checkpoint inhibitors, as indicated by the pan-cancer FDA approval of immune checkpoint blockade to treat any cancer that has TMB greater than 10/Mbp. Correctly placing in clonal trees the (mutated) genes associated with higher TMB is also useful because the subtrees with these mutations at the root likely have a distinct, higher mutation rate (44). For these gene-specific and general reasons, the discrepant placement of the labeled genes such as MUC16, as compared to TP53, limits what can be robustly inferred from the clonal trees for some patients in the TRACERx NSCLC dataset. For those patients and samples for which CONIPHER and PairTree agree on the placement of these frequent mutations, more robust inferences about tumor progression can be made.
2.2. Application to SCS trees: B2905 preclinical melanoma model
We applied omlta to tumor progression trees inferred from three sequencing datasets of tumors derived from the B2905 cell line, a murine model of UV-induced, RAS-mutated human melanoma (9): (i) a bulk whole exome sequencing (bWES) dataset of 24 single cell derived sublines, (ii) a bulk whole transcriptome sequencing (bWTS) dataset of the same 24 sublines, and (iii) three single-cell whole transcriptome (scWTS) datasets described in (14). We discuss the omlta between trees derived from these datasets below.
Aligning trees for 24 single cell derived sublines individually sequenced using bulk methods
Our first set of experiments are on bulk sequencing datasets. As described in detail below, we (i) compare a pair of trees, each reconstructed using a distinct tree inference method applied to the the same bulk sequencing dataset, and also (ii) compare a pair of trees, each reconstructed by the same tree inference method, applied independently to two distinct datasets, which were both obtained from the same tumor.
The bWES dataset consists of 24 single-cell-derived sublines, each sequenced independently, featuring a total of 1689 mutations. Each of the 24 sublines was derived from an isolated single cell from the parental cell line and grown in vitro, and represents a genetically homogeneous cell population. As such, the 24 sublines represent an idealized, high coverage version of whole exome sequencing data from 24 single cells. Formally, the input genotype matrix representing the bWES dataset consists of 24 rows, each representing a single subline, and 1689 columns, each representing a mutation observed in one or more of the sublines. Each entry of the binary matrix indicates the absence or presence of a mutation in a subline.
We applied to the bWES dataset two computational methods for inferring trees from single-cell sequencing data: ScisTree (60) (see Fig. 4a for the tree inferred by ScisTree) and SCITE (19) (see Fig. 4b for the tree inferred by SCITE). While these methods are methodologically similar, they exhibit some key differences in their tree-scoring strategies and in the approaches they employ for exploring tree space. Neither ScisTree nor SCITE provides a theoretical guarantee of optimality within a specified time.
Figure 4:
Comparison of trees reconstructed from bWES data consisting of 24 sublines and 1689 mutations by the use of a ScisTree (60) and b SCITE (19). Each non-root node (clone) is labeled by the number of mutations occurring for the first time at that node. When aligning these trees, omlta removes 29 mutation labels. Numbers shown in red next to the nodes indicate the number of mutations deleted from those nodes. c. The omlta tree between the trees shown in a and b. The green arrows point to the same mutational cluster across all trees.
The alignment between the trees inferred by ScisTree and SCITE on the same input dataset demonstrate high topological concordance in terms of mutational ordering, with only a few mutation label deletions (29 out of 1689). The main difference between the two trees is in the placement of matching nodes each with (the same set of) 69 mutations. In the tree shown in Fig. 4a, the 69 mutations are labels in the right child of the root, while in the tree shown in Fig. 4b, the 69 mutations are in the root’s left child’s subtree; these are indicated by green arrows). To maximize concordance, omlta removes those mutations that are on the path from the root to the node with these 69 mutations in the tree shown in Fig. 4b - although these mutations are concordantly placed in the two trees–enabling the retention of the larger set of 69 mutations in the alignment tree.
Next, we compared trees reconstructed using the same method on distinct sequencing datasets, each derived from the same parental cancer cell line. We conducted two experiments, differing in the sets of mutations used for tree inference, as explained below. The first sequencing dataset used in these experiments is the bWTS dataset, consisting of 11 sublines in which 536 mutations were detected. Each of these 11 sublines was also sequenced using bulk whole-exome sequencing; i.e., these 11 sublines are included in the bWES dataset described above. To allow for a direct comparison, we restricted the bWES dataset to the 11 sublines common to both bWTS and bWES datasets, obtaining the reduced-bWES dataset, consisting of 11 sublines and 1420 mutations.
In principle, the bWTS and reduced-bWES datasets differ technologically in sampling depth and sequencing noise, which may potentially result in discrepancies in the inferred ancestral relationships between mutation pairs across their respective trees. To demonstrate that our omlta algorithm can effectively reconcile trees derived from sequencing data collected by different wet lab methods, we conducted two experiments. The first experiment was on trees inferred using the restricted set of mutations common to both the BWTS and the reduced-bWES datasets. The second experiment was on trees inferred using the mutations observed in either dataset.
The set of mutations observed in both bWTS and reduced-bWES datasets contains only 92 mutations. Due to this reduced size, we were able to use a tree inference method with optimality guarantee, namely PhISCS (20), to build the trees. The omltd between the bWTS (Fig. 5a) and reduced-bWES (Fig. 5b) trees (both on 11 sublines and 92 common mutations) had a notably low value of 12, due to 6 mutation label deletions in each tree. The omlta tree (Fig. 5c) features the maximal set of concordant mutations across bWTS and reduced-bWES trees. If a pair of mutations are not ordered in one input tree, due to being labels of the same node, while the mutations appear in different nodes in the other input tree, then the order implied by the latter input tree is featured in the output alignment tree. As such, omlta can resolve the temporal ordering of each retained mutation pair assigned to the same node in exactly one input tree by using the mutation ordering in the other input tree, potentially producing an output tree with higher resolution than either input tree.
Figure 5:
Comparison of clonal trees reconstructed by PhISCS (20) from (a) bWTS and (b) reduced-bWES data, each with 11 sublines, featuring a total of 92 mutations common to both datasets. Each non-root node (clone) is labeled by the number of mutations occurring for the first time at that node. When aligning these trees, omltd reports 6 mutation label deletions - numbers shown in red next to the nodes indicate the number of mutations deleted from those nodes. (c) The omlta alignment tree between the trees shown in and .
As a companion to the analysis of bulk sequencing melanoma trees built by PhISCS, we built trees with the complete set of mutations observed in either bWTS (11 sublines, 536 mutations) and reduced-bWES (11 sublines, 1420 mutations) datasets. Since tree inference methods with an optimality guarantee, such as PhISCS, can not handle 1420 mutations, we employed ScisTree for tree inference. The omlta alignment tree between the bWTS tree (Figure 6a) and the reduced-bWES tree (Figure 6b) is shown in Figure 6c. Focusing on the 92 mutations shared between the bWTS and reduced-bWES trees (as the other mutations are necessarily excluded from the alignment tree), we observe that only 6 of these 92 mutations are not included in the alignment tree–concordant with the alignment between the bWTS and reduced-bWES trees inferred on mutations common to both datasets (see Fig. 5).
Figure 6:
Comparison of clonal trees reconstructed by ScisTree (60) on a bWTS (11 sublines and 536 mutations) and b reduced-bWES (11 sublines and 1420 mutations) data. Each non-root node (clone) is labeled by the number of mutations occurring for the first time at that node. In addition to the mutations present in only one of the two trees, when aligning these trees, omlta also reports 6 mutation label deletions in each of them - numbers shown in red next to the nodes indicate the number of mutations deleted from those nodes. c. The omlta alignment tree between the trees shown in a and b.
The comparisons of trees built with PhISCS and ScisTree demonstrate that the tree reconstructed from bulk transcriptome data closely resembles that of the tree inferred from the bulk exome data obtained from the same set of sublines. Notably, the omltd for PhISCS-built trees on mutations shared between the two datasets is equal to that for ScisTree-built trees on the complete set of mutations observed in each dataset. This demonstrates that ScisTree, a method with no optimality guarantees, produced results on a larger set of mutations that are comparable to those produced by an optimal tree reconstruction method, PhISCS, on a restricted set of mutations - providing a strong support for trees built by ScisTree on these datasets. In fact, the subtrees induced on the set of common mutation labels for the reduced-bWES trees built by PhISCS (Fig. 5b) and ScisTree (Fig. 6b) are isomorphic and the corresponding bWTS trees (Fig. 5a and Fig. 6a) have only two differently placed mutations (not shown).
Reconciling trees reconstructed from single-cell RNA sequencing datasets
We subsequently evaluated the trees built from single-cell datasets derived from the same parental cancer cell line. For that, we used two datasets from a preclinical study related to the impact of immunotherapy on intratumoral heterogeneity and subclonal evolution. Specifically, cells from the B2905 melanoma cell line were subcutaneously implanted into six syngeneic mice randomized to two groups corresponding to different treatment settings, mouse anti-CTLA-4 antibody treated (“Treated”, 4 mice) and mouse IgG2b as isotype, negative control (“Control”, 2 mice). Cells from each tumor were sequenced using the Smart-seq2 protocol (61) to generate single-cell, full-length transcript reads, resulting in our smartseq-treated and smartseq-control datasets comprising 508 and 163 cells, respectively. Application of omlta on these trees may offer insights into subclones and mutations they harbor which may have undergone immunoediting. In particular, if a node in the smartseq-control tree is missing from the smartseq-treated tree but its parent node is retained, then the subclone defined by that node may have been selectively eliminated by the immune system. Such a deletion points to a set of mutations which may induce neoantigens recognizable by the immune system.
We inferred clonal trees from these mutational profiles by the use of ScisTree (60)—for both the control and treated tumors; these trees are presented in Fig. 7a. Additional details related to clustering and parameters for tree inference are provided in Section A.5 of Supplementary Material. The topological differences between the true clonal trees for control and treated tumors would imply anti-CTLA-4 therapy induced immunoediting, as they correspond to the negative selection against subclonal mutations.
Figure 7: Tumor progression trees inferred by ScisTree on scRNA data from a preclinical study of anti-CTLA-4 immunotherapy for melanoma.
a. Tumor progression trees inferred by ScisTree from smartseq-control data (“Control-tree”, left) and smartseq-treated data (“Treated-tree”, right). The clonal trees are labeled by the number of mutations that were inferred to have been acquired for the first time in the evolution of the tumor for each node/subclone. Based on shared mutations labeled at the root of each subtree, there are three major clades (B3, B4, and B5) that were previously identified in (14) and are colored accordingly. b. An optimal alignment between Control- and Treated-tree, “Alignment-tree”, as determined by computing omltd. The clonal tree is labeled by the number of common mutations with concordant placement between Control- and Treated-trees.
The resulting Control-tree was built on 24 clusters with 740 mutations, while the Treated-tree was built on 25 clusters with 1518 mutations; see Figure 7a. The number of mutations common to both trees was 583, among which 333 were deleted to obtain the omlta, i.e, the alignment tree obtained from these clonal trees featured 250 mutations, as presented in Figure 7b. Notably, the omlta exhibits a more “linear” topology than either clonal tree, primarily preserving a specific lineage from each of the three major subtrees (colored orange, purple and blue) observable in both the Control-tree and the Treated-tree. This indicates that, while the major clade structure is preserved between the Control-tree and the Treated-tree, the exact placements of mutations differ substantially. This is not surprising since clonal tree inference from these datasets is substantially more challenging than that from the bulk sequencing datasets not only because individual cells were sampled from highly heterogeneous tumors but also the read coverage on mutational loci was highly variable across cells.
In a final experiment, we compared tumor progression trees inferred exclusively from the control tumors, where each cell was sequenced using one of the two distinct single-cell RNA sequencing protocols: 163 single cells were sequenced using the Smart-seq2 protocol, forming our smartseq-control dataset. An additional 163 single cells were sequenced using the Seq-Well protocol (62) forming our seqwell-control dataset (see (14) for details). In Figure 8a, we present the trees we inferred for the two datasets, and in Figure 8b, we show their corresponding alignment tree. The omltd of these two trees and additional comparisons of trees reconstructed using different clustering criteria are provided in Tables 1 and 2.
Figure 8: Tumor progression trees inferred by ScisTree on scRNA data from control tumors sequenced by Seq-Well and Smart-seq2.
a. Tumor progression trees inferred by ScisTree from seqwell-control data (“Seq-Well”, left) and smartseq-control data (“Smart-seq2”, right). The clonal trees are labeled by the number of mutations that were inferred to have been acquired for the first time in the evolution of the tumor for each node/subclone.
b. An optimal alignment between Seq-Well and Smart-seq2 tree, “Alignment tree”, as determined by performing omlta. The clonal tree is labeled by the number of common mutations with concordant placement between Seq-Well and Smart-seq2 trees.
Table 1:
Pairwise comparisons of clonal trees reconstructed by the use of ScisTree from control and treated tumors sequenced by Smart-seq2. The omltd/2 for each pair of trees is provided; specifically, this is the number of labels that are deleted from one of the two trees.
| Clusters (S=n) | Min. cells | Control | Treated | Common Mutations | omltd/2 | ||
|---|---|---|---|---|---|---|---|
| per cluster | mutations | clusters | mutations | clusters | |||
|
| |||||||
| 100 | 15 | 490 | 3 | 995 | 3 | 361 | 196 |
| 100 | 14 | 554 | 4 | 1122 | 4 | 426 | 248 |
| 100 | 13 | 554 | 4 | 1122 | 4 | 426 | 248 |
| 100 | 12 | 628 | 6 | 1304 | 6 | 505 | 306 |
| 100 | 11 | 699 | 9 | 1376 | 9 | 551 | 335 |
| 100 | 10 | 705 | 10 | 1393 | 10 | 554 | 338 |
| 100 | 9 | 720 | 15 | 1448 | 15 | 569 | 326 |
| 100 | 8 | 740 | 24 | 1518 | 25 | 583 | 333 |
| 100 | 7 | 741 | 30 | 1531 | 33 | 584 | 355 |
Table 2:
Pairwise comparisons of clonal trees reconstructed by the use of ScisTree from replicate control tumors sequenced by Smart-seq2 and Seq-Well protocols (min. cells per cluster is 1). The omltd/2 for each pair of trees is provided; specifically, this is the number of labels that are deleted from one of the two trees.
| Clusters (S=n) | Seq-Well | Smart-seq2 | Common Mutations | omltd/2 | ||
|---|---|---|---|---|---|---|
| mutations | clusters | mutations | clusters | |||
|
| ||||||
| 5 | 978 | 4 | 1025 | 5 | 978 | 136 |
| 6 | 983 | 5 | 1025 | 6 | 983 | 78 |
| 7 | 983 | 6 | 1025 | 7 | 983 | 72 |
| 8 | 983 | 6 | 1025 | 8 | 983 | 119 |
| 9 | 984 | 7 | 1025 | 8 | 984 | 311 |
| 10 | 994 | 8 | 1025 | 9 | 994 | 182 |
| 11 | 994 | 8 | 1025 | 10 | 994 | 365 |
| 12 | 994 | 9 | 1025 | 10 | 994 | 389 |
| 13 | 994 | 9 | 1025 | 11 | 994 | 395 |
| 14 | 995 | 10 | 1025 | 10 | 995 | 395 |
| 15 | 995 | 10 | 1025 | 12 | 995 | 430 |
| 16 | 995 | 11 | 1025 | 12 | 995 | 476 |
| 17 | 1000 | 12 | 1025 | 13 | 1000 | 501 |
| 18 | 1001 | 13 | 1025 | 14 | 1001 | 523 |
| 19 | 1001 | 13 | 1025 | 14 | 1001 | 606 |
| 20 | 1001 | 14 | 1025 | 16 | 1001 | 533 |
A key difference between the trees obtained for single-cell sequencing data and those obtained for single-cell-derived subline bulk sequencing data is that omltd values for the former are much higher; up to two-thirds of the mutation labels shared between the aligned trees may need to be deleted. This is partially because of sampling variability. While the single-cell-derived sublines are fixed (with each subline being well-represented in its respective bulk sequencing dataset), each single-cell dataset is comprised of distinct cells possibly representing distinct cell populations with many distinct mutations. Data sparsity plays a role as well, with many mutational loci not covered by even a single read in certain cells. In addition, pre-clustering of cells could add noise to tree inference process.
Despite these challenges, the omlta alignment between the single-cell trees retains a substantial number of mutations, reflecting that single-cell trees can provide reliable information about the temporal ordering of mutations and the branching patterns leading to distinct cell lineages. The lineages preserved in the omlta tree can be robustly leveraged in downstream analyses, such as integrating mutation profiles with gene expression data in single cells to identify potential associations. Perhaps more importantly, these experiments demonstrate that our omlta algorithm remains practical and effective even in the presence of extensive mutation label deletions in large single-cell trees, highlighting its practical utility.
3. Discussion
Robust tumor phylogeny inference remains fundamentally constrained by the limitations of current sequencing technologies and analytic approaches. Regarding sequencing technology, multi-sample bulk data often lack the resolution needed to unambiguously place key mutations, while single-cell sequencing suffers from substantial sparsity and technical noise that impede confident reconstruction of clonal relationships. Regarding analytical methods, there are different software methods for inferring clonal trees and mutation trees. Moreover, different parameter settings within the same method can yield markedly different trees from the very same dataset.
One premise of this work is that the variation in tree inference methods can be viewed as an opportunity rather than as a limitation. If the trees produced by two tree inference methods can be robustly compared by a neutral third method, then one can identify the substructures shared by the two inferred trees. To address the need for a tree comparison method, we introduced the notion of optimal tree alignment, omlta, for clonal trees of tumor progression and developed an efficient algorithm for computing an optimal alignment. Our method for computing optimal alignments naturally produces the integer distance between the two trees, omltd, which is the sum of the numbers of node label deletions that must be applied in each tree to make the resulting derived trees isomorphic. The omltd is unique, but there may be multiple optimal alignments, as illustrated below in Figure 9.
Figure 9:

a. A star tree and a single node tree, which have an omltd distance of 4 between them. b. Some possible expansions of a single node tree with label set , , .
Although we showed that computing omlta is formally intractable (NP-complete), we were able to compute omlta in practical runtimes for all input instances tested, including instances with more than 1000 mutations. Thus, the NP-completeness does not represent a practical limitation. However, one practical limitation of our methods and results is that omlta compares exactly two trees at a time. Since there are more than two methods for inferring clonal trees and these methods have parameter settings that can be varied to produce different clonal trees, it may be desirable to compare more than two trees simultaneously. Just as pairwise tree alignment corresponds to pairwise sequence alignment, the problem of comparing more than two trees corresponds to multiple sequence alignment, which is a widely studied problem with widely used methods that offer a mixture of formal optimization criteria and heuristics (63; 64; 65).
In conclusion, applying our framework to clonal trees inferred from both multi-sample bulk and single-cell sequencing data, we demonstrated utility of omlta in revealing robust evolutionary features and consistent mutational placements across pairs of methods and data types, thereby enabling more reliable downstream analyses. The use of omlta should lead to more rigorous use of clonal trees in cancer genomics. Our omlta framework will also provide an impetus to develop new methods for tree inference because it is now possible to compare more rigorously a new method to existing methods, as we compared CONIPHER to PairTree.
4. Methods
4.1. Preliminaries
In this paper, we consider rooted, unordered trees with node set , edge set , and a specified root node denoted . For two nodes and , such that lies on the path from to , we say that is an ancestor of and that is a descendant of . A node is a child of if is a descendant of and . For a node denotes the set of children of . For shorthand, is used with the same meaning as in , and is used to denote the number of nodes in (i.e., ). Given two nodes , denotes the set of nodes on the path from to in , including and . We denote the subtree rooted at as . A forest is a collection of node-disjoint trees . For any , denotes the forest excluding . The generalization of the problem to forests is needed because during our recursive algorithm single trees may be transformed into multiple trees via deletions of nodes and edges.
The nodes in our trees have labels from an alphabet , which includes the mutations observed in the sample and to be assigned to nodes in the tree. Each node may have multiple labels (representing mutations), which are treated for computation purposes as an unordered set, but each label appears at most once in a tree. We let represent a label function such that is the label set of node . Given a set of nodes , we define to be the set of all labels present in nodes in , that is . For a tree , we may refer to as .
Definition 1.
A multi-label tree with nodes , edges , and label function is an unordered tree in which for all , , except the root which may have no label. Furthermore, for all with , label sets and are disjoint. A multi-label forest is a collection of multi-label trees such that for any with , label sets and are disjoint.
Definition 2.
An edit operation for the multi-label tree edit distance problem is defined as one of the following tree operations:
Label Deletion: Delete a label for a node . We denote this label deletion by . For a set of labels , let denote deletion from of all labels that belong to , i.e., if we start with , then after is applied, we have .
Node Deletion: Delete a node and, if is not the root of , make all nodes in child children of , where denotes the parent of . If is the root of , then all nodes become roots of their own distinct trees and this transforms a single tree into a forest. The node deletion operation can be applied only to empty nodes. We denote this operation as .
Expansion: For a node with and some , add a new node to , set and . If was a non-root node with parent , we set . Otherwise, becomes the new root of and we set . We denote such an expansion as .
Given a forest with a node , we use to denote the forest after performing . Similarly, given a forest and a subset of labels present in , we use to denote the forest after performing for all , where is the node in such that .
The edit distance between two trees is the cost of a minimum-cost sequence of edits, where an edit may be performed on either tree, that transforms both trees into the same tree, the alignment tree. With this in mind, we must assign costs to each edit. In this work, we are interested in finding the number (and the set) of labels that must be deleted in both trees; therefore, we set the cost of label deletion to 1 and the cost of empty-label node deletion and node expansion to 0, i.e., these are free operations. Since empty-label node deletion and node expansion are 0-cost operations, we say two forests are “equal” or “the same” when referring to two forests that could be transformed into equal forests after a sequence of only empty-label node deletions and node expansion. We make the distinction between forests that are exactly equal and forests that are equal after additional node expansions and empty-label node deletions when it is relevant to do so.
We can now formally define:
Problem 1.
Given two multi-label forests , , the optimal multi-label tree edit alignment (omlta) asks to find a minimum-cost sequence of label deletions, node deletions, and expansions needed to transform and into equal forests, and optimal multi-label tree edit distance (omltd) of , , denoted as , is the cost of this edit sequence.
For the application of our omlta algorithm to real data, we are only interested in finding omlta for trees. However, we define the edit distance problem on forests because the intermediate states when edits are applied in sequence can include multi-tree forests and hence, forests are needed in the proof of correctness and in the formal analysis of asymptotic runtime. When given two trees as input, the minimum-cost edit sequence obtained by our algorithm, which we give in the following subsection, yields the same output tree (not a forest) derived by edits applied to one input tree or the other, and we refer to this common output tree as the alignment tree.
Before discussing the algorithm, we give a small insight into the limitations of the node expansion operation. It may seem that allowing node expansions at no cost may trivialize our distance computation and potentially allow any two trees to be matched without any label deletions needed. As a simple example contradicting this idea, consider two trees, a star and a single node, as in Figure 9a. Following the above definition, expansion can never create a node with degree greater than 1. Therefore, using expansion on a single node can only create various chain topologies with the mutation labels in various orders but can never create a star. Figure 9b shows some example expansions, and we may observe that one of the only notable changes in any expansion of the single node labeled is the order of labels in the expanded trees. In all cases, the minimum number of labels that need to be deleted to transform the star and single node into the same tree is 4 (2 from each input tree). Essentially, omltd does not penalize long paths of nodes with degree 1 by allowing free node expansions, but does penalize actual topological differences in branching and mutation label ordering, which is precisely what we aim to measure with this distance.
4.2. An -time recursive algorithm for omlta
In this section, we present a simplified recursive formula to help compute omlta/omltd in -time where is the number of mutations occurring in the two input trees (counting mutations in both trees as 1). The recursive formula identifies the minimum number of label deletions needed to induce two isomorphic trees up to node deletions and expansions. It is also constructed to handle forests as input since the recursive computation sometimes requires solving smaller subproblems in which the intermediate structure may be a forest of more than one tree. We denote the function to be computed as where , can be trees or forests. Given two trees , finds the minimum number of label deletions that can be used to recover the alignment tree, solving both omltd and omlta simultaneously. After discussing runtime and correctness of our given recursive solution, we show in Supplementary Section 4.4 how to improve the exponent in the asymptotic running time to be linear in rather than linear in , where . Our improved algorithm and runtime analysis require knowing an upper bound on in advance, and so we run our algorithm with every possible value, 1, 2, 3,…, stopping when we reach , and show that this search loop does not affect the runtime asymptotically.
Given two forests and , the core idea of our algorithm is a recursive approach in which we iteratively target a single mutation label in the root of any tree of and find the node with its matching label in (if one exists). The algorithm then proceeds either to match or to delete this pair of nodes. In either case, the algorithm proceeds recursively on the remaining set of labels after removing the current considered label from both forests. If all the labels of a root node of any tree in have been deleted by the algorithm or is matched, then is removed from for the remainder of the algorithm and the subtrees of the children of are added into so that their labels may be matched or deleted next. By considering each label one at a time, all labels will eventually be matched or deleted while guaranteeing that the resulting forests after all deletions are equal as required by the formalized Problem 1. The algorithm finds exactly the sequence of matches and deletions that minimizes the number of label deletions needed to reach the alignment tree.
The main challenge is how to determine whether each label should be matched or deleted. For any tree in that has no corresponding label-isomorphic tree in , for each label in , the algorithm will try both options, deleting and matching. Since there are labels, we need to explore both options at most times, which suggests a factor of in the runtime; actually, since the choice of whether to match or to delete arises only when the label occurs once in each forest, formal analysis in Section 4.3 shows that the exponential term can be reduced to . To improve the dependency further from to , we rely on the fact that the number of label deletions is bounded by some positive integer , and therefore, we argue that we only have to explore both choices at most times, otherwise the distance must be larger than .
Figure 11 shows an example of the basic approach of our algorithm. We compute omltd by iteratively matching or deleting each mutation label in the input trees. A root-to-leaf traversal of one of the input trees, chosen arbitrarily from the two, determines the order in which we consider mutation labels. In a preliminary step, we do a linear traversal of the trees and delete any mutation labels not present in both trees. In our example figure, there is one such label only present in , which is deleted immediately. Then we begin our iterative approach to handle remaining mutation labels shared between the input trees. As mentioned, we start at the root of . First, the algorithm handles . Any mutation contained in the root of both trees may be preserved at no cost via a node expansion. Thus, is matched between the two trees in the omlta and will remain in the final alignment tree. Next, , the other label in the root of is considered. is in a lower level of and therefore matching and retaining this label in the alignment tree requires some edits. The omltd computation therefore breaks into two alternative cases. In one alternative case, the algorithm tries to maintain in both trees. As shown in the figure, maintaining requires deleting the path of nodes above from the current root of and then also deleting the new hanging subtree of , since it will not have an isomorphic match in if is preserved. In the resulting trees, a node expansion can be made in each tree to place in its own node to be retained in the resulting alignment tree. In the other alternative case, is deleted in both trees. In either case, after handling , the algorithm recurses and continues iterating on the remaining trees. Whichever path leads to a lower number of total mutation label deletions is then chosen as the solution path and the alignment tree from that path is outputted. In the figure example, intuitively, deleting is most likely the correct choice since it only requires 2 immediate deletions whereas matching requires 86 immediate deletions.
Figure 11.

Before giving our recurrence for computing omlta/omltd, we define a useful function that is used in the final case of the recurrence. Given a forest and node in tree , let denote the forest after deleting all nodes of (recall that is the path in from root to node , including the endpoints) from and adding the subtree of any child node of a deleted node . See Figure 10 for an example.
Figure 10:

Left panel: A forest (in this example just a tree) with root and node . Right panel: Tree and forest obtained from by deleting all nodes on the path from to and adding to the subtrees of any children node whose parent has been deleted.
We consider one mutation at a time. Let be the root of a tree in . Let be a label in . Recall that empty-labeled node deletions have no cost towards omltd, so we may delete empty-labeled nodes for free. Additionally, if a root node of an input tree of (or ) has no labels, we may similarly delete that empty node before applying the recursive algorithm to ensure that all root nodes contain at least one label.
Let be the node in tree with if it exists. If exists, let be the node in the path from to , inclusive, that is closest to and shares some label with , i.e., . Set to be any mutation in or just if no matching label for was found in . While not written in formula 1, we assume that when the last label of a node is deleted at any step, the now empty-labeled node is deleted as well. We define the following recursive formula for :
| (1) |
The above recurrence helps us compute omltd and find which labels need to be deleted for omlta. The three above cases handle all possibilities for label . In the first case, if there are no labels in at all, then must be deleted to match and so we compute the cost of deleting all labels in . In the second case, label is present in but not in . Since none of the edit operations insert a label into the label set of a node, all edit sequences must delete and so we add 1 to the distance and remove from consideration moving forward. In the final case, we try both matching the nodes of and containing , as well as deleting from both forests, and we compute and return the minimum cost edit sequence between these two cases. Since is a label of the root of , when trying to match the nodes corresponding to , it is important we delete all nodes above so that is also a label of . This is why we split into and . Also one crucial detail of our setup is that by choosing to be the highest node in that shares a label with , we can guarantee that during the process of deleting nodes above , we do not accidentally delete a label that we could have kept via a node expansion on . Since shares no labels with the deleted nodes, we know that it cannot expand to match to any of these soon-to-be-deleted nodes, and we are sure not to delete too many labels in this case.
As mentioned in the previous subsection, by tracing the path which minimizes label deletions through the recursion tree for Equation 1, we may recover the exact minimum cost edit sequence found by for two input trees and , which when applied to the input trees yields the common alignment tree for omlta in an additional time.
Equation 1 thus provides the starting point and the core structure for our -time algorithm for omlta. We prove that Equation 1 correctly computes omltd and that it can be computed in time , where in Section 4.3. Additional details on how we modify and improve this approach for our final result can be found in Section 4.4. We also provide the proof that computing omltd is an NP-hard problem in Section A.3.
4.3. Proof of correctness and analysis of asymptotic runtime for the algorithm in Section 4.2
The minimum cost sequence of edits for two forests is typically not unique, since there are often many orderings of the edits that will produce the same transformations. With this in mind, we give a useful observation for computing the omlta/omltd between two forests in which we have some prior knowledge that a pair of trees, one from each forest, are going to be transformed into the same tree after an optimal sequence of edits. Instead of finding the cost of an optimal edit sequence on the entire forest, we can instead find a minimum-cost sequence of edits on just the trees separately from the rest of the forest and then sum up the computed distances for the pair of trees and the remaining forests. We have implicitly used this idea when building the third case of Equation 1, and now we provide a formal proof of it.
Observation 1.
Given forests , and a minimum-cost edit sequence transforming and into the same forest, if and are transformed into the same forest by for any , , then .
Proof.
Consider a minimum cost edit sequence that transforms and into the same forest such that and are transformed into the same forest by . Let denote the cost, i.e., the number of label deletions, in . Let be the subsequence of that transforms and into the same forest, and let be the remaining edits (which transform and into the same forest). As is a valid edit sequence, omltd . Similarly, . Thus,
Now for contradiction, assume there is a minimum cost edit sequence such that and transforms and into the same forest. Then , form a valid edit sequence transforming and into the same forest with , which contradicts being a minimum cost edit sequence. Therefore, no such can exist and so by contradiction. By a similar argument, , and therefore, .
We make one more useful observation that if two root nodes, one from each forest and , share a label, we can expand the root nodes with this shared label and then compute the rest of the edit distance on the remaining labels in the trees.
Observation 2.
Given trees , and label , then )
Proof.
Consider trees and that are the result of performing expansions expand and expand . Any minimum cost edit sequence on and will be a minimum cost edit sequence on and and vise versa. Furthermore, since node expansions are a 0-cost operation, we have that .
Claim 1.
Given two multi-label forests , , Equation 1 correctly computes .
Proof.
To compute , recall that by the formalization of Problem 1, we can find a minimum-cost sequence of label deletions, node deletions, and node expansions that transforms and into equal forests where the cost of an edit sequence is the number of label deletions performed.
In the first case of Equation 1, when is empty, since no allowed edit operations can add any nodes to , any optimal edit sequence must delete all nodes of as well so that both forests are empty after all edits. The number of deleted labels will therefore be , matching the first case of Equation 1.
In the second case, when a mutation label is in but not in , again no allowed edit operations can add to , so any optimal edit sequence must delete . We may therefore compute omltd , the distance between without mutation and , and then add 1 for the deletion of .
In the third case, when mutation label is present in both and , we compute the cost of two possible edit sequences and return the minimum of them. Since all labels only appear once per forest by Definition 1, either both appearances of must be kept in the final versions of and after all edits or both appearances of are deleted. If both are deleted, this adds 2 to the final cost. It is easy to see that any minimum-cost edit sequence transforming and into equal forests will be a minimum-cost edit sequence for , with two extra label deletions to delete the copies of . The final cost of such an edit sequence is omltd , which matches the second parameter of the min function in the third case of Equation 1.
If instead both copies of remain in , , note that since is the root of and is the highest node in sharing a label with , then all labels in an ancestor of must be deleted in any edit sequence. It may be the case that a minimum-cost edit sequence does not delete the ancestor nodes of even though they have empty labels, but since node deletions do not contribute to the distance, any such minimum-cost edit sequence may be modified to delete all ancestor nodes of and the empty-labeled nodes in that matched them with no additional cost. Performing these deletions transforms into . Furthermore, any optimal edit sequence preserving the labels in and must transform and into the same tree. With the above assumption, by Observation 1, we know that
| (2) |
The cost of deleting all ancestors of is exactly the cost of deleting all labels on the path from to excluding , i.e., . Combining this cost with Equality 2 when mutation is preserved by a minimum-cost sequence of edits transforming and into the same forest yields
This almost matches the first parameter of the min function in the third case of Equation 1, except that there instead of we have . However, note that and are both root nodes in and , respectively, so by Observation 2, . Thus, we correctly compute both the cost of an edit sequence preserving label in both forests and an edit sequence deleting label , and we set the distance to be the minimum of the two in the third case of Equation 1.
Claim 2.
Given two multi-label forests , , can be computed in time , where .
Proof of Claim 2.
By Claim 1, we know an algorithm utilizing Equation 1 will correctly compute omltd . We now analyze the runtime complexity of such an algorithm using induction on the number of labels in and . Our base case occurs when contains no more labels, which is the first case of Equation 1. In this case, there is no recursion and computing can be done via a simple traversal through to count each label, which will take time .
Now, we define our induction hypothesis to be that omltd takes time to compute for all forests , with . Now, consider forests , such that . In the second and third cases of Equation 2, we must search through to find label if it exists. This can be done again with a simple linear-time search through in time . In the second case, is not present in and we have a recursive call on omltd . Deleting from the label of node can be done in at most time. By the induction hypothesis, the recursive call resolves in time , so the total time will be
In the third case of Equation 1, we must construct and remove from and . This can be done in at most steps by deleting all labels one at a time in excluding the labels of itself, and when a node has its last label deleted, we delete the node itself as well. Finally, there are 3 recursive calls to omltd. By the inductive hypothesis, takes time at most and omltd takes time at most . Note that and , so together these recursive calls take time
As for the last recursive call , by the induction hypothesis this takes time . In total, for the third case we have time
where the last inequality is true for , which must be satisfied in the third case of Equation 1 since both and contain (a copy of) the label .
Therefore, both recursive cases of Equation 2 are done in time and so, by induction, the entire computation of can be done in time .
4.4. An asymptotically faster -time algorithm for computing omlta/omltd
In this section, we show how to compute omlta/omltd utilizing an improvement to the recursive algorithm defined by Equation 1 such that the runtime depends on , the optimal edit distance between the two input forests. We start by giving the new recursive definition, which takes an additional parameter , that can be viewed as an upper bound on that we use to bound the runtime of the recursive computation.
We define the same set of variables as for Equation 1. We let be the root of any tree , and let . Let be the node in tree with , if it exists. If such a exists, let denote the node in the path from to , inclusive, that is closest to and shares some label with , i.e., . Set to be any mutation in or just if no matching label for was found in . We assume implicitly that when the last label of a node is deleted at any step, the now empty-labeled node is deleted as well.
There are two new variables we must define. Let and . and variables correspond to the omltd between pairs and , respectively. When these distances are either 0 or 1, the trees and forests are almost exactly matching already and we do not want to make any substantial edits on them. We add two corresponding cases for when either of these distances is small. While computing tree edit distance is NP-hard, checking if two forests are exactly matching (or off by 1 label) can be done in polynomial time dependent on the total number of labels in the forest, and so computing and does not increase our asymptotic runtime too much.
| (3) |
The following two lemmas help prove the correctness of the new fifth and sixth cases in Equation 3. After that, we provide a polynomial-time algorithm for checking if the distance between two forests is at most 1 to show that these cases can be evaluated quickly.
Lemma 1.
Given multi-label forests , with trees , and . Let , . If , then . If , then .
Proof.
If or are 0, then the lemma statement follows directly from Observation 1.
Consider when . In this case, an optimal edit sequence between and must delete a single label present in exactly one of or . Without loss of generality let . Now consider a minimum cost edit sequence between and , i.e., a sequence that minimizes the number of label deletions needed to make these two forests equal. If deletes , then and already match. Thus, performs no more label deletions on nodes in and and by Observation 1, omltd . If instead does not delete , then to match the nodes with label in and together, the roots of and can no longer be matched since is in but not . Since is in the root of and , label must be deleted since these roots are no longer matched together. Since there are two copies of , must have two label deletions corresponding to deletions of . We may consider a new edit sequence obtaining by modifying to delete both copies of instead and then match and , which match perfectly after deletion of , and note that the new sequence has the same number of label deletions as . Therefore, any minimum cost edit sequence can be modified to delete , match and and so, .
If , then there must be a label present in exactly one of or . Without loss of generality let . Consider a minimum cost edit sequence between and . If deletes , then by Observation 1, . If instead does not delete , then its copy must be in . Similarly to the previous case above, since is in the root of , it must be deleted by in order for the nodes labeled with to match. We consider a new edit sequence obtained by modifying to delete both copies of instead of both copies of and by Observation 2, since labels the root of both and , the modified edit sequence of still transforms and into the same forests and requires no additional label deletions. Therefore, any optimal edit sequence can be modified to delete and subsequently match and ; therefore, .
Lemma 2.
Given multi-label forests , with trees , and a node such that
,
there exists a label ,
.
If , then . If , then .
Proof.
Since , there is only a single label on . Let denote this label. Let be a minimum cost edit sequence of and .
If deletes , then it can be modified to delete for no cost since empty label deletions are not counted towards omltd. If omltd , then does not have to make any further edits to and and so by Observation 1, . By a symmetric argument, if , .
If does not delete , we claim that must delete label . Note that and is the only label of , which is not included in since . Furthermore, is in the label set of , a child of . The only way for to remain in the forests is if is deleted and becomes a root node of its own subtree, but note that deleting would require deleting label . By our assumption, must not be deleted since is not deleted. Therefore, must be deleted. Since there are 2 label deletions for , we may modify to instead match together and delete both copies of for the same cost. By Observation 2, after deleting , we know that the modified edit sequence of still transforms , into equal forests and no further label deletions need to be added to . Therefore, all edit sequences can be modified to delete instead of . Thus, if omltd or omltd , the lemma statement holds by Observation 1.
Lemma 3.
Given multi-label forests , , can be determined in time where .
Proof.
We now describe an algorithm that computes .
First, we check if the label sets of and differ by at most 1 label. If they differ by more than 1 label, we may return 2 immediately. If they differ by a single label, we may delete the label. This can be done in -time. For the remaining labels present in both forests, if any label in must be deleted, label must also be in since by definition, there is only one copy of each label per multi-label forest. Therefore, if a label shared in both forests is deleted, then omltd . Thus, we can check if and are exactly the same up to node expansions as no labels may be deleted, and we will find . There are many ways to check forest equality, for the sake of completion we outline one below. Define a branching node as a node with more than one child and non-branching nodes as a node with 1 or 0 children. Note that any node expansion creates a non-branching node, and so when checking if trees are equal up to node expansions, we must check if paths of non-branching nodes can be expanded to become equal. This is done in step 3 of the following routine for checking forest equality.
-
Compute set of paths such that
is the node in closest to the root of the tree containing in ,
the parent of is a branching node or is the root of the tree containing ,
is a branching node or a leaf.
We call the root of path . We assume that node has a pointer to its path and vice versa.
Sort and lexicographically according to for all .
-
For each path :
Use binary search on to find a path in with exactly the same label set as (i.e., ). If no such path is found, return 2.
Check if and are equal up to node expansions. We can do this by checking the labels of the nodes in the paths one at a time starting at the roots of the paths according to Observation 2. If both paths’ roots contain the label, we may remove the label from consideration. Once a root node has all labels removed, we delete it and move to the next node in the path. If the current pair of root nodes considered has no more shared labels and both root node label sets are still non-empty, we return 2.
If and are empty after the previous step, we mark these paths as matching by storing a pointer to in and move on to the next path of .
Starting in the root node of a tree in we find it’s corresponding path in and the marked matching path in . Let be the last node in and let be the last node in . Note by Step 1 these are branching nodes or leaves. For every child node of for we find it’s corresponding path and check that the root of the matching path has parent . If the parents of the checked pairs of paths are not and , we output 2, otherwise we continue iteratively, performing the same check for the children nodes of the last node in and for all . We then continue iteratively until we’ve performed these checks for every pair of matching paths. After all paths in tree pass these checks, we move on to a new tree in until all paths of are checked or 2 is returned.
The first and last step above take time and sorting in step 2 can be done in (e.g., via mergesort). The third step dominates the runtime. Performing the binary search on may take time . When checking if two paths are equal up to node expansions, each label in is only considered during its corresponding path of , and it is compared to at most every label of . Therefore, this step takes time at most . Overall, checking if can be done in time .
Finally, we prove the correctness and runtime of an algorithm computing omltd according to Equation 3. We begin with the correctness.
Lemma 4.
Given two multi-label forests , , for a positive integer computes
Proof.
First, we consider when and show Equation 3 correctly computes omltd when this inequality holds. As an invariant, we will argue that we maintain that the value passed to parameter is larger than the distance between the two forests of any recursive call we make in any case of Equation 3.
The first three cases of Equation 3 do not have any recursive calls and comprise the base cases.
Case 1: In the first case and . Therefore, the first case can never occur when .
Case 2: The second case is trivially correct. If then 0 is correctly output.
Case 3: Similarly, the third case occurs when is empty and any optimal edit sequence must delete all of , which has cost , as in Equation 3.
Case 4: The correctness of the fourth case follows from Claim 1. However, we must also show that . By the case constraint, must be deleted by any optimal edit sequence between and since is only contained in . Therefore,
Case 5: In the fifth case, we have that where recall that . Note that since is non-negative, if , it must be the case that . If , then is the root of and so . The correctness of this case then follows from Lemma 1. If instead , then must be the child of . Furthermore, since , we must have that omltd , and so the correctness of this case follows from Lemma 2.
Case 6: The correctness of the sixth case follows from an analogous argument to the fifth case.
Case 7: The correctness of the final case follows from Claim 1, however, we must make sure that is a correct upper-bound for each recursive call made in this case. Consider the first parameter of the min function. Recall that omltd computes the cost of a minimum cost edit sequence matching label together in and by deleting all ancestors of in . We know that since we are not in Case 6, . Therefore, if this edit sequence is optimal, we have that
We also know that since we are not in Case 5, . An analogous argument shows that as well.
Recall that the second parameter of the min function represents an optimal sequence of edits that deletes label from and . Since is contained in both forests, this requires 2 deletions and so
Therefore, we maintain the invariant that in any recursive call of Equation 3 if it is true at the first call, and so the algorithm will correctly output by induction.
If , the correctness of Equation 3 still holds from the previous arguments. However, we may additionally reach Case 1, which returns or we may compute a number higher than . If computes a value greater than , we return , which satisfies the lemma statement.
We now prove the runtime of an algorithm implementing Equation 3 via induction. The proof follows similarly to that of Claim 2.
Theorem 1.
Given two multi-label forests , and , then can be computed in time .
Proof.
By Lemma 4, we know that an algorithm utilizing Equation 3 will correctly compute using . We now analyze the runtime complexity of such an algorithm using induction on .
By Lemma 3, we can check the constraints of the fifth and sixth cases of Equation 3 in less than time where (note the lower bound on 3 is arbitrary and we choose it for convenience later in this proof) is a constant and . Now, we define our induction hypothesis to be that takes time .
Cases 1–3: Our base case occurs when either of the first three cases of Equation 3 are reached. In any of these cases, there is no recursion. Checking if can be done in time by Lemma 3 and computing can be done via a simple traversal through to count each label, which will take time , so the total amount of time is less than in any of these cases.
Case 4: In the fourth case, there is a recursive call on , which takes time by the induction hypothesis. Finding and deleting label can be done in time, and so in total, this step takes
Case 5: In this case, we must find label and construct , which can be done in time. Additionally, we must compute . By Lemma 3, this can be done in time at most . By the induction hypothesis, the recursive call takes time at most <mi>. Let . The total time of this step is then at most
where note the second last line follows since since and contain at least label each so and (if , we can skip the recursive call as the remaining forests would be empty).
Case 6: This case follows from a symmetric argument to case 5.
Case 7: This is the final case. As for Equation 1, we must construct and remove from and . This can be done in at most steps by deleting all labels one at a time in excluding the labels of itself, and when a node has its last label deleted, we delete the node itself as well. We additionally must compute and to check if we indeed fall into any of the previous cases, which takes time at most . There are three recursive calls we consider. Let . By the inductive hypothesis, omltd takes time at most and omltd takes time at most . Together, these recursive calls take time
As for the last recursive call, takes time at most by the inductive hypothesis. We therefore have total time at most,
where the last inequality follows since for all . We know that is at least 4 since otherwise we would have fallen into case 5 or case 6 as there would be no labels in and besides both copies of and potentially one other label.
Therefore, all cases take time at most , and so by induction, takes time .
Given an upper bound , Theorem 1 provides a very fast bound for omlta/omltd if , otherwise it reports that there is no valid solution. However, for real data sets we cannot know in advance what value to assign to . We run our algorithm multiple times incrementing by 1 at each iteration and starting at until our algorithm outputs a valid solution. Let . The total runtime to compute considering these iterations will be:
where the above inequality follows from the geometric series formula.
Obtaining omlta from omltd calculation.
As shown, Equation 3 provides a recursive computation of omltd that can be used to find the minimum number of label deletions for two input trees and . In other words, in the recursion tree for this computation, there exists at least one optimal branch that can be used to compute omltd. If we keep track of the optimal branch of the recursive algorithm in the recursion tree, we may additionally construct a minimum cost edit sequence that constructs the omlta alignment tree. We describe how to do so informally in the following paragraph using the notation of Equation 3.
While following the optimal branch, we add label deletions to our minimum cost edit sequence corresponding to removed labels in cases 3, 4, 5, 6, where the latter two cases only have a label deletion if or . In case 7, there are two subcases. Either we delete label in both subtrees, which if optimal, we add as a label deletion for and in our minimum cost edit sequence, or we delete all nodes and labels in the path leading to node , which again we add to our edit sequence if optimal. In the latter subcase, we choose to retain label in and , which is maintained as we continue down the optimal branch, so we may add a node expansion for and to our minimum cost edit sequence to separate label from and into a pair of matching nodes in the final alignment tree. Finally, after reaching the bottom of the optimal recursion tree branch, we obtain all label deletions and node expansions. We may then finish our minimum cost edit sequence by adding any node deletions needed for any nodes whose entire label set is deleted in the minimum cost edit sequence. By performing the resulting edit sequence on and , both are transformed into the alignment tree for omlta.
Supplementary Material
Acknowledgments
This research was supported in part by the Intramural Research Program of the National Institutes of Health (NIH). The contributions of the NIH authors were made as part of their official duties as NIH federal employees, are in compliance with agency policy requirements, and are considered Works of the United States Government. However, the findings and conclusions presented in this paper are those of the authors and do not necessarily reflect the views of the NIH or the U.S. Department of Health and Human Services. This work utilized the computational resources of the NIH HPC Biowulf cluster (https://hpc.nih.gov).
References
- 1.Levenshtein V. Binary codes capable of correcting deletions, insertions and reversals. Sov. Phys. Dokl. 10, 707 (1966). [Google Scholar]
- 2.Needleman S. B. & Wunsch C. D. A general method applicable to the search for similarities in the amino acid sequence of two proteins. J. Mol. Biol. 48, 443–453 (1970). [DOI] [PubMed] [Google Scholar]
- 3.Smith T. F. & Watermanm M. S. Identification of common molecular subsequences. J. Mol. Biol. 147, 195–197 (1981). [DOI] [PubMed] [Google Scholar]
- 4.Demeulemeester J., Dentro S. C., Gerstung M. & Van Loo P. Biallelic mutations in cancer genomes reveal local mutational determinants. Nat. Genet. 54, 128–133 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Akutsu T., Fukagawa D., Takasu A. & Tamura T. Exact algorithms for computing the tree edit distance between unordered trees. Theor. Comp. Sci. 412, 352–364 (2011). [Google Scholar]
- 6.Al Bakir M. et al. The evolution of non-small cell lung cancer metastases in tracerx. Nature 616, 534–542 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7.Grigoriadis K. et al. CONIPHER: a computational framework for scalable phylogenetic reconstruction with error correction. Nature Prot. 19, 159–183 (2024). [DOI] [PubMed] [Google Scholar]
- 8.Wintersinger J. A. et al. Reconstructing complex cancer evolutionary histories from multiple bulk DNA samples using Pairtree. Blood Cancer Discov. 3, 208–219 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Pérez-Guijarro E. et al. Multimodel preclinical platform predicts clinical response of melanoma to immunotherapy. Nat. Med. 26, 781–791 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Govek K., Sikes C., Zhou Y. & Oesper L. Graphyc: Using consensus to infer tumor evolution. IEEE/ACM Trans. Comput. Biol. Bioinformatics 19, 465–478 (2022). [DOI] [PubMed] [Google Scholar]
- 11.Guang Z., Smith-Erb M. & Oesper L. A weighted distance-based approach for deriving consensus tumor evolutionary trees. Bioinformatics 39, i204–i212 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Fu X. & Schwartz R. Contreedp: A consensus method of tumor trees based on maximum directed partition support problem. In 2021 IEEE International Conference on Bioinformatics and Biomedicine (BIBM), 125–130 (2021). [Google Scholar]
- 13.Aguse N., Qi Y. & El-Kebir M. Summarizing the solution space in tumor phylogeny inference by multiple consensus trees. Bioinformatics 35, i408–i416 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Mehrabadi F. R. et al. Profiles of expressed mutations in single cells reveal subclonal expansion patterns and therapeutic impact of intratumor heterogeneity. bioRxiv; 2021. –03 (2021). [Google Scholar]
- 15.Christensen S., Kim J., Chia N., Koyejo O. & El-Kebir M. Detecting evolutionary patterns of cancers using consensus trees. Bioinformatics 36, i684–i691 (2020). [DOI] [PubMed] [Google Scholar]
- 16.Karpov N., Malikic S., Rahman K. & Sahinalp C. A multi-labeled tree dissimilarity measure for comparing “clonal trees” of tumor progression. Algorithms Mol. Biol. 14, 17 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Malikic S., McPherson A. W., Donmez N. & Sahinalp C. S. Clonality inference in multiple tumor samples using phylogeny. Bioinformatics 31, 1349–1356 (2015). [DOI] [PubMed] [Google Scholar]
- 18.El-Kebir M., Oesper L., Acheson-Field H. & Raphael B. J. Reconstruction of clonal trees and tumor composition from multi-sample sequencing data. Bioinformatics 31, i62–i70 (2015). URL 10.1093/bioinformatics/btv261. https://academic.oup.com/bioinformatics/article-pdf/31/12/i62/49014148/bioinformatics_31_12_i62.pdf. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 19.Jahn K., Kuipers J. & Beerenwinkel N. Tree inference for single-cell data. Genome Biol. 17, 86 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Malikic S. et al. Phiscs: a combinatorial approach for subperfect tumor phylogeny reconstruction via integrative use of single-cell and bulk sequencing data. Genome Res. 29, 1860–1877 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Robinson D. F. & Foulds L. R. Comparison of phylogenetic trees. Math. Biosci. 53, 131–147 (1981). URL 10.1016/0025-5564(81)90043-2. [DOI] [Google Scholar]
- 22.DiNardo Z., Tomlinson K., Ritz A. & Oesper L. Distance measures for tumor evolutionary trees. Bioinformatics 36, 2090–2097 (2019). URL 10.1093/bioinformatics/btz869. https://academic.oup.com/bioinformatics/article-pdf/36/7/2090/50670253/bioinformatics_36_7_2090.pdf. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Jahn K., Beerenwinkel N. & Zhang L. The Bourque distances for mutation trees of cancers. Algorithms Mol. Biol. 16, 9 (2021). URL 10.1186/s13015-021-00188-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Ciccolella S. et al. Triplet-based similarity score for fully multilabeled trees with poly-occurring labels. Bioinformatics 37, 178–184 (2020). URL 10.1093/bioinformatics/btaa676. https://academic.oup.com/bioinformatics/article-pdf/37/2/178/50322388/btaa676.pdf. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 25.Selkow S. M. The tree-to-tree editing problem. Inf. Proc. Lett. 6, 184–186 (1977). [Google Scholar]
- 26.Tai K.-C. The tree-to-tree correction problem. J. ACM 26, 422–433 (1979). [Google Scholar]
- 27.Zhang K. & Shasha D. Simple fast algorithms for the editing distance between trees and related problems. SIAM J. Comput. 18, 1245–1262 (1989). [Google Scholar]
- 28.Klein P. N. Computing the edit-distance between unrooted ordered trees. In Bilardi G., Italiano G. F., Pietracaprina A. & Pucci G. (eds.) 6th Annual European Symposium on Algorithms, ESA 1998, vol. 1461 of LNCS, 91–102 (Springer, 1998). [Google Scholar]
- 29.Demaine E. D., Mozes S., Rossman B. & Weimann O. An optimal decomposition algorithm for tree edit distance. ACM Trans. Algorithms 6, 2:1–2:19 (2009). [Google Scholar]
- 30.Mao X. Breaking the cubic barrier for (unweighted) tree edit distance. In 62nd IEEE Annual Symposium on Foundations of Computer Science, FOCS 2021, 792–803 (IEEE, 2021). [Google Scholar]
- 31.Zhang K., Statman R. & Shasha D. On the editing distance between unordered labeled trees. Inf. Proc. Lett. 42, 133–139 (1992). [Google Scholar]
- 32.Akutsu T., Tamura T., Fukagawa D. & Takasu A. Efficient exponential time algorithms for edit distance between unordered trees. In Kärkkäinen J. & Stoye J. (eds.) Combinatorial Pattern Matching, 360–372 (Springer Berlin Heidelberg, Berlin, Heidelberg, 2012). [Google Scholar]
- 33.Akutsu T., Fukagawa D., Halldórsson M., Takasu A. & Tanaka K. Approximation and parameterized algorithms for common subtrees and edit distance between unordered trees. Theor. Comp. Sci. 470, 10–22 (2013). [Google Scholar]
- 34.Fukagawa D., Tamura T., Takasu A., Tomita E. & Akutsu T. A clique-based method for the edit distance between unordered trees and its application to analysis of glycan structures. BMC Bioinformatics 12 Suppl 1, S13 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 35.Mori T. et al. A clique-based method using dynamic programming for computing edit distance between unordered trees. J. Comput. Biol. 19, 1089–1104 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36.Mair A. & Keselman D. Maximum agreement subtree in a set of evolutionary trees:metrics and efficient algorithms. SIAM J. Comput. 26, 1656–1669 (1997). [Google Scholar]
- 37.Cole R., Farach-Colton M., Hariharan R., Przytycka T. & Thorup M. An O(nlog n) algorithm for the maximum agreement subtree problem for binary trees. SIAM J. Comput. 30, 1385–1404 (2000). [Google Scholar]
- 38.Farach M., Przytycka T. & Thorup M. On the agreement of many trees. Inf. Proc. Lett. 55, 297–301 (1995). [Google Scholar]
- 39.Qi Y. & El-Kebir M. Sapling: Inferring and summarizing tumor phylogenies from bulk data using backbone trees. In Pissis S. P. & Sun W. (eds.) 24th International Workshop on Algorithms in Bioinformatics (WABI 2024), vol. 312 of Leibniz International Proceedings in Informatics (LIPIcs), 7:1–7:19 (2024). [Google Scholar]
- 40.Roth A. et al. Pyclone: statistical inference of clonal population structure in cancer. Nature Meth. 11, 396–398 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 41.Popic V. et al. Fast and scalable inference of multi-sample cancer lineages. Genome Biol. 16, 91 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 42.Fischer M., Herbst L., Kersting S., Kühn A. L. & Wicke K. Tree balance indices: A comprehensive survey (Springer Nature, Cham, Switzerland, 2023). [Google Scholar]
- 43.Burrell R. A. & Swanton C. Re-evaluating clonal dominance in cancer evolution. Trends Cancer 2, 263–276 (2016). [DOI] [PubMed] [Google Scholar]
- 44.Attolini C. S.-O. & Michor F. Evolutionary theory of cancer. Ann. N. Y. Acad. Sci. 1168, 23–51 (2009). [DOI] [PubMed] [Google Scholar]
- 45.Cross W. C. H., Graham T. A. & Wright N. A. New paradigms in clonal evolution: punctuated equilibrium in cancer. J. Pathol. 126–136 (2016). [DOI] [PubMed] [Google Scholar]
- 46.Frankell A. M. et al. The evolution of lung cancer and impact of subclonal selection in tracerx. Nature 616, 525–533 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 47.Hong W. S., Shpak M. & Townsend J. P. Inferring the origin of metastases from cancer phylogenies. Cancer Res. 75, 4021–4025 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 48.Sondka Z. et al. COSMIC: a curated database of somatic variants and clinical data for cancer. Nucleic Acids Res. 52, D1210–D1217 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 49.Suehnholz S. P. et al. Quantifying the expanding landscape of clinical actionability for patients with cancer. Cancer Discov. 14, 49–65 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 50.Chakravarty D. et al. OncoKB: a precision oncology knowledge base. JCO Precis. Oncol. 1, 1–16 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 51.McGranahan N. et al. Clonal status of actionable driver events and the timing of mutational processes in cancer evolution. Sci. Transl. Med. 7, 283ra54 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 52.Zhang L., Han X. & Shi Y. Association of itmuc16 mutation with response to immune checkpoint inhibitors in solid tumors. JAMA Netw. Open 3, e2013201 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 53.Chen H. et al. Association of lrp1b mutation with tumor mutation burden and outcomes in melanoma and non-small cell lung cancer patients treated with immune check-point blockades. Front. Immunol. 10, 1113 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 54.Brown L. C. et al. LRP1B mutations are associated with favorable outcomes to immune checkpoint inhibitors across multiple cancer types. J. Immunother. Cancer 9, e001792 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 55.Hao F., Ma Q. & Zhong D. Potential predictive value of comutant lrp1b and fat for immune response in non-small cell lung cancer: Lrp1b and fat comutation enhance immune response. Transl. Oncol. 24, 101493 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 56.Liu T. et al. Comprehensive characterization of muc16 mutations in lung adenocarcinoma for immunotherapies and prognosis: An observational study. Medicine 102, e35481 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 57.Loeb L. A. Mutator phenotype may be required for multistage carcinogenesis. Cancer Res. 51, 3075–3079 (1991). [PubMed] [Google Scholar]
- 58.Cahill D. P., Kinzler K. W., Vogelstein B. & Lengauer C. Genetic instability and darwinian selection in tumours. Trends Cell Biol. 9, M57–M60 (1999). [PubMed] [Google Scholar]
- 59.Tsao J. et al. Genetic reconstruction of individual colorectal tumor histories. Proc. Natl, Acad. Sci. USA 97, 1236–1241 (2000). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 60.Wu Y. Accurate and efficient cell lineage tree inference from noisy single cell data: the maximum likelihood perfect phylogeny approach. Bioinformatics 36, 742–750 (2020). [DOI] [PubMed] [Google Scholar]
- 61.Picelli S. et al. Full-length RNA-seq from single cells using Smart-seq2. Nat. Prot. 9, 171–181 (2014). [DOI] [PubMed] [Google Scholar]
- 62.Gierahn T. M. et al. Seq-well: portable, low-cost rna sequencing of single cells at high throughput. Nat. Meth. 14, 395–398 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 63.Gotoh O. Multiple sequence alignment: Algorithms and applications. Adv. Biophys. 11, 159–206 (1999). [DOI] [PubMed] [Google Scholar]
- 64.Edgar R. C. & Batzoglu S. Multiple sequence alignment. Curr. Opin. Struct. Biol. 16, 368–373 (2006). [DOI] [PubMed] [Google Scholar]
- 65.Zhang Y., Zhang Q., Zhou J. & Zou Q. A survey on the algorithm and development of multiple sequence alignment. Brief. Bioinformatics 23, bbbac069 (2022). [DOI] [PubMed] [Google Scholar]
- 66.Cormen T. H., Leiserson C. E., Rivest R. L. & Stein C. Introduction to Algorithms, 3rd Edition (MIT Press, 2009). URL http://mitpress.mit.edu/books/introduction-algorithms. [Google Scholar]
- 67.Garey M. R. & Johnson D. S. Computers and Intractability; A Guide to the Theory of NP-Completeness (W. H. Freeman & Co., New York, USA, 1990). [Google Scholar]
- 68.Qiu P. Embracing the dropouts in single-cell rna-seq analysis. Nat Commun. 11, 1169 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 69.Bouland G. A., Mahfouz A. & Reinders M. J. T. Consequences and opportunities arising due to sparser single-cell RNA-seq datasets. Genome Biol. 24, 86 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 70.Cardona G., Mir A., Rosselló L. R. & Sánchez D. Cophenetic metrics for phylogenetic trees, after Sokal and Rohlf. BMC Bioinformatics 14, 3 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 71.Llabrés M., Rosselló F. & Valiente G. The generalized Robinson-Foulds distance for phylogenetic trees. J. Comput. Biol. 28, 1181–1195 (2021). URL https://doi.org/10.1089/cmb.2021.0342. 10.1089/cmb.2021.0342. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 72.Popic V. et al. Fast and scalable inference of multi-sample cancer lineages. Genome Biol. 16, 91 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 73.Malikic S., Jahn K., Kuipers J., Sahinalp S. C. & Beerenwinkel N. Integrative inference of subclonal tumour evolution from single-cell and bulk sequencing data. Nat. Commun. 10, 2750 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.








