Reconciling multiple genes trees via segmental duplications and losses

Reconciling gene trees with a species tree is a fundamental problem to understand the evolution of gene families. Many existing approaches reconcile each gene tree independently. However, it is well-known that the evolution of gene families is interconnected. In this paper, we extend a previous approach to reconcile a set of gene trees with a species tree based on segmental macro-evolutionary events, where segmental duplication events and losses are associated with cost \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\delta $$\end{document}δ and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda $$\end{document}λ, respectively. We show that the problem is polynomial-time solvable when \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\delta \le \lambda $$\end{document}δ≤λ (via LCA-mapping), while if \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\delta > \lambda $$\end{document}δ>λ the problem is NP-hard, even when \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda = 0$$\end{document}λ=0 and a single gene tree is given, solving a long standing open problem on the complexity of multi-gene reconciliation. On the positive side, we give a fixed-parameter algorithm for the problem, where the parameters are \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\delta /\lambda $$\end{document}δ/λ and the number d of segmental duplications, of time complexity \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O\left(\lceil \frac{\delta }{\lambda } \rceil ^{d} \cdot n \cdot \frac{\delta }{\lambda }\right)$$\end{document}O⌈δλ⌉d·n·δλ. Finally, we demonstrate the usefulness of this algorithm on two previously studied real datasets: we first show that our method can be used to confirm or raise doubt on hypothetical segmental duplications on a set of 16 eukaryotes, then show how we can detect whole genome duplications in yeast genomes.


Basic notions
For our purposes, a rooted phylogenetic tree T = (V (T ), E(T )) is an oriented tree, where V (T ) is the set of nodes, E(T ) is the set of arcs, all oriented away from r(T ), the root. Unless stated otherwise, all trees in this paper are rooted phylogenetic trees. A forest F = (V (F ), E(F )) is a directed graph in which every connected component is a tree. Denote by t(F ) the set of trees of F that are formed by its connected components. Note that a tree is itself a forest. In what follows, we shall extend the usual terminology on trees to forests. For an arc (x, y) of F , we call x the parent of y, and y a child of x. If there exists a path that starts at x and ends at y, then x is an ancestor of y and y is a descendant of x. We say y is a proper descendant of x if y = x, and then x is a proper ancestor of y. This defines a partial order denoted by y ≤ F x, and y < F x if x = y (we may omit the F subscript if clear from the context). If none of x ≤ y and y ≤ x holds, then x and y are incomparable. The set of children of x is denoted ch(x) and its parent x is denoted par(x) (which is defined to be x if x itself is a root of a tree in t(F )). For some integer k ≥ 0, we define par k (x) as the k-th parent of x. Formally, par 0 (x) = par(x) and par k (x) = par(par k−1 (x)) for k > 0. The number of children |ch(x)| of x is called the out-degree of x. Nodes with no children are leaves, all others are internal nodes. The set of leaves of a tree F is denoted by L(F ). The leaves of F are bijectively labeled by a set L(F ) of labels. A forest is binary if |ch(x)| = 2 for all internal nodes x. Given a set of nodes X that belong to the same tree T ∈ t(F ), the lowest common ancestor of X, denoted LCA F (X), is the node z that satisfies x ≤ z for all x ∈ X and such that no child of z satisfies this property. We leave LCA F (X) undefined if no such node exists (when elements of X belong to different trees of t(F )). We may write LCA F (x, y) instead of LCA F ({x, y}). The height of a forest F , denoted h(F ), is the number of nodes of a longest directed path from a root to a leaf in a tree of F (note that the height is sometimes defined as the number of arcs on such a path -here we use the number of nodes instead). Observe that since a tree is a forest, all the above notions also apply on trees.

Reconciliations
A reconciliation usually involves two rooted phylogenetic trees, a gene tree G and a species tree S, which we always assume to be both binary. In what follows, we will instead define reconciliation between a gene forest G and a species tree. Here G can be thought of as a set of gene trees. Each leaf of G represents a distinct extant gene, and G and S are related by a function s : L(G) → L(S), which means that each extant gene belongs to an extant species. Note that s does not have to be injective (in particular, several genes from a same gene tree G of G can belong to the same species) or surjective (some species may not contain any gene of G). Given G and S, we will implicitly assume the existence of the function s.
In a DL 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 (C) -under some constraints. A contemporary event C associates a leaf u of G with a leaf x of S such that s(u) = x. WA B I 2 0 1 8 5:4

Reconciling Multiple Genes with Segmental Duplications
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 1 (Reconciliation). Given a gene forest G and a species tree S, a reconciliation between G and S 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 (S) and α e (u) is an event of type S, D or C, such that: 1. if u is a leaf of G, then α e (u) = C and α r (u) = s(u); 2. if u is an internal node of G with children u 1 , u 2 , then exactly one of following cases holds: • α e (u) = S, α r (u) = LCA S (α r (u 1 ), α r (u 2 )) and α r (u 1 ), α r (u 2 ) are incomparable; • α e (u) = D, α r (u 1 ) ≤ α r (u) and α r (u 2 ) ≤ α r (u) Note that if G consists of one tree, this definition coincides with the usual one given in the literature (first formally defined in [18]). We say that α is an LCA-mapping if, for each internal node u ∈ V (G) with children u 1 , u 2 , α r (u) = LCA S (α r (u 1 ), α r (u 2 )). Note that there may be more than one LCA-mapping, since the S and D events on internal nodes can vary. The number of duplications of α, denoted by d(α) is the number of nodes u of G such that α e (u) = D. For counting the losses, first define for y ≤ x the distance dist(x, y) as the number of arcs on the path from x to y. Then, for every internal node u with children {u 1 , u 2 }, the number of losses associated with u in a reconciliation α, denoted by l α (u), is defined as follows: The number of losses of a reconciliation α, denoted by l(α), is the sum of l α (·) for all internal nodes of G. The usual cost of α, denoted by cost(α), is d(α) · δ + l(α) · λ [16], where δ and λ are respectively the cost of a duplication and a loss event (it is usually assumed that speciations do not incur cost). A most parsimonious reconciliation, or MPR, is a reconciliation α of minimum cost. It is not hard to see that finding such an α can be achieved by computing a MPR for each tree in t(G) separately. This MPR is the unique LCA-mapping α in which α e (u) = S whenever it is allowed according to Definition 1 [3].

Reconciliation with segmental duplications
Given a reconciliation α for G in S, and given s ∈ V (S), write D(G, α, s) = {u ∈ V (G) : α e (u) = D and α r (u) = s} for the set of duplications of G mapped to s. We define G[α, s] to be the subgraph of G induced by the nodes in D(G, α, s). Note that G[α, s] is a forest.

5:5
Here we want to tackle the problem of reconciling several gene trees at the same time and counting segmental duplications only once. Given a set of duplications nodes D ∈ V (G) occurring in a given node s of the species tree, it is easy to see that the minimum the number of segmental duplications associated with s is the minimal number of parts in a partition of D in which each part does not contain comparable nodes. See Figure 1.(4) for an example. This number coincides [1] with h α (s) := h(G[α, s]), i.e. the height of the forest of the duplications in s. Now, denoted(α) = s∈V (S) h α (s). For instance in Figure 1, under the mapping µ in (2), we haved(µ) = 6, because h µ (s) = 1 for s ∈ {A, B, C, E} and h µ (F ) = 2. But under the mapping α in (3),d(α) = 4, since h α (A) = 1 and h α (F ) = 3. Note that this does not consider losses though -the α mapping has more losses than µ.
The cost of α is cost SD (G, S, α) = δ ·d(α) + λ · l(α). If G and S are unambiguous, we may write cost SD (α). We have the following problem : Most Parsimonious Reconciliation of a Set of Trees with Segmental Duplications (MPRST-SD) Instance: a species tree S, a gene forest G, costs δ for duplications and λ for losses. Output: a reconciliation α of G in S such that cost SD (G, S, α) is minimum.
Note that, when λ = 0, cost SD coincides with the unconstrained ME score defined in [20] (where it is called the FHS model).

Properties of multi-gene reconciliations
We finish this section with some additional terminology and general properties of multi-gene reconciliations that will be useful throughout the paper. The next basic result states that in a reconciliation α, we should set the events of internal nodes to S whenever it is allowed.

Lemma 2.
Let α be a reconciliation for G in S, and let u ∈ V (G) such that α e (u) = D. Let α be identical to α, with the exception that α e (u) = S, and suppose that α satisfies the requirements of Definition 1. Then cost SD (α ) ≤ cost SD (α).

Proof.
Observe that changing α e (u) from D to S cannot increased(α). Moreover, as dist(α r (u), α r (u 1 )) and dist(α r (u), α r (u 2 )) are the same as in α for the two children u 1 and u 2 of u, by definition of duplications and losses this decreases the number of losses by 2. Thus cost SD (α ) ≤ cost SD (α), and this inequality is strict when λ > 0.
Since we are looking for a most parsimonious reconciliation, by Lemma 2 we may assume that for an internal node u ∈ V (G), α e (u) = S whenever allowed, and α e (u) = D otherwise. Therefore, α e (u) is implicitly defined by the α r mapping. To alleviate notation, we will treat α as simply as a mapping from V (G) to V (S) and thus write α(u) instead of α r (u). We will assume that the events α e (u) can be deduced from this mapping α by Lemma 2.
Therefore, treating α as a mapping, we will say that α is valid if for every v ∈ V (G), Since we are assuming that S and D events can be deduced from α, the LCA-mapping is now unique: we denote by µ : where v 1 and v 2 are the children of v. Note that for any valid reconciliation α, we have α(v) ≥ µ(v) for all v ∈ V (G). We also have the following, which will be useful to establish our results. Let v 1 and v 2 be the two children of v. If α(v) = LCA S (α(v 1 ), α(v 2 )), then v must be a duplication, by the definition of S events. The same holds if α(v 1 ) and α(v 2 ) are not incomparable. Thus assume α(v) = LCA S (α(v 1 ), α(v 2 )) > µ(v) and that α(v 1 ) and α(v 2 ) are incomparable. This implies that one of

Lemma 4.
Let α be a mapping from G to S, and let v ∈ V (G). Suppose that there is some , and so α(v ) = µ(v). We must then have α(v ) = µ(v) for every node v on the path between v and v. In particular, v has a child v 1 with α(v) = α(v 1 ) and thus v is a duplication. If instead α(v) > µ(v), then v is a duplication by Lemma 3.
The Shift-down lemma will prove very useful to argue that we should shift mappings of duplications down when possible, as it saves losses (see Figure 2). For future reference, do note however that this may increase the height of some duplication forest G[α, s].
Proof. Let v 1 and v 2 be the children of v, and denote t := α(v), t 1 := α(v 1 ) and t 2 := α(v 2 ). Moreover denote α := α[v → s]. Let P be the set of nodes that appear on the path between s and t, excluding s but including t (note that s is a proper descendant of t but an ancestor of both t 1 and t 2 , by the validity of α ). For instance in Figure 2, P = {x, t}. Observe that |P | = k. Under α, there is a loss for each node of P on both the (v, v 1 ) and (v, v 2 ) branches. (noting that v is a duplication by Lemma 3). These 2k losses are not present under α . On the other hand, there are at most k losses that are present under α but not under α, which consist of one loss for each node of P on the (par(v), v) branch (in the case that v is not the root of its tree -otherwise, no such loss occurs). This proves that l(α ) ≤ l(α) − k.
An illustration of the Shift-down lemma can be found in Figure 2.

Figure 2
The Shift-down lemma in action. Here t = par 2 (s), and remapping v from t to s saves 2 losses -4 losses are saved below v and 2 are added above.

3
The computational complexity of the MPRST-SD problem We separate the study of the complexity of the MPRST-SD problem into two subcases: when λ ≥ δ and when λ < δ. The following theorem states that, when λ ≥ δ, the MPR (ie the LCA-mapping) is a solution to the MPRST-SD problem.
Theorem 6. Let G and S be an instance of MPRST-SD, and suppose that λ ≥ δ, Then the LCA-mapping µ is a reconciliation of minimum cost for G and S. Moreover if λ > δ, µ is the unique reconciliation of minimum cost.
Proof. Let α be a mapping of G into S of minimum cost. Let v ∈ V (G) be a minimal node of G with the property that α(v) = µ(v) (i.e. all proper descendants v of v satisfy α(v) = µ(v)). Note that v must exists since, for every leaf l ∈ L(G), we have α(l) = µ(l).
This possibly increases the sum of duplications by 1, so thatd(α ) ≤d(α) + 1. But by the Shift-down lemma, l(α ) ≤ l(α) − 1. Thus we have at most one duplication but save at least one loss.
If λ > δ, this contradicts the optimality of α, implying that v cannot exist and thus that α = µ. This proves the uniqueness of µ in this case.

The case of δ > λ.
We show that, in contrast with the λ ≥ δ case, the MPRST-SD problem is NP-hard when δ > λ and the costs are given as part of the input. More specifically, we show that the problem is NP-hard when one only wants to minimize the sum of duplication heights, i.e. λ = 0. Note that if λ > 0 but is small enough, the effect will be the same and the hardness result also holds -for instance, putting δ = 1 and say λ < 1 2|V (G)||V (S)| ensures that even if a maximum number of losses appears on every branch of G, it does not even amount to the cost of one duplication. The hardness proof is quite technical, and we refer the interested reader to the Appendix for the details.
We briefly outline the main ideas of the reduction. The reduction is from the Vertex Cover problem, where we are given a graph G and must find a subset of vertices V ⊆ V (G) of minimum size such that each edge has at least one endpoint in V . The species tree S and the forest G are constructed so that, for each vertex v i ∈ V (G), there is a gene tree A i in G with a long path of duplications, all of which could either be mapped to a species called y i or another species z i . We make it so that mapping to y i introduces one more duplication than mapping to z i , hence we have to "pay" for each y i . We also have a gene tree C h in G for each edge e h ∈ E(G), with say v i and v j being the endpoints of e h . In C h , there is a large set of duplications D under the LCA-mapping µ. We make it so that if we either mapped the duplications in A i or A j to y i or y j , respectively, then we may map all the D nodes to y i or y j without adding more duplications. However if we did not choose y i nor y j , then it will not be possible to remap the D nodes without incurring a large duplication cost. Therefore, the goal becomes to choose a minimum number of y i 's from the A i trees so that for each edge e h = {v i , v j }, one of y i or y j is chosen for the tree C h . This establishes the correspondence with the vertex cover instance.
The above hardness supposes that δ and λ can be arbitrarily far apart. This leaves open the question of whether MPRST-SD is NP-hard when δ and λ are fixed constants -WA B I 2 0 1 8 5:8 Figure 3 The construction of S and T from S and the set of gene trees G1, . . . , G k (here k = 3). The black squares indicate the path of k − 1 duplications that must be mapped to r(S ).

Reconciling Multiple Genes with Segmental Duplications
in particular when δ = 1 + and λ = 1, where < 1 is some very small constant. We end this section by showing that the above hardness result persists even if only one gene tree is given. The idea is to reduce from the MPRST-SD show hard just above. Given a species tree S and a gene forest G, we make G a single tree by incorporating a large number of speciations (under µ) above the root of each tree of G (modifying S accordingly), then successively joining the roots of two trees of G under a common parent until G has only one tree.
Theorem 8. The MPRST-SD problem is NP-hard for λ = 0 and for given δ > λ, even if only one gene tree is given as input.
Proof. We reduce from the MPRST-SD problem in which multiple trees are given. We assume that δ = 1 and λ = 0 and only consider duplications -we use the same argument as before to justify that the problem is NP-hard for very small λ. Let S be the given species tree and G be the given gene forest. As we are working with the decision version of MPRST-SD, assume we are given an integer t and asked whether cost SD (G, S, α) ≤ t for some α. Denote n = |L(G)| and let G 1 , . . . , G k be the k > 1 trees of G. We construct a corresponding instance of a species tree S and a single gene tree T as follows (the construction is illustrated in Figure 3). Let S be a species tree obtained by adding 2(t + k) nodes "above" the root of S. More precisely, first let C be a caterpillar with 2(t + k) internal nodes. Let l be a deepest leaf of C. Obtain S by replacing l by the root of S. Then, obtain the gene tree T by taking k copies C 1 , . . . , C k of C, and for each leaf l of each C i other than l, put s(l ) as the corresponding leaf in S . Then for each i ∈ [k], replace the l leaf of C i by the tree G i (we keep the leaf mapping s of G i ), resulting in a tree we call T i . Finally, let T be a caterpillar with k leaves h 1 , . . . , h k , and replace each h i by the T i tree. The resulting tree is T . We show that cost(G, S, α) ≤ t for some α if and only if cost(T, S , α ) ≤ t + k − 1 for some α .
Notice the following: in any mapping α of T , the k −1 internal nodes of the T caterpillar must be duplications mapped to r(S ), so that h α (r(S )) ≥ k − 1. Also note that under the LCA mapping µ for T and S , the only duplications other than those k − 1 mentioned above occur in the G i subtrees. The (⇒) is then easy to see: given α such that cost(G, S, α) ≤ t, we set α (v) = α(v) for every node v of T that is also in G (namely the nodes of G 1 , . . . , G k ), and set α (v) = µ(v) for every other node. This achieves a cost of t + k − 1.
As for the (⇐) direction, suppose that cost SD (T , S , α ) ≤ t + k − 1 for some mapping α . Observe that under the LCA-mapping in T , each root of each G i subtree has a path of 2(t + k) speciations in its ancestors. If any node in a G i subtree of T is mapped to r(S ), then all these speciations become duplications (by Lemma 4), which would contradict cost SD (T , S , α ) ≤ t + k − 1. We may thus assume that no node belonging to a G i subtree is mapped to r(S ). Since h α (r(S )) ≥ k − 1, this implies that the restriction of α to the

5:9
G i subtrees has cost at most t.
More formally, consider the mapping α from G to S in which we put because α does not contain the top k − 1 duplications of α , and cannot introduce longer duplication paths than in α .
We are not done, however, since α is a mapping from G to S , and not from G to S.
We will remap every such node to r(S) and show that this cannot increase the cost. Observe that if v ∈ Q, then every ancestor of v in G is also in Q. Also, every node in Q is a duplication (by invoking Lemma 3).
Consider the mapping α * from G to S in which we put α Moreover, the height of the r(S) duplications under α * cannot be more than the height of the forest induced by Q and the duplications mapped to r(S) under α . In other words, Therefore, the sum of duplication heights cannot have increased. Finally, because α * is a mapping from G to S, we deduce that cost SD (G, S, α * ) ≤ cost SD (G, S , α ) ≤ t, as desired.

An FPT algorithm
In this section, we show that for costs δ > λ and a parameter d > 0, if there is an optimal In what follows, we allow mappings to be partially defined, and we use the ⊥ symbol to indicate undetermined mappings. The idea is to start from a mapping in which every internal node is undetermined, and gradually determine those in a bottom-up fashion. We need an additional set of definitions. We will assume that δ > λ > 0 (although the algorithm described in this section can solve the λ = 0 case by setting λ to a very small value).
We say that the mapping α : That is, if a node is determined, then all its descendants also are. This also implies that every ancestor of a ⊥-node is also a ⊥-node. Reconciling Multiple Genes with Segmental Duplications v ∈ V (G), then α is called complete. Note that if α is partial and α(v) = ⊥, one can already determine whether v is an S or a D node, and hence we may say that v is a speciation or a duplication under α. Also note that the definitions ofd(α), l(α) and h α (s) extend naturally to a partial mapping α by considering the forest induced by the nodes not mapped to ⊥.
If α is a partial mapping, we call α a completion of α if α is complete, and α(v) = α (v) whenever α(v) = ⊥. Note that such a completion always exists, as in particular one can map every ⊥-node to the root of S (such a mapping must be valid, since all ancestors of a ⊥-node are also ⊥-nodes, which ensures that r(S) = α (v) ≥ α (v ) for every descendant v of a newly mapped ⊥-node v). We say that α is an optimal completion of α if cost SD (α ) is minimum among every possible completion of α. For a minimal ⊥-node v with children v 1 and v 2 , we denote µ α (v) = LCA S (α(v 1 ), α(v 2 )), i.e. the lowest species of S to which v can possibly be mapped to in any completion of α.
The following Lemma forms the basis of our FPT algorithm, as it allows us to bound the possible mappings of a minimal ⊥-node.
Proof. Let α * be an optimal completion of α and let α : This contradicts the optimality of α * .
A node v ∈ V (G) is a required duplication (under α) if, in any completion α of α, v is a duplication under α . We first show that required duplications are easy to find.
, and equality follows.
Lemma 11 and Lemma 12 allow us to find minimal ⊥-nodes of G that are the easiest to deal with, as their mapping in an optimal completion can be determined with certainty.
Lemma 11. Let v be a minimal ⊥-node under α. If v is not a required duplication under α, then α * (v) = µ α (v) for any optimal completion α * of α.

Proof.
Let v 1 , v 2 be the children of v, and let α * be an optimal completion of α. Since v is not a required duplication, by Lemma 10 we have α(v 1 ) < µ(v) and α(v 2 ) < µ(v) and, as argued in the proof of Lemma 10, α(v 1 ) and α(v 2 ) are incomparable. We thus have R. Dondi, M. Lafond and C. Scornavacca

5:11
is a valid mapping, and v is a speciation under this mapping. Henced(α * [v → µ(v)]) ≤d(α * ). Then by the Shift-down lemma, this new mapping has fewer losses, and thus attains a lower cost than α * .

Lemma 12.
Let v be a minimal ⊥-node under α, and let Proof. Let α * be an optimal completion of α. Denote s := µ α (v), and assume that α * (v) > s (as otherwise, we are done). Let α = α * [v → s]. We have that l(α ) < l(α * ) by the Shiftdown lemma. To prove the Lemma, we then show thatd(α ) ≤d(α * ). Suppose otherwise thatd(α ) >d(α * ). As only v changed mapping to s to go from α * to α , this implies that h α (s) > h α * (s) because of v. Since under α * , no ancestor of v is mapped to s, it must be that under α , v is the root of a subtree T of height h α (s) of duplications in s. Since T contains only descendants of v, it must also be that h αv (s) = h α (s) (here α v is the mapping defined in the Lemma statement). As we are assuming that h α (s) > h α * (s), we get h αv (s) > h α * (s). This is a contradiction, since h α * (s) ≥ h α (s) = h αv (s) (the left inequality because α * is a completion of α, and the right equality by the choice of α v ). Then l(α ) < l(α * ) andd(α ) ≤d(α * ) contradicts the fact that α * is optimal.
We say that a minimal ⊥-node v ∈ V (G) is easy (under α) if v falls into one of the cases described by Lemma 11 or Lemma 12. Formally, v is easy if either v is a speciation mapped to µ α (v) under any optimal completion of α (Lemma 11), ord(α) =d(α[v → µ α (v)]) (Lemma 12). Our strategy will be to "clean-up" the easy nodes, meaning that we map them to µ α (v) as prescribed above, and then handle the remaining non-easy nodes by branching over the possibilities. We say that a partial mapping α is clean if every minimal ⊥-node v satisfies the two following conditions: [C1] v is not easy; [C2] for all duplication nodes w (under α with α(w) = ⊥), either α(w) ≤ µ α (v) or α(w) is incomparable with µ α (v).
Roughly speaking, C2 says that all further duplications that may "appear" in a completion of α will be mapped to nodes "above" the current duplications in α. The purpose of C2 is to allow us to create duplication nodes with mappings from the bottom of S to the top. Our goal will be to build our α mapping in a bottom-up fashion in G whilst maintaining this condition. The next lemma states that if α is clean and some lowest minimal ⊥-node v gets mapped to species s, then v brings with it every minimal ⊥-node that can be mapped to s. Lemma 13. Suppose that α is a clean partial mapping, and let α * be an optimal completion of α. Let v be a lowest minimal ⊥-node under α, and let s := α * (v). Then for every minimal ⊥-node w such that µ α (w) ≤ s, we have α * (w) = s.
Suppose first that s = µ α (v). Note that since α is clean, v is not easy, which implies that h α (s) = h α (s) + 1. Since v is a lowest minimal ⊥-node, if w is a minimal ⊥-node such that µ α (w) ≤ s, we must have µ α (w) = s, as otherwise v would not have the 'lowest' property. Moreover, because v and w are both minimal ⊥-nodes under the partial mapping α, one cannot be the ancestor of the other and so v and w are incomparable. This implies that mapping w to s under α cannot further increase h α (s) (because we already increased it by 1 when mapping v to s). Thusd(α ) =d(α [w → s]), and w is easy under α and must be mapped to s by Lemma 12. This proves the α * (v) = µ α (s) case.  Figure 4 An illustration of one pass through the algorithm. The species tree S is left and G has two trees (middle) and has partial mapping α (labels are the lowercase of the species). Here α is in a clean state, and the algorithm will pick a lowest minimal ⊥-node (white circle) and try to map it to, say, H. The forest on the right is the state of α after applying this and cleaning up. Now assume that s > µ α (v), and let w be a minimal ⊥-node with µ α (w) ≤ s. Let us denote s := α * (w). If s = s, then we are done. Suppose that s < s, noting that h α * (s ) > 0 (because w must be a duplication node, due to α being clean). If s = µ α (v), then w is also a lowest minimal ⊥-node. In this case, using the arguments from the previous paragraph and swapping the roles of v and w, one can see that v is easy in α[w → s ] and must be mapped to s < s, a contradiction. Thus assume s > µ α (v). Under α * , for each child v of v, we have α * (v ) ≤ µ α (v) < s , and for each ancestor v of v, we have α * (v ) ≥ α * (v) = s > s . Therefore, by remapping v to s , v is the only duplication mapped to s among its ancestors and descendants. In other words, because h α * (s ) > 0, we haved(α * [v → s ]) ≤d(α * ). Moreover by the Shift-down lemma, l(α * [v → s ]) < l(α * ), which contradicts the optimality of α * .
The remaining case is s > s. Note that h α * (s) > 0 (because v must be a duplication node, due to α being clean). Since it holds that v is a minimal ⊥-node, that α is clean and that s > µ α (v), it must be the case that α has no duplication mapped to s (by the second property of cleanness). In particular, w has no descendant that is a duplication mapped to s under α (and hence under α * ). Moreover, as s = α * (w) > s, w has no ancestor that is a duplication mapped to s. Thusd(α * [w → s]) ≤d(α * ), and the Shift-down lemma contradicts the optimality of α * . This concludes the proof.
We are finally ready to describe our algorithm. We start from a partial mapping α with α(v) = ⊥ for every internal node v of G. We gradually "fill-up" the ⊥-nodes of α in a bottom-up fashion, maintaining a clean mapping at each step and ensuring that each decision leads to an optimal completion α * . To do this, we pick a lowest minimal ⊥-node v, and "guess" α * (v) among the δ/λ possibilities. This increases some h α (s) by 1. For each such guess s, we use Lemma 13 to map the appropriate minimal ⊥-nodes to s, then take care of the easy nodes to obtain another clean mapping. We repeat until we have either found a complete mapping or we have a duplication height higher than d. An illustration of a pass through the algorithm is shown in Figure 4.
Notice that the algorithm assumes that it receives a clean partial mapping α. In particular, the initial mapping α that we pass to the first call should satisfy the two properties of cleanness. To achieve this, we start with a partial mapping α in which every internal node is a ⊥-node. Then, while there is a minimal ⊥-node v that is not a required duplication, we set α(v) = µ α (v), which makes v a speciation. It is straightforward to see that the resulting α is clean: C1 is satisfied because we cannot make any more minimal ⊥-nodes become speciations, and we cannot create any duplication node without increasing cost SD because α has no duplication. C2 is met because there are no duplications at all.
See below for the proof of correctness. The complexity follows from the fact that the algorithm creates a search tree of degree δ/λ of depth at most d. The main technicality R. Dondi, M. Lafond and C. Scornavacca

5:13
Algorithm 1 FPT algorithm for parameter d. 1: procedure SuperReconcile (G, S, α, d) G is the set of input trees, S is the species tree, α is a clean partial mapping, d is the maximum value ofd(α).

4:
else if α is a complete mapping then

Theorem 14. Algorithm 1 is correct and finds a minimum cost mapping
Proof. We show by induction over the depth of the search tree that, in any recursive call made to Algorithm 1 with partial mapping α, the algorithm returns the cost of an optimal completion α * of α havingd(α * ) ≤ d, or ∞ if no such completion exists -assuming that the algorithm receives a clean mapping α as input. Thus in order to use induction, we must also show that at each recursive call done on line 15, α is a clean mapping. We additionally claim that the search tree created by the algorithm has depth at most d. To show this, we will also prove that every α sent to a recursive call satisfiesd(α ) =d(α) + 1. The base cases of lines 3 -5 are trivial. For the induction step, let v be the lowest minimal ⊥-node chosen on line 7. By Lemma 9, if α * is an optimal completion of α and s = α * (v), then µ α (v) ≤ s ≤ par δ/λ (µ α (v)). We try all the δ/λ possibilities in the for-loop on line 9. The for-loop on line 11 is justified by Lemma 13, and the for-loop on line 13 is justified by Lemma 11 and Lemma 12. Assuming that α is clean on line 15, by induction the recursive call will return the cost of an optimal completion α * of α havinĝ d(α * ) ≤ d, if any such completion exists. It remains to argue that for every α sent to a recursive call on line 15, α is clean andd(α ) =d(α) + 1 .
Let us first show that such a α is clean, for each choice of s on line 9. There clearly cannot be an easy node under α after line 13, so we must show C2, i.e. that for any minimal 2 There is a subtlety to consider here. What we have shown is that if there exists a mapping α of minimum cost cost SD (G, S) withd(α) ≤ d, then the algorithm finds it. It might be that a reconciliation α satisfyingd(α) ≤ d exists, but that the algorithm returns no solution. This can happen in the case that α is not of cost cost SD (G, S).

5:14
Reconciling Multiple Genes with Segmental Duplications ⊥-node w under α , there is no duplication z under α satisfying α (z) > µ α (w). Suppose instead that α (z) > µ α (w) for some duplication node z. Let w 0 be a descendant of w that is a minimal ⊥-node in α (note that w 0 = w is possible). We must have µ α (w) ≥ µ α (w 0 ). By our assumption, we then have α (z) > µ α (w) ≥ µ α (w 0 ). Then z cannot be a duplication under α, as otherwise α itself could not be clean (by C2 applied on z and w 0 ). Thus z is a newly introduced duplication in α , and so z was a ⊥-node under α. Note that Algorithm 1 maps ⊥-nodes of G one after another, in some order (z 1 , z 2 , . . . , z k ). Suppose without loss of generality that z is the first duplication node in this ordering that gets mapped to α (z). There are two cases: either α (z) = s, or α (z) = s.
Suppose first that α (z) = s. Lines 10 and 11 can only map ⊥-nodes to s, and line 13 either maps speciation nodes, or easy nodes that become duplications. Thus when α (z) = s, we may assume that z falls into the latter case, i.e. z is easy before being mapped, so that mapping z to α (z) does not increase h α (α (z)). Because z is the first ⊥-node that gets mapped to α (z), this is only possible if there was already a duplication z 0 mapped to α (z) in α. This implies that α(z 0 ) = α (z) > µ α (w 0 ), and that α was not clean (by C2 applied on z 0 and w 0 ). This is a contradiction.
We may thus assume that α (z) = s. This implies µ α (w) < α (z) = s. If w was a minimal ⊥-node in α, it would have been mapped to s on line 11, and so in this case w cannot also be a minimal ⊥-node in α , as we supposed. If instead w was not a minimal ⊥-node in α, then w has a descendant w 0 that was a minimal ⊥-node under α. We have µ α (w 0 ) ≤ µ α (w) < s, which implies that w 0 gets mapped to s on line 11. This makes µ α (w) < s impossible, and we have reached a contradiction. We deduce that z cannot exist, and that α is clean.
It remains to show thatd(α ) =d(α) + 1. Again, let s be the chosen species on line 9. Suppose first that s = µ α (v). Then h α[v→s] (s) = h α (s) + 1, as otherwise v would be easy under α, contradicting its cleanness. In this situation, as argued in the proof of Lemma 13, each node w that gets mapped to s on line 11 or on line 13 is easy, and thus cannot further increase the height of the duplications in s. If s > µ α (v), then h α[v→s] (s) = 1 = h α (s) + 1, since by cleanness no duplication under α maps to s. Here, each node w that gets mapped on line 11 has no descendant nor ancestor mapped to s, and thus the height does not increase. Noting that remapping easy nodes on line 13 cannot alter the duplication heights, we get in both cases thatd(α[v → s]) =d(α) + 1. This proves the correctness of the algorithm.
As for the complexity, the algorithm creates a search tree of degree δ/λ and of depth at most d. Each pass can easily seen to be feasible in time O(δ/λ · n) (with appropriate pre-parsing to compute µ α (v) in constant time, and to decide if a node is easy or not in constant time as well), and so the total complexity is O( δ/λ d n · δ λ ).

Experiments
We used our software to reanalyze a data set of 53 gene trees for 16 eukaryotes presented in [10] and already reanalyzed in [19,1]. In [1], the authors showed that, if segmental duplications are not accounted for, we get a solution havingd equal to 9, while their software (ExactMGD) returns a solution withd equal to 5. We were able to retrieve the solution with maximum height of 5 fixing δ ∈ [28, 61] and λ = 1, but, as soon as δ > 61, we got a solution with maximum height of 4 where no duplications are placed in the branch leading to the Tetrapoda clade (see [19, Fig. 1 The species tree phylogeny for the yeast data set described in [2]. Numbers at the internal nodes are meaningless and are only used to refer to the nodes in the main text. We also reanalyzed the data set of yeast species described in [2]. First, we selected from the data set the 2379 gene trees containing all 16 species and refined unsupported branches using the method described in [12] and implemented in ecceTERA [11] with a bootstrap threshold of 0.9 and δ = λ = 1. Using our method with δ = 1.5, λ = 1 we were able to detect the ancient genome duplication in Saccharomyces cerevisiae already established using synteny information [13], with 216 gene families supporting the event. Other nodes with a signature of segmental duplication are nodes 7, 6, 13 and 2 (refer to Fig. 5) with respectively 190, 157, 148 and 136 gene families supporting the event. It would be interesting to see if the synteny information supports these hypotheses.

Conclusion
This work poses a variety of questions that deserve further investigation. The complexity of the problem when δ/λ is a constant remains an open problem. Moreover, our FPT algorithm can handle data sets with a sum of duplication height of about d = 30, but in the future, one might consider whether there exist fast approximation algorithms for MPRST-SD in order to attain better scalability. Other future directions include a multivariate complexity analysis of the problem, in order to understand whether it is possible to identify other parameters that are small in practice. Finally, we plan to extend the experimental analysis to other data sets, for instance for the detection of whole genome duplications in plants.
In the following, we will assume that λ = 0 and δ = 1. We reduce the Vertex Cover problem to that of finding a mapping of minimum cost for given G and S. Recall that in Vertex Cover, we are given a graph G = (V, E) and an integer β < n and are asked if there exists a subset V ⊆ V with |V | ≤ β such that every edge of E has at least one endpoint in V . For such a given instance, denote V = {v 1 , . . . , v n } and E = {e 1 , . . . , e m } (so that n = |V | and m = |E|). The ordering of the v i 's and e j 's can be arbitrary, but must remain fixed for the remainder of the construction. Let K := (n + m) 10 , and observe in particular that β < n K. We construct a species tree S and a gene forest G from G. The construction is relatively technical, but we will provide the main intuitions after having fully described it. For convenience, we will describe G as a set of gene trees instead of a single graph. Figure 6 illustrates the constructed species tree and gene trees. The construction of S is as follows: start with S being a caterpillar on 3n + 2 leaves. Let (x 1 , y 1 , z 1 , x 2 , y 2 , z 2 , . . . , x n , y n , z n , x n+1 ) be the path of this caterpillar consisting of the internal nodes, ordered by decreasing depth (i.e. x 1 is the deepest internal node, and x n+1 is the root). For each i ∈ [n], call p i , q i and r i , respectively, the leaf child of x i , y i and z i . Note that x 1 has two leaf children: choose one to name p 1 arbitrarily among the two. Then for each edge uv of S, graft a large number, say K 100 , of leaves on the uv edge (grafting t leaves on an edge uv consists of subdividing uv t times, thereby creating t new internal nodes of degree 2, then adding a leaf child to each of these nodes, see Figure 6). We will refer to these grafted leaves as the special uv leaves, and the parents of these leaves as the special uv nodes. These special nodes are the fundamental tool that lets us control the range of duplication mappings.
Finally, for each i ∈ {1, . . . , n}, replace the leaf p i by a tree P i that contains K distinguished leaves c i,1 , . . . , c i,K such that dist(c i,j , r(P i )) = K for all j ∈ [K], and such that dist(c i,j , lca(c i,j , c i,k )) ≥ K/2 for all distinct j, k ∈ [K]. By Lemma 15, each P i can be constructed in polynomial time. Note that the edges inside a P i subtree do not have special leaves grafted onto them. This concludes the construction of S. WA B I 2 0 1 8

5:18
Reconciling Multiple Genes with Segmental Duplications . . . We proceed with the construction of the set of gene trees G. Most of the trees of G consist of a subset of the nodes of S, to which we graft additional leaves to introduce duplications -some terminology is needed before proceeding. For w ∈ V (S), deleting w consists in removing w and all its descendants from S, then contracting the possible resulting degree two vertex (which was the parent of w if p(w) = r(S)). If this leaves a root with only one child, we contract the root with its child. For X ⊆ L(S), keeping X consists of successively deleting every node that has no descendant in X until none remains (the tree obtained by keeping X is sometimes called the restriction of S to X).
The forest G is the union of three sets of trees A, B, C, so that G = A ∪ B ∪ C. Roughly speaking A is a set of trees corresponding to the choice of vertices in a vertex cover, B is a set of trees to ensure that we "pay" a cost of one for each vertex in the cover, and C is a set of trees corresponding to edges. For simplicity, we shall describe the trees of G as having leaves labeled by elements of L(S) -a leaf labeled s ∈ L(S) in a gene tree T ∈ G is understood to be a unique gene that belongs to species s.
The A trees. Let A = {A 1 , . . . , A n }, one tree for each vertex of G. For each i ∈ [n], obtain A i by first taking a copy of S, then deleting all the special y i z i leaves. Then on the resulting z i y i branch, graft 10K leaves labeled q i . Then delete the child of z i that is also an ancestor of r i (removing z i in the process). Figure 6 bottom-left might be helpful.

5:19
As a result, under the LCA-mapping µ, A i has a path of 10K duplications mapped to y i . One can choose whether to keep this mapping in A i , or to remap these duplications to z i . The B trees. Let B = {B 1 , . . . , B n }. For i ∈ [n], B i is obtained from S by deleting all except 10K − 2 of the special r i z i leaves, and grafting a leaf labeled r i on the edge between r i and its parent, thereby creating a single duplication mapped to r i under µ.
we list the set of leaves that we keep from S. Keep all the leaves of the P i subtree of S, and keep a subset of the special leaves defined as follows: -keep 9K of the special x i y i leaves; -keep (j − i − 1)10K + K of the special y i z i leaves; -keep 9K of the special x j y j leaves; -keep all the special y j z j leaves. No other leaves are kept. Next, in the tree obtained by keeping the aforementioned list of leaves, for each k ∈ [K] we graft, on the edge between c h,k and its parent, another leaf labeled c h,k . Thus C h has K duplications, all located at the bottom of the P i subtree. This concludes our construction.
Let us pause for a moment and provide a bit of intuition for this construction. We will show that G has a vertex cover of size β if and only if there exists a mapping α of G of cost at most 10Kn + β. As we will show later on, two A i trees cannot have a duplication mapped to the same species of S, so these trees alone account for 10Kn duplications. The r i duplications in the B i trees account for n more duplications, so that if we kept the LCAmapping, we would have 10Kn + n > 10Kn + β duplications. But these r i duplications can be remapped to z i , at the cost of creating a path of 10K duplications to z i . This is fine if A i also has a path of 10K duplications to z i , as this does not incur additional height. Otherwise, this path in A i is mapped to y i , in which case we leave r i untouched, summing up to 10K + 1 duplications for such a particular A i , B i pair. Mapping the duplications of A i to y i represents including vertex v i in the vertex cover, and mapping them to z i represents not including v i . Because each time we map the A i duplications to y i , we have the additional r i duplication in B i , we cannot do that more than β times. Now consider a C h tree. Under the LCA-mapping, the c h,k duplications at the bottom enforce an additional K duplications. This can be avoided by, say, mapping all these duplications to the same species. For instance, we could remap all these duplications to some y i node of S. But in this case, because of Lemma 4, every node v of C h above a c h,k duplication for which µ(v) ≤ y i will become a duplication. This will create a duplication subtree D in C h with a large height, and our goal will be to "spread" the duplications of D among the y i and z i duplications that are present in the A i trees. As it turns out, this will be feasible only if some y i or y j has duplication height 10K, where v i and v j are the endpoints of edge e h corresponding to C h . If this does not occur, any attempt at mapping the c h,k nodes to a common species will induce a chain reaction of too many duplications created above. We now proceed with the details.
Proof. Let G and β be a given instance of vertex cover, and let G and S be constructed as above. Call a node v ∈ V (G) an original duplication if v is a duplication under µ. If µ(v) = s, we might call v an original s-duplication for more precision. For T ∈ G and t ∈ V (S), suppose there is a unique node w ∈ V (T ) such that µ(w) = s. We then denote w WA B I 2 0 1 8

5:20
Reconciling Multiple Genes with Segmental Duplications by T [t]. In particular, any special node that is present in a tree T ∈ G satisfies the property, so when we mention the special uv nodes of T , we refer to the special nodes that are mapped to the corresponding special uv nodes in S under µ. For example in the C h tree of Figure 6, the indicated set of (j −i−1)10K +K nodes are called special y i z i nodes as they are mapped to the special y i z i nodes of S under µ.
We now show that G has a vertex cover of size β if and only if G and S admit a mapping α of cost at most 10Kn + β.
(⇒) Suppose that V = {v a1 , . . . , v a β } is a vertex cover of G. We describe a mapping α such that for each i ∈ [n]: all its internal node descendants duplications. We map them to the set {y j } ∪ j−1 l=i {y l , z l }. This case is illustrated in Figure 7.
More specifically, the longest path from w to a descending internal node contains 9K + (j − i − 1)10K + K + 9K + K = (j − i + 1)10K, where we have counted the special x j y j nodes, the special y i z i nodes, the special x i y i nodes and the P i subtree nodes. We have h α (y j ) + j−1 l=i (h α (y l ) + h α (z l )) = 10K + (j − i)10K = (j − i + 1)10K, just enough to map the whole subtree rooted at w to duplications. It is easy to see that such a mapping can be made valid by first mapping the 9K special x j y j nodes to y j , then the other nodes descending from w to the rest of {y j } ∪ j−1 l=i {y l , z l }. This is because all these nodes are ancestors of the special y i z i nodes, the special x i y i nodes and the P i nodes (except y i , but we have h α (y i ) = 0 anyway).
We have constructed a mapping α with the desired duplication heights, concluding this direction of the proof. Let us proceed with the converse direction.
(⇐): suppose that there exists a mapping α of the G trees of cost at most 10Kn + β. We show that there exists a vertex cover of size at most β in G. For some X ⊆ V (S), define h α (X) = x∈X h α (x). For each i ∈ [n], define the sets Our goal is to show that the Y i 's for which h α (Y i ) > 9K correspond to a vertex cover. The proof is divided into a series of claims.
Proof. Consider the A i tree of A, and let y * i be an original y i -duplication in A i . If α(y * i ) ≥ x i+1 , then every node of A i on the path from y * i to A i [x i+1 ] is a duplication. This includes all the K 100 special z i x i+1 nodes, contradicting the cost of α. Thus y i ≤ α(y * i ) < x i+1 .