Skip to main content

Efficient algorithms for reconciling gene trees and species networks via duplication and loss events

Abstract

Reconciliation methods explain topology differences between a species tree and a gene tree by evolutionary events other than speciations. However, not all phylogenies are trees: hybridization can occur and create new species and this results into reticulate phylogenies. Here, we consider the problem of reconciling a gene tree with a species network via duplication and loss events. Two variants are proposed and solved with effcient algorithms: the first one finds the best tree in the network with which to reconcile the gene tree, and the second one finds the best reconciliation between the gene tree and the whole network.

Background

Reconciliations explain topology incompatibilities between a species tree and a gene tree by evolutionary events - other than speciation - affecting genes [[1], for a review]. However, not all phylogenies are trees: indeed, hybridization can occur and create new species [2] and this results into reticulate phylogenies, i.e. species (phylogenetic) networks [3]. In [4], the authors presented a first contribution toward solving a problem similar to the reconciliation problem, namely the cophylogeny problem [58], on networks. In their article, they first propose a polynomial algorithm to solve this problem on dated host trees taking into account codivergence, duplication, host switching, and loss events. This model is similar to the DTL model in gene tree reconciliation - that takes into account speciation, duplication, transfer, and loss events [[9], among others]. However, when extending the cophylogeny problem to species networks, their model may not be the more pertinent one for the DTL problem. Indeed, in [4] the parasite tree that is "reconciled" with the host network can take any path in the latter, modeling the fact that some hybridization species can receive the parasites of both parents. In the problem of gene tree reconciliation, their model is more adapted to novel hybridizations, where the genes still keep trace of the polyploidy due to the hybridization. But, for ancient hybridizations, the polyploidy of the extant species being reduced, a model where each gene of an hybridization species can be inherited from at most one of its two parents is more pertinent. In other words, for solving the latter problem, we are interested in finding a tree that is "displayed" by the species network such that its reconciliation with a given gene tree is optimum. We propose an efficient algorithm that takes into account duplication and loss events whose complexity does not depend on the number of hybridization events in the species network but only on the level of the network, where the level is a measure of how much the network is "tangled". Moreover, we propose a faster algorithm solving the problem described in [4] when restricting to duplication and loss events (that is, host switching is not taken into account).

Basic notions

We start by giving some basic definitions that will be useful in the paper.

Definition 1 (Rooted phylogenetic network) A rooted phylogenetic network N on a label set  X is a rooted directed acyclic graph with a single root where each outdegree-0 node (the leaves) is labelled by an element of  X. The root of N, denoted by r(N), has indegree 0 and outdegree 2. All other internal nodes have either indegree 1 and outdegree 2 (speciation node), or indegree 2 and outdegree 1 (hybridization node).

Denote by V(N), I(N), E(N), L(N) and L ( N ) respectively the set of nodes, internal nodes (nodes with outdegree greater than 0), edges, leaves and leaf labels of N. The size of N, denoted by |N|, is equal to |V(N)| + |E(N)|. Given x in V(N), we denote by N x the subnetwork of N rooted at x, i.e. the subgraph of N consisting of all edges and nodes reachable from x. If x is a leaf of N, we denote by s(x) the label of x in L ( N ) . If x is a speciation node, we denote by p(x) the only parent of x.

Given two nodes x and y of N, we say that x is lower or equal to y in N, denoted by x N y (resp. lower, denoted by x < N y), if and only if there exists a path (possible reduced to a single node) in N from y to x (resp. and xy). If x N y, then, for every path p from y to x, denote by length(p) the number of speciation nodes in N such that x < N z N y. If N is a tree, then, for every two nodes u, v of N, LCA N (u, v) [10] is the lowest node of N that is above or equal to both u, v.

Given a speciation node x in N, two paths of N starting from x are said to be separated if each path contains a different child of x. Let x, y be two nodes of N. Denote by M N ( x , y ) the set of nodes z of N such that there exist two separated paths in N from z to x and y. For example, in Figure 1(d), M N ' ( x , y ) = { m 1 , m 2 , m 3 } . Note that all nodes in M N ( x , y ) are speciation nodes and, when N is a tree and x, y are not comparable, M N (x, y) contains exactly one node, which coincides with LCA N (x, y).

Figure 1
figure 1

( a ) An example of a level-2 network N , ( b ) the tree bc ( N ), (c) a switching of N where the switched-off edges are dotted, (d) a network N' such that M N x , y = { m 1 , m 2 , m 3 } , (e) another switching of a network. Note that the edge (a; b) will also be switched off since all out-going edges of b are off.

If every biconnected component of N has at most k hybridization nodes, we say that N is of level-k [11]. A rooted phylogenetic tree is a rooted phylogenetic network with no hybridization nodes, i.e. a level-0 network. In the following, we will refer to rooted phylogenetic networks and rooted phylogenetic trees simply as networks and trees, respectively. In this paper, we allow trees to contain artificial nodes, i.e. nodes with indegree and outdegree 1.

Let B be a biconnected component of a network N. Then B contains exactly one node r(B) without ancestors in B [[12], Lemma 5.3]; we call r(B) the root of B. If B is not trivial, i.e. B consists of more than one node, we can contract it by removing all nodes of B other than r(B), then connect r(B) to every node with indegree 0 created by this removal. Then the following definitions are well-posed.

Definition 2 (Tree bc(N)) Given a network N, the tree bc(N) is obtained from N by contracting all its biconnected components.

For example, Figure 1(a, b) shows respectively a level-2 network N and its associated tree bc(N).

Let denote by B the node in bc(N) that corresponds to a biconnected component B in N. Given two biconnected component B i , B j , we say that B i N B j (resp. B i < N B j ) if and only if B i b c ( N ) B j (resp. B i < b c ( N ) B j ). We say that B i is the parent (resp. a child) of B j if B i is the parent (resp. a child) of B j in bc(N). We also denote by LCA N (B i , B j ) the biconnected component corresponding to L C A b c ( N ) ( B i , B j ) in N.

Definition 3 (Elementary network) Given a network N, each biconnected component B that is not a leaf of N defines an elementary network, denoted by N(B), consisting of B and all cut-edges coming out from B.

Definition 4 (Switchings of a network [13]) Given a network N, a switching S of N is obtained from N by choosing, for each hybridization node, an incoming edge to switch on and the other to switch off. Once this is done, we also switch off all switched-on edges with the target node having only switched-off outgoing edges (see Figure 1(e) for an example). For each bi-connected component B of N, we also denote by S(B) the subgraph of S restricted to N(B).

Switchings will be used in the next section to model gene histories for genes evolving in a species network. For example, Figure 1 presents in (c) a switching of the level-2 network in (a). We denote by V on (S) the set of nodes of S that are not an endpoint of any switched-off edge. A path of S is a path of N that uses only switched-on edges.

Hereafter, G will denote a tree and N a network such that there is a bijection between L(N) and L ( N ) and L ( G ) L ( N ) . In the gene tree reconciliation problem, G represents a gene tree such that each leaf corresponds to a contemporary gene and is labeled by the species containing this gene, while N is a species network such that each leaf represents an extant species. In the cophylogeny problem, G represents a parasite tree such that each leaf corresponds to a parasite species that is labeled by the species that hosts it, while N is a host network such that each leaf represents an extant species.

Reconciliations

We will now extend the definition of D L reconciliation in [14] to networks. In a D L reconciliation, each node of G is associated to a node of S and an event - a speciation (S), a duplication (D) or a contemporary event () - under some constraints. A contemporary event  ℂ associates a leaf u of G with a leaf x of S such that s(u) = s(x). A speciation in a node u of G is constrained to the existence of two separated paths from the mapping of u to the mappings of its two children, while the only constraint given by a duplication event is that evolution of G cannot go back in time. More formally:

Definition 5 (Reconciliation) Given a tree G and a network N such that L ( G ) L ( N ) , a reconciliation between G and N is a function α that maps each node u of G to a pair (α r (u), α e (u)) where α r (u) is a node of V(N) and α e (u) is an event of type  S or  D or ℂ, such that:

  • α e ( u ) = if and only if u L(G), α r (u)L(N) and s(u) = s(α r (u));

  • for every u I(G) with child nodes {u1, u2}, if α e ( u ) =S, then α r ( u ) N ( α r ( u 1 ) , α r ( u 2 ) ) ;

  • for any two nodes u, v of V(G) such that v < G u, if α e ( u ) = D , then α r (v) ≤ N α r (u). Otherwise, α r (v) < N α r (u).

Note that, if N is a tree, this definition coincides with the one given in [14].

The number of duplications of α, denoted by d(α) is the number of nodes u of G such that α e ( u ) = D . Since in a network there can be several paths between two nodes, we count the number of losses on shortest paths, as done in [4]. In more details, given two nodes x, y of N, the distance between x and y, denoted by dist(x, y), is defined as follows:

  • If y N x, then dist(x, y) = min p length(p) over all possible paths p from x to y;

  • otherwise, dist(x, y) = +∞.

Then, for every u I(G) with child nodes {u1, u2}, the number of losses associated with u in a reconciliation α, denoted by l α (u), is defined as follows:

  • if α e ( u ) =S, then l α (u) = min{dist(x1, α r (u1)) + dist(x2, α r (u2)), dist(x1, α r (u2))+dist(x2, α r (u1))} where x1, x2 are the two children of α r (u);

  • if α e ( u ) = D , then l α (u) = dist(α r (u), α r (u1)) + dist(α r (u), α r (u2)).

The number of losses of a reconciliation α, denoted by l(α), is the sum of l α (·) for all internal nodes of G. Thus, the cost of α, denoted by cost(α), is d(αδ + l(αλ, where δ and λ are respectively the cost of a duplication and a loss event. We use cost(G,N) to denote the cost of the minimum reconciliations between G and N. A reconciliation having the minimum cost is called a most parsimonious reconciliation.

Let S be a switching of N, then a reconciliation between G and S is defined similarly to Definition 5 except that only switched-on edges are considered when defining paths, and only nodes in V on (S) are counted for calculating the length of the shortest path in the definition of dist. This is done to model the fact that, since each gene of an hybridization species is inherited from one of its two parents, we should not count as a loss the fact that the other parent does not contribute. Moreover, note that, for every two nodes x, y of S such that x ≤ S y, there is a unique path from y to x in S.

When N is a tree, there is a unique reconciliation (the LCA reconciliation) between G and N which has minimum cost and this reconciliation can be found in O(|G|) time [1518] as follows:

  • for each node u in L(G), α r (u) is defined as the only node x of S such that s(u) = s(x), and α e ( u ) =;

  • for each node u in I(G) with child nodes {u1, u2}, α r (u) = LCA N (α r (u1), α r (u2)); if α r (u1) N α r (u2) or α r (u2) N α r (u1) then α e ( u ) = D ; otherwise α e ( u ) =S.

In the LCA reconciliation, the mapping α e is totally defined by α r , hence it can be omitted, and we will use α to refer to α r . Note that the algorithms used on trees to find the LCA reconciliation can also be used on switchings, which - when only switched-on edges are considered - are actually trees. Hereafter, when we refer to the reconciliation between a tree and a switching, we refer to the LCA reconciliation between them. The problems in which we are interested in here are defined as follows:

Problem 1 BEST SWITCHING FOR THE D L MODEL

Input A tree G, a network N such that L ( G ) L ( N ) , and positive costs δ and λ for respectively  D and  L events.

Output A switching S of N such that the cost(G, S) is minimum over all switchings of N.

Problem 2 MINIMUM D L RECONCILIATION ON NETWORKS

Input A tree G, a network N such that L ( G ) L ( N ) , and positive costs δ and λ for respectively  D and  L events.

Output A minimum reconciliation between G and N.

Remark 1 For the sake of simplicity, we suppose that G does not contain any internal node u such that | L G u | = 1 (i.e. all nodes of G u are mapped to a leaf of N). If it is not the case, we can simplify the instance by replacing in G each such subtree G u by a leaf labeled by the unique label in L G u and compute a reconciliation for the simplified tree G'. A parsimonious reconciliation for G can be easily obtained from a parsimonious one for G'.

Method

Best switching

We start by proving that finding the best switching for the D L model is NP-hard:

Theorem 1 Problem 1 is NP-hard.

Proof: To prove the theorem, we reduce Problem 1 to the TREE CONTAINMENT problem, which is NP-hard [19]. The TREE CONTAINMENT problem asks the following "Given a network N and a tree T, both with their leaf sets bijectively labeled by a label set  X, is there a switching S of N such that T can be obtained by S deleting all switched-off edges and nodes with indegree and outdegree 1?". Now, assume there is an algorithm  A to solve Problem 1 in polynomial time. Then, it is easy to see that, since λ, δ > 0, there is a solution of Problem 1 with cost 0 if and only if G is contained in N. Therefore, this method would provide a polynomial-time algorithm to solve the TREE CONTAINMENT problem, which is impossible.

In the following, we present a fixed-parameter tractable algorithm [20] in the level of the network to solve Problem 1. To do so, we need to introduce some notations.

Definition 6 (Mapping B ) For every u V(G), B(u) is defined as the lowest biconnected component B of N such that (Nr(B)) contains (G u ).

Then the following remark holds:

Remark 2 If u L(G), then B(u) is the only leaf of N such that s(u) = s(B(u)). If u L(G), then B(u) = LCA N (B(u1), B(u2)) where u1, u2 are child nodes of u in G.

We define by G N the tree obtained from G by adding some artificial nodes on the edges of G and label each node of G N by a biconnected component of N via an extension of the labeling function B(·) as follows:

Definition 7 (Tree G N ) The tree G N is obtained from G as follows: for each internal node u in G with child nodes u1, u2 such that there exist k biconnected components B i 1 > N . . . > N B i k strictly below B(u) and strictly above B(u1), we add k artificial nodes v1 > ... >v k on the edge (u, u1), and B(v j ) is fixed to B i j . We do the same for u2.

See Figure 2 for an example of G N . We have the following lemma:

Figure 2
figure 2

(a) A gene tree G and (b) the tree G N along with the labeling B (·) of its nodes ( N here is the network in Figure 1(a)).

Lemma 1 Let u be a node of I(G N ), and u' be one of the children of u. If u is an artificial node, then B(u) is the parent of B(u') and a child of B(p(u)); otherwise, B(u') is either equal to B(u) or one of its children.

Proof: Suppose that u is an artificial node. Then, by Definition 7, B(p(u)), B(u), B(u') are three consecutive nodes of G N , thus B(u) is the parent of B(u') and a child of B(p(u)). Suppose now that u is not an artificial node, and let u" be the child of u in G such that u" Gn u' Gn u. If B(u") = B(u'), then by definition, u" = u' because no artificial node is added between u and u", and thus the claim holds. If B(u') ≠ B(u"), then by Definition 7, B(u') is the highest biconnected component of N that is below B(u) and above B(u"), which is then a child of B(u).

Definition 8 (G B ) Let B be a biconnected component of N different from a leaf, then G B is the set of all maximal connected subgraph H of G N such that B(u) = B for every u I(H).

For example, in Figure 3, G B 1 consists of one binary tree, G B 2 consists of one edge, and G B 3 contains 1 tree and 1 edge.

Figure 3
figure 3

An example of execution of Algorithm 1 on the tree G in Figure 2(a) and the network N in Figure 1(a). (a) G B 1 and a switching of N(B1) on which its reconciliation with G B 1 contains 1 duplication and 2 losses. (b) G B 2 and a switching of N(B2) on which the reconciliation with G B 2 contains one loss. (c) G B 3 and a switching of N(B3) on which the reconciliation with G B 3 contains 2 losses.

Lemma 2 Let B be a biconnected component of N different from a leaf, then we have the following:

(i) for every H G B , H is either a binary tree or an edge whose upper extremity is an artificial node. Moreover, for every leaf u of H, B(u) is a child of B.

(ii) if B = B(r(G)), then G B consists of one binary tree.

Proof: (i) First, suppose that I(H) contains an artificial node u. Then this artificial node is the only internal node of H; indeed, by Lemma 1, the value of B(·) for the parent and the child of u are both different from B. Thus, H consists of only one edge whose upper extremity is u. If I(H) does not contain any artificial node, it follows that H is a binary tree. Moreover, by Lemma 1 and Definition 8, B(u) is a child of B for every leaf u of H.

(ii) Suppose now that B = B(r(G)), and G B contains at least two components H1, H2, rooted at two different nodes r1, r2 where B(r1) = B(r2) = B. Let r = L C A G N ( r 1 , r 2 ) , then, by Definition 6, B(v) = B for every node v on the two paths from r to r1 and to r2, because B(r(G)) = B(r1) = B(r2) = B and r 1 , r 2 G N r G N r G . But this contradicts the maximality of H1 and H2 since they can both be extended. Hence G B contains only one component. Suppose that this component is an edge; thus, its upper extremity is an artificial node that has been added on the path from a node u to a node v of G where u is strictly higher than r(G). But this is not possible, because r(G) is the highest node of G. Therefore, G B contains one binary tree.

Given a biconnected component B i different from a leaf, denote by G B i t the set of binary trees of G B i , and G B i e the set of edges of G B i . Let S i be a switching of N(B i ), and let H be a tree in G B i t . By Lemma 2, for every u L(H), B(u) is a child of B i and thus r(B(u)) is a leaf of N(B i ), which is also a leaf of S i . Hence, we can define a reconciliation between H and S i , denoted by β S i H , such that each leaf u of H is mapped to the leaf r(B(u)) of S i .

Lemma 3 Let S be a switching of N, and let α be the reconciliation between G and S. For every u I(G), there exists H G B ( u ) t such that u I(H), and α ( u ) = β S ( B ( u ) ) H ( u ) .

The proof of this lemma is deferred to the appendix. The following definition will be useful later on.

Definition 9 ( cost(H,S i )) Let B i be a biconnected component of N different from a leaf, and S i a switching of N(B i ); then cost(H,S i ) is defined as follows:

  • H G B i t , c o s t ( H , S i ) = c o s t ( β S i H ) if B i = B(r(G)), and c o s t ( H , S i ) = c o s t ( β S i H ) + λ · d i s t ( r ( S i ) , β S i H ( r ( H ) ) otherwise;

  • H G B i e , c o s t ( H , S i ) = λ · d i s t ( r ( S i ) , β S i H ( r ( B ( u ) ) ) where u is the only leaf of H.

As we will see later, this cost corresponds to the contribution of H to a reconciliation between G and any switching of N that contains S i . For example, in Figure 3(b), H is the edge (B2, a) and, if S i is the switching on the left, then cost(H,S i ) = λ.

The next lemma is a central one, and it permits to solve Problem 1 independently per each biconnected component of N :

Lemma 4 Let {B1,..., B p } be the biconnected components of N that are not leaf nodes, and let S be a switching of N where each elementary network N(B i ) has S i as switching. Then c o s t G , S = i = 1 p H G B i c o s t ( H , S i ) .

Proof: Let α be the reconciliation between G and S. Denote by d α (S i ) the number of nodes in I(S i ) associated to a duplication by α. By Remark 1, no duplication happens at leaves of S. Additionally, B i H G B i t I H = I G and the sets of internal nodes of G B i t are disjoint. Hence, we have d ( α ) = i = 1 i d α ( s i ) = i = 1 p H G B i t d ( β S i H ) because β S i H ( u ) = α ( u ) for every internal node u of H (Lemma 3).

Let us now consider the loss count. Note that a node/edge is on (resp. off) in S i if and only if it is also on (resp. off) in S. Let x, y be two nodes of S such that y ≤ S x. Then we define d i s t S i ( x , y ) as the number of nodes z in V on (S i ) \ L(S i ) such that y < S z ≤ S x. Then, for each internal node u of G, we define the number of losses associated with u in S i , denoted by l α (u, S i ), similarly to l α (u) but using the function d i s t S i instead of dist. Then, l α ( u ) = i = 1 p l α ( u , S i ) . Now, let u1, u2 be two children of u in G, then l α (u, S i ) >0 only if the path from α(u) to either α(u1) or α(u2) in S contains at least a node of B i . Therefore, we have three possible cases: (1) α(u) is in is in B i , (3) α(u) is above r(B i ) while either α(u1) or α(u2) is in a biconnected component below B i . In case (1), by Lemma 3, there exists a binary tree H of G B i t such that uI(H), and α v = β S i H ( v ) for every vI(S i ), thus l α u , S i = l β s i H u . Now, let suppose S i that case (2) holds for u1, then u1 must be the root of a binary tree H1 of Gt , and the contribution of u1 to l α (u, S i ) is d i s t r S i , β S i H 1 r H 1 . Note that in this case, u1r(G). Finally, let suppose that case (3) holds for u1 and let u a , u b be the artificial nodes added on the edge (u, u1) of G such that B(u a ) = B i and B(u b ) is a child of B i . Hence, u a , u b G B i e , and the contribution of u1 to l α (u, S i ) is dist(r(S i ), r(B(u b ))). Let call V i 1 , V i 2 , V i 3 the set of nodes u in the first, second, and third case. By construction, V1 is disjoint from V i 2 and V i 3 . Moreover, V i 2 and V i 3 are disjoint because if a node u has two children u1, u2 such that u1 is in B i , and u2 is below B i , then u must be in B i , i.e. cannot be above r(B i ). Thus,

l ( α ) = u I ( G ) l α ( u ) = u I ( G ) i = 1 p l α ( u , S i ) = i = 1 p u V i 1 V i 2 V i 3 l α ( u , S i ) .

Therefore,

c o s t ( G , S ) = δ d ( α ) + λ l ( α ) = i = 1 p ( δ d α ( S i ) + λ u I ( G ) l α ( u , S i ) ) = i = 1 p ( δ H G B i t d ( β i H ) + λ u V i 1 V i 2 V i 3 l α ( u , S i ) = i = 1 p ( [ λ u V i 3 ( u , S i ) ] + + [ δ H G B i t d ( β S i H ) + λ u V i 1 l α ( u , S i ) + λ u V i 2 l α ( u , S i ) ] ) .

As proved above (in case (3)), the first term between squared brackets is equal to H G B i t cost ( H , S I ) by Definition 9. In the second term between squared brackets, the sum of the two first factors is exactly H G B i t c o s t ( β S i H ) (as proved in case (1)), while the last factor is equal to λ · H G B i t d i s t ( r ( S i ) , β S i H ( r ( H ) ) (as proved in case (2)). Note that as mentioned in case (2), only nodes that are not the root of G are considered. Hence, the second term between squared brackets corresponds to H G B i t c o s t ( H , S i ) by Definition 9.

Therefore, c o s t G , S = i = 1 p H G B i c o s t ( H , S i ) and this concludes the proof.

Algorithm 1 computes the switching of N for which its reconciliation with G has the smallest cost, by analyzing each biconnected component of N independently. See Figure 3 for an example of application of this algorithm to the species network in Figure 1(a) and the gene tree in Figure 2(a).

Algorithm 1 Solving Problem 1

1: Input: A species network N and a gene tree G such that L ( G ) L ( N ) , and positive costs δ, λ for duplication and loss events, respectively.

2: Output: A switching S of N that is optimal in the sense of Problem 1.

3: Compute the tree G N and its labeling function B(·);

4: Compute G B i for each biconnected component B i of N that is not a leaf;

5: for each biconnected component B i of N do

6:      for each switching S i j of N(B i ) do

7:          c o s t j = H G B i c o s t H , S i j ;

8:      S i m the switching of N(B i ) with the lowest value of cost j over all j;

9: Return the switching S of N in which each elementary network N(B i ) has S i m as switching.

Theorem 2 Let N be a level-k network with p biconnected components. Algorithm 1 runs in O(|N| + 2k·p·|G|) time and returns a switching S of N such that cost(G,S) is minimum.

Proof: Complexity: It is well-known that all biconnected components of N can be computed in linear time, i.e. O(|N|), by using depth-first-search [10]. After a linear preprocessing, LCA operations on a tree can be performed in constant time [21, 22]. Thus, from Remark 2, the mapping B(·) can be computed in O(|G N |). Hence, the tree G N can be constructed in times O(|G N | + |N|).

By a simple traversal of G N which takes time O(|G N |), we can compute G B i for all B i . Each biconnected component B i of N has at most k hybridization nodes, then N(B i ) has at most 2k switchings. For each switching S i j of N(B i ), it takes O(|G B |) to compute cost j [23, 24]. The overall size of all G Bi is the size of G N . Therefore, the total complexity of the loop at lines 5 - 8 is O(2k ·|G N |). Each edge of G can have at most p artificial nodes added to it. Hence in the worst case O(|G N |) = O(|Gp), i.e. the total complexity of Algorithm 1 is O(|N| + 2k·p·|G|).

Correctness: Let S be a switching of N where each elementary network N(B i ) has S i as the switching. By Lemma 4, cost(G,S) = i = 1 p H G B i cost ( H , S i ) . Hence cost(G,S) is minimum if and only if H G B i cost ( H , S i ) is minimum for every S i . Lines 5-8 in Algorithm 1 search, for each network N(B i ), the tree S i m such that H G B i cost ( H , S i ) is minimum, which implies the correctness of the algorithm.

Minimum Reconciliation on Networks

Given a tree G and a network N, in [4] the authors prove that reconciling G on N can be solved in polynomial time, when host switchings (or transfer events, in the DTL reconciliation terminology) are also accounted for. In their model, each node of N is dated by a single date while each node of G is dated by a set of dates, and they search for a parsimonious reconciliation between G and N, i.e. one that has minimum cost, under the constraint that an event associated to a node u of G can only happen at a node/edge of N whose date is contained in the set of possible dates of u. Although the algorithm complexity stays polynomial, it is very high: O(τ3·|G|·|N|5) for a binary tree and a binary network, where τ is the number of possible dates of the nodes of G and N, which is at most O(|G| + |N|). A drawback of this model is that it requires information on the dates that is often not available. Moreover, transfers are not always possible in all parts of Tree of Life. Here, we take into account only speciation, duplication and loss events, and consider G and N as undated (see Problem 2 and Definition 5 for more details). Using a similar dynamic algorithm on this simpler model, and by some further analyses, we provide an algorithm that is a generalization of the LCA algorithm to networks that has a much smaller complexity than the algorithm in [4], namely O(h2·|G|·|N|), where h is the number of hybridization nodes of N.

Let x, y be two nodes of N. Denote by M i n N x , y the subset of M N x , y such that, for every z M i n N x , y , there does not exist any z M i n N x , y such that every path from z to x and to y passes through z'. For example, in Figure 1(d), m1, m2, m3 are in M N x , y but only m1 and m2 are in M N x , y because every path from m3 to x, y must pass m2.

For the sake of simplicity, we consider only reconciliations without duplications on hybridization nodes: indeed, since losses are not counted at hybridization nodes, a duplication on such nodes can be moved to its only child without changing the total cost of the reconciliation.

Lemma 5 Let α be a reconciliation of minimum cost between G and N, then for every node u of G that has two children u1, u2, we have:

(i) if α e u =S, then α r u M i n N ( α r u 1 , α r u 2 ) ;

(ii) if α e u = D , then either α r (u1) ≤ N α r (u2) and α r (u) = α r (u2), or α r (u2) ≤ N α r (u1) and α r (u) = α r (u1).

Proof: (i) Suppose that α e ( u ) =S, then by definition α r (u) must be a node of M N ( α r u 1 , α r u 2 ) . Let x1, x2 be two children of α r (u) such that l α (u) = dist(x1, α r (u1))+dist(x2, α r (u2)). Suppose that α r u M i n N ( α r u 1 , α r u 2 ) , then there exists a node y in M i n N ( α r u 1 , α r u 2 ) such that every path from α r (u) to α r (u1) (resp. to α r (u2)) passes for y. Let y1, y2 be the two children of y.

First, we suppose that the shortest path from x1 to α r (u1) passes through y, y1, while the one from x2 to α r (u2) passes y, y2. Consider the reconciliation α' such that α r v = α r v and α r e = α r e for every vu, while α r u = y and α e u = S . It is easy to see that α' respects Definition 5, and that d(α) = d(α'). Denote by f = dist(α r (u), y), then f >0. The numbers of losses in α and α' are different on those associated with u and p(u) (if u is not the root of G). We thus have l α (p(u)) ≥ l α' (p(u)) - f if ur(G). Moreover, l α (u) = dist(x1, α r (u1)) + dist(x2, α r (u2)) = dist(x1, y) + 1 + dist(y1, α r (u1)) + dist(x2, y) + 1 +dist(y2, α r (u2)) ≥ dist(α r (u), y) + dist(y1, α' (u1) + dist(α r (u), y)+dist(y2, α' (u2))) ≥ 2·f +l α' (u). Hence, whether u coincides with r(G) or not, l(α) > l(α'), i.e. cost(α) > cost(α'), a contradiction.

Suppose now that both the shortest paths from x1 to α r (u1) and to α r (u2) pass through y, and then pass through y1 (or y2). This means that y1 is above both α r (u1) and α r (u2). Let y' be one of the lowest nodes below or equal to y1 that is above both α r (u1) and α r (u2). Let y 1 , y 2 be the two children of y', and sup-1 2 pose, without loss of generality, that y 1 is above or equal to α r (u1) and y 2 is above or equal to α r (u2). Hence, the shortest path from x1 to α r (u1) must pass, in the order, through y, y1, y', and y', while the shortest path from x2 to α r (u2) must pass through y, y1, y', and y 1 . By defining the reconciliation α'as done above apart for α'(u), which is fixed to y', we arrive at a contradiction by a similar argument.

(ii) Suppose that α e ( u ) = D , and α r (u1), α r (u2) are not comparable. Hence, M i n N ( α r u 1 , α r u 2 ) is not empty. If α r u M i n N ( α r u 1 , α r u 2 ) , then there exists a node y M i n N ( α r u 1 , α r u 2 ) such that every path from α r (u) to α r (u1) and to α r (u2) must pass through y. Similarly to case (i), we have that the reconciliation α' that coincides with α apart for the fact that α r u = y and α e u = S has smaller cost than α, a contradiction. Hence, α r (u) 2 in N (α r (u1), α r (u2)). Considering now the reconciliation α' that coincides with α but for α' (u), which is fixed to  S. Hence d(α) = d(α')+1, and l α p u = l α p u if u ≠ r(G). Let x1, x2 be the two children of α r (u). If the shortest path from α r (u) to α r (u1) passes through x1 while the shortest path from α r (u) to α r (u2) passes through x2, then l α u = 2 + l α ( u ) . Therefore, cost(α) > cost(α'), a contradiction. Thus, both the two shortest paths from α r (u) to α r (u1) and α r (u2) must pass through x1 (or x2). Let y be one of the lowest nodes located on both of these paths. Then, y in N (α r (u1), α r (u2)). By the same argument as in the previous case, the reconciliation α" coinciding with α but for α r u =y and α e u =S must have smaller cost than α, a contradiction.

Hence, either α r (u1) N α r (u2) or α r (u2) N α r (u1). Suppose that the first case holds (the second case is similar), but α r (u) ≠ α r (u2), i.e. α r (u2) < N α r (u). Let x1, x2 be two children of α r (u). If the shortest path from α r (u) to α r (u1) passes through x1 while the shortest path from α r (u) to α r (u2) passes through x2, then by replacing α e (u) by an  S event, we obtain a reconciliation with a smaller cost. Thus, both shortest paths from α r (u) to α r (u1) and α r (u2) must pass through x1 (or x2). Let y be a node that is located on both paths such that there is no other node below y on these two paths. Then, yin N (α r (u1), α r (u2)). By the same argument as in the case (i), the reconciliation α' such that α r v = α r v , α e v = α e v for every vu, α r u = y , α e u = S must have smaller cost than α, a contradiction.

Now, we are ready to describe a dynamic algorithm to compute a reconciliation of minimum cost between G and N. Let α be a reconciliation between G and N. For every u V(G), denote by cost α (u) the cost of the reconciliation of α restricted to G u . Hence, if α is a most parsimonious reconciliation, then cost α (u) is the minimum cost among all reconciliations between G u and N that maps u to α r (u). Algorithm 2 aims at computing, for each u, the set  C(u) containing all pairs (x,c) such that c is the minimum cost among all reconciliations between G u and N mapping u to x. It is straightforward to see that the cost of a most parsimonious reconciliation between G and N is the minimum cost involved in a pair in  C(r(G)).

The function merge(L1, L2) used in Algorithm 2 takes as input two lists of pairs (x,c) - where x is a node of N and c is a real number - and merges them keeping, for each x, the pair (x,c) with the smallest value of c. The method computeMin(y, z) used in Algorithm 2 is detailed in Algorithm 3. This method computes, for two nodes y, z of N, the set M i n N y , z by using two breath-first-searches (BFS) starting respectively from y and z up to the root of N (note that, to perform the breath-first-searches, the edges are considered as directed in the inverse order). For this, it labels each node v in such a way that, if v is not strictly above y and z, then label (v) = . Otherwise, label(v) is the lowest node such that every path from v to y and z passes through it. This method also computes the value of the function dist between y (resp. z) and each node visited in the corresponding breath-first-search.

Algorithm 2 Solving Problem 2

1: Input: A network N and a tree G such that L ( G ) L ( N ) , and positive costs δ, λ for duplication and loss events, respectively.

2: Output: The set  C(u) of pairs (x,c) for every u V G .

3: for each node u of G in post-order do

4:    C(u) ← ;

5:   if u is a leaf then

6:      Let x be the leaf of S such that s(x) = s(u);

7:       C(u) ← {(x, 0)};

8:   else

9:      Let u1, u2 be the two children of u;

10:      for each (y, c1)  C(u1) and each (z, c2)  C(u2) do

11:         computeMin(y, z);

12:         C;

13:         for each x M i n N y , z do

14:            Let x1, x2 be the two children of x in N ;

15:            c = c1 + c2 + λ·min{dist(x1, y) + dist(x2, z), dist(x2, z) + dist(x1, y)};

16:            CC {(x, c)};

17:         if y ≤ N z then

18:            c = δ + λ·dist(z, y)+ c1 + c2;

19:            CC {(z, c)};

20:         else if z ≤ N y then

21:            c = δ + λ·dist(y, z) + c1 + c2;

22:            CC {(y, c)};

23:        C(u) = merge(C(u),C);

24: Return  C.

The following theorem proves the correctness of Algorithm 2:

Theorem 3 Algorithm 2 returns a matrix  C such that, for every u V(G), (x,c) is contained in  C(u) if and only if there exists a most parsimonious reconciliation between G u and N mapping u to x with cost c.

Algorithm 3 computeMin(y, z)

1: Proceed a BFS from y, store the ordered list of visited nodes in BFS(y) and compute, for each u in BFS(y), dist(y,v);

2: Do the same from z;

3: for each node v BFS(y) do

4:   if v = y or v = z or v is not in BFS(z) then label(v) =

5:   else if v has only one child v1 that is in BFS(z) or BFS(y) then

6:      label(v) = label(v1);

7:   else

8:      Let v1, v2 be the two children of v;

9:      if label(v1) = label(v2) ≠ then

10:         label(v) = label(v1);

11:      else

12:         label(v) = {v}; Add v into M i n N y , z ;

Proof: For each u V(G), we need to prove that, if α' is a reconciliation of minimum cost between G u on N, then (α'(u), cost α' ) is contained in  C(u). This is obviously true for every leaf of G (by lines 5-7). Let now u be an internal node having two children u1, u2. Then, following Lemma 5,  C(u) can be computed from  C(u1) and  C(u2) by using the information contained in M i n N and dist. Lines 10-23 in Algorithm 2 computes  C(u) following this lemma.

It remains now to prove that Algorithm 3 correctly computes M i n N y , z . For every node v that is above y, z, denote by low(v) the lowest node such that every path from v to y, z must pass through this node. There is only one such node. Indeed, suppose that there are two such nodes m, m', then every path from v to y must pass through both m, m', i.e. either m < N m' or m' < N m, contradicting the lowest property of m, m'. To prove the claim, we need to show that if v is a node of BFS(y), then:

(i) if v is not strictly above y and z, then label(v) = ;

(ii) otherwise, label(v) = low(v) and line 12 of Algorithm 3 is performed if and only if v is actually in M i n N y , z .

Let v be a node of BFS(y), then (i) holds by line 4. Now consider the case where v is strictly above y and z. We will prove (ii) by recursion on v following the order of the nodes in BFS(y). The recursion begins from the set of lowest nodes that are strictly above y and z, i.e. the set of nodes of v in M i n N y , z such that there is not any node in M i n N y , z that is below v. Let v1, v2 be two children of v, then by hypothesis v1, v2 are not strictly above y, z, i.e. label(v1) = label(v2) ≠ ; and low(v) = v. Thus, due to line 12, label(v) = v = low(v). Now let v be a node strictly above y, z such that (ii) is correct for each node below v which is strictly above or equal to y, z. If v is a hybridization node, then it is evident that low(v) = low(v1) where v1 is the only child of v. Moreover, since label(v1) = low(v1) (by the hypothesis of recurrence), then label(v) = label(v1) = low(v1) = low(v). If v is a speciation node having two children v1, v2 such that v2 is not in either BFS(y) or BFS(z), then we also have low(v) = low(v1). Hence, due to lines 5 - 6, we have label(v) = label(v1) = low(v1) = low(v). Now consider the last case, i.e. v is a speciation node having two children v1, v2 that are both in BFS(y) and BFS(z). If there exists a node q = low(v1) = low(v2), then low(v) = q because every from v to y, z must pass either through v1 or v2, i.e. always pass through q. Following line 10, we fix label(v) = label(v1) = q = low(v). Moreover, in this case v can not be in M i n N y , z because every path from v to y, z passes through a node q below v. In the last case, we have l a b e l v 1 l a b e l v 2 . Since both v1, v2 are above y, z, then there exists a node q1 = label(v1), and a different node q2 = label(v2). We will prove that v M i n N y , z . Indeed, suppose otherwise, then there is a node q such that every path from v to y, z must pass through q. Hence, every path from v1 (resp. v2) to y, z must also pass through q, so q1 N q (resp. q2 N q). It means that there is a path from v1 to q to q2 and then to y, z that does not pass through q1, a contradiction. Hence v is in M i n N y , z , and thus by definition the only node that every path from v to y, z must pass through is v itself (line 12).

We now present some intermediate results that will be useful to prove the complexity of Algorithm 2.

We extend the definition of M N to a subset of leaves. Let L be a subset of L(N ). If |L| = 1, then M N L = L . Otherwise, M N L is the set of nodes m of N such that m is above all leaves in L and there exist at least two separated paths from m to two distinct leaves of L.

Given a node u of G, L N (u) is defined as the set of leaves of N to which α maps the leaf set of G u , i.e. L N u = { x L N | u L G u and s(u) = s(x)}.

Lemma 6 Let α be a most parsimonious reconciliation between G and N, then, for every node u of G , α r u M N L N u .

Proof: It is true for every leaf u of G. Let u now be an internal node having two children u1, u2.

If u1, u2 L(G), then following Remark 1, L N (u) consists of two distinct nodes α r (u1), α r (u2). By Lemma 5, α e ( u ) =S and α r u M i n N ( α r u 1 , α r u 2 ) , i.e. there exist two separated paths from α r (u) to α r (u1) and α r (u2). It means that α r u M N L N u .

Let u1 L(G), then following Remark 1, |L N (u1)| ≥ 2, then there always exist two distinct leaves x, y of L N (u) such that x L N (u1), y L N (u2), i.e. x is below α r (u1) and y is below α r (u2). If α e ( u ) =S, then following Lemma 5, α r u M i n N ( α r u 1 , α r u 2 ) , i.e. there exist two separated paths from α r (u) to α r (u1), α r (u2). By extending these two paths from α r (u1) to x, and from α r (u2) to y, we have to two separated paths from α r (u) to x, y. In other words, α r (u) N (L N (u)). If α e (u) =  D and suppose that α r (u2) N α r (u1), then α r (u) = α r (u1) following Lemma 5, and α r (u) is not a leaf of N following Remark 1. Let u' be the highest node such that u' G u1 and α e ( u ) = S . Then following Lemma 5, α r ( u ) = α r u , and there exists two separated paths from α r (u'), i.e. from α r (u), to two distinct leaves of L N (u'), i.e. two distinct leaves of L N (u). We can prove the claim similarly for the case when α r (u1) N α r (u2).

Lemma 7 If N is a network that contains h hybridization nodes, then for every subset L of L N , | M N L | h + 1 holds.

The proof of this lemma is deferred to the appendix. We are now ready to state the complexity of Algorithm 2.

Theorem 4 The time complexity of Algorithm 2 is O(h2·|G|·|N|) where h is the number of hybridization nodes of N.

Proof: For every u V(G), |C(u)| is equal to the possible nodes of N that u can be mapped to, which is bounded by | M N L N u | by Lemma 6, and so by O(h) following Lemma 7.

The for loop at lines 3 - 23 is performed |G| times, and, at each iteration, the for loop at lines 10-23 is performed O(h2) times. In each iteration of the second loop, the operation computeMin, as detailed in Algorithm 3, requires two breath-first-search traversals, which can be performed in time O(|N|). Moreover, for every node x of M i n N y , z , by definition there exists two separated paths from x to y, z, which can be extended to be two separated paths from x to two distinct leaves l1, l2 of L N (u) where l1 is a leaf below y of and l2 is a leaf below z. This is always possible because, by Remark 1, |L N (u)| > 1. Hence, x must be in M N L N u by definition, i.e. M i n N y , z M N L N u , and thus | M i n N y , z | | M N L N u | h +  1 . Therefore, the loop at lines 13 - 16 can be performed in time O(h). The operation merge(L1, L2) at lines 23 for two lists of size O(h) can be implemented in times O(h), if we know that the resulting list is also of size O(h). Hence, it takes O(|N| + h) = O(|N|) times for each iteration of the loop 10 - 23. Therefore, the total complexity is O(h2· |G|·|N|).

Finally, a reconciliation of minimum cost between G and N can be then obtained by a standard back-tracking of the matrix  C, starting from any pair (x,c) of  C(r(G)) such that c is the minimum value over all pairs in  C(r(G)).

Conclusions

In this paper, we have studied two variants of the reconciliation problem between a gene tree and a species network. In particular, for the problem of finding the "most parsimonious" switching of the network, even though the number of switchings can be exponential with respect to the number of hybridization nodes, we proposed an algorithm that is exponential only with respect to the level of the network, which is often low for biological data. Moreover, the problem of finding a reconciliation between a gene tree and a network, which was solved in [4] for a more general model but with a very high complexity, was re-studied here for a simpler model, which is more pertinent for same parts of the Tree of Life, and an algorithm with a much smaller complexity was provided. In a further work, we intend to implement the algorithms presented in this paper and apply them to biological data.

Appendix

Proof of lemma 3

By Definition 8, for every u I(G), there must exist H GB(u) such that u I(H). If H is an edge, then u is the only internal node of H, which must be an artificial node by Lemma 2. But this is not possible because nodes of G cannot be artificial. Hence, H must be a binary tree. Let denote B i = B(u), and S i = S(B(u)). We will prove now that α u = β S i H u by recursion on the height of u.

Let u be an internal node of G that has two children u1, u2 in G, and let H be the binary tree of G B i such that u I(H). Denote B i 1 = B u 1 , B i 2 = B u 2 , and S i 1 = S B u 1 , S i 2 = S B u 2 . For j = 1, 2, if u j is a leaf, let H j be equal to u j , otherwise H j is the binary tree of G B i j such that u j I(H j ). For the sake of convenience, if u j is a leaf, we also denote by β S i j H j the reconciliation that maps the only leaf u j to the only leaf x of N such that s(x) = s(u j ). Note that s(x) = α(u j ).

We now suppose that α u j = β S i j H j u j for j = 1, 2 (which is evidently true if u j is a leaf), and we will show that this implies that the claim is true for u.

Let u 1 (resp. u 2 ) be the child of u in G N such that u 1 G N u 1 < G N u ( resp . u 2 G N u 2 ) < G N u ). We respectively denote B i 1 = B ( u 1 ) and B i 2 = B ( u 2 ) . By definition of the LCA reconciliation, we have β S i H ( u ) = L C A S i ( β S i H ( u 1 ) , β ( u 2 ) ) .

  1. (i)

    If B i 1 = B i 2 , then B i = B i 1 = B i 1 = B i 2 = B i 2 , and H = H1 = H2. This implies that u 1 = u 1 , because otherwise H will contain an artificial node. The same holds for u 2 and u2. Thus, α u = L C A S ( α u 1 , α u 2 ) = L C A S ( β S i 1 H 1 u 1 , β S i 2 H 2 u 2 ) = L C A S ( β S i H u 1 , β S i H u 2 ) = L C A S i ( β S i H u 1 , β S i H u 2 ) = L C A S i ( β S i H u 1 , β S i H u 2 ) = β S i H u .

  2. (ii)

    If B i 1 < N B i 2 , then B i = B i 2 , and H = H2. As in point (i), this implies u 2 = u 2 and thus α ( u ) = L C A S ( α ( u 1 ) , α ( u 2 ) ) = L C A S ( β S i 1 H 1 ( u 1 ) , β S i H ( u 2 ) ) . If u 1 = u 1 , then we have L C A S ( β S i 1 H 1 ( u 1 ) , β S i H ( u 2 ) = L C A S ( β S i H ( u 1 ) , β S i H ( u 2 ) = β S i H ( u ) . Otherwise, u 1 is an artificial node which is a leaf of H that is mapped to r ( B i 1 ) by β S i H . By Lemma 1, B i 1 N B i 1 < N B i , so all nodes of B i are above all nodes of B i 1 and above r ( B i 1 ) . This implies that L C A S ( β S i 1 H 1 u 1 , β S i H ( u 2 ) ) = L C A S ( r B i 1 , β S i H ( u 2 ) ) = L C A S i ( β S i H ( u 1 ) , β S i H ( u 2 ) ) = β S i H u . Similarly for the case where B i 2 < N B i 1 .

  3. (iii)

    Suppose now that B i 1 , B i 2 are not comparable and that u 1 u 1 and u 2 u 2 (the other cases can be shown reusing the arguments of point (ii)). Then, similarly as in point (ii), B i 1 N B i 1 < N B i , B i 2 N B i 2 < N B i , and u 1 , u 2 are leaves of H mapped respectively to r ( B i 1 ) and r ( B i 2 ) by β S i H . Since β S i 1 H 1 u 1 is a node of B i 1 , β S i 2 H 2 u 2 is a node of B i 2 , then L C A S ( β S i 1 H 1 u 1 , β S i 2 H 2 u 2 ) = L C A S r B i 1 , r B i 2 = L C A S i ( β S i H u 1 , β S i H u 2 ) = β S i H u .

Therefore, in all cases we always have α u = β S H u , and thus the same is true for every u I(G) by recursion.

Proof of lemma 7

We will prove this lemma by recursion on the number of hybridization nodes. See the figure 4 for an example.

Figure 4
figure 4

An illustration for the proof of Lemma 7. In this example: L = {l1, l2, l3, l4}, Q = {q1, q2, q3}, L* = {l1, l3, l4}, L3 = {l4}, L2 = {l3}, and L1 = . For i = 1, let l(q1) = l3; thus, we have c(1) = 2 and the path p1 starts from q1, passes through q 1 , b1 to l3, while the path p 1 starts from q2, passes through q 2 , b1 to l3. In this case, we have h1 = b1. For i = 2, let l(q2) = l3; thus we have c(2) = 3 and the path p2 starts from q2, passes through q 2 , b1, b2, h2 to l4, while the path p 2 starts from q3 passes through q 3 to l4. Let x be a node in M N ( L ) , then x is also in M N ( L ) where N" is obtained from N' by removing all edges (a i , b i ).

If there is no hybridization node, then N is a tree, and it is evident that M N L contains exactly one node.

Suppose that the claim is correct for every network having h hybridization nodes. Let N now be a network that has h + 1 hybridization nodes. Let (a, b) be an edge of N having as target a hybridization node (namely, b) such that it does not exist any hybridization node above a (such a node always exists because N is a directed acyclic graph). Let N' be the network obtained by removing (a, b) from N (and also removing all nodes of indegree 1 and outdegree 1 created by this removal), then N' has exactly h hybridization nodes. Let Q = M N L \ M N L , then every node q in Q must be above a. Indeed, if q is not above a, then every path from q to every node of L does not contains (a, b), thus q is in M N L , a contradiction. Moreover, by hypothesis, there is no hybridization node above a, hence all nodes of Q must be contained in a path leading a, and this path does not contain any hybridization to node. Let enumerate the nodes in Q as q1,... q m from the lowest to the highest one.

If Q 1 , then | M N L = | M N L | + Q h + 1 + 1 = h + 2 , we are done.

Suppose now that |Q| = m >1. In the following, we will define m - 1 edges of N having as target a hybridization node such that if N" is the network obtained from N' by removing these edges, then M N L = M N L .

Denote by L* the set of nodes in L that are below q m in N'. Hence L \ L* is not empty since otherwise q m would be in M N L , a contradiction. For every q i , i = 1,..., m, let q i , q i be the two children of q i such that q i is above or equal to a. Hence, q i , is not above or equal to a since there is no hybridization node above a, thus every path from q i to L \ L* must pass through q i and a, b. By definition, there must exist at least two separated paths from q i to two leaves of L. Hence, for every i, there exists always a path from q i to a node of L* that passes through q i . Denoted this node by l(q i ).

Denote by L m the set of nodes in L* such that, for every l L m , there is a path from q to l that passes through q m . As explained above, L m is not empty. Recursively, for every i< m, let L i be the set of nodes in L* \ L m \... Li+1 such that, for every l L i , there is a path from q i to l that passes q i . Note that this set may be empty if i< m, and for every ij, L i L j = .

We will define, for each i < m, an index c(i) that is strictly greater than i such that Lc(i) , together with two paths p i (resp. p i ) from q i (resp. qc(i)) to a node of Lc(i) as follows: if l(q i ) is not in L i , then by the definition, there exists a unique j such that L j contains l(q i ), and j > i. We fix c(i) = j. Next, we define p i (resp. p i ) as a path from q i (resp. qc(i)) to l(q i ) that passes q i (resp. q c i ). If l(q i ) is in L i , then let c(i) be the smallest number that is greater than i and Lc(i) (such an index always exists because L m ). Let l' be a node of Lc(i). Since q i is in M N (L), then there must exist a path from q i to l', and we define p i as this path. The path p i is defined as the one from qc(i) to l' that passes through q c ( i ) . Note that p i , p i must contain at least one common hybridization node since they start from different nodes and end at a same leaf of L. Denote by h i the highest common hybridization node of p i and p i . Hence, all h i s are distinct since each p i starts at a different node q i , and each p i starts at a node qc(i) that is strictly greater than q i . We define (a i , b i ) recursively in increasing order of i from 1 to m - 1 as follows. If i = 1, then b i is the highest hybridizatition node on p i . If i >1, then b i is the highest hybridization node on p i and different from all b k for every k < i. There exists always such a node b i , for example h i . Therefore, all b i s are distinct. Denote by a i the parent of b i on the path p i .

Denote by N" the network obtained from N' by removing all edges (a i , b i ). For every node x in M N L , we will prove that x is also in M N L . Denote by x', x" the two children of x. By definition, for every l L, there exists a path, denoted by f'(l), in N' from x to l such that at least one path among them passes through x' and one other passes through x". To prove that x is in M N L , we will now construct another set of paths in N" (i.e. in N' and does not contain any (a i , b i )) from x to each leaf l of L, denoted by f"(l), such that at least one path among them passes through x'and one other passes through x".

Consider first the case that x is above q m (as shown in the figure 4). Without loss of generality, suppose that x' is above or equal to q m while x" is not. Suppose that f'(l) contains q m , then l L* and f'(l) must pass through x' because there is no hybridization node above q m . Suppose that l L 1 . . . L m . Let k be the index such that l L k , then we can choose a path f"(l) in N' from x to l that does not contain any (a i , b i ) as follows. This path starts from x, passes through x', goes down to q k , then takes the path from q k to l that contains q". Note that this path does not include any p i since, by construction, every path p i starts from q i and goes to a node in Lc(i) that is different from L i , while this path passes through q k and goes to a node in L k . Moreover, this path and p i can not have any common hybridization node above a i because b i is the highest hybridization node on p i . Hence, it can not pass through (a i , b i ) for any i. If l is not in L 1 . . . L m , it means that every path from q m to l must pass through q 1 , then we take the path starting from x, going down to q i , then continuing to l. It is evident that this path does not include any p i , and it cannot have with p i any common hybridization node above a i because b i is the highest hybridization node on p i . Hence it does not pass through any (a i , b i ). If f'(l) does not contain q m , then we fix f"(l) = f'(l). It is easy to see that f'(l) does not contain any edge (a i , b i ) because otherwise f'(l) and p i must have at least a common hybridization node above a i (since there is no hybridization node above q i ). But this is not possible because b i is the highest hybridization node on p i . Remark that at least one of the paths f'(l) in this case must pass through x" since all paths in the first case must pass through x'. Hence at least two of the paths f"(l) are separated, thus x is in M N L by definition.

Consider now the case that x is not above q m , then similarly as in the previous case where f'(l) does not contain q m , we deduce that f'(l) does not contain any (a i , b i ) for every l. Hence, by choosing f"(l) = f'(l) for every l, we are done.

Therefore, we have M N L = M N L .

The network N" contains h - |Q| + 1 hybridization nodes, then following the hypothesis of recurrence, | M N L h - | Q | +  2 . This implies that | M N L | = | M N L h - Q | +  2 , thus | M N L | = | M N L | + Q h - | Q | + 2 + | Q | = h +  2 .

References

  1. Doyon J-p, Ranwez V, Daubin V, Berry V: Models, algorithms and programs for phylogeny reconciliation. Briefings in bioinformatics. 2011, 12 (5): 392-400. doi:10.1093/bib/bbr045

    Article  Google Scholar 

  2. Maddison WP: Gene trees in species trees. Systematic Biology. 1997, 46 (3): 523-536. doi:10.1093/sysbio/46.3.523, [http://sysbio.oxfordjournals.org/content/46/3/523.full.pdf+html]

    Article  Google Scholar 

  3. Huson D, Rupp R, Scornavacca C: Phylogenetic Networks. 2010, Cambridge University Press

    Chapter  Google Scholar 

  4. Libeskind-Hadas R, Charleston MA: On the computational complexity of the reticulate cophylogeny reconstruction problem. JCB. 2009, 16 (1): 105-117.

    CAS  Google Scholar 

  5. Page RDM: Parallel phylogenies: reconstructing the history of host-parasite assemblages. Cladistics. 1994, 10 (2): 155-173.

    Article  Google Scholar 

  6. Ronquist F: Reconstructing the history of host-parasite associations using generalized parsimony. Cladistics. 1995, 11 (1): 73-89.

    Article  Google Scholar 

  7. Charleston M: Jungles: a new solution to the hostparasite phylogeny reconciliation problem. Math Biosci. 1998, 149 (2): 191-223.

    Article  CAS  Google Scholar 

  8. Merkle D, Middendort M: Reconstruction of the cophylogenetic history of related phylogenetic trees with divergence timing information. Theory Biosci. 2005, 123 (4): 277-299.

    Article  CAS  Google Scholar 

  9. Doyon JP, Scornavacca C, Gorbunov KY, Szöllősi GJ, Ranwez V, Berry V: An effcient algorithm for gene/species trees parsimonious reconciliation with losses duplications and transfers. Research in Computational Molecular Biology: Proceedings of the 14th International Conference on Research in Computational Molecular Biology (RECOMB). 2010, LNCS, Springer, Berlin/Heidelberg, Germany, 6398: 93-108. Software downloadable at http://www.atgc-montpellier.fr/Mowgli/

    Google Scholar 

  10. Cormen TH, Stein C, Rivest RL, Leiserson CE: Introduction to Algorithms. 2001, McGraw-Hill Higher Education, 2

    Google Scholar 

  11. Choy C, Jansson J, Sadakane K, Sung W-K: Computing the maximum agreement of phylogenetic networks. Theoretical Computer Science. 2005, 335 (1): 93-107.

    Article  Google Scholar 

  12. Fischier M, van Iersel L, Kelk S, Scornavacca C: On Computing the Maximum Parsimony Score of a Phylogenetic Network. SIAM Journal on Discrete Mathematics - SIDMA. 2015.

    Google Scholar 

  13. Kelk S, Scornavacca C, Van Iersel L: On the elusiveness of clusters. IEEE/ACM Transactions on Computational Biology and Bioinformatics (TCBB). 2012, 9 (2): 517-534.

    Article  Google Scholar 

  14. Doyon J, Chauve C, Hamel S: Space of gene/species trees reconciliations and parsimonious models. Journal of Computational Biology. 2009, 16 (10): 1399-1418.

    Article  CAS  Google Scholar 

  15. Zmasek CM, Eddy SR: A simple algorithm to infer gene duplication and speciation events on a gene tree. Bioinformatics. 2001, 17 (9): 821-828.

    Article  CAS  Google Scholar 

  16. Goodman M, Czelusniak J, Moore GW, Romero-Herrera AE, Matsuda G: Fitting the gene lineage into its species lineage, a parsimony strategy illustrated by cladograms constructed from globin sequences. Systematic Biology. 1979, 28 (2): 132-163.

    Article  CAS  Google Scholar 

  17. Page RDM: Maps between trees and cladistic analysis of historical associations among genes, organisms, and areas. Systematic Biology. 1994, 43 (1): 58-77.

    Google Scholar 

  18. Chauve C, El-Mabrouk N: New perspectives on gene family evolution: Losses in reconciliation and a link with supertrees. Research in Computational Molecular Biology, 13th Annual International Conference, RECOMB 2009, Tucson, AZ, USA, May 18-21, 2009. Proceedings. 2009, 46-58.

    Google Scholar 

  19. Kanj Ia, Nakhleh L, Than C, Xia G: Seeing the trees and their branches in the network is hard. Theoretical Computer Science. 2008, 401: 153-164. doi:10.1016/j.tcs.2008.04.019

    Article  Google Scholar 

  20. Downey RG, Fellows MR: Fundamentals of Parameterized Complexity. Springer. 2013, 4:

    Google Scholar 

  21. Gabow HN, Tarjan RE: A linear-time algorithm for a special case of disjoint set union. Proceedings of the Fifteenth Annual ACM Symposium on Theory of Computing. 1983, 246-251.

    Google Scholar 

  22. Harel D, Tarjan RE: Fast algorithms for finding nearest common ancestors. SIAM Journal on Computing. 1984, 13 (2): 338-355.

    Article  Google Scholar 

  23. Zhang L: On a mirkin-muchnik-smith conjecture for comparing molecular phylogenies. Journal of Computational Biology. 1997, 4: 177-187.

    Article  CAS  Google Scholar 

  24. Bender M, Farach-Colton M: The lca problem revisited. LATIN 2000: Theoretical Informatics. Lecture Notes in Computer Science Springer. 2000, 1776: 88-94.

    Google Scholar 

Download references

Acknowledgements

This work was partially funded by the French Agence Nationale de la Recherche Investissements d'Avenir/ Bioinformatique (ANR-10-BINF-01-02, Ancestrome). The publication charges of this article were funded by the French Grant Agence Nationale de la Recherche: Investissements d'Avenir/Bioinformatique (ANR-10-BINF-01-02, Ancestrome).

This article has been published as part of BMC Genomics Volume 16 Supplement 10, 2015: Proceedings of the 13th Annual Research in Computational Molecular Biology (RECOMB) Satellite Workshop on Comparative Genomics: Genomics. The full contents of the supplement are available online at http://www.biomedcentral.com/bmcgenomics/supplements/16/S10.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Thu-Hien To.

Additional information

Competing interests

The authors declare that they have no competing interests.

Authors' contributions

Both authors contributed to design the models, algorithms and to write the paper.

Rights and permissions

This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

To, TH., Scornavacca, C. Efficient algorithms for reconciling gene trees and species networks via duplication and loss events. BMC Genomics 16 (Suppl 10), S6 (2015). https://doi.org/10.1186/1471-2164-16-S10-S6

Download citation

  • Published:

  • DOI: https://doi.org/10.1186/1471-2164-16-S10-S6

Keywords