Lecture Notes in Bioinformatics
6293
Edited by S. Istrail, P. Pevzner, and M. Waterman Editorial Board: A. Apostolico S. Brunak M. Gelfand T. Lengauer S. Miyano G. Myers M.F. Sagot D. Sankoff R. Shamir T. Speed M. Vingron W. Wong
Subseries of Lecture Notes in Computer Science
Vincent Moulton Mona Singh (Eds.)
Algorithms in Bioinformatics 10th International Workshop, WABI 2010 Liverpool, UK, September 68, 2010 Proceedings
13
Series Editors Sorin Istrail, Brown University, Providence, RI, USA Pavel Pevzner, University of California, San Diego, CA, USA Michael Waterman, University of Southern California, Los Angeles, CA, USA Volume Editors Vincent Moulton University of East Anglia School of Computing Sciences Norwich, NR4 7TJ, UK Email:
[email protected] Mona Singh Princeton University LewisSigler Institute for Integrative Genomics Department of Computer Science Princeton, NJ 08544, USA Email:
[email protected] Library of Congress Control Number: 2010932425
CR Subject Classification (1998): J.3, F.1, I.2, F.2.2, H.2.8, E.1 LNCS Sublibrary: SL 8 – Bioinformatics ISSN ISBN10 ISBN13
03029743 3642152937 Springer Berlin Heidelberg New York 9783642152931 Springer Berlin Heidelberg New York
This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. springer.com © SpringerVerlag Berlin Heidelberg 2010 Printed in Germany Typesetting: Cameraready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acidfree paper 06/3180
Preface
We are pleased to present the proceedings of the 10th Workshop on Algorithms in Bioinformatics (WABI 2010) which took place in Liverpool, UK, September 6–8, 2010. The WABI 2010 workshop was part of the four ALGO 2010 conference meetings, which, in addition to WABI, included ESA, ATMOS, and WAOA. WABI 2010 was hosted by the University of Liverpool Department of Computer Science, and sponsored by the European Association for Theoretical Computer Science (EATCS) and the International Society for Computational Biology (ISCB). See http://algo2010.csc.liv.ac.uk/wabi/ for more details. The Workshop in Algorithms in Bioinformatics highlights research in algorithmic work for bioinformatics, computational biology and systems biology. The emphasis is mainly on discrete algorithms and machinelearning methods that address important problems in molecular biology, that are founded on sound models, that are computationally eﬃcient, and that have been implemented and tested in simulations and on real datasets. The goal is to present recent research results, including signiﬁcant workinprogress, and to identify and explore directions of future research. Original research papers (including signiﬁcant workinprogress) or stateoftheart surveys were solicited for WABI 2010 in all aspects of algorithms in bioinformatics, computational biology and systems biology. In response to our call, we received 83 submissions for papers and 30 were accepted. In addition, WABI 2010 hosted distinguished lectures by Eran Halperin, of Tel Aviv University and ICSI, Berkeley, and, together with ESA, Paolo Ferragina of University of Pisa. We would like to sincerely thank the authors of all submitted papers and the conference participants. We also thank the Program Committee and their subreferees for their hard work in reviewing and selecting papers for the workshop. We would espcially like to thank Bernard Moret and Tandy Warnow for all of their advice and support in carrying out the role of being Cochairs. Thanks once again to all who participated in making WABI’s 10th anniversary such a success. For us it has been an exciting and rewarding experience. June 2010
Vincent Moulton Mona Singh
Organization
Program Committee Tatsuya Akutsu Bonnie Berger Tanya BergerWolf Mathieu Blanchette Sebastian B¨ocker Magnus Bordewich Mike Brudno Philipp Bucher Benny Chor Anne Condon Lenore Cowen Keith Crandall Bhaskar Das Gupta Nadia ElMabrouk Liliana Florea Olivier Gascuel Barbara Holland Katharina Huber Daniel Huson Lydia Kavraki Junhyong Kim Carl Kingsford Mehmet Koyuturk Jens Lagergren Chris Langmead Ryan Lilien Ion Mandiou Joao Meidanis Satoru Miyano Bernard M.E. Moret Burkhard Morgenstern Vincent Moulton Gene W. Myers Mihai Pop Teresa Przytycka Cenk Sahinalp David Sankoﬀ
Kyoto University, Japan MIT, USA University of Illinois, USA McGill University, Canada University of Jena, Germany University of Durham, UK University of Toronto, Canada EPFL, Switzerland Tel Aviv University, Israel University of British Columbia, Canada Tufts University, USA Brigham Young University, USA University of Illinois, USA University of Montreal, Canada University of Maryland, USA University of Montpellier, France Massey University, New Zealand University of East Anglia, UK University of Tuebingen, Germany Rice University, USA University Penn, USA University of Maryland, USA Case Western, USA KTH, Sweden CMU, USA University of Toronto, Canada University of Connecticut, USA Campinas University, Brazil Tokyo University, Japan Swiss Federal Institute of Technology, Switzerland University of G¨ ottingen, Germany University of East Anglia, UK, Cochair Janelia Farms, USA University of Maryland, USA NIH, USA Simon Fraser University, USA University of Montr´eal, Canada
VIII
Organization
Russell Schwartz Joao Setubal Mona Singh Jens Stoye Glenn Tesler Olga Vitek Lusheng Wang Tandy Warnow Chris Workman Louxin Zhang
CMU, USA Virginia Tech., USA Princeton University, USA, Cochair University of Bielefeld, Germany UCSD, USA Purdue University, USA City University Hong Kong, Hong Kong University of Texas Austin, USA Technical University of Denmark, Denmark National University of Singapore, Singapore
Table of Contents
Biomolecular Structure: RNA, Protein and Molecular Comparison A WorstCase and Practical Speedup for the RNA Cofolding Problem Using the FourRussians Idea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yelena Frid and Dan Gusﬁeld Sparse Estimation for Structural Variability . . . . . . . . . . . . . . . . . . . . . . . . . Raghavendra Hosur, Rohit Singh, and Bonnie Berger Data Structures for Accelerating Tanimoto Queries on Real Valued Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Thomas G. Kristensen and Christian N.S. Pedersen Sparsiﬁcation of RNA Structure Prediction Including Pseudoknots . . . . . Mathias M¨ ohl, Raheleh Salari, Sebastian Will, Rolf Backofen, and S. Cenk Sahinalp
1 13
28 40
Prediction of RNA Secondary Structure Including Kissing Hairpin Motifs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Corinna Theis, Stefan Janssen, and Robert Giegerich
52
Reducing the Worst Case Running Times of a Family of RNA and CFG Problems, Using Valiant’s Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . Shay Zakov, Dekel Tsur, and Michal ZivUkelson
65
Comparative Genomics Reconstruction of Ancestral Genome Subject to Whole Genome Duplication, Speciation, Rearrangement and Loss . . . . . . . . . . . . . . . . . . . . Denis Bertrand, Yves Gagnon, Mathieu Blanchette, and Nadia ElMabrouk
78
Genomic Distance with DCJ and Indels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Mar´ılia D.V. Braga, Eyla Willing, and Jens Stoye
90
Listing All Sorting Reversals in Quadratic Time . . . . . . . . . . . . . . . . . . . . . Krister M. Swenson, Ghada Badr, and David Sankoﬀ
102
Haplotype and Genotype Analysis Discovering Kinship through Small Subsets . . . . . . . . . . . . . . . . . . . . . . . . . . Daniel G. Brown and Tanya BergerWolf
111
X
Table of Contents
FixedParameter Algorithm for Haplotype Inferences on General Pedigrees with Small Number of Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Duong D. Doan and Patricia A. Evans Haplotypes versus Genotypes on Pedigrees . . . . . . . . . . . . . . . . . . . . . . . . . . Bonnie Kirkpatrick Haplotype Inference on Pedigrees with Recombinations and Mutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yuri Pirola, Paola Bonizzoni, and Tao Jiang
124
136
148
Highthroughput Data Analysis: Next Generation Sequencing and Flow Cytometry Identifying Rare Cell Populations in Comparative Flow Cytometry . . . . . Ariful Azad, Johannes Langguth, Youhan Fang, Alan Qi, and Alex Pothen Fast Mapping and Precise Alignment of AB SOLiD Color Reads to Reference DNA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Mikl´ os Cs˝ ur¨ os, Szilveszter Juhos, and Attila B´erces Design of an Eﬃcient OutofCore Read Alignment Algorithm . . . . . . . . . Arun S. Konagurthu, Lloyd Allison, Thomas Conway, Bryan BeresfordSmith, and Justin Zobel Estimation of Alternative Splicing Isoform Frequencies from RNASeq Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Marius Nicolae, Serghei Mangul, Ion M˘ andoiu, and Alex Zelikovsky
162
176
189
202
Networks Improved Orientations of Physical Networks . . . . . . . . . . . . . . . . . . . . . . . . . Iftah Gamzu, Danny Segev, and Roded Sharan Enumerating Chemical Organisations in Consistent Metabolic Networks: Complexity and Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Paulo Vieira Milreu, Vicente Acu˜ na, Etienne Birmel´e, Pierluigi Crescenzi, Alberto MarchettiSpaccamela, MarieFrance Sagot, Leen Stougie, and Vincent Lacroix Eﬃcient Subgraph Frequency Estimation with GTries . . . . . . . . . . . . . . . . Pedro Ribeiro and Fernando Silva
215
226
238
Table of Contents
XI
Phylogenetics Accuracy Guarantees for Phylogeny Reconstruction Algorithms Based on Balanced Minimum Evolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Magnus Bordewich and Radu Mihaescu
250
The Complexity of Inferring a Minimally Resolved Phylogenetic Supertree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jesper Jansson, Richard S. Lemence, and Andrzej Lingas
262
Reducing Multistate to Binary Perfect Phylogeny with Applications to Missing, Removable, Inserted, and Deleted Data . . . . . . . . . . . . . . . . . . . . . Kristian Stevens and Dan Gusﬁeld
274
An Experimental Study of Quartets MaxCut and Other Supertree Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M. Shel Swenson, Rahul Suri, C. Randal Linder, and Tandy Warnow
288
An Eﬃcient Method for DNABased Species Assignment via Gene Tree and Species Tree Reconciliation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Louxin Zhang and Yun Cui
300
Sequences, Strings and Motifs Eﬀective Algorithms for Fusion Gene Detection . . . . . . . . . . . . . . . . . . . . . . Dan He and Eleazar Eskin
312
Swiftly Computing Center Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Franziska Hufsky, L´eon Kuchenbecker, Katharina Jahn, Jens Stoye, and Sebastian B¨ ocker
325
Speeding Up Exact Motif Discovery by Bounding the Expected Clump Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tobias Marschall and Sven Rahmann
337
Pair HMM Based Gap Statistics for Reevaluation of Indels in Alignments with Aﬃne Gap Penalties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Alexander Sch¨ onhuth, Raheleh Salari, and S. Cenk Sahinalp
350
Quantifying the Strength of Natural Selection of a Motif Sequence . . . . . ChenHsiang Yeang
362
Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
375
A WorstCase and Practical Speedup for the RNA Cofolding Problem Using the FourRussians Idea Yelena Frid and Dan Gusﬁeld Department of Computer Science, U.C. Davis
Abstract. The computational formulation for ﬁnding the optimal simultaneous alignment and fold (optimal Cofold) of RNA sequences was ﬁrst introduced by Sankoﬀ in 1985. Since then the importance of CoFolding has grown as conservation of structure and its relationship to function have been widely observed in RNA. For two sequences, the computation time of Sankoﬀ’s Algorithm is θ(N 6 ). Existing literature on cofolding attempts to improve eﬃciency through simplifying the original problem formulation. We present here a practical and worstcase speed up using the FourRussians method, without placing any added constraints on the types of alignments or folds allowed. Our algorithm, Fast Cofold, ﬁnds the optimal Cofold in O(N 6 / log(N 2 ))time, a speedup which is observed in practice. Because the solution matrix produced by our algorithm is identical to the one produced by the Sankoﬀ algorithm, the contribution of the algorithm lays not only in its standalone practicality but also in the ability to implement it alongside heuristic speed ups leading to even greater reductions in time.
1
Introduction
The algorithmic goal of ﬁnding alignments together with structure prediction is motivated by the understanding that RNA structure helps to determine function. It has been observed particularly that in eukaryotic genomes ncRNA (Non coding RNA) function is seen more clearly from conserved structure then from alignment alone [17,13,16]. In trRNAs, srpRNA and tRNAs there are also observed relationships between structure and function. Alignment methods that take structure into account can also allow biologists to identify nonfunctional transcripts as well as structure motifs for RNA[4]. Algorithms that produce both folds and alignments can be classiﬁed into three groups:(1) folding methods that use aligned sequences as input to ﬁnd a common structure [11,18,12,15];(2) algorithms that compute structure and then align [8]; and (3) cofolding algorithms i.e. those that do alignment and folding simultaneously [14,7,3,9,5,19,1]. Sankoﬀ’s Algorithm was the ﬁrst dynamic programming algorithm to simultaneously ﬁnd alignment and RNA folding for a set of sequences [14]. For L V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 1–12, 2010. c SpringerVerlag Berlin Heidelberg 2010
2
Y. Frid and D. Gusﬁeld
sequences of equal length N the algorithm required O(N 3L )time and O(N 2L )space[14]. Because of the large runtime and space requirement of Sankoﬀ’s solution, his original problem formulation has often been restricted to allow for greater eﬃciency, but at the cost of not solving the original problem[7,3,9,5]. Problem simpliﬁcation and restrictions on the recurrences were explored by [7,3,9,5]. FoldAlign[7] removed the possibility of a branch in the recurrences, achieving an O(N 4 ) time algorithm. Dynalign [9] constrained the distance d between aligned nucleotides, thereby reducing the computation time to O(N 3 ∗ d3 ). Eddy et al. used covariance models to achieve O(N 3 ∗ r) runtime where r is the number of states in the model [5]. Consan[3] used pairSCFG to constrain the algorithm leading to an asymptotic time between O(N 6 ) and O(N 3 ). ZivUkelson et al. introduced a time reduction algorithm that retained the Sankoﬀ style recurrence. Based on some simple pruning of the branching points, the algorithm was able to achieve practical time reduction and asymptotic bound O(N 4 ∗ K)1 where K is constrained by N ≤ K ≤ N 2 and converges to O(N ) when assuming the polymer folding model[19]. An O(N 3 +Z)space algorithm was developed based on the pruning formulation by Backofen et al. [2]. While Z ranges from N 2 to N 4 , in practice it was seen to be lower then N 4 . Surprisingly, the Four Russians method, which is widely used and known to speed up dynamic programming, has not previously been applied to the cofolding problem. Traditionally the FourRussians method performs some preprocessing for a subset of all possible inputs and then computes using that preprocessing. We take advantage of the idea discussed in Frid and Gusﬁeld [6] interleaving the computation and preprocessing to create a speedup. The algorithm as presented by Sankoﬀ does not easily lend itself to subset precomputation, and we reorganized the order of evaluation. We also create a function that choose the optimal subset size that leads to the greatest speedup. The Fast Cofold algorithm presented in this paper formulates a Four Russians speed up to the Sankoﬀ’s original cofolding problem and reduces the asymptotic computation time to O(N 6 /log(N 2 )).
2
Sankoﬀ Algorithm for Two Sequences
Let s1 and s2 be two RNA sequences over the fourletter alphabet {A,U,C,G}, where each letter in the alphabet represents an RNA nucleotide. We are interested in ﬁnding the optimal cofold or optimal alignment and common structure of the two sequences, using a scoring scheme that accounts for alignment, folding, and substitutions that conserve structure. We will make use of a modiﬁed version of Sankoﬀ’s Algorithm for cofolding as described by ZivUkelson et al. [19] . That version restricts the original algorithm to computing the optimal cofold of two sequences(L = 2) by maximizing the pair contributions to the fold instead of minimizing energy of a fold. 1
Still O(N 6 ) time in terms of the length N.
A WorstCase and Practical Speedup for the RNA Cofolding Problem
3
The basic optimal Alignment problem. Deﬁne a scoring scheme α such that α(x, y) is the score for substituting nucleotide x for y where x, y ∈ {A,U,C,G,−}. Let s1 and s2 be two RNA sequences of length N over the fourletter alphabet {A,U,C,G}. Alignment sequences s1 and s2 of s1, s2 are created by inserting gaps or ’ ’ into each sequence such that s1  = s2  and {¬∃is1 [i] = s2 [i] = ’ ’}. s1  Let AligScore = α(s1 [i], s2 [i]) be the score associated with the alignment i=0
sequences s1 ,s2 . The optimal alignment problem: Given s1 and s2 ﬁnd alignment sequences s1 and s2 for which AligScore is maximum. Alignments can also be enhanced by creating more complicated scoring schemes, for example adding larger penalties for introducing gaps versus extending gaps. The basic optimal Folding Problem. We present below the maximum matching folding problem as introduced by Nussinov et al.[10]. However, it is slightly modiﬁed to incorporate sequences that have gaps as characters. A nucleotide pair (x, y) is a permitted pair if (x, y) or (y, x) ∈ {(A,U), (C,G), (G,U), ( , )}. For a given sequence seq of length N over the alphabet {A,U,C,G, } we deﬁne the folding set M as a set containing disjoint permitted pairs of sites in sequence seq, such that for any i, i , j, j where i < i < j < j , M does not contain both pairs (i, j) and (i , j ). Let β be a scoring scheme such that β(x, y) returns the contribution of pairing nucleotide at site x with the nucleotide at site y. The basic scoring scheme sets β(x, y) equal to one if (x, y) is a permitted pair with y − x > d and set β(x, y) to zero otherwise. However, richer scoring schemes as those formulated by the cofold problem, allow nonpermitted pairs to match. Let f oldScore be the score associated with a folding set M where β(seq[i], seq[j]). f oldScore = (i,j)∈M
The optimal folding problem: Find the set M for which f oldScore is maximum. The Optimal Cofolding Problem. The cofold of s1 and s2 consists of aligns1  ment sequences s1 , s2 , and a folding set M [19]. Let cof oldScore = α(s1 [i], i=0 s2 [i]) + β(s1 [i], s1 [j]) + β(s2 [i], s2 [j]) + τ (s1 [i], s1 [j], s2 [i], s2 [j]) (i,j)∈M
where τ (s1 [i], s1 [j], s2 [i], s2 [j]) is a score for aligning s1’[i] for s2’[i] and substituting s1’[j] for s2’[j] taking into account compensator mutations that preserve structure. In general all the scoring schemes α, β and τ can be modiﬁed to ﬁt richer biological models. The optimal cofold problem: Find the M and alignment sequences s1 and s2 for which the cof oldScore is maximum.
4
Y. Frid and D. Gusﬁeld
Recurrences for finding the Optimal Cofold. Let S[i, j; k, l] contain the score for the optimal cofold of subsequence s1(i..j)2 and subsequence s2(k...l). S is therefore a four dimensional matrix and optimal cofold score for the entire sequence is equal to S[1, n; 1, n]. We make use of the following recurrences derived from Sankoﬀ’s algorithm in [19].
S[i, j; k, l] = max
8 Rule > > > > Rule > > > > Rule > > > > > Rule >
> > > > Rule > > > > Rule > > > > Rule > : Rule
a. b. c. d. e. f. g. h. i. j.
S[i + 1, j; k, l] + α(s1[i], − ) S[i, j; k + 1, l] + α(s2[k], − ) S[i, j − 1; k, l] + α(s1[j], − ) S[i, j; k, l − 1] + α(s2[l], − ) S[i + 1, j; k + 1, l] + α(s1[i], s2[k]) S[i, j − 1; k, l − 1] + α(s1[j], s2[l]) S[i + 1, j − 1; k, l] + β(s1[i], s1[j]) + α(s1[i], − ) + α(s1[j], − ) S[i, j; k + 1, l − 1] + β(s2[k], s2[l]) + α(s2[k], − ) + α(s2[l], − ) S[i + 1, j − 1; k + 1, l − 1] + β(s1[i], s1[j]) + β(s2[k], s2[l]) + τ (s1[i], s1[j], s2[k], s2[l]) maxi≤m≤j∧k≤n≤l {S[i, m; k, n] + S[m + 1, j; n + 1, l]} ( )
(1) Rules a to d account for the possibility of placing gaps and not adding any new pair to folding set M . Rules e and f account for the possibility of aligning either the right, or left end of the sequences but not adding any pair to the folding set M . Rules g and h account for the possibility of adding a pair to folding set M where the characters of the pair in one sequence are aligned with inserted gaps in the other subsequence 3 . Rule i accounts for adding a pair to folding set M and aligning both ends of the sequences. Let us call Rule j the Branch Rule. The Branch Rule covers the case where the optimal solution comes from breaking up s1 at index m, breaking up s2 at index n and cofolding s1(i..m) with s2(k..n) and s1(m+1..j) with s2(n+1..l) or S[i, m; k, n] + S[m+1, j; n+1, l]. The branching rule looks at all combination of m and n and ﬁnds the combination which maximizes S[i, m; k, n] + S[m+1, j; n+1, l]. We will call every break up index a branch point and call S[i,m;k,n] the head of the branch and S[m+1,j;n+1,l] the tail . We will call each possible {m, n} a branch point combination. 2.1
Cofold Algorithm
The S matrix can be computed by an algorithm that goes through all the possible subsequences of s1 and s2 and ﬁnds the optimal cofold for each pair. There are O(N 4 ) such pairs of subsequences . For each pair a branch function computes the Branching Rule in an O(N 2 ) time, searching through the possible branch point combinations. As shown in Cofold Algorithm below, the recurrences are evaluated in increasing order of the right endpoints of s1 and s2. 2
3
Notational note: All subsequences will be represented as seq(a..b) where a is the starting index of the subsequence and b is the index of the of the ﬁnal character in that subsequence. Constraint: Rule g is applicable only if (s1(i + 1), s1(j − 1)) ∈ folding set M . Rule h is applicable only if (s2(k + 1), s2(l − 1)) ∈ folding set M .
A WorstCase and Practical Speedup for the RNA Cofolding Problem
5
Cofold Algorithm for j=1 to N do for l=1 to N do for i=j − 1 to 1 do for k=l − 1 to 1 do const oper max =max(Rules a to i) branch max = branch function (i, j; k, l) S[i,j;k,l]=max( const oper max, branch max )
branch function(i,j;k,l):: for m=j − 1 to i + 1 do for n=l − 1 to k + 1 do cur max = max( cur max,S[i,m;k,n]+S[m+1,j;n+1,l] ) return cur max
This algorithm is correct based on the following facts. Fact 1. During computation of S[i, j; k, l] we have already computed the optimal solution for S[i , j ; k , l ] where j ≤ j − 1, l ≤ l − 1 and( i < j and k < l .) Fact 2. For a particular i and k at the time S[i, j; k, l] is computed all S[i , j; k , l] have been computed where i > i and k > k. It is clear that the Cofold Algorithm takes O(N 6 ) time operations to compute the solution matrix S. We present a method that produces the identical solution matrix S as the the above O(N 6 ) time algorithm. Moreover, we will reduce the asymptotic time to O(N 6 /logb (N 2 )), by speeding up the branch function through the adaptation of the FourRussians method.
3
Conceptually Speeding Up the Branch function
For s1(i..j) and s2(k..l) let {m∗ ,n∗ } be the branch point combination that maximizes S[i, m; k, n] + S[m + 1, j; n + 1, l] over all possible branch point combinations {m, n} where m belongs to the set {i + 1, i + 2, i + 3, ...j − 1} and n belongs to the set {k + 1, k + 2, ....l − 1}. Overall there are there are O(N 2 ) branch points combinations to evaluate i.e. {i + 1, k + 1}{i + 1, k + 2}...{i + 2, k + 1}...{j − 1, l − 1}. Therefore, the time to a compute branch function for a ﬁxed i, j, k, and l is O(N 2 ). The Four Russians method applied to the branch function lowers the computation to O(N 2 /q 2 ). The value of q will play an important role in the speedup and will be examined in the time analysis section. We conceptually divide all the possible branch points of s1 into sets of size q called Mgroups. Let Mg=0 be the ﬁrst such group that contains the possible branch points {0, 1, ...q − 1}, let Mg=1 contain {q, ...2q − 1} and so on ... the last group of which Mg=n/q = {n − q, ...n − 1}. We will also conceptually divide all the possible branch points of s2 into sets of size q called Ngroups such that Ng =0 = {0, 1, ..., q − 1} and so on. In general: Mg = {g ∗ q, g ∗ q + 1, ...g ∗ q + q − 1} Ng = {g ∗ q, g ∗ q + 1, ...g ∗ q + q − 1}
6
Y. Frid and D. Gusﬁeld
Let {m∗g , n∗g } be the branch point combination that maximizes the sum S[i, m; k, n] + S[m + 1, j, n + 1, L] such that m ∈ Mg and n ∈ Ng . Let {M∗ ,N∗ } be equal to the pair {m∗g , n∗g } where S[i, m∗g , k, n∗g ] + S[m∗g + j−1 k+1 l−1 1, j, n∗g +1, l] is maximum for all Mg ,Ng sets g, g in { i+1 q , ..., q }, { q , ..., q } respectively. Fact 3. {m∗ , n∗ } = {M ∗ , N ∗ }. Based on Fact 3. we change the Branch Rule from max{{m,n}m∈{i+1,...,j−1}∧n∈{k+1,...,l−1}}S[i, m; k, n] + S[m + 1, j, n + 1, l] to max{{m∗ ,n∗ }g∈{ i+1 ,..., j−1 }∧g ∈{ k+1 ,..., l−1 }} S[i, m∗g , k, n∗g ] + S[m∗g + 1, j, n∗g + 1, l] g
g
q
q
q
q
Now assume there is a precomputed table R2 that returns {m∗g , n∗g } in O(1) time for any i, j, k, l. Such a table would reduce computation of the branch function to O(N 2 /q 2 ) time. 3.1
Implementing the Branch Function with Table R2
Encoding. For a particular j, l, let Vg,g be a q by q matrix that contains the possible tails for the branches in Mg , Ng . Where Vg,g (1, 1) = S[gq+1, j; g q+1, l] ... Vg,g (1, q) = S[gq + q, j; g q + q, l] and so on. More precisely Vg,g (m + 1 − gq, n + 1 − g q) = S[m + 1, j; n + 1, l] (see Figure 1).
Fig. 1. The example V matrix shown in ﬁgure 1 is for Mgroup g and Ngroup g’ and some j,l. The integers x,y,z,y’, x’ are example values in Vg,g . These values equal the designated values of the S matrix. The base= S[gq + q, j; g q + q, l]=x.
Optimal cofold scores stored in S[i, j; k, l] and S[i + 1, j; k, l] can diﬀer by the eﬀect of only one more nucleotide i.e. s1[i]. Therefore we can observe that for the scoring scheme and the recurrences of the Colfold Algorithm, S[i, j; k, l] − S[i + 1, j; k, l] belongs to a ﬁnite set of diﬀerences D, where D is the set of scores created by combinations of scores from the sets α, β, and τ . The cardinality or size of D is O(1) as a function of N . Clearly, S[i, j; k − 1, l] − S[i, j; k, l] also belongs to D.
A WorstCase and Practical Speedup for the RNA Cofolding Problem
7
Fig. 2. The corresponding E matrix to Vg,g in ﬁgure 1. A few example values are shown i.e. Eg,g [1, 1]=Vg,g [1, 1]base=z − x ∈ D.
Let S[gq + q, j; g q + q, k] be called the base of Vg,g and let E be q by q matrix of diﬀerences from the base. We deﬁne Eg,g (x, y) = (S[a + x, j; b + y, l] − S[a + q, j; b + q, l]), where S[a+q,j;b+q,l] is the base of Vg,g and a = gq and b = g q. For a particular j, l we can create and store matrices Eg,g as soon as the corresponding values in the S matrix are computed. Once computed, retrieval of any desired E clearly takes O(1) time. The overall overhead for encoding the S matrix into a set of E matrices for the entire algorithm requires an addition of O(N 4 ) time. Theorem 1. Given Eg,g and the base we can reconstruct all the values of Vg,g . Proof. Vg,g (e, f )= Ei,k (e, f )+base Fact 4. For a speciﬁc i, j, k, l and g, g , if {m, n} is the branch point combination that leads to the maximum of the sum of S[i, m; k, n]+Eg,g (m+1−gq, n+1−g q) where m ∈ M g and n ∈ N g then {m∗g , n∗g } = {m,n}. 3.2
R2 Table Integration into Branching
The fast branch function below calculates the new Branch Rule. Taking advantage of the precomputed R2 table as well as the precomputed and stored E matrices, the total time for this function will be O(N 2 /q 2 ). fast branch function(i,j;k,l):: for g= j−1 to q
i+1 do q k+1 g = l−1 to do q q
for retrieve Eg,g {m∗g , n∗g }=R2 (i, k, g, g , Eg,g ) cur max= max( cur max, S[i, m∗g ; k, n∗g ] + S[m∗g + 1, j; n∗g + 1, l] ) return cur max
8
Y. Frid and D. Gusﬁeld
Precomputing the R2 Table
4
Finally we present how to precompute table R2 for all possible variations of E. For simplicity of exposition we reorganize the Cofolding Algorithm as follows. for g=0 to N/q do for g =0 to N/q do for j=g ∗ q to gq + q − 1 do for l=g q to g q + q − 1 do for i=j − 1 to 1 do for k=l − 1 to 1 do const oper max =max(Rules a to i) branch max = branch function(i, j; k, l) S[i,j;k,l]=max( const oper max, branch max )
Note that neither the runtime nor accuracy is aﬀected by this change. Also note that facts 1,and 2, still hold true. Assume we have completed the iteration of algorithm above where g = 0 and g = 0 and have the optimal solutions for all i, k S[i, m ; k, n ] where m < q and n < q. At this point we have computed all the heads for branch points in Mgroup M0 , and Ngroup N0 (g = 0,g = 0). For any matrix E the following algorithm computes {m∗0 , n∗0 }. for each matrix v of size q by q such v[x, y] ∈ D do compute (E from v) 4 for each i such that i < q − 1 do for each k such that k < q − 1 do R2 (i, k, g = 0, g = 0, E) is the to the branch combination {m, n} such that S[i, m; k, n] + E[m + 1, n + 1] is maximum.
We can generalize this algorithm for any g, g , by creating an update table function that is called once any g iteration is complete. update table function(g,g’) :: for each matrix size q by q v such v[x, y] ∈ D do compute E from v for each i such that i < gq − 1 do for each k such that k < g q − 1 do R2 (i, k, g, g, E) is set to branch combination {m, n} such that S[i, m; k, n]+ E(m + 1 − g ∗ q, n + 1 − g ∗ q) is maximum.
4.1
Fast Cofold Algorithm
We present the speedup algorithm combining both preprocessing and use of table R2 . 4
For example compute E from v function sets E(i, j) =
i x=q−1
v[x, q] +
j y=q−1
v[i, y].
A WorstCase and Practical Speedup for the RNA Cofolding Problem
9
Fast Cofold Algorithm for g=0 to N/q do for g =0 to N/q do for j=g ∗ q to gq + q − 1 do for l=g q to g q + q − 1 do for i=j − 1 to 1 do for k=l − 1 to 1 do const oper max =max(Rules a to i) branch max = fast branch function(i, j; k, l) S[i,j;k,l]=max( const oper max, branch max ) update table(g,g’)
Boundary case for branch function. We deﬁne the boundary case of the fast branch function(i,j,k,l) the case where g = j/q and/or g = l/q. Because, the update table function has not yet precomputed {m∗g , n∗g } in this case, we must explicitly compute {m∗g , n∗g } comparing all q 2 branch point combinations. The fast branch function including the Boundary case is shown below. fast branch function(i,j;k,l):: for g= j−1 to q for
i+1 do q k+1 l−1 g = q to q
do if (boundary case) compute {m∗g , n∗g } directly; continue retrieve Eg,g {m∗g , n∗g }=R2 (i, k, g, g , Eg,g ) cur max=max( cur max, S[i, m∗g , k; n∗g ] + S[m∗g + 1, j; n∗g + 1, l] ) return cur max
5
Asymptotic Time Analysis
The FastCofold algorithm can be grouped into 3 sections: (1)The computations of Rules ai, (2) the computation of Branch Rule j or the Fast Branch function, (3)the preprocessing done by the update table function. The loops g and g are each called O(N/q) times, loops j and l are each called O(q) times, loops i and k are each called O(N ) time. Therefore, the computation time of Fast Cofold Algorithm for Rules ai equals to O( Nq ∗ Nq ∗ q ∗ q ∗ N ∗ N )=O(N 4 ) and remains unchanged from the Cofolding algorithm. The fast branch function is called O(N 4 ) times. In the branch function, loops for g and g will reference the R2 table a total of O(N 2 /q 2 ) times. There are O(N/q + N/q) boundary cases during each call to the fast branch function that take O(q 2 ) time to compute. Therefore, each call to the fast branch function takes O(N 2 /q 2 + (2N/q) ∗ (q 2 )) = O(N 2 /q 2 + 2qN ) time. In the Fast Cofold algorithm the Branch Rule j is computed in total O(N 6 /q 2 + 2qN 5 ) time. The update table function is called for every new Mgroup, Ngroup combination completed, or on every iteration of loop g . In total there are N 2 /q 2
10
Y. Frid and D. Gusﬁeld
such iterations. With in the update table function we have three loops. The 2 outer loop iterates over every possible E matrix of which there are Dq . The next two loops then maximize for every i,k taking O(N 2 ) time to do O(q 2 ) maximizations. Therefore, the asymptotic time of the update table function is 2 2 O(N 2 /q 2 ∗ Dq ∗ N 2 ∗ q 2 )= O(N 4 ∗ Dq ). The entire Fast Cofold algorithm algorithm has a runtime of O(N 6 /q 2 +2qN 5 ) 2 +O(N 4 ∗ Dq ) + O(N 4 ). Theorem 2. The Fast Cofold algorithm has an asymptotic time bound of O(N 6 /logb (N 2 )) if q= logb (N 2 ) where the log base b is is constrained by D < b < N. Proof. If q is set to logb (N 2 ) then the algorithm takes O(N 6 / logb (N 2 ) + 2 2 logb (N 2 ) ∗ N 5 ) +O(N 4 / logb (N 2 ) ∗ Dlogb (N ) ) + O(N 4 ) time. 2
So if O(N 4 ∗ Dlogb (M ) )= O(N 6 /logb (N 2 )) then Fast Cofold algorithm computes in O(N 6 / logb (N 2 )) time. Let N = N 2 and Q = q 2 then the Fast Cofold Algorithm has an asymp totic time of O(N 2 ∗ DQ ). Base on theorem 1. in Frid and Gusﬁeld O(N 2 ∗ DQ )=O(N 3 / logb (N )) for D < b < N [6]. Therefore, O(N 3 / logb (N )) = O((N 2 )3 / logb (N 2 )) = O(N 6 / logb (N 2 )) q.e.d. 5.1
Memory
Unchanged from Sankoﬀ’s algorithm, the Fast Cofold algorithm will also require O(N 4 )space to store matrix S. However, there is an additional memory cost of 2 O(N 4 /q 2 ∗ Dq )space for storing Table R2 .
6
Empirical Results
We compare our Fast Cofold Algorithm with the Sankoﬀ Cofold Algorithm for two sequences described in the paper. The purpose of these empirical results is to show that our algorithm not only achieves a theoretical speedup but can also lead to practical improvements. As discussed above we produce the same solution matrix S produced by the O(N 6 ) algorithm. Therefore, we don’t test diﬀerent values for the scoring schemes α, β, τ , but do test the change in cardinality D. Our algorithm also performs identically for randomly generated and real sequences geneBank sequences of the same length N . In fact the practicality and speed up of the Fast Cofold algorithm is dependent only on the size of the sequence N , the base of the log b, and the cardinality of set D. An optimization function was created that sets base b to the value that would create the greatest speedup. The function calculated the optimal b for a set D, sequence length n and the memory constraints of the computer. We report the results in Table 1 for average times in seconds for 30 random generated and 10 geneBank sequences (standard deviation for all tests is less than .5 seconds).
A WorstCase and Practical Speedup for the RNA Cofolding Problem
11
Table 1. Empirical Results D base b Size (N) Cofold Algorithm runtime(seconds) Fast Cofold Algorithm (seconds) ratio 7 9 150 21307.45 12085.9 1.76 3 4 150 21307.45 7446.04 2.88 2 4 150 21307.45 5866.39 3.66 3 4 100 1770.33 733.502 2.42 2 3 100 1770.33 631.525 2.80 5 6 50 24.41 20.79 1.17 3 4 50 24.41 18.58 1.31 2 3 50 24.41 10.63 2.30
7
Conclusion and Future Work
The Fast Cofold algorithm presented formulates Four Russians speedup for the problem of ﬁnding an optimal simultaneous alignment and fold. The algorithm produces the same solution matrix S as the modiﬁed Sankoﬀ’s Cofolding algorithm but in the reduced time of O(N 6 / logb (N 2 )) from O(N 6 ). This compatibility makes it possible to apply other speed ups and memory reduction algorithms alongside the Four Russians speedup. As discussed in the introduction ZivUkelson et al. [19] and Backofen et al. [2] improved computation time and lowered memory costs by ﬁltering the branch points that the branch function examines. Excluding groups that don’t have any members that are coterminus cofolding from computation in the update table function and branch function would lead to an additional speedup of O(N 4 W ) where W is the number of group combinations that N contain coterminus coco folding members. W is constrained by log(N ) ≤ W ≤ 2
N 5 min(K, log(N ) ) . There is also interest in extending the speedup to the algorithms that compute cofolds for more than two sequences, and algorithms that compute local alignments. We also note that based on Theorem 2 Mgroups and Ngroups don’t have to be the same size. In fact Theorem 2 holds for Q = q1 ∗ q2 where q1 is the size of any Mgroup and q2 of any Ngroup. The variation in group sizes can be implemented with a few small changes to the algorithm leading to an even greater speedup.
Acknowledgments This research was partially supported by grants SEIBIO 0513910 and IIS0803564 from the National Science Foundation.
References 1. Backofen, R., Landau, G.M., M¨ ohl, M., Tsur, D., Weimann, O.: Fast RNA structure alignment for crossing input structures. In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009. LNCS, vol. 5577, pp. 236–248. Springer, Heidelberg (2009) 5
K is constrained by N ≤ K ≤ N 2 [19].
12
Y. Frid and D. Gusﬁeld
2. Backofen, R., Tsur, D., Zakov, S., ZivUkelson, M.: Sparse RNA folding: Time and space eﬃcient algorithms. In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009. LNCS, vol. 5577, pp. 249–262. Springer, Heidelberg (2009) 3. Dowell, R., Eddy, S.: Eﬃcient pairwise RNA structure prediction and alignment using sequence alignment constraints. BMC Bioinformatics 7(1), 400 (2006) 4. Eddy, S.R.: Computational genomics of noncoding RNA genes. Cell 109(2), 137– 140 (2002) 5. Eddy, S.R., Durbin, R.: RNA sequence analysis using covariance models. Nucl. Acids Res. 22(11), 2079–2088 (1994) 6. Frid, Y., Gusﬁeld, D.: A simple, practical and complete O(n3 /log(n)) time algorithm for RNA folding using the four russians speedup. In: Salzberg, S.L., Warnow, T. (eds.) WABI 2009. LNCS, vol. 5724, pp. 97–107. Springer, Heidelberg (2009) 7. Gorodkin, J., Heyer, L.J., Stormo, G.D.: Finding common sequence and structure motifs in a set of RNA sequences. In: ISMB, pp. 120–123 (1997) 8. Hofacker, I.L., Fontana, W., Stadler, P.F., Bonhoeﬀer, S.L., Tacker, M., Schuster, P.: Fast folding and comparison of RNA secondary structures. Chemical Monthly 125, 167–188 (1994) 9. Mathews, D.H., Turner, D.H.: Dynalign: an algorithm for ﬁnding the secondary structure common to two RNA sequences. Journal of Molecular Biology 317(2), 191–203 (2002) 10. Nussinov, R., Pieczenik, G., Griggs, J.R., Kleitman, D.J.: Algorithms for loop matchings. SIAM Journal on Applied Mathematics 35(1), 68–82 (1978) 11. Pedersen, J.S., Bejerano, G., Siepel, A., Rosenbloom, K., LindbladToh, K., Lander, E.S., Kent, J., Miller, W., Haussler, D.: Identiﬁcation and classiﬁcation of conserved RNA secondary structures in the human genome. PLoS Comput Biol. 2(4), e33 (2006) 12. Rivas, E., Eddy, S.: Noncoding RNA gene detection using comparative sequence analysis. BMC Bioinformatics 2(1), 8 (2001) 13. Rose, D., Hackermuller, J., Washietl, S., Reiche, K., Hertel, J., FindeiSZ, S., Stadler, P., Prohaska, S.: Computational rnomics of drosophilids. BMC Genomics 8(1), 406 (2007) 14. Sankoﬀ, D.: Simultaneous solution of the RNA folding, alignment and protosequence problems. SIAM Journal on Applied Mathematics 45(5), 810–825 (1985) 15. Seemann, S.E., Gorodkin, J., Backofen, R.: Unifying evolutionary and thermodynamic information for RNA folding of multiple alignments. In: NAR (2008) 16. Torarinsson, E., Yao, Z., Wiklund, E.D., Bramsen, J.B., Hansen, C., Kjems, J., Tommerup, N., Ruzzo, W.L., Gorodkin, J.: Comparative genomics beyond sequencebased alignments: RNA structures in the encode regions. Genome Res. 18(2), 242–251 (2008) 17. Torarinsson, E., Havgaard, J.H., Gorodkin, J.: Multiple structural alignment and clustering of RNA sequences. Bioinformatics 23(8), 926–932 (2007) 18. Washietl, S., Hofacker, I.L.: Consensus folding of aligned sequences as a new measure for the detection of functional RNAs by comparative genomics. Journal of Molecular Biology 342(1), 19–30 (2004) 19. ZivUkelson, M., GatViks, I., Wexler, Y., Shamir, R.: A faster algorithm for RNA cofolding. In: Crandall, K.A., Lagergren, J. (eds.) WABI 2008. LNCS (LNBI), vol. 5251, pp. 174–185. Springer, Heidelberg (2008)
Sparse Estimation for Structural Variability Raghavendra Hosur1,3 , Rohit Singh1 , and Bonnie Berger1,2, 1
Computer Science and Artiﬁcial Intelligence Laboratory, MIT Massachusetts Institute of Technology Cambridge MA 02139 2 Dept. Of Mathematics, MIT 3 Dept. Of Materials Science and Eng., MIT
[email protected] Abstract. Proteins are dynamic molecules that exhibit a wide range of motions; often these conformational changes are important for protein function. Determining biologically relevant conformational changes, or true variability, eﬃciently is challenging due to the noise present in structure data. In this paper we present a novel approach to elucidate conformational variability in structures solved using Xray crystallography. We ﬁrst infer an ensemble to represent the experimental data and then formulate the identiﬁcation of truly variable members of the ensemble (as opposed to those that vary only due to noise) as a sparse estimation problem. Our results indicate that the algorithm is able to accurately distinguish genuine conformational changes from variability due to noise. We validate our predictions for structures in the Protein Data Bank by comparing with NMR experiments, as well as on synthetic data. In addition to improved performance over existing methods, the algorithm is robust to the levels of noise present in real data. In the case of Ubc9, variability identiﬁed by the algorithm corresponds to functionally important residues implicated by mutagenesis experiments. Our algorithm is also general enough to be integrated into stateoftheart software tools for structureinference.
1
Introduction
A central tenet of molecular biology is that a protein’s threedimensional (3D) structure is crucial to its function. Indeed the structural genomics initiative is producing ever increasing number of structures at high resolution, providing accurate coordinates for each atom in the structure [2]. A protein’s structure, however, is rarely static. Proteins are dynamic molecules, capable of exhibiting a wide range of motions and conformational variability [11,21]. Such conformational changes are important in biological functions such as enzymatic catalysis, cellular transport, and signaling [27,8]. It has been postulated that even subtle conformational changes may have important functional consequences [16]. A multiconformer model, or ensemble, attempts to model variability by explaining the data using an ensemble of conformers, rather than just one conformer. Indeed, conformational variability in a protein might be present even
Corresponding author.
V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 13–27, 2010. c SpringerVerlag Berlin Heidelberg 2010
14
R. Hosur, R. Singh, and B. Berger
in a single experiment, where the observed data is an average over multiple conformations [6,9]. Multiconformer approaches have long been the norm when modeling NMR data. It has been suggested that, for an accurate representation of the physical heterogeneity in a protein, such multipleconformer models also be used to explain Xray crystallography data [9,24,14]. An open problem— and the focus of this paper— is understanding the nature of conformational variability implied by experimental data. The key challenge here is to distinguish variability resulting due to noise in experimental data from functionally relevant physical motion [24,20,5]. The problem is particularly diﬃcult to solve with singleconformer approaches, given their limited ability to model the data. Indeed, this issue has been a driving force in the eﬀorts toward ensemble approaches [9]. Even with the current ensemble approaches, it is diﬃcult to disentangle a protein’s physical motion (e.g. hinge or loop motions) from other kinds of protein motion (e.g., vibrational motion). The key problem is that limited sampling (i.e. number of conformations) and multiplicity of the problem make for weak statistical estimates [9,14,12]. While a growing number of tools address the problem of using ensembles to implicitly model conformational variability [6,14,5], they generally do not distinguish between variability due to noise vs. physical motion. There have been some attempts to analyze structural variability, but using pairs of structures rather than ensembles. Conventional parameters such as torsional angle diﬀerences, temperature factors and rootmeansquareddistance (RMSD) values have been used to identify ﬂexible regions. But they combine estimation noise and true variability into a single quantity; thus, they are of limited usefulness under noisy data (e.g. for lowtomedium resolution structures) (see Related Work, [20]). More importantly, conformational variability is best described over a population (i.e ensemble) of conformations; pairwise comparison between structures implies such limited sampling of the conformational space that it may be unreliable for all but the least noisy datasets. In this paper, we take a diﬀerent approach to analyzing variability. Our approach is inspired by recent developments in regressionbased predictive models in machine learning. The basic intuition behind the approach is to construct an ensemble of conformers that explain the experimental data and then use sparse estimation to distinguish between conformers that are just noisy versions of a base conformation (e.g., the PDB structure) and those that capture true conformational variability (relative to the base). Accordingly, structures sampled from a Gaussian distribution about the base structure should be more predictive of the base structure than structures displaying true variability. This allows us to separate out the biologically relevant variability due to physical motion using a feature selection technique, Lasso [25]. Lasso, which stands for “least absolute shrinkage and selection operator”, is a regularized regression technique in which only the most signiﬁcant predictor features are selected [25]. We illustrate the approach on Xray crystallographic data, as it is the most common source of structural data. Our results demonstrate that the method compares favorably with previous approaches. It is more robust to speciﬁc parameter choices and
Sparse Estimation for Structural Variability
15
produces fewer false positives and false negatives (see Comparative Analysis). In contrast to conventional approaches of pairwise structure comparison, we use Electron Density Maps (EDM) for identiﬁcation of true variability; this allows us greater power in accurately identifying true structural outliers without the need for any artiﬁcial parameters to model noise [13]. Finally, our predictions of true variable regions are in good agreement with the dynamics inferred from solution NMR experiments; the latter are presumably closer to the physical reality. One of the key contributions of our work is in framing the problem as a sparse estimation problem, in a way that allows a wealth of machine learning knowledge to be applied to it. In particular, the problem of identifying sparse models that can be physically interpreted has recently gained much attention in machine learning, data mining and statistics due to the exponential growth in publicly available data [10]. We show here that identiﬁcation of true variable regions in an ensemble is naturally formulated as a sparse learning problem via Lasso. This formulation allows us to rigorously deal both with noise in the experimental data and uncertainty associated with the structurebuilding process. Our approach of using Lasso is quite general, and can be applied to any structural data. Application of our method to proteins of interest may reveal interesting conformational changes that might go unnoticed due to the absence of alternate structural evidence, i.e. independently solved alternate conformations, which are still expensive and cumbersome to obtain. A key intuition driving our approach is as follows: to identify true variability in a protein fragment, rather than performing a peratom statistical test, we perform a wholemodel statistical test. A peratom test will essentially ignore correlated motions (even if small) between neighboring atoms; in contrast, a wholemodel test will be able to identify even small correlated motions. We formalize this approach using the Lassobased test. We exploit the idea of borrowing information from all the samples to make a reliable statistical inference on a particular sample. In contrast, a pairwise tstatistic approach uses information from only a single sample to make a decision [12].
2
Related Work
Coordinatebased methods using pairwise comparisons have had reasonable success in identifying ﬂexible regions [20]. However these techniques were designed to identify true ﬂexibility in conformations that have been solved independently, where there is already some evidence of variability. Nigham et al. give a statistical test based on pairwise RMSD to identify regions showing true variability in the presence of noise. Key to their method is the assumption of a uniform, normal independent noise (artiﬁcially added) at each coordinate. However, this assumption typically does not hold in reality [26]. Related approaches rely on the use of various parameters such as torsion angle diﬀerences, temperature factors and RMSD. Torsion angle diﬀerences are highly sensitive to noise: small deviations in coordinates might cause signiﬁcant changes in torsion angles [20]. Temperature factors (Bfactors) are parameters used to
16
R. Hosur, R. Singh, and B. Berger
model uncertainty in atomic positions; the value of the Bfactor corresponding to an atom represents the degree of uncertainty in that atom’s location in the model. This distribution accounts for small vibrations about an atom’s position. However, Bfactors tend to encapsulate in one value the conformational variability, as well as ambiguities related to inadequacies in data (e.g. related to crystal imperfections, errors in measurement of intensities). This problem is aggravated at mediumtolow resolutions (> 1.5˚ A). At such resolutions, Bfactors act as “errorsinks”, absorbing any errors (not necessarily related to protein motion) in the optimization and model building process [13]. A number of methods have been proposed to model multiple conformations that might give rise to Xray crystallographic data from a single crystal [6,24,14,5]. Although independently optimized multiconformer representations prove to be a very attractive solution, interpretation of what the ensemble represents is a gray area [24,5]. Knight et al. (2008) give a simple residuelevel heuristic test based on the variance in the ensemble to identify true variability. However, there is no consensus method to identify true structural variability, and the interpretation of such ensembles is still the subject of debate [24,5].
3
Methods
Our method consists of two steps: a) construction of an ensemble representative of the observed data, and b) analysis of the variability in this ensemble using Lasso. The ensemble generation algorithm is independent of the classiﬁcation of variability; the ensemble can be obtained from any other method. However it is important to ensure that all the structures in the ensemble are of highquality, and represent the data almost as well as the PDB structure. 3.1
Ensemble Construction
To obtain a diverse, highquality ensemble representing the Xray diﬀraction data, we seed a singleconformer maximum likelihood optimization procedure (e.g. PHENIX) with a diverse set of conformations [1]. We assume that realistic conformations explaining the crystallographic data will be within a limited RMSD distance of the published PDB structure; this follows similar assumptions in previous work [6,14]. However, hinge motion, if present in a single crystal specimen, can also be detected by sampling in a larger conformational space around the PDB structure. Starting from the backbone coordinates in the PDB, we construct alternate backbone conformations within 2˚ A1 RMSD using ChainTweak, a stateoftheart inversekinematics based neighborhoodsampling algorithm [22]. ChainTweak can, in principle, exhaustively sample from the neighborhood of a conformation; leading to a highly variable and diverse ensemble. For each backbone, we assign sidechains using RAPPER [6], based on their ﬁt to the 1
We tried using higher cutoﬀs, but RAPPER often fails to ﬁnd a rotamerassignment compatible with the EDM for conformations greater than 2˚ A RMSD from the PDB backbone.
Sparse Estimation for Structural Variability
17
Electron Density Map (EDM). The ﬁnal ensemble is obtained by subsequent optimization using PHENIX and ﬁltering based on ﬁttodata, measured using a crossvalidation parameter Rf ree 2 ;lower Rf ree implies better ﬁttodata. The ﬁnal ensemble consists of structures that are of high quality, and collectively represent the data as well as the PDB structure (Fig 1).
"
! "
# $% ! & " $
' " (
Fig. 1. Overview of the ensemble generation and classiﬁcation algorithm
3.2
Analysis of Variability Using Lasso
Given an ensemble of conformations, our goal in this section is to identify the subset of conformations whose variation from a given base conformation is most likely due to only noise in the experimental data. The remaining conformations can then be interpreted as demonstrating true variability compared to the base conformation. The choice of a base conformation here is arbitrary; a natural choice for it is the PDB structure, since one is often interested in conformational variability not captured by the published PDB structure. To achieve this goal, we formulate a Lasso regression problem: we express the base conformation as a linear combination of the ensemble members (each such conformation is thus a feature); we use experimental data (i.e. diﬀraction data) to ﬁt this regression. As part of the Lasso framework for feature selection, we assign (unknown) weights to each feature. The key strength of Lasso is that it is likely to make the weights 2
R is a measure of agreement between the amplitudes of the structure factors calculated from a structure and those from the original diﬀraction data. Rf ree is the corresponding crossvalidation parameter, calculated on diﬀraction data not used in the structure optimization process [26].
18
R. Hosur, R. Singh, and B. Berger
for irrelevant features exactly zero, clearly identifying them. The intuition here is that structures sampled from a Gaussian distribution (i.e. modeled by Bfactors) about the PDB structure should be more predictive of the PDB structure than structures displaying true variability. The former structures will be assigned a nonzero weight during Lasso and can then be classiﬁed as not displaying true structural variability, since they are adequately represented by the PDB structure and do not represent biologically relevant long timescale motion. Lasso regression is often an eﬀective technique for shrinkage and feature selection in cases where feature selection must be performed with noisy, limited data [25,17,29]. The loss function of Lasso regression is deﬁned as: L=
(yi −
i
p
βp xip )2 + λ
βp 1
(1)
p
where xip denotes the pth predictor (feature) in the ith data point, yi denotes the value of the response for this data point, and βp denotes the regression coeﬃcient of the pth feature. The l1 regularizer leads to a sparse solution in the feature space, which means that regression coeﬃcients for the most irrelevant and redundant features shrink to zero. Interestingly, recent theoretical work recovers Lasso as a formulation of a linear robust regression problem under featurewise uncorrelated and normbounded noise [29]. The authors suggest that such problems are of interest when values of the features are obtained with noisy preprocessing steps, and the magnitudes of such noises are bounded. We exploit this parallel in our formulation, where we compute each feature (i.e. each structure in the ensemble) by optimizing against the observed data. The PDB structure is the observed quantity, and the individually optimized structures in the ensemble are our noisy predictor features. A sparse solution in the β space will then represent structures which are variable due to noise (βp > 0), thus decomposing the variability observed in the ensemble. To get the regularization penalty λ, we follow suggestions based on other applications of Lasso and use crossvalidation [25,19]. 3.3
Electron Density Map
Lasso regression can be performed either in the coordinate space or the electron density space (EDM). In contrast to previous approaches, which use coordinate based methods for pairwise structure comparison, we have designed the test using EDMs, since the former cannot distinguish between model errors and genuine structural outliers [13]. EDMs are obtained by taking an inversefourier transform of the observed diﬀraction data, which are appropriately scaled using Bfactors [7]. Another advantage of using an EDM is that it directly includes the Bfactors of the models, and hence can also inherently deal with isotropic or anisotropic Bfactors. This circumvents the problem of estimating actual uncertainty from Bfactors; which is often a challenge for coordinate based methods. The simple regression test quantiﬁes the relevance of each structure in the ensemble to the Gaussian distribution around the PDB (as given by the Bfactors).
Sparse Estimation for Structural Variability
19
As part of our Lasso formulation, we assume as the observed variable, the EDM computed from the PDB structure. The predictor variables, or features, are EDMs of structures in the ensemble. The electron density at a point ’g’ on a grid describing the observed EDM (ρgP DB ), is then modeled as a linear combination of electron densities at the point ’g’ of the predictor EDMs (ρgi ). We assume that the observed electron density is noisy with respect to our generative model and model this using a normally distributed noise component g . We then minimize the Lasso loss function: ρgP DB = wi ρgi + g (2) min
gG
i
(ρgP DB
−
i
wi ρgi )2 + λ
wi
(3)
i
Here, wi are the regression coeﬃcients. The structures for which wi approaches zero are the ones most irrelevant compared to the PDB, and hence exhibit true variability. To optimize over a fragment (e.g. one residue), G is restricted to the bounding box for the fragment. All EDMs are constructed using Clipper [3], and are described on the same unit cell with the same symmetry as that of the PDB structure. The optimization was carried out using the nonlinear optimization libraries IPOPT. IPOPT uses an interior point method, combined with an eﬃcient linesearch procedure to minimize the nonlinear objective function [28].
4 4.1
Results Synthetic Data
Our algorithm successfully models variability in a simulated crystal having two conformations, one the PDB structure (conformer 1) and the other constructed computationally (conformer 2) (Fig 2A; RMSD = 0.989 ˚ A). The second conformer was constructed using ChainTweak; we randomly selected a conformation from a set of 100. Side chains were built using RAPPER and all atoms were assigned a Bfactor of 30 ˚ A2 . Synthetic diﬀraction data were computed by averaging the simulated structure factors of the two conformers using the experimental resolution cutoﬀs [5,7]. Starting from an EDM of the simulated crystal, our algorithm generates structures similar to both the original structures (Fig 2A,B). Of the 13 structures output by the algorithm, 4 structures were nonredundant; remaining structures were almost identical to these 4 structures. Lasso regression on these 4 structures show that the ensemble correctly identiﬁes the heterogeneity in the original data, with 2 structures having coeﬃcients w ≈ 0 with regression done with EDM of conformer 1 (as per a ttest; colored light gray in Fig 2A), corresponding to structures with true variability. Moreover, the same conformations had statistically signiﬁcant coeﬃcients (w > 0) in the regression with EDM of conformer 2. Indeed, these conformations are closer to conformer 2 (RMSDs= 0.298, 0.128 ˚ A) than the conformations classiﬁed as nonvariable (RMSDs = 0.456, 0.765 ˚ A). The algorithm thus appears to recover the heterogeneity in the data (Fig 2B).
20
R. Hosur, R. Singh, and B. Berger Num. Initial Conformers 2 Output Ensemble Ensemble Size 4 R2 0.796 RMSDs for ω = 0 0.952, 0.712 RMSDs for ω > 0 0.324, 0.613 (A)
(B)
Fig. 2. Example of ensemble construction and classiﬁcation. A) PDB structure and the second conformer in the synthetic crystal are in black. The two structures classiﬁed by Lasso as variable are shown in light gray and the two as variable due to noise, in dark gray. B) Summary of the algorithm output using synthetic data. RMSD is calculated with respect to the PDB structure. Suitability of the linear model and statistical signiﬁcance of the regression coeﬃcients were evaluated using standard techniques (R2 and ttest).
Performance analysis. Our method is robust and consistent (Fig 3A,B). The consistency and accuracy of our method depends on the extent of correlation between the features. Correlation between structures that are truly variable and ones variable due to noise, will make the regression convoluted; diﬀerent regularization penalties (λ) will select diﬀerent structures, leading to highly varying regression weights [19]. Our simulations indicate that the features (i.e. conformations in the ensemble) are uncorrelated to a large extent (Fig 3A), indicated by the overall smooth trends for ω as we increase the regularization penalty λ. Increasing λ shrinks the individual weights of the features towards zero, thereby decreasing the ratio ω1 /maxω1 . We believe the overall smoothness of the regularization path may be due to the eﬃciency of the sampling algorithm– ChainTweak, which constructs highly diverse and uncorrelated conformations. In our simulations we ﬁnd that, of the four structures in the ensemble, only one structure (dashed line) is dominant for all regularization penalties. A second structure (dashed line) is selected only at low λ’s (< 50; Fig3A). We ﬁnd that our overall classiﬁcations are quite robust to the size of optimized grid region ’G’. The average weight of a structure, calculated by averaging over all fragments, is consistent across varying fragment and window sizes; structures represented by dashed lines do indeed have the highest average weights and those by solid lines, negligible average weights (Fig 3B). One could vary G in two ways: by splitting the chain into separate fragments and carrying out Lasso on each one, or by sliding a window centered around each residue and optimizing over each window. Our results on the fragmentbased approach are identical to Fig 3B; we used fragment sizes of 1,2,4 and 8 (data not shown). For the second approach, we use sliding windows of sizes 3 and 5 centered on each residue (Fig 3B), and optimize over the bounding box enclosing the residues in the window. Comparative analysis. Lasso compares favorably to other methods in identifying true ﬂexibility. The pairwise comparison method of Nigham et al. (Pflex)
Sparse Estimation for Structural Variability 1.4
1.4
1.2
1.2
1
1
window = 5 window = 3 1
0.8
0.6
0.6
0.4
0.4
0.2
0.2
ω
ω
ω
0.8
0 0
21
0.5 0
0.2
0.4
0.6
ω1/maxω1
(a)
0.8
1
0 1
2
3
4
2
Residue
4
Residue 5
6
6 7
(b)
Fig. 3. Performance analysis. A) Regularization path for the ensemble (ω1 → 0 as λ → ∞ towards left). B) Residuelevel lasso with varying window sizes centered on each residue (λ = 10). Dashed lines are for structures classiﬁed as variable due to noise, solid lines are for those classiﬁed as truly variable.
is sensitive to the standard deviation of added noise (σ). Pflex computes a ﬂexibility measure, ’f’, for each residue based on RMSD, σ and a threshold pvalue. A lower f implies higher ﬂexibility. We used the values suggested by Nigham et al. for σ (0.1 0 is a small constant. Please note that to keep presentation simple, we didn’t make this explicit in the pseudocode. Since the maximal stacking length is usually small, there are only very few instances of j with dj ,j > k such that for those few j it is cheap to consider all i as candidates. Hence, we store O(kn) = O(n) candidate lists each requiring at most O(n) space.
3
Sparsification of the Rivas and Eddy Algorithm
The class of structures predicted by the R&E algorithm [8], here called class of R&E structures, is the most general RNA secondary structure prediction algorithm described in the literature [14]. To keep presentation simple we explain the sparsiﬁcation strategy for a basepair maximization algorithm that handles the R&E structure class. Finally, we motivate that sparsiﬁcation can be transferred to the R&E energy minimization algorithm.
Sparsiﬁcation of RNA Structure Prediction Including Pseudoknots
45
First, we give recursions of base pair maximization for R&E structures. Note that the recursions are intentionally very close to the recursions of the R&E energy minimization algorithm. After initialization for i ≥ j and k ≥ l W (i, j) =
if i = j or i = j + 1 if i > j + 1
0 −∞
and
W (i, j; k, l) = −∞ if j < i or l < k W (i, i; k, k) = bp(i, k)
1 if Si , Sk complementary is the base pair contribution, −∞ otherwise, the recursions (R&E recursions) are given for 1 ≤ i < j < k < l ≤ S as where bp(i, j) =
⎧ W (i, j − 1) (12’) ⎪ ⎪ ⎪ ⎨bp(i, j) + W (i + 1, j − 1) (1’21’) W (i, j) = max ⎪maxj W (i, j − 1) + W (j , j) (12) ⎪ ⎪ ⎩ maxj ,k ,l W (i, j − 1; k + 1, l − 1) + W (j , k ; l , j) (1212) ⎧ ⎪ W (i + 1, j; k, l) (1’2G2) ⎪ ⎪ ⎪ ⎪ W (i, j − 1; k, l) (12’G1) ⎪ ⎪ ⎪ ⎪ ⎪ W (i, j; k + 1, l) (1G2’1) ⎪ ⎪ ⎪ ⎪ ⎪ W (i, j; k, l − 1) (1G12’) ⎪ ⎪ ⎪ ⎪max W (i, j ) + W (j + 1, j; k, l) ⎪ (12G2) ⎪ j ⎪ ⎪ ⎨max W (i, j − 1, j; k, l) + W (j , j) (12G1) j W (i, j; k, l) = max ⎪ W (i, j; l + 1, l) + W (k, l ) (1G21) max l ⎪ ⎪ ⎪ ⎪ ⎪ W (i, j; k, l − 1) + W (l , l) (1G12) max l ⎪ ⎪ ⎪ ⎪ ⎪ maxj ,k W (i, j − 1; k + 1, l) + W (j , j; k, k ) (12G21) ⎪ ⎪ ⎪ ⎪ ⎪ maxj ,k W (i, j − 1; k, k − 1) + W (j , j; k , l) (12G12) ⎪ ⎪ ⎪ ⎪ ⎪ maxk ,l W (i, j; k + 1, l − 1) + W (k, k ; l , l) (1G212) ⎪ ⎪ ⎩ maxi ,j W (i, i − 1; j + 1, j) + W (i , j ; k, l) (121G2).
It is easy to check that W (1, S) is the maximal number of base pairs in a R&E structure of S, because the recursions perform the same decompositions as the original R&E recursions. Note that W (i, j; k, l) is the maximal number of base pairs in structures with at least one base pair that spans the gap. We label each recursion case in a way that illustrates the type of the decomposition of this case. The idea of these labels is taken from M¨ ohl et al. [15], where we developed a type system for decompositions, which there are called splits. For this reason, we call these labels split types, however, we won’t need any details of the typing system. The decomposition by R&E is illustrated in Figure 2. A fragment is deﬁned as a set of positions of the ﬁxed sequence S. The fragments corresponding to matrix entries in the R&E recursion can be described conveniently by their boundaries. We distinguish ungapped fragments F = {i, . . . , j}, written (i, j), and 1gap fragments F = {i, . . . , j} ∪ {k, . . . , l}, written (i, j; k, l) where i, j, k, l, are called boundaries of respective F or F . A split of a fragment F is a tuple (F1 , F2 ) such that F = F1 ∪ F2 and F1 ∩ F2 = ∅.
46
M. M¨ ohl et al. = 1'21'
12'
12
1212
= 1'2G2
12'G1
1G2'1
1G12'
12G2
12G1
1G21
1G12
12G21
12G12
1G212
121G2
Fig. 2. Decomposition for R&E base pair maximization annotated with labels, i.e. split types, of the corresponding recursion cases
For our sparsiﬁcation approach, we will show that in each recursion case, certain optimally decomposable fragments do not have to be considered for computing an optimal solution, because each decomposition using these fragments can be replaced by a decomposition using a smaller fragment. We deﬁne optimal decomposability with respect to the split type of a R&E recursion case. Definition 2 (Optimally decomposable). A fragment F is optimally decomposable by a split of type T (T OD) iﬀ there is a split (F1 , F2 ) that occurs in recursion case T and W (F1 ) + W (F2 ) ≥ W (F ). A fragment F is optimally decomposable w.r.t a set of split types T (T OD) iﬀ F is T OD for some T ∈ T . Here, we emphasize that testing T OD for a fragment F is simple in a run of the DP algorithm. After evaluating the case T in the computation of W (F ), one compares the maximum of the case to W (F ). For example, a fragment (i, j; k, l) is 12G21OD iﬀ W (i, j; k, l) = maxj ,k W (i, j − 1; k + 1, l) + W (j , j; k, k ). In the following we show that for the maximization in a recursion case T , we do not need to consider T OD fragments as second fragment of the split, where T is from a T speciﬁc set of split types. As an example consider the recursion case 12G21, which splits fragments (i, j; k, l) into F1 = (i, j − 1; k + 1, l) and F2 = (j , j; k, k ). Assume that F2 is 12G21OD. Then we can show that every evaluation of W (F ) where W (F ) = W (F1 ) + W (F2 ) can be replaced by another at least equally good evaluation that splits F into F1 and F2 ⊂ F2 , where F2 is the second fragment in the 12G21split of F2 . However, note that the argument is split type speciﬁc and cannot be applied e.g. when F2 is 12G12OD. For sparsifying R&E, we deﬁne the following sets of split types. T12RE = {12}
RE T1212 = {12G2, 12G1, 1G21}
RE RE RE T12G1 = T1G12 = T1G21 = {12} RE T12G21 = {12G2, 1G12, 12G21}
RE T12G2 = {12G2} RE T12G12 = {12G2, 1G21, 12G12}
RE T1G212 = {12G1, 1G21, 12G21}
RE T121G2 = {12G2, 12G1, 121G2}
Sparsiﬁcation of RNA Structure Prediction Including Pseudoknots
47
These sets are deﬁned such that in a recursion case T , whenever the second fragment of a split (F1 , F2 ) of F can be optimally decomposed by a split of a type in TTRE , a diﬀerent split (F1 , F2 ) of type T can be applied to F , where F2 ⊂ F2 . As we show later, this split will be just as good as (F1 , F2 ) for computing W (F ). Then, one systematically obtains sparsiﬁed recursion equations W (i, j) and W (i, j; k, l) from the equations for W (i, j) and W (i, j; k, l) by replacing symbol W by W and modifying them in the following way. For each case T in the recursion of W (i, j) and W (i, j; k, l) that maximizes over W (F1 ) + W (F2 ) for respective splits of the fragment F = (i, j) or F = (i, j; k, l), maximize only over fragments F2 that are not TTRE OD. In an algorithm that evaluates the sparsiﬁed recursion, such nonTTRE OD fragments correspond to entries of candidate lists. For example, case 12G21 of W is modiﬁed in the equation for W (i, j; k, l) to max
RE j ,k , (j ,j;k,k ) not T12G21 OD
W (i, j − 1; k + 1, l) + W (j , j; k, k )
(12G21 of W’).
Theorem 1. Let W be the matrix of the R&E recursion and W its sparsiﬁed variant, then W (1, S) = W (1, S). Proof. We show for all 1 ≤ i, j, k, l ≤ S, W (i, j) = W (i, j) and W (i, j; k, l) = W (i, j; k, l). First note that it holds that W (i, j) ≥ W (i, j) and W (i, j; k, l) ≥ W (i, j; k, l). The claim is shown by induction on the fragment size and a case distinction over recursion cases. For the case of split type 12, we show that W (i, j − 1) + W (j , j) = max j
max
j , (j ,j) not T12RE OD
W (i, j − 1) + W (j , j).
Let (j , j) be 12OD for some j : i ≤ j ≤ j. By IH, it suﬃces to ﬁnd a (smaller) fragment (j , j), where j > j and W (i, j − 1) + W (j , j) ≥ W (i, j − 1) + W (j , j). Either (j , j) is not 12OD or there is a j , such that W (j , j) = W (j , j −1)+W (j , j) and thus W (i, j −1)+W (j , j) ≥ W (i, j −1)+W (j , j) because W (i, j − 1) + W (j , j) ≥Δineq W (i, j − 1) + W (j , j − 1) + W (j , j) =12OD W (i, j − 1) + W (j , j). The triangle inequality (Δineq) is an immediate consequence of the correctness of the recursion for W . Thus, for the decompositions of all recursion cases there holds such a corresponding inequation. Analogous arguments can be given for all other modiﬁed recursion cases. Exemplarily, we elaborate the argument for the complex case 12G21. Let F1 = (i, j − 1; k + 1, l) and F2 = (j , j; k, k ), such RE that (F1 , F2 ) is a split of type 12G21 of (j, j; k, k). We need to show for all T12G21 OD fragments F2 there are nonempty ungapped or 1gap fragments F1 and F2 , where F1 ∪ F2 = F2 , F1 ∩ F2 = ∅, and W (F1 ∪ F1 ) + W (F2 ) ≥ W (F1 ) + W (F2 ) and the split (F1 ∪ F1 , F2 ) occurs in a recursion case of R&E. Again, either F2 is RE not T12G21 OD or one of the following cases applies. Case 1 (12G2): for some j , W (j , j; k, k ) = W (j , j − 1) + W (j , j; k, k ). Then, the claim holds for F1 = (j , j − 1) and F2 = (j , j; k, k ) by triangle inequality and split (F1 ∪ F1 , F2 ) occurs in recursion case 12G21. Case 2 (2G21): for some k , W (j , j; k, k ) =
48
M. M¨ ohl et al.
W (j , j; k, k ) + W (k + 1, k ). The claim holds for F2 = (j , j; k, k ). Case 3 (12G21): for some j , k , W (j , j; k, k ) = W (j , j −1; k +1, k )+W (j , j; k, k ). Again, this satisﬁes the claim by triangle inequality. Algorithm. The recursion equation W tailors a sparsiﬁed dynamic programming algorithm for the evaluation of W (1, S) with very limited overhead. We maintain separate candidate lists for each sparsiﬁed recursion case. As already mentioned, the T OD properties of each fragment F can be easily checked after evaluation of each case of W (F ). A fragment is added to a candidate list for recursion case T iﬀ it is not TTRE OD. The maximizations are restricted to run only over the candidates in the respective candidate list. Their intended use dictates the exact nature of such candidate lists. For a case T , which splits a fragments T into T1 and T2 , there are candidate lists for all boundaries of a fragment T2 that are not adjacent to boundaries of T1 due to split type T . The list entries are tuples of the adjacent boundaries and the fragment score for T2 . In order to proﬁt from a reduced number of candidates in space, we maintain two threedimensional slices of the matrix for W (i, j; k, l), storing entries only for the current i and i + 1. Scores W (i, j; k, l) for larger i are stored for candidates only. R&E Free Energy Minimization. Sparsiﬁcation is analogously applied to the energy minimizing R&E algorithm. This algorithm distinguishes several additional matrices that contain minimal energies for fragments (i, j) or (i, j; k, l) under the condition that respectively the base pair (i, j) or base pairs (i, l) and (j, k) or one of them exist. Almost all decompositions in the recursion for these matrices are of discussed split types and are sparsiﬁed analogously. The only notable exception is due to internal loops. Internal loops require minimizing over all possible positions of the inner loop base pair, where commonly the loop size is restricted by a constant K such that minimizing takes constant time. However, handling inner loops requires access to entries of noncandidate fragments (i , j ; k , l ) for i ≤ i ≤ i + K + 2. This is handled by maintaining matrix slices for i to i + K + 2 in O(n3 ) space, which preserves total space complexity. Complexity Analysis. The described algorithm proﬁts from sparsiﬁcation in time and space. Compared to O(n6 ) time and O(n4 ) space of the unsparsiﬁed algorithm (for n = S), we obtain complexities in the number of candidates. Let ZT denote the maximal length of a candidate lists for case T and Z denote the total number of entries in all lists. Then, the time complexity is O(n2 (Z12 + Z1212 ) + n4 (Z12G2 + Z12G1 + Z1G21 + Z1G12 + Z12G21 + Z12G12 + Z1G212 + Z121G2 )) and space complexity is O(n3 + Z). In the worst case, Z12 , Z12G2 , Z12G1 , Z1G21 and Z1G12 are O(n), Z12G21 , Z12G12 , Z1G212 , Z121G2 are O(n2 ), and Z1212 is O(n3 ); ﬁnally Z is O(n4 ) in the worst case.
4
Experimental Results
In order to evaluate the eﬀect of sparsiﬁcation on pseudoknotted RNA secondary structure prediction, we implemented original and sparsiﬁed variants of the Reeder and Giegerich (R&G) algorithm.
Sparsiﬁcation of RNA Structure Prediction Including Pseudoknots 500 500
a)
55
b)
44
300 300 original original sparsified sparsified
200 200
Speedup Speedup
400 400
Running Running time time (s) (s)
49
33
22
11
100 100
00
00 00
200 200
400 400
600 600
Sequence length length Sequence
800 800
1000 1000
00
200 200
400 400
600 600
800 800
1000 1000
Sequence Sequencelength length
Fig. 3. Running times of the original and sparsiﬁed variants of the R&G algorithm
Data Set. We obtained all RNA sequences from PseudoBase[20], which are known to have some pseudoknots in their secondary structures. This set contains 294 sequences that their length is distributed between 76nt and 93399nt. We randomly divided all long sequences into subsequences shorter than 1000nt. Therefore the data set that we used in our experiments contains 1563 sequences with length between 76nt and 1000nt. Performance. We applied both variants of the R&G algorithm to our data set. Fig. 3 shows the running time of the algorithms on a server with Intel Core Duo CPU at 2.53GHz and 4GB RAM. The results in Fig. 3 show that sparsiﬁcation signiﬁcantly improves the running time of the R&G algorithm. As the RNA sequences get longer, the relative performance of the sparsiﬁed algorithm (with respect to the nonsparsiﬁed ones) improves. Fig. 3.(b) shows the speedup of the sparsiﬁed algorithm, which ﬁts well to a linear regression (R2 = 0.84). Number of candidates. For a better understanding of the eﬀect of sparsiﬁcation on the R&G algorithm, we measured the number of (i , j ) pairs which are checked in each fragment [i, j] in both original and sparsiﬁed variants of the algorithm. Note that the number of (i , j ) pairs is in order of O((j − i)2 ) in the worst case. Fig. 4 shows the average number of (i , j ) pairs on fragments of equal length which are checked by the two variants of the algorithm. As expected, this amount is signiﬁcantly smaller for the sparsiﬁed algorithm compared to the original one. Moreover, we observe that as the fragments get longer, the diﬀerence between the average number of (i , j ) pairs in the sparsiﬁed and the original algorithm increases. We deﬁne the work load per each fragment [i, j] as the number of candidate (i , j ) pairs. Figure 4(b), shows a signiﬁcant reduction of the work load in the sparsiﬁed algorithms. As it can be seen for subsequences of length 1000nt, the work load by the sparsiﬁed algorithm is reduced by a factor of about 10 compared to the original algorithm. Note that the work load reduction at fragment length 1000nt does not yield the same speedup for sequences of length 1000nt (here this speedup is about 3.5, confer Fig.3(b)), because for a sequence of length n, all fragments of smaller length are processed by the algorithm.
M. M¨ ohl et al. 200000
Average number of candidates
a)
12
b)
10
160000
120000 original 80000
sparsified
40000
Work load reduction
50
8 6 4 2
0
0 0
200
400
600
Fragment length
800
1000
0
200
400
600
800
1000
Fragment length
Fig. 4. Average number of (i , j ) candidates in the original and sparsiﬁed variants of the R&G algorithm
5
Conclusion
The presented work gives two examples for sparsiﬁcation in the context of gap fragments and a complex recursion structure. Since we successfully sparsiﬁed the fastest and the most complex pseudoknot structure prediction algorithm for RNA, it is likely that all other DPbased pseudoknotalgorithm can be sparsiﬁed. Thus, the paper motivates further generalization of sparsiﬁcation for systematic application to complex DPalgorithms as RNA structure prediction algorithms. Even more, by providing detailed examples the paper directly prepares such generalization. Our results from an implementation of the sparsiﬁed Reeder and Giegerich algorithm show a signiﬁcant, presumably even linear, expected work load reduction due to sparsiﬁcation. Acknowledgments. This work is partially supported by DFG grants WI 3628/11 and BA 2168/31 R. Salari was supported by SFUCTEF funded Bioinformatics for Combating Infectious Diseases Project colead by Sahinalp. S.C. Sahinalp was supported by MITACS, NSERC, the CRC program and the Michael Smith Foundation for Health Research.
References 1. Sharp, P.A.: The centrality of RNA. Cell 136(4), 577–580 (2009) 2. Amaral, P.P., Dinger, M.E., Mercer, T.R., Mattick, J.S.: The eukaryotic genome as an RNA machine. Science 319(5871), 1787–1789 (2008) 3. Washietl, S., Pedersen, J.S., Korbel, J.O., Stocsits, C., Gruber, A.R., Hackermuller, J., Hertel, J., Lindemeyer, M., Reiche, K., Tanzer, A., Ucla, C., Wyss, C., Antonarakis, S.E., Denoeud, F., Lagarde, J., Drenkow, J., Kapranov, P., Gingeras, T.R., Guigo, R., Snyder, M., Gerstein, M.B., Reymond, A., Hofacker, I.L., Stadler, P.F.: Structured RNAs in the ENCODE selected regions of the human genome. Genome Res. 17(6), 852–864 (2007) 4. Mattick, J.S., Makunin, I.V.: Noncoding RNA. Hum. Mol. Genet. 15 Spec No. 1, R17–R29 (2006)
Sparsiﬁcation of RNA Structure Prediction Including Pseudoknots
51
5. Staple, D.W., Butcher, S.E.: Pseudoknots: RNA structures with diverse functions. PLoS Biol. 3(6), e213 (2005) 6. Xayaphoummine, A., Bucher, T., Thalmann, F., Isambert, H.: Prediction and statistics of pseudoknots in RNA structures using exactly clustered stochastic simulations. Proc. Natl. Acad. Sci. USA 100(26), 15310–15315 (2003) 7. Lyngso, R.B., Pedersen, C.N.S.: Pseudoknots in RNA secondary structures. In: Proc. of the Fourth Annual International Conferences on Computational Molecular Biology (RECOMB 2000). ACM Press, New York (2000) (BRICS Report Series RS001) 8. Rivas, E., Eddy, S.R.: A dynamic programming algorithm for RNA structure prediction including pseudoknots. Journal of Molecular Biology 285(5), 2053–2068 (1999) 9. Uemura, Y., Hasegawa, A., Kobayashi, S., Yokomori, T.: Tree adjoining grammars for RNA structure prediction. Theoretical Computer Science 210, 277–303 (1999) (Paper as Print Copy) 10. Akutsu, T.: Dynamic programming algorithms for RNA secondary structure prediction with pseudoknots. Discrete Applied Mathematics 104, 45–62 (2000) 11. Deogun, J.S., Donis, R., Komina, O., Ma, F.: RNA secondary structure prediction with simple pseudoknots. In: APBC 2004: Proceedings of the second conference on AsiaPaciﬁc bioinformatics, pp. 239–246. Australian Computer Society, Inc., Darlinghurst (2004) 12. Dirks, R.M., Pierce, N.A.: A partition function algorithm for nucleic acid secondary structure including pseudoknots. J. Comput. Chem. 24(13), 1664–1677 (2003) 13. Reeder, J., Giegerich, R.: Design, implementation and evaluation of a practical pseudoknot folding algorithm based on thermodynamics. BMC Bioinformatics 5, 104 (2004) 14. Condon, A., Davy, B., Rastegari, B., Zhao, S., Tarrant, F.: Classifying RNA pseudoknotted structures. Theoretical Computer Science 320(1), 35–50 (2004) 15. M¨ ohl, M., Will, S., Backofen, R.: Lifting prediction to alignment of RNA pseudoknots. Journal of Computational Biology (2010) (accepted) 16. Wexler, Y., Zilberstein, C.B.Z., ZivUkelson, M.: A study of accessible motifs and rna folding complexity. In: Apostolico, A., Guerra, C., Istrail, S., Pevzner, P.A., Waterman, M.S. (eds.) RECOMB 2006. LNCS (LNBI), vol. 3909, pp. 473–487. Springer, Heidelberg (2006) 17. Backofen, R., Tsur, D., Zakov, S., ZivUkelson, M.: Sparse RNA folding: Time and space eﬃcient algorithms. In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009. LNCS, vol. 5577, pp. 249–262. Springer, Heidelberg (2009) 18. ZivUkelson, M., GatViks, I., Wexler, Y., Shamir, R.: A faster algorithm for RNA cofolding. In: Crandall, K.A., Lagergren, J. (eds.) WABI 2008. LNCS (LNBI), vol. 5251, pp. 174–185. Springer, Heidelberg (2008) 19. Salari, R., M¨ ohl, M., Will, S., Sahinalp, S.C., Backofen, R.: Time and space eﬃcient RNARNA interaction prediction via sparse folding. In: Berger, B. (ed.) RECOMB 2010. LNCS, vol. 6044, pp. 473–490. Springer, Heidelberg (2010) 20. van Batenburg, F.H., Gultyaev, A.P., Pleij, C.W., Ng, J., Oliehoek, J.: Pseudobase: a database with RNA pseudoknots. Nucleic Acids Research 28(1), 201–204 (2000)
Prediction of RNA Secondary Structure Including Kissing Hairpin Motifs Corinna Theis, Stefan Janssen, and Robert Giegerich Faculty of Technology, Bielefeld University 33501 Bielefeld, Germany
[email protected] Abstract. We present three heuristic strategies for folding RNA sequences into secondary structures including kissing hairpin motifs. The new idea is to construct a kissing hairpin motif from an overlay of two simple canonical pseudoknots. The diﬃculty is that the overlay does not satisfy Bellman’s Principle of Optimality, and the kissing hairpin cannot simply be built from optimal pseudoknots. Our strategies have time/space complexities of O(n4 )/O(n2 ), O(n4 )/O(n3 ), and O(n5 )/O(n2 ). All strategies have been implemented in the program pKiss and were evaluated against known structures. Surprisingly, our simplest strategy performs best. As it has the same complexity as the previous algorithm for simple pseudoknots, the overlay idea opens a way to construct a variety of practically useful algorithms for pseudoknots of higher topological complexity within O(n4 ) time and O(n2 ) space.
1 1.1
Introduction Biological Relevance of Pseudoknots in RNA Structure
RNA is a chain molecule, the activated form of genetic information in all living organisms. Folding back onto itself, RNA forms secondary structure via base pairing of complementary nucleotides. Stacks of base pairs form helices, akin to the WatsonCrick helix of DNA, but with base pairs AU, GC, GU, and occasionally some nonstandard pairs. Ultimately, a tertiary (spatial) structure forms which is essential for biological function. Pseudoknots are structural motifs also deﬁned via base pairing patterns, but, as they form late in the folding process, are generally considered as elements of tertiary structure. Kissing hairpins are a common RNA folding motif belonging to the class of pseudoknots. The unpaired bases of a secondary structure build crossing base pairs by looploop interactions (the “kiss”) and form a stable tertiary structure motif. Although these motifs have been known for over ﬁfteen years, our understanding of kissing hairpins is still small. Especially viral genomes have been investigated for kissing hairpins, but also bacterial and eukaryotic ones. Researchers showed that kissing hairpins have important duties in a wide variety of RNA mediated processes. For example, they contribute extensively in stabilizing the structure and also play a role in viral plasmid DNA replication [5] V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 52–64, 2010. c SpringerVerlag Berlin Heidelberg 2010
Prediction of RNA Secondary Structure Including Kissing Hairpin Motifs
53
or RNA synthesis [19]. Li et al. investigated in 2006 the mechanical unfolding of a minimal kissing complex [15]. They discovered that the looploop interaction is exceptionally stable. 1.2
RNA Folding of Nested Structures
In RNA structure prediction, there is a dichotomy between prediction of nested and pseudoknotted structures. The former is essentially a solved problem, whereas the latter is an active area of research. A structure holds a pseudoknot, if residues i − j and k − l form base pairs such that i < k < j < l. This situation is also called a crossing interaction. Without any crossing interaction, a structure is nested. Nested structures can be naturally represented as trees, and they lend themselves to structure prediction in O(n3 ) time and O(n2 ) space. Early algorithms used a simple optimization criterion such as base pair maximization, while today’s algorithms of practical relevance [27,14,17] use free energy minimization under an experimentally established thermodynamic model [18]. An improvement to O(n3 / log n) time for folding of nested structures has recently been contributed by Frid et al. [9], but this approach is not easily adapted to the established energy model. Recent progress in the ﬁeld of nested structure prediction has been made mostly in the area of a more comprehensive analysis of the folding space [26,4], comparative prediction from multiple sequences [8], or trading the thermodynamic model for machine learning techniques [2]. 1.3
Folding Pseudoknots
Structures with pseudoknots are much more diﬃcult to predict. Even under energy models much simpler than what we use in practice, prediction of the optimal pseudoknotted structure has been shown to be NPhard [16,1]. This has generated considerable interest in algorithms that solve the problem in polynomial time for restricted topologies of pseudoknots – see the review by Condon and Jabbari [7]. In an investigation of pseudoknot topologies [23], Rødland argues that the full topological complexity of pseudoknots is probably not needed in practical applications. For reasons of space, in the sequel we focus on those approaches which have resulted in realistic programs. Pseudoknot folding using the established energy model was pioneered by Rivas and Eddy [22]. They presented an O(n6 ) time, O(n4 ) space algorithm for a fairly general class of pseudoknots. The high eﬀort allows to fold only rather short sequences, and hence, the generality of the algorithm cannot really be exploited. A pragmatic approach was chosen by Reeder and Giegerich with the program pknotsRG [20]. They restricted the analysis to the class of canonical simple recursive pseudoknots, achieving O(n4 ) time, O(n2 ) space, and leading to a program widely used 1 today. The program HotKnots [21] uses a heuristics to assemble pseudoknots from lowenergy helices. 1
Counting over 200 downloads and over 4,000 submissions per year according to http://bibiserv.techfak.unibielefeld.de/statistics/
54
C. Theis, S. Janssen, and R. Giegerich
Quite recently, a new algorithm has been published in [6], but at the point of this writing, an implementation was not yet available. Our new approach presented here is an extension of the ideas used with pknotsRG, which we will review in necessary detail in Section 2.1. 1.4
Typology of Structures
Notation. Dynamic programming over sequences leads to a decomposition of the given sequence into subwords, typically in all possible ways. Let S = 0 s1 . . . sn be a sequence over the RNA alphabet {A, C, G, U }. The use of a ﬁctitious 0position at the start of S allows us to describe subwords by their bounding positions. For example, subword (0, n) is S and subword (2, 4) is 2 s3 s4 . A subword (i, j) has length j − i and splits seamlessly into subwords (i, k) and (k, j) for i ≤ k ≤ j. This convention avoids a lot of ﬁddling with ±1. We write s = xyz to indicate that s is split into subwords x, y, z. The notation s = i xk yl zj indicates, more concretely, that s is itself a subword of the overall input sequence S with boundaries i and j, and k, l denote the subword boundaries between x, y, z. If all boundaries are independent, a Dynamic Programming algorithm investigating all possible decompositions of this type has at least O(n4 ) steps, iterating over all 0 ≤ i ≤ k ≤ l ≤ j ≤ n.
Fig. 1. Schematic representation of a nested structure (the Y shape), a simple pseudoknot, and a kissing hairpin motif. The bottom line shows the arrangement of helix parts mapped to the primary sequence, with arbitrary sequence in between.
Nested structures, simple pseudoknots, and kissing hairpins. We use the notation axa to indicate that subword a is a reverse complement (under RNA rules) of a, and hence the two can form a helix. Using these conventions, Figure 1 sketches three types of RNA structures, together with their associated sequence decomposition. The ﬁrst is a nested structure, the socalled Yshape, the second a simple pseudoknot (sometimes called Htype), and the third is a kissing hairpin structure, which is our speciﬁc concern here. We shall reserve the word “pseudoknot” for simple pseudoknots here, to distinguish them from kissing hairpins. When we allude to pesudoknots with a more complex topology than these two classes, we shall explicitly say so.
Prediction of RNA Secondary Structure Including Kissing Hairpin Motifs
55
To evaluate the folding energy of a kissing hairpin motif on subword s, we need to split s = aubva wcxb yc . The subwords named u, v, w, x, y can attain arbitrary (sub)structures, so kissing hairpins (as well as pseudoknots) may be embedded within each other.
2 2.1
Three Strategies for Kissing Hairpin Prediction The Combined Power of Canonization Rules and Nonambiguous Dynamic Programming
Canonization. The algorithm of pknotsRG reduces computational complexity by imposing three canonization rules on the pseudoknots it considers: Rule 1: In a helix s = aua , a and a are perfect helices. Rule 2: In a helix s = aua , a and a extend towards each other maximally according to the rules of base pairing, except the following case: Rule 3: With crossing helices as in aubva wb , Rule 2 might imply a negative length of v. We set v = ε and both helices meet at an arbitrary position. Note that these rules are imposed on pseudoknots only, the search space of nested structures remains untouched. The beneﬁcial eﬀect of these rules is that maximal helices of form i azaj can be precomputed, and a canonical split into a pseudoknot of form s = aubva wb is uniquely characterized by four moving boundaries only, more precisely as s = i auk bval wbj . This is the key to achieve O(n4 ) time, O(n2 ) space eﬃciency. For details, we refer to [20]. There, it is shown that while an optimal, pseudoknotted structure P may not satisfy the canonicity constraints, there is a nearoptimal pseudoknot Pcan which does. However, minimum free energy folding might deliver an unknotted structure U with free energy such that E(P ) ≤ E(U ) ≤ E(Pcan ). U will be returned without a hint to Pcan , and hence to the potential existence of P . At this point, computing with canonical pseudoknots seems but another heuristic approach. Semantic nonambiguity. A Dynamic Programming Algorithm is called semantically ambiguous [10,11], if it examines an object of interest in its search space more than once. This typically leads to exponential explosion of redundant solution candidates. For ﬁnding a single, optimal solution in a Dynamic Programming Algorithm, such redundancy does not matter, but it renders the algorithm useless for producing nearoptimals. The pknotsRG program is implemented in a nonambiguous way. Combining canonicity with a nonambiguous algorithm allows the program to return suboptimals. In particular, we can ask the best canonical pseudoknot from the nearoptimal search space, even when the minimum free energy structure comes out unknotted. The best canonical pseudoknot Pcan may be checked for potential extension to a noncanonical structure P of even lower energy. In this sense, the heuristic constraint of canonization appears tolerable. Our algorithms presented here adhere to the same idea. All considered structures are canonical, and there will be only one situation where a structure is considered twice.
56
2.2
C. Theis, S. Janssen, and R. Giegerich
Decomposition Alternatives of the Kissing Hairpin Motif
An elementary decomposition of a kissing hairpin leads to three helices (a−a , b− b , c − c ) with intervening sequences u, v, w, x, y, folded in arbitrary ways, with the overall arrangement aubva wcxb yc . See Figure 2 for an illustration. Such a decomposition, in full generality, leads to 12 moving boundaries, and makes us resort to canonization. Rule 2 of our canonization constraints eliminates six moving boundaries – the inner endpoints of three helices, which are now ﬁxed by the helix maximality rule. The remaining boundaries are the outer endpoints of the three helices. Iterating over these six boundaries would lead to an O(n6 ) time, O(n2 ) space strategy. Our goal is to do better than this. Our key idea is the view of the kissing hairpin motif as an overlay of two simple pseudoknots (Figure 2). Given that we already know how to compute optimal simple pseudoknots for the overlapping subwords aubva zb and btcxb yc , can we ﬁnd their optimal overlay such that z = wcx and t = va w, thus deﬁning the overall optimal decomposition into aubva wcxb yc ? Can we ﬁnd its optimal energy as the sum from its two constituents?
a u b v a w c x b y c                                         i h k m h l m j Fig. 2. The composition of two pseudoknots leading to a kissing hairpin motif with the overlay of parts of the sequence and the moving boundaries i, h, k, l, m, and j on top. The linear form of the sequence below shows 12 moving boundaries (vertical lines). With the canonization rules, only six boundaries (labeled lines) remain.
Simple as it seems, there is a problem. First, if w = ε, the optimal choice of a (with respect to a and b ) may conﬂict with the optimal choice of c (with respect to b and c ). Moreover, in the overlay, the energy contribution of the middle helix (b − b ) and the structure for v, w, and x embedded within both pseudoknots are accounted for twice, and must be subtracted from the energy sum of both parts. This violates the monotonicity requirement for dynamic programming known as Bellman’s Principle: for the overlay, the energy function is nonmonotonic, and as a consequence, an optimal kissing hairpin motif may arise as an overlay of suboptimal pseudoknots.
Prediction of RNA Secondary Structure Including Kissing Hairpin Motifs
57
We will present three, increasingly complex strategies A, B, and C, such that their search spaces are properly included in the form SearchspaceA ⊆ SearchspaceB ⊆ SearchspaceC ⊂ SearchspaceKH . This relation will allow us to evaluate whether the expense for a more general strategy pays oﬀ in practice, but we will not be able to relate our results to an evaluation of the complete search space SearchspaceKH of all (noncanonical) structures. 2.3
Strategy A – An O(n4 ) Time, O(n2 ) Space Algorithm
Strategy A makes the optimistic assumption that at least one of the pseudoknots is the optimal structure for its underlying subword. This ﬁxed, we choose the rest of the motif in the best possible way. (1) For all subwords p, ﬁnd the optimal pseudoknot such that p = aubva zb . Store results in a table of size O(n2 ). (2) For all subwords s, split in all ways s = pt and look up the optimal decomposition p = aubva zb . (3) For all s of Step 2, use s = auq and ﬁnd the pseudoknot decomposition such that q = brcxb yc and r = va w, to complete the kissing hairpin decomposition s = aubva wcxb yc . This pseudoknot must be chosen such that c lies strictly to the right of a , hence this is not, in general, the optimal pseudoknot over its underlying subword q. Record the decomposition of lowest free energy. (4  6) Apply symmetric steps starting from an optimal choice for the right pseudoknot in the overlay. (7) Choose lower energy value from (3) and (6); store it in a table of size O(n2 ). The symmetry of (13) and (46) leads to the only case of ambiguity in our approach: If the two locally optimal pseudoknots make a perfect overlay as a kissing hairpin, this (optimal) structure will be found twice. Eﬃciency: (1) takes O(n4 ) steps as with pknotsRG. (2) takes O(n3 ) steps, as the decomposition of p is already computed. (3) takes also O(n4 ), because it inherits O(n3 ) from Step 2 for all splits of s, which determine au and hence, the split auq. (Only) one extra factor of n arises from the split rc, which in turn determines the inner endpoints of helix (c − c ) due to the maximality rule, and hence implies the split yc . (46) take O(n4 ) steps for symmetry reasons. (7) takes O(n2 ) steps. Postponing implementation details, we see that this yields an algorithm with O(n4 ) time, O(n2 ) space requirements. Note that Strategy A does some redundant work – the right pseudoknot determined in Step 3 has already been considered as a (generally suboptimal) pseudoknot in Step 1. 2.4
Strategy B – An O(n4 ) Time, O(n3 ) Space Algorithm
Strategy B avoids the redundant work of Strategy A, and also enlarges the search space. We spend extra space in Step 1 to store results about suboptimal pseudoknots.
58
C. Theis, S. Janssen, and R. Giegerich
(1) For p = aubva zb , and for each choice of b therein, we record the optimal choice of a . Conversely, for each choice of a , we store the optimal choice of b. This requires two tables of size O(n3 ). (2) For the kissing hairpin motif, we ﬁrst choose a, b, b , and c , which costs O(n4 ), and use the stored information to optimally determine the other bounds for a and c by lookup with O(1). (3) Unfortunately, the stored information may suggest that with an optimal choice, a and c would overlap (and w have negative length).We correct this by a heuristic decision – selecting an a further to the left and a c further to the right. This decision will also be based on precomputed information in order to retain a runtime of O(n4 ). (4) We minimize over all cases considered. The overall eﬃciency is O(n4 ) time and O(n3 ) space. Note that the search space here is more general than with strategy A, as neither pseudoknot needs to be optimal with respect to its underlying subword. This generalization lies with Step 1. In Strategy A, only the optimal choice of b within p is considered for overlay, while here, all possible choices of b are tried. 2.5
Strategy C – An O(n5 ) Time, O(n2 ) Space Algorithm
Strategy C avoids the extra storage required by Strategy B. The necessary information is recomputed on demand, after choosing a, b, b and c . This increases runtime, but also allows us to avoid the heuristic decision when a and c would overlap. For each choice of a , we compute the best choice of c strictly to its right. This threatens to raise time complexity to O(n6 ), but with a clever arrangement of computations and an extra table of size O(n), we can keep it at O(n5 ). The optimal choice of l with respect to (h, j) as a pseudoknot is a heuristics with respect to (i, j) as a kissing hairpin (see Figure 3). It assumes that va w can fold optimally. For the kiss, however, v and w can only fold individually, as they are separated by a , which is the partner of a. Thus, l need not be optimal for (i, j) as a kissing hairpin.
3 3.1
Algorithms Algorithmic Subtleties
Annotated energies. When computing minimum free energies from pseudoknots, we will need to also record the internal boundaries of the given subword which achieved optimal energy. These will be data of the form (E, h, k). When we minimize over these tuples, we do this with a lexicographic ordering. This is consistent with mimimizing over energies alone. When two structures have the same energy, then the choice is arbitrary and remains unspeciﬁed. Exact subword boundaries in the input decomposition. Substructures have certain minimal sizes. For example, we forbid lonely pairs, i.e. helices of length 1. Therefore, in i ak zaj , we do not iterate k over i ≤ k ≤ j, but only over i+2 ≤ k ≤ j −2.
Prediction of RNA Secondary Structure Including Kissing Hairpin Motifs
59
Fig. 3. The graphic shows the mandatory bases (black dots) of a kissing hairpin and the indices i, h, k, l, m, and j determining the start and end points of the helices (black tics). Gray regions u, v, w, x, and y can fold in an arbitrary way.
This does not aﬀect the asymptotics, but saves substantial time in practice. The minimal subword sizes used are two base pairs for each helix, loop u and y have one unpaired base. Loop w has two single bases (k + 2 ≤ l). The size of loop v and x is ≤ 0, because we want to keep the possibility of coaxially stacking of the helices. With that, we get a minimal sequence length of 16 bases to form a kissing hairpin (see Figure 3). To be concrete in the following recurrences, we use the precise boundaries consistent with our implementation. But for understanding the essentials of the algorithms, the reader may choose to ignore them. 3.2
PseudoknotRecurrence of pknotsRG – csrPK
Due to the canonization of pknotsRG, the calculation of a canonical simple recursive pseudoknot (csrPK) for a given subword needs two boundaries in addition to (i, j): h, the start position of the b − b helix, and k, the end position of the a − a helix. The recurrence of a csrPK for a subword (i, j) is: csrPK (i, j) = min EcsrPK i auh bvak rbj i+3 ≤ h ≤ j−8 h+4 ≤ k ≤ j−4
The energy function EcsrPK makes use of a precomputed table to determine the inner endpoints of the helices in a unique, maximal and nonoverlapping fashion. With these boundaries ﬁxed, the energy value is the sum of stabilizing energies of both helices + energy contributions of the arbitrary folded regions u, v and w + contributions from bases which dangle onto the helices from inside the csrPK + penalties for explicitly unpaired bases in front of u and b . For later use, we adapt EcsrPK to additionaly store h and k, which can be retrieved by the functions boundaryleft and boundaryright . 3.3
Recurrences of Strategy A – csrKHA
For Strategy A we make two strong assumptions. (1) Helices a − a and b − b of an optimal csrPK, starting at i and ending at m, can be adopted for the overall
60
C. Theis, S. Janssen, and R. Giegerich
csrKH and thus determine the boundaries h and k. We can look up these values via the table csrPK. (2) The remaining boundary l, the starting point for the c − c helix, can be determined by using the energy of a second csrPK as an objective function. This second csrPK must start at h, end at j and have its end position of the left helix b : b at m, thus overlaying a part of the ﬁrst csrPK: left (i, j) = min EcsrKH i auh bvak wl cxbm ycj , where i+13 ≤ m ≤ j−3
h = boundaryleft (csrPK (i, m)) , k = boundaryright (csrPK (i, m)) , l = boundaryleft EcsrPK h bva wd cxbm ycj min k+2 ≤ d ≤ m−4
A csrKH may alternatively arise from the opposite direction, i.e. an optimal csrPK on its right half overlaying a suboptimal csrPK at its left: EcsrKH i auh bvak wl cxbm ycj , where right (i, j) = min i+3 ≤ h ≤ j−13
l = boundaryleft (csrPK (h, j)) , m = boundaryright (csrPK (h, j)) , EcsrPK (i auh bvad wcxbm ) min k = boundaryright h+4 ≤ d ≤ l−2
The optimal csrKH with Strategy A is: csrKHA (i, j) = min (left (i, j) , right (i, j)) 3.4
Recurrences of Strategy B – csrKHB
Since Strategy B has to store the optimal choice of a for every given b for csrPKs on the left side and the optimal b for every given a for csrPKs on the right side of the csrKH, we have to replace the function csrPK with lpk and rpk. A csrPK for a subword (i, j) can now be determined by minimizing over lpk (i, h, j) and rpk (i, k, j): EcsrPK i auh bvak rbj lpk (i, h, j) = min h+4 ≤ k ≤ j−4 rpk (i, k, j) = min EcsrPK i auh bvak rbj i+3 ≤ h ≤ k−4
An overlay of csrPKs from lpk and rkp might overlap in region w of the csrKH, when building it. We can overcome this obstacle in a heuristic way by introducing an artiﬁcal border ξ: min EcsrPK i auh bvak rbj lpkheuristic (i, h, j) = h+4 ≤ k ≤ ξ rpkheuristic (i, k, j) = min EcsrPK i auh bvak rbj ξ ≤ h ≤ k−4
Prediction of RNA Secondary Structure Including Kissing Hairpin Motifs
61
Thus we can construct a csrKH with Strategy B by ﬁrst iterating over the outer endpoints of helix b − b , namely m and h. Second, we choose the energetically optimal combination of k and l by overlaying all csrPKs from lpk (i, h, m) and rpk (h, m, j), as well as their heuristic counterparts lpkheuristic (i, h, m) and rpkheuristic (h, m, j) to guarantee at least one feasible overlay: csrKHB (i, j) = min EcsrKH i auh bvak wl cxbm ycj , where i+13 ≤ m ≤ j−3
i+3 ≤ h ≤ m−10
k ∈ boundaryright lpk (i, h, m) , lpkheuristic (i, h, m) l ∈ boundaryleft rpk (h, m, j) , rpkheuristic (h, m, j) 3.5
Recurrences of Strategy C – csrKHC
We start with Strategy C identical to Strategy B, by iterating over m and h. But instead of retrieving k and l from precomputed csrPK tables, we now also iterate k to determine a and look up the optimal choice for l depending on k in a one dimensional table rpk: min EcsrKH i auh bvak wl cxbm ycj csrKHC (i, j) = i+13 ≤ m ≤ j−3
i+3 ≤ h ≤ m−10 h+4 ≤ k ≤ m−6 l = boundaryleft (rpk(k))
When iterating over k, we go from right to left. Thus we have a growing subword (k, m). While shifting k one position to the left, the function rpk(k) also determines the optimal csrPK that begins at h, ends at j, has its b at m and its c somewhere in the subword (k, m). Since we temporarily store the results for rpk(k), it can be calculated in O(1) time. We just compare the existing result for the one letter shorter subword rpk(k + 1) with one new csrPK, whose boundaries are at h, k + 2, m, j: rpk(k) = min EcsrPK h bva wk+2 cxbm ycj , rpk(k + 1) 3.6
Implementation via Algebraic Dynamic Programming
Alike pknotsRG, pKiss is implemented with the algebraic dynamic programming technique [12]. This makes it easy to add and combine diﬀerent types of analysis. Currently, we compute optimal and suboptimal structures. We plan to add shape abstraction and computation of best knotted and unknotted folding.
4
Evaluation of Strategies A, B, and C
A piece of anecdotal evidence. The RNA polymerase gene (gene 1) of the human coronavirus 229E is a good example for the usefulness of improved secondary
62
C. Theis, S. Janssen, and R. Giegerich
structure prediction tools. Analyzing the genome of the human coronavirus, Herold and Siddell [13] guessed, that a “slippery site” together with an Htype pseudoknot acts as a frameshift inducing structure. Extensive mutational analyses showed that a kissing hairpin is required for high frequency frameshifts. Their work implied computerassisted modeling, but prior prediction tools could not detect kissing hairpin motifs. pKiss ﬁnds the proper kissing hairpin. Available test data. Veriﬁed structures holding pseudoknots and kissing hairpins are rare. We collected a dataset of 61 pseudoknotted structures include 6 kissing hairpins, one “double” pseudoknot with topology a b c d c a d b and 5 simple pseudoknots with nested substructures (see Appendix). The sequence length varies from 28 to 115 nt. The sequence types consist of viral ribosomal frame shifting or readthrough, mRNA, tmRNA, viral 3’ UTR, ribozymes, signal recognition particle RNA [25], sequences with high aﬃnity to HIV1RT [24] and viral RNA. These wellstudied structures are subsequently called the true structures. Comparison of the Strategies A, B, and C. On 57 out of 61 sequences, Strategies A, B, and C agree. B ﬁnds a structure of lower energy than A in two cases, and C in the same two cases and two further ones. This is consistent with the hierarchy of search space inclusion, but the small disagreement is surprising. Positive and negative test cases. For a true positive prediction, we require the structure with the right topology in the right sequence position, but allow for a few missing base pairs (the price of canonization) or extra base pairs when they are consistent with the true structure. All 6 true kissing hairpins are precisely predicted by each strategy. Overall, 46 structures (75.4%) are correctly predicted while 15 sequences (24.6%) deviate from the true structure. These negative cases contain the complex pseudoknot which is beyond the class of kissing hairpins, but the helices actually predicted are correct. In seven cases, a kissing hairpin is predicted instead of a simple pseudoknot. One cannot exclude that this kissing hairpin is actually correct, but has not been detected before due to the lack of appropriate tools. Further evaluations. Comparing pKiss to the program by Rivas and Eddy brought little insight, as the program solves a more general problem and, as expected from their asymptotics, is much slower and greedy for space. Comparing pKiss to the most recent version of HotKnots [3] on our data set, we ﬁnd the following: HotKnots currently provides four diﬀerent parameter sets. Choosing the best prediction from those four in each case, it agrees with Strategy A in 3 out of our 6 positive test cases. On the larger data set of simple pseudoknots, there is more agreement between the methods. Execution time for a single parameter choice is generally lower than for pKiss by a factor of 3 – 6. We have also evaluated pKiss on random data and tested the robustness of predictions under varied energy parameters for kissing hairpin initiation. All evaluation data, as well as the ﬁrst author’s M.Sc. thesis, can be obtained from our website at http://bibiserv.techfak.unibielefeld.de/pkiss/.
Prediction of RNA Secondary Structure Including Kissing Hairpin Motifs
5
63
Conclusion
Should the observations from our evaluation on sparse data generalize, interesting algorithmic perspectives open up. Strategy A evaluates a more complex motif than simple pseudoknots – without increasing asymptotic complexity. Unexpectedly, Strategy A performs best among A, B, and C – it is faster, agrees on the true positives, and has fewer false negatives. Closer inspection showed that it is always the left pseudoknot of the overlay which was chosen optimally. One may speculate that this is because the strategy is consistent with the hierarchic folding path during transcription. Boldly dropping the symmetric computation starting from the right pseudoknot reduces work in the innermost loop and may provide a speedup factor close to 2. The more exciting perspective is the extension of the overlay idea to more complex structures. A motif of four hairpins with two kissing interactions, for example, can be overlaid as a b a c b c and b c b d c d . Using ideas of Strategy A, this can, again, be achieved in O(n4 ) time and O(n2 ) space! Additionally, alternative decompostions, say a b a c b c with c d c d (a kissing hairpin overlaid with a simple pseudoknot) may be investigated, without raising the asymptotics. Furthermore, two such double kissing structures can form an overlay, and so on. It appears that one can construct a variety of practically useful, albeit increasingly heuristic, programs for pseudoknotted motifs of increasingly complex topologies within O(n4 ) time and O(n2 ) space. Acknowledgement. RG thanks A. Condon and H. Jabbari for discussion of the pKiss ideas in their early state.
References 1. Akutsu, T.: Dynamic programming algorithms for RNA secondary structure prediction with pseudoknots. Discrete Appl. Math. 104(13), 45–62 (2000) 2. Andronescu, M.S., Condon, A.E., Hoos, H.H., Mathews, D.H., Murphy, K.P.: Eﬃcient parameter estimation for RNA secondary structure prediction. Bioinformatics 23, 19–28 (2007) 3. Andronescu, M.S., Pop, C., Condon, A.E.: Improved free energy parameters for RNA pseudoknotted secondary structure prediction. RNA 16(1), 26–42 (2010) 4. Chan, C.Y., Lawrence, C.E., Ding, Y.: Structure clustering features on the Sfold Web server. Bioinformatics 21(20), 3926–3928 (2005) 5. Chang, K.Y., Tinoco, I.: Characterization of a kissing hairpin complex derived from the human immunodeﬁciency virus genome. Proc. Natl. Acad. Sci. USA 91(18), 8705–8709 (1994) 6. Chen, H.L., Condon, A.E., Jabbari, H.: An O(n5 ) Algorithm for MFE Prediction of Kissing Hairpins and 4Chains in Nucleic Acids. J. Comput. Biol. 16(6), 803–815 (2009) 7. Condon, A.E., Jabbari, H.: Computational prediction of nucleic acid secondary structure: Methods, applications, and challenges. Theoretical Computer Science 410(45), 294–301 (2009) 8. Deblasio, D., Bruand, J., Zhang, S.: PMFastR: A New Approach to Multiple RNA Structure Alignment. In: Salzberg, S.L., Warnow, T. (eds.) WABI 2009. LNCS, vol. 5724, pp. 49–61. Springer, Heidelberg (2009)
64
C. Theis, S. Janssen, and R. Giegerich
9. Frid, Y., Gusﬁeld, D.: A simple, practical and complete O(n3 / log n)time Algorithm for RNA folding using the FourRussians Speedup. Algorithms Mol. Biol. 5(1), 13 (2010) 10. Giegerich, R.: Explaining and Controlling Ambiguity in Dynamic Programming. In: Giancarlo, R., Sankoﬀ, D. (eds.) CPM 2000. LNCS, vol. 1848, pp. 46–59. Springer, Heidelberg (2000) 11. Giegerich, R., Hoener, C., Siederdissen, z.: Semantics and Ambiguity of Stochastic RNA Family Models. IEEE/ACM Transactions on Computational Biology and Bioinformatics 99(PrePrints) (2010) 12. Giegerich, R., Meyer, C., Steﬀen, P.: A discipline of dynamic programming over sequence data. Science of Computer Programming 51(3), 215–263 (2004) 13. Herold, J., Siddell, S.G.: An ‘elaborated’ pseudoknot is required for high frequency frameshifting during translation of HCV 229E polymerase mRNA. Nucl. Acids Res. 21(25), 5838–5842 (1993) 14. Hofacker, I.L., Fontana, W., Stadler, P.F., Bonhoeﬀer, S.L., Tacker, M., Schuster, P.: Fast Folding and Comparison of RNA Secondary Structures. Monatsh. Chem. 125, 167–188 (1994) 15. Li, P.T.X., Bustamante, C., Tinoco, I.: Unusual mechanical stability of a minimal RNA kissing complex. Proc. Natl. Acad. Sci. USA 103(43), 15847–15852 (2006) 16. Lyngsø, R.B., Pedersen, C.N.S.: RNA Pseudoknot Prediction in EnergyBased Models. J. Comput. Biol. 7(34), 409–427 (2000) 17. Mathews, D.H., Disney, M.D., Childs, J.L., Schroeder, S.J., Zuker, M., Turner, D.H.: Incorporating chemical modiﬁcation constraints into a dynamic programming algorithm for prediction of RNA secondary structure. Proc. Natl. Acad. Sci. USA 101(19), 7287–7292 (2004) 18. Mathews, D.H., Turner, D.H.: Prediction of RNA secondary structure by free energy minimization. Curr. Opin. Struct. Biol. 16(3), 270–278 (2006) 19. Melchers, W.J.G., Hoenderop, J.G.J., Slot, H.J.B., Pleij, C.W.A., Pilipenko, E.V., Agol, V.I., Galama, J.M.D.: Kissing of the two predominant hairpin loops in the coxsackie B virus 3’ untranslated region is the essential structural feature of the origin of replication required for negativestrand RNA synthesis. J. Virol. 71(1), 686–696 (1997) 20. Reeder, J., Giegerich, R.: Design, implementation and evaluation of a practical pseudoknot folding algorithm based on thermodynamics. BMC Bioinformatics 5(1), 104 (2004) 21. Ren, J., Rastegari, B., Condon, A.E., Hoos, H.H.: HotKnots: Heuristic prediction of RNA secondary structures including pseudoknots. RNA 11(10), 1494–1504 (2005) 22. Rivas, E., Eddy, S.R.: A dynamic programming algorithm for RNA structure prediction including pseudoknots. J. Mol. Biol. 285(5), 2053–2068 (1999) 23. Rødland, E.A.: Pseudoknots in RNA Secondary Structures: Representation, Enumeration, and Prevalence. J. Comput. Biol. 13(6), 1197–1213 (2006) 24. Tuerk, C., MacDougal, S., Gold, L.: RNA pseudoknots that inhibit HIV type 1 reverse transcriptase. Proc. Natl. Acad. Sci. USA 89(15), 6988–6992 (1992) 25. van Batenburg, F.H.D., Gultyaev, A.P., Pleij, C.W.A.: PseudoBase: structural information on RNA pseudoknots. Nucl. Acids Res. 29(1), 194–195 (2001) 26. Wuchty, S., Fontana, W., Hofacker, I.L., Schuster, P.: Complete suboptimal folding of RNA and the stability of secondary structures. Biopolymers 49(2), 145–165 (1999) 27. Zuker, M., Stiegler, P.: Optimal computer folding of large RNA sequences using thermodynamics and auxiliary information. Nucl. Acids Res. 9(1), 133–148 (1981)
Reducing the Worst Case Running Times of a Family of RNA and CFG Problems, Using Valiant’s Approach Shay Zakov, Dekel Tsur, and Michal ZivUkelson Department of Computer Science, BenGurion University of the Negev, Israel {zakovs,dekelts,michaluz}@cs.bgu.ac.il
Abstract. We study Valiant’s classical algorithm for Context Free Grammar recognition in subcubic time, and extract features that are common to problems on which Valiant’s approach can be applied. Based on this, we describe several problem templates, and formulate generic algorithms that use Valiant’s technique and can be applied to all problems which abide by these templates. These algorithms obtain new worst case running time bounds for a large family of important problems within the world of RNA Secondary Structures and Context Free Grammars.
1
Introduction
Computational prediction of RNA structures serves as the basis of many approaches related to RNA functional analysis [1]. Most computational tools for RNA structural prediction focus on RNA secondary structures — a reduced structural representation of RNA molecules which describes a set of paired nucleotides, through hydrogen bonds, in an RNA sequence. Over the last decades, several variants of RNA secondary structure prediction problems were deﬁned, to which polynomial algorithms have been designed [2,3,4,5,6,7,8,9]. The computational feasibility of these variants (as opposed to threedimensional structure prediction), combined with the fact that secondary structures still reveal important information about the functional behavior of RNA molecules, account for the high popularity of stateoftheart tools for RNA secondary structure prediction. Sakakibara et al. [10] noticed that the basic variants of RNA Secondary Structure Prediction problems [2,3] are in fact special cases of the Weighted Context Free Grammar (WCFG) Parsing problem [11]. This approach was then followed by Dowell and Eddy [12], Do et al. [13], and others, who studied diﬀerent aspects of the relationship between these two domains. The WCFG Parsing problem is a generalization of the simpler Context Free Grammar (CFG) Parsing problem, where both problems can be solved by the CockeKasamiYounger (CKY) algorithm [14,15,16], whose running time is cubic in the number of words in the input sentence (or the number of nucleotides in the input RNA sequence). The CFG literature describes two improvements which allow to obtain a subcubic time for the CKY algorithm. The ﬁrst among these improvements was a V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 65–77, 2010. c SpringerVerlag Berlin Heidelberg 2010
66
S. Zakov, D. Tsur, and M. ZivUkelson
Table 1. Time complexities of several VMT problems Standard DP running time CFG Recognition / Parsing Θ n3 [15, 16, 14] Results 3 previously WCFG Parsing Θ n [11] published RNA BasePairing Maximization Θ n3 [2] 3 RNA Energy Minimization Θ n [3] WCFG InsideOutside Θ n3 [33] 3 RNA Partition Function Θ n [5] RNA Simultaneous Θ n3m [9] In this Alignment and Folding paper RNARNA Interaction Θ n6 [4] RNARNA Interaction Θ n6 [7] Partition Function RNA Sequence to StructuredΘ n4 [8] Sequence Alignment Problem
VMT algorithm running time Θ (BS(n)) [17] Θ (M P(n)) [19, 20] Θ (M P(n)) [19] Θ (M P(n)) [19] Θ (BS(n)) Θ (BS(n)) Θ (M P(nm )) Θ M P n2 2 Θ BS n Θ (nM P(n))
technique suggested by Valiant [17], who showed that the CFG parsing problem can be solved in a running time which matches the running time of a Boolean Matrix Multiplication of two n × n matrices. The currently fastest algorithm for this variant of matrix multiplication runs in O(n2.376 ) time [18]. In [19], Akutsu argued that the algorithm of Valiant can be modiﬁed to deal also with WCFG Parsing, and consequentially with RNA Folding (this extension is described in more details in [20]). The running time of the adapted algorithm is diﬀerent from that of Valiant’s algorithm, and matches the running time of a MaxPlus Matrix Multiplication of two n × n matrices. The currently fastest algorithm 3 3 log n for this variant of matrix multiplication runs in O( n log ) time [21]. The log2 n second improvement was introduced by Graham et al. [22], who applied the Four technique [23] to the CFG parsing problem, and obtained an Russians 3
n O log running time algorithm. To the best of our knowledge, no extension n of this approach to the WCFG Parsing problem has been described. Recently, Frid and Gusﬁeld [24] showed how to apply the Four Russians technique to the RNA Energy Minimization problem (under the assumption 3 of a discrete n scoring scheme), obtaining the same running time of O log n . Several other techniques have been previously developed to accelerate the practical running times of diﬀerent variants of CFG and RNA related algorithms. Nevertheless, these techniques either retain the same worst case running times of the standard algorithms [22,25,26,27,28,29,30], or apply heuristics which compromise the optimality of the obtained solutions [31,32]. In this extended abstract, we present three template formulations, entitled Vector Multiplication Templates (VMTs), which abstract the essential properties that characterize problems for which a Valiantlike algorithmic approach can be applied. Then, we exemplify how Valiant’s approach can be simpliﬁed and applied in order to describe generic algorithms for all problems sustaining these templates. Table 1 lists some examples of VMT problems. The table compares
Reducing the Worst Case Running Times of a Family of RNA
67
between the running times of standard dynamic programming (DP) algorithms, and the VMT algorithms presented here. In the single string problems, n denotes the length of the input string. In the doublestring problems [4,7,8], we assume that both input strings are of length n. For the RNA Simultaneous Alignment and Folding problem, m denotes the number of input strings and n is the length of each string. BS(n) denotes the time complexity of a Scalar or a Boolean matrix multiplication of two n×n matrices, for which the current best result is O(n2.376 ), due to [18]. M P (n) denotes the time complexity of a MinPlus or a MaxPlus matrix multiplication of two n × n matrices, for which the current best result is 3 3 log n O( n log ), due to [21]. For most of the problems, the algorithms presented log2 n here obtain lower running time bounds than the best previous algorithms.
2 2.1
Preliminaries Interval and Matrix Notations
For two integers a, b, denote by [a, b] the interval which contains all integers q such that a ≤ q ≤ b. For two intervals I = [i1 , i2 ] and J = [j1 , j2 ], deﬁne the following intervals: [I, J] = {q : i1 ≤ q ≤ j2 }, (I, J) = {q : i2 < q < j1 }, [I, J) = {q : i1 ≤ q < j1 }, and (I, J] = {q : i2 < q ≤ j2 }. When an integer r replaces one of the intervals I or J in the notation above, we regard it as if it was the interval [r, r]. For example, [0, I) = {q : 0 ≤ q < i1 }, and (i, j) = {q : i < q < j}. For two intervals I = [i1 , i2 ] and J = [j1 , j2 ] such that j1 = i2 + 1, deﬁne IJ to be the concatenation of I and J, i.e. the interval [i1 , j2 ]. Let X be an n1 × n2 matrix, with rows indexed with 0, 1, . . . , n1 − 1 and columns indexed with 0, 1, . . . , n2 − 1. Denote by Xi,j the element in the ith row and jth column of X. For two intervals I ⊆ [0, n1 ) and J ⊆ [0, n2 ), let XI,J denote the submatrix of X obtained by projecting it onto the subset of rows I and subset of columns J. Denote by Xi,J the submatrix X[i,i],J , and by XI,j the submatrix XI,[j,j] . Let D be a domain of elements, and ⊗ and ⊕ two binary operations on D. We assume that (1) ⊕ is associative (i.e. for three elements a, b, c in the domain, (a ⊕ b) ⊕ c = a ⊕ (b ⊕ c)), and (2) there exists a zero element φ in D, such that for every element a ∈ D, a ⊕ φ = φ ⊕ a = a and a ⊗ φ = φ ⊗ a = φ. Let X and Y be a pair of matrices of sizes n1 × n2 and n2 × n3 , respectively, which elements are taken from D. Deﬁne the result of the matrix multiplication X ⊗ Y to be the matrix Z of size n1 × n3 , where each entry Zi,j is given by Zi,j = ⊕q∈[0,n2 ) (Xi,q ⊗ Yq,j ) = (Xi,0 ⊗Y0,j )⊕(Xi,1 ⊗Y1,j )⊕. . .⊕(Xi,n2 −1 ⊗Yn2 −1,j ). In the special case where n2 = 0, deﬁne the result of the multiplication Z to be an n1 ×n3 matrix in which all elements are φ. In the special case where n1 = n3 = 1, the matrix multiplication X ⊗ Y is also called a vector multiplication (where the resulting matrix Z contains a single element). Let X and Y be two matrices. When X and Y are of the same size, deﬁne the result of the matrix addition X ⊕ Y to be the matrix Z of the same size
68
S. Zakov, D. Tsur, and M. ZivUkelson
as X and Y , where Zi,j =Xi,j ⊕ Yi,j . When X and Y have the same number X of columns, denote by the matrix obtained by concatenating Y below X. Y When X and Y have the same number of rows, denote by [XY ] the matrix obtained by concatenating Y to the right of X. The following properties are well known, and can be easily deduced from the deﬁnition of matrix multiplication and the associativity of the ⊕ operation. In each property we assume that the participating matrices are of the appropriate sizes. X ⊗ Y 1 Y 2 = (X ⊗ Y 1 )(X ⊗ Y 2 ) 1 1 2 Y 1 1 2 2 (X ⊗ Y ) ⊕ (X ⊗ Y ) = X X ⊗ Y2
(2.1) (2.2)
Under the assumption that the operations ⊗ and ⊕ between two domain elements consume Θ(1) computation time, a straightforward implementation of a matrix multiplication between two n × n matrices can be computed in Θ(n3 ) time. Nevertheless, for some variants of multiplications, subcubic algorithms for square matrix multiplications are known. Here, we consider three such variants, which will be referred to as standard multiplications in the rest of this paper: – Scalar multiplication: The matrices hold numerical elements, ⊗ stands for number multiplication (·) and ⊕ stands for number addition (+). The zero element is 0. The running time of the currently fastest algorithm for this variant is O(n2.376 ) [18]. – Minplus/Maxplus multiplication: The matrices hold numerical elements, ⊗ stands for number addition and ⊕ stands for min or max (where a min b is the minimum between a and b, and similarly for max). The zero element is ∞ for the minplus variant and −∞ for the maxplus variant. The running time 3 3 log n ) [21]. of the currently fastest algorithm for these variants is O( n log log2 n – Boolean multiplication: The matrices hold boolean elements, ⊗ stands for boolean AND (∧) and ⊕ stands for boolean OR (∨). The zero element is the false value. Boolean matrix multiplication is computable with the same complexity as the scalar multiplication, having the running time of O(n2.376 ) [18]. 2.2
String Notations
Let s = s0 s1 . . . sn−1 be a string of length n over some alphabet. Let si,j denote the substring of s between indices i (inclusive) and j (exclusive). In a case where i = j, si,j corresponds to an empty string, and for i > j, si,j does not correspond to a valid string. An inside value βi,j is a value which reﬂects some property dependent only on the substring si,j . In the context of RNA, an input string usually represents a sequence of nucleotides, where in the context of CFGs, it usually represents a sequence of words. Examples of inside values in the world of RNA problems are the maximum number of basepairs in a secondary structure of
Reducing the Worst Case Running Times of a Family of RNA
69
si,j [2], the minimum free energy of a secondary structure of si,j [3], the sum of weights of all secondary structures of si,j [5], etc. In CFGs, inside values can be boolean values which state whether the subsentence can be derived from some nonterminal symbol of the grammar, or numeric values corresponding to the probability of (all or best) such derivations [14,15,16,11]. In the rest of this paper, the notation β will be used to denote the set of all values of the form βi,j with respect to substrings si,j of some given string s. It is convenient to visualize β as an upper triangle of an (n + 1) × (n + 1) matrix, where n denotes the length of s and the (i, j)th entry in the matrix contains the value βi,j . We will also use notations such as βI,J , βi,J , and βI,j to denote the corresponding submatrices of β, as deﬁned in Section 2.1.
3
The Inside Vector Multiplication Template
In this section we describe a class of problems which are called Inside VMT problems. We start by giving a simple motivating example in Section 3.1. Then, we formally deﬁne the class of Inside VMT problems in Section 3.2, and in Section 3.3 we formulate an eﬃcient generic algorithm for all Inside VMT problems. 3.1
Example: RNA BasePairing Maximization
The RNA BasePairing Maximization problem [2] is a simple problem which exhibits the main characteristics of Inside VMT problems. In this problem, an input string s = s0 s1 · · · sn−1 represents a string of bases over the alphabet A, C, G, U . The goal is to compute the maximum number of nested complementary basepairs in a secondary structure of s (we refer the reader to [2] for the formal problem deﬁnition). We call such a number the solution for the instance s, where βi,j denotes the solution for the substring si,j . The value βi,j is 0 for j − i ≤ 1, and otherwise can be computed according to the following recurrence:
(I) βi+1,j−1 + δi,j−1 , βi,j = max (II) max β + β , i,q q,j q∈(i,j)
where δi,j−1 = 1 if si and sj−1 are complementary bases, and otherwise δi,j−1 = −∞. This recursive computation can be eﬃciently implemented using dynamic programming (DP). For an input string s of length n, the DP algorithm maintains the upper triangle of an (n + 1) × (n + 1) matrix B, where each entry Bi,j in B corresponds to a solution βi,j . The entries in B are ﬁlled, starting from short basecase entries of the form Bi,i and Bi,i+1 , and continuing by computing entries corresponding to substrings with increasing lengths. In order to compute a value βi,j , the algorithm needs to examine only values of the form βi ,j such that si ,j is a strict substring of si,j . Due to the bottomup computation, these values are already computed and stored in B, and can be obtained in Θ(1) time. Upon computing some value βi,j , the algorithm needs to compute term (II) of the recurrence. This computation is of the form of the vector multiplication
70
S. Zakov, D. Tsur, and M. ZivUkelson
operation ⊕q∈(i,j) βi,q ⊗ βj,q , where the multiplication variant is the Max Plus multiplication. Since all relevant values in B are computed, this computation can be implemented by computing Bi,(i,j) ⊗B(i,j),j (see Fig. 1a), which takes Θ(j −i) running time. After computing term (II), the algorithm needs to perform additional operations for computing βi,j which take Θ(1) running time (computing term (I), and taking the maximum between the results of the two terms). Thus, on average, the running time for computing each value βi,j is Θ(n), and the overall running time for computing all Θ(n2 ) values βi,j is Θ(n3 ). Upon termination, the computed matrix B equals to the matrix β, and the required result β0,n is found in the entry B0,n . Note that reducing vector multiplication computation time would reduce the overall running time of the described algorithm. This observation holds in general for all VMT problems, as we show below. The algorithms we develop follow the approach of Valiant, which organizes the required vector multiplication operations in a manner that allows to compute them via the usage of fast matrix multiplication algorithms, and hence reduces the amortized running time of each vector multiplication to sublinear time. 3.2
Inside VMT Definition
In this section we characterize the class of Inside VMT problems. The RNA BaseParing Maximization problem, which was presented in the previous section, exhibits a simple special case of an Inside VMT problem, in which the goal is to compute a single inside value for a given input string. Note that this requires the computation of such inside values for all substrings of the input. In other Inside VMT problems the case is similar, hence we will assume that the goal of Inside VMT problems is to compute inside values for all substrings of an input string. In the more general case, an Inside VMT problem deﬁnes several inside values for each substring, where the computation of these values is formulated in a mutually recursive manner. Examples of such a problems are the RNA Energy Minimization problem [3] and the CFG Parsing problem [14,15,16]. A common property of all Inside VMT problems is that the computation of at least one type of the inside values requires the result of a vector multiplication operation, which is of similar structure to the multiplication presented for the RNA BaseParing Maximization problem. Definition 1. A problem is considered an Inside VMT problem if it fulfills the following requirements: 1. The instances of the problem are strings, and the goal of the problem is to compute for every substring si,j of an input string s, a series of inside values 1 2 K βi,j , βi,j , . . . , βi,j . 2. Let n denote the length of s, and let 0 ≤ i ≤ j ≤ n and 1 ≤ k ≤ K. Let μki,j be a result of a standard vector multiplication of the form μki,j = k k , where 1 ≤ k , k ≤ K. Assume that the following val⊗ βq,j ⊕q∈(i,j) βi,q
ues can be obtained in Θ(1) running time: μki,j , all values βik ,j for 1 ≤ k ≤
Reducing the Worst Case Running Times of a Family of RNA
71
k K and si ,j a strict substring of si,j , and all values βi,j for 1 ≤ k < k. k running time, Then, the computation of βi,j can be performed in o M(n) 2 n
where M (n) is the running time of the matrix multiplication algorithm which corresponds to the multiplication variant for computing μki,j . 3.3
Inside VMT Algorithm
We next describe a generic algorithm, based on Valiant’s algorithm [17], for solving problems sustaining the Inside VMT requirements. For simplicity, we assume that a single value βi,j needs to be computed for each substring si,j of the input string s. The new algorithm also maintains the matrix B as deﬁned in Section 3.1. At each stage of the run, each entry Bi,j either contains the value βi,j , or some intermediate result in the computation of μi,j . Note that only the upper triangle of B corresponds to valid substrings of the input. Nevertheless, our formulation handles all entries uniformly, implicitly ignoring values in entries Bi,j when j < i. At each stage, the algorithm computes the values in a submatrix BI,J for some pair of intervals I, J ⊆ [0, n]. The following precondition is maintained at the beginning of the stage (Fig. 1b): 1. Each entry Bi,j ∈ B[I,n],[0,J] , such that Bi,j ∈ / BI,J , contains the value βi,j . 2. Each entry Bi,j ∈ BI,J contains the value ⊕q∈(I,J) βi,q ⊗ βj,q . In other words, BI,J = βI,(I,J) ⊗ β(I,J),J . Upon initialization, I = J = [0, n], and all values in B are set to φ. Observe that at this stage the precondition is met. Now, consider a call to the algorithm with some pair of intervals I, J. If I = [i, i] and J = [j, j], then from the precondition we have that all values βi ,j which are required for the computation of βi,j are computed and stored in B, and Bi,j = μi,j (Fig. 1a). Thus, βi,j can be evaluated in o M(n) running time, and be stored in Bi,j . n2 Else, either I > 1 or J > 1 (or both), and the algorithm partitions BI,J into two submatrices of approximately equal sizes, and computes each part recursively. This partition is described next. In the case where I ≤ J, BI,J is partitioned “vertically” (Fig. 1,(b),(c),(d)): Let J1 and J2 be two column intervals such that J = J1 J2 and J1  = J/2. Since J and J1 start at the same position, (I, J) = (I, J1 ). Thus, from the precondition and Equation 2.1, BI,J1 = βI,(I,J1 ) ⊗ β(I,J1 ),J1 . Therefore, the precondition with respect to the submatrix BI,J1 is met, and the algorithm computes this submatrix recursively. After BI,J1 is computed, the ﬁrst part of the precondition with respect to BI,J2 is met, i.e. all necessary solutions, except for those in BI,J2 are computed and stored in B. In addition, at this stage BI,J2 = βI,(I,J) ⊗ β(I,J),J2 . Let L be the interval such that (I, J2 ) = (I, J)L. Observe that L = J1 if the last index in I is smaller than the ﬁrst index in J, or otherwise L is some (possibly empty) suﬃx of J1 . To meet the full precondition requirements with respect to I and J2 , BI,J2 is updated using Equation 2.2
72
S. Zakov, D. Tsur, and M. ZivUkelson
(a)
(b)
(e)
(c)
(f)
(d)
(g)
Fig. 1. An exempliﬁcation of the matrix B maintained by the Inside VMT algorithm
to be BI,J2 ⊕(BI,L ⊗ BL,J2 ) = βI,(I,J) ⊗ β(I,J),J2 ⊕ βI,L ⊗ βL,J2 = βI,(I,J2 ) ⊗ β(I,J2 ),J2 . Now, the precondition with respect to BI,J2 is established, and the algorithm computes BI,J2 recursively. In the case where I > J, BI,J is partitioned “horizontally”, in a symmetric manner to the vertical partition. Fig. 1,(e),(f),(g) exempliﬁes this partition, where further technical details are excluded. The extension of the algorithm to the general case, where the goal is to compute a series of inside valuesets β 1 , β 2 , . . . , β K , is implemented by maintaining K matrices instead of a single matrix, and applying the recurrence over all K matrices simultaneously. Time complexity analysis of this algorithm is excluded from this abstract. It is similar to that of Valiant’s algorithm (presented in [17]), showing that the time complexity of the Inside VMT algorithm over strings of length n matches the time complexity of multiplying two n × n matrices, with the corresponding variant of matrix multiplication. Theorem 1. For every Inside VMT problem there is an algorithm whose running time is Θ (M (n)), where n is the length of the input string and M (n) is the running time of the corresponding matrix multiplication algorithm over two n × n matrices.
4
Additional Vector Multiplication Templates
This section presents two additional vector multiplication templates: Outside VMT and Multiple String VMT. These templates are sustained by several important problems which do not follow the Inside VMT requirements, yet share similar properties. Algorithms for these VMT problems may also be accelerated by incorporating fast matrix multiplication subroutines.
Reducing the Worst Case Running Times of a Family of RNA
4.1
73
Outside VMT
Let s be a string over some alphabet. An outside value αi,j is a value that reﬂects some property of the string obtained by removing the substring si,j from s. Similarly to Inside VMT problems, the goal of Outside VMT problems is to compute a set of outside values with respect to a given input string. Examples of problems which require outside value computations and adhere to the VMT requirements are the RNA Partition Function problem [5] and the WCFG InsideOutside problem [33]. In both problems, the computation of outside values requires a set of precomputed inside values, where these inside values can be computed with the Inside VMT algorithm. In such cases, we call the problems InsideOutside VMT problems. Definition 2. A problem is considered an Outside VMT problem if it fulfills the following requirements: 1. The instances of the problem are strings, and the goal of the problem is to compute for every substring si,j of an input string s, a series of outside values α1i,j , α2i,j , . . . , αK i,j . 2. Let n denote the length of s, and let 0 ≤ i ≤ j ≤ n and 1 ≤ k ≤ K. Let β 1 , β 2 , . . . , β K be a set of precomputed inside value matrices for s, and k let μki,j be an expression of the form μki,j = ⊕q∈[0,i) βq,i ⊗ αkq,j or of the k form μki,j = ⊕q∈(j,n] αki,q ⊗ βj,q , where 1 ≤ k ≤ K. Assume that the
following values can be obtained in Θ(1) running time: μki,j , all values αki ,j for 1 ≤ k ≤ K and si,j a strict substring of si ,j , and all values αki,j for 1 ≤ k < k. Then, the computation of αki,j can be performed in o M(n) 2 n running time, where M (n) is the running time of the matrix multiplication algorithm which corresponds to the multiplication variant for computing μki,j . A generic algorithm for Outside VMT problems, which is similar to the Inside VMT algorithm presented in the previous section, can be described. This algorithm obtains the same running time as that of the Inside VMT algorithm. Due to its technicality and the space requirements, the description of the Outside VMT algorithm is excluded from this abstract, and will be presented in an extended version of this paper. Theorem 2. For every Outside VMT problem there is an algorithm whose running time is Θ (M (n)), where n is the length of the input string and M (n) is the running time of the corresponding matrix multiplication algorithm over two n × n matrices. 4.2
Multiple String VMT
In this section we describe another extension to the VMT framework, intended for problems whose instances are sets of strings, rather than a single string.
74
S. Zakov, D. Tsur, and M. ZivUkelson
Examples of such problems are the RNA Simultaneous Alignment and Folding problem [9,31], and the RNARNA Interaction problem [4]. Additional problems which exhibit slight divergences of the presented template, such as the RNARNA Interaction Partition Function problem [7] and the RNA Sequence to StructuresSequence Alignment problem [8], can be solved in similar manners. To deﬁne the Multiple String VMT variant in a general manner, we ﬁrst give some related notation. An instance of a Multiple String VMT problem is a set of strings S = s0 , s1 , . . . , sm−1 . For simplicity, we will assume that all strings sp ∈ S are of the same length n, though this assumption can be easily relaxed. A position in S is a set of indices X = (i0 , i1 , . . . , im−1 ), where each index ip ∈ X is in the range 0 ≤ ip ≤ n. Let X = (i0 , i1 , . . . , im−1 ) and Y = (j0 , j1 , . . . , jm−1 ) be two positions in S. Say that X ≤ Y if ip ≤ jp for every 0 ≤ p < m, and say that X < Y if X ≤ Y and X = Y . When X ≤ Y , denote by SX,Y the subinstance SX,Y = s0i0 ,j0 , s1i1 ,j1 , . . . , sm−1 of S. Denote by (X, Y ) the im−1 ,jm−1 set of all positions Q such that X < Q < Y . An inside value βX,Y is a value which reﬂects some property that depends only on the subinstance SX,Y , where an outside value αX,Y reﬂects some property that depends on the instance S, after excluding from each string in S the corresponding substring in SX,Y . We next deﬁne Multiple String Inside VMT problems. The “outside” variant can be formulated in a similar manner. Definition 3. A problem is considered a Multiple String Inside VMT problem if it fulfills the following requirements: 1. The instances of the problem are sets of strings, and the goal of the problem is to compute for every subinstance SX,Y of an input instance S, a series 1 2 K of inside values βX,Y , βX,Y , . . . , βX,Y . 2. Let X and Y be two positions in S such that X ≤ Y, and let 1 ≤k ≤ K. k k ⊗ βQ,Y , where Let μkX,Y be a value of the form μkX,Y = ⊕Q∈(X,Y ) βX,Q 1 ≤ k , k ≤ K. Assume that the following values can be obtained in Θ(1) k running time: μkX,Y , all values βX ,Y for 1 ≤ k ≤ K and SX ,Y a strict sub k instance of SX,Y , and all values βX,Y for 1 ≤ k < k. Then, the computation m ) k of βX,Y can be performed in o M((n+1) running time, where M (n) is 2m (n+1) the running time of the matrix multiplication algorithm which corresponds to the multiplication variant for computing μki,j . In order to solve Multiple String Inside or Outside VMT problems, we reduce them to standard single string Inside or Outside VMT problems. The reduction maps a Multiple String VMT instance S composed of m strings of length n each, to a single string s of length (n + 1)m . Each subinstance SX,Y of S corresponds
k k ⊗ βQ,Y can to a substring si,j of s, and expressions of the form ⊕Q∈(X,Y ) βX,Q k k be computed by computing expressions of the form ⊕q∈(i,j) βi,q ⊗ βq,j (and similarly for expressions required for the computation of outside values). Due to the space requirements, the description of this reduction is excluded from this abstract, and will be presented in an extended version of this paper.
Reducing the Worst Case Running Times of a Family of RNA
75
Theorem 3. Let P be a Multiple String (Inside or Outside) VMT problem, and let S be an input instance of P composed of m strings of length n each. Then, a solution for S with respect to P can be computed in the same running time as that of computing a solution for a string of length (n + 1)m with respect to a regular (single string) VMT problem and the same vector multiplication variant.
5
Concluding Discussion
This paper presents a simpliﬁcation and a generalization of Valiant’s technique, which speeds up a family of algorithms by incorporating fast matrix multiplication procedures. We suggest generic templates that identify problems for which this approach is applicable, where these templates are based on general recursive properties of the problems (rather than on their speciﬁc algorithms). An explicit algorithm is described for the Inside Vector Multiplication Template, where algorithms for other variants of problems can be similarly designed. The presented framework yields new worst case running time bounds for a family of important problems. The examples given here come from the ﬁelds of RNA secondary structure prediction and CFG parsing, yet it is possible that problems from other domains can be similarly accelerated. While previous works describe other practical acceleration techniques for some of these problems, Valiant’s technique, along with the Four Russians technique [24], are the only two techniques which currently allow to reduce the worst case running times of the standard algorithms, without compromising the correctness of the computations. Valiant’s technique has several advantages over the Four Russians technique. First, the running times obtained by applying it are faster than those obtained by applying the Four Russians technique (for example, the running times of algorithms for the RNA Energy Minimization problems which apply these techniques 3 3 log(n) n3 are O( n log ) and O( log(n) ), respectively). Second, it does not require the log2 (n) enumeration of submatrices of the dynamic programming matrix, which may be done only in the case of discrete scoring schemes. In addition, Valiant’s technique extends in a natural manner to a whole set of problems, without the need of taking into consideration many problemspeciﬁc aspects. Many of the previous acceleration techniques for RNA and CFG related algorithms are based on sparsiﬁcation, and are applicable only to optimization problems. Another important advantage of the technique presented here over previous ones is that it is the ﬁrst technique which reduces the running times of algorithms for the nonoptimization problem variants, such as RNA Partition Function related problems [5,7] and the PCFG InsideOutside algorithm [33] (in which the goals are to sum the scores of all solutions of the input, instead of computing the score of an optimal solution). The time complexities of the VMT algorithms we describe here are dictated by the time complexities of matrix multiplication algorithms. As matrix multiplication variants are essential operations in many computational problems, much work has been done to improve both the theoretical and the practical
76
S. Zakov, D. Tsur, and M. ZivUkelson
running times of these operations, including many recent achievements (see e.g. [21,34,35]). It is expected that even further improvements in this domain will be developed in the future, due to its importance. Acknowledgments. This work was partially supported by the Frankel Center for Computer Science at Ben Gurion University of the Negev.
References 1. Consortium, A.F.B., Backofen, R., Bernhart, S.H., Flamm, C., Fried, C., Fritzsch, G., Hackermuller, J., Hertel, J., Hofacker, I.L., Missal, K., Mosig, A., Prohaska, S.J., Rose, D., Stadler, P.F., Tanzer, A., Washietl, S., Will, S.: RNAs everywhere: genomewide annotation of structured RNAs. J. Exp. Zoolog. B. Mol. Dev. Evol. 308, 1–25 (2007) 2. Nussinov, R., Jacobson, A.B.: Fast algorithm for predicting the secondary structure of singlestranded RNA. PNAS 77, 6309–6313 (1980) 3. Zuker, M., Stiegler, P.: Optimal computer folding of large RNA sequences using thermodynamics and auxiliary information. Nucleic Acids Research 9, 133–148 (1981) 4. Alkan, C., Karako¸c, E., Nadeau, J.H., Sahinalp, S.C., Zhang, K.: RNARNA interaction prediction and antisense RNA target search. Journal of Computational Biology 13, 267–282 (2006) 5. McCaskill, J.S.: The equilibrium partition function and base pair binding probabilities for RNA secondary structure. Biopolymers 29, 1105–1119 (1990) 6. Bernhart, S., Tafer, H., M¨ uckstein, U., Flamm, C., Stadler, P., Hofacker, I.: Partition function and base pairing probabilities of RNA heterodimers. Algorithms for Molecular Biology 1, 3 (2006) 7. Chitsaz, H., Salari, R., Sahinalp, S.C., Backofen, R.: A partition function algorithm for interacting nucleic acid strands. Bioinformatics 25, i365–i373 (2009) 8. Zhang, K.: Computing similarity between RNA secondary structures. In: INTSYS 1998: Proceedings of the IEEE International Joint Symposia on Intelligence and Systems, p. 126. IEEE Computer Society, Washington (1998) 9. Sankoﬀ, D.: Simultaneous solution of the RNA folding, alignment and protosequence problems. SIAM Journal on Applied Mathematics 45, 810–825 (1985) 10. Sakakibara, Y., Brown, M., Hughey, R., Mian, I., Sjolander, K., Underwood, R., Haussler, D.: Stochastic contextfree grammers for tRNA modeling. Nucleic Acids Research 22, 5112 (1994) 11. Teitelbaum, R.: Contextfree error analysis by evaluation of algebraic power series. In: STOC, pp. 196–199. ACM, New York (1973) 12. Dowell, R., Eddy, S.: Evaluation of several lightweight stochastic contextfree grammars for RNA secondary structure prediction. BMC bioinformatics 5, 71 (2004) 13. Do, C.B., Woods, D.A., Batzoglou, S.: CONTRAfold: RNA secondary structure prediction without physicsbased models. Bioinformatics 22, e90–e98 (2006) 14. Cocke, J., Schwartz, J.T.: Programming Languages and Their Compilers. Courant Institute of Mathematical Sciences, New York (1970) 15. Kasami, T.: An eﬃcient recognition and syntax analysis algorithm for contextfree languages. Technical Report AFCRL65758, Air Force Cambridge Res. Lab., Bedford Mass. (1965) 16. Younger, D.H.: Recognition and parsing of contextfree languages in time n3 . Information and Control 10, 189–208 (1967)
Reducing the Worst Case Running Times of a Family of RNA
77
17. Valiant, L.: General contextfree recognition in less than cubic time. Journal of Computer and System Sciences 10, 308–315 (1975) 18. Coppersmith, D., Winograd, S.: Matrix multiplication via arithmetic progressions. J. Symb. Comput. 9, 251–280 (1990) 19. Akutsu, T.: Approximation and exact algorithms for RNA secondary structure prediction and recognition of stochastic contextfree languages. Journal of Combinatorial Optimization 3, 321–336 (1999) 20. Bened´ı, J., S´ anchez, J.: Fast Stochastic ContextFree Parsing: A Stochastic Version of the Valiant Algorithm. In: Mart´ı, J., Bened´ı, J.M., Mendon¸ca, A.M., Serrat, J. (eds.) IbPRIA 2007. LNCS, vol. 4477, pp. 80–88. Springer, Heidelberg (2007) 21. Chan, T.M.: More algorithms for allpairs shortest paths in weighted graphs. In: STOC 2007: Proceedings of the thirtyninth annual ACM symposium on Theory of computing, pp. 590–598. ACM, New York (2007) 22. Graham, S.L., Harrison, M.A., Ruzzo, W.L.: An improved contextfree recognizer. ACM Transactions on Programming Languages and Systems 2, 415–462 (1980) 23. Arlazarov, V.L., Dinic, E.A., Kronod, M.A., Faradzev, I.A.: On economical construction of the transitive closure of an oriented graph. Soviet. Math. Dokl. 11, 1209–1210 (1970) n3 )time algorithm 24. Frid, Y., Gusﬁeld, D.: A simple, practical and complete O( log n for RNA folding using the fourrussians speedup. In: Salzberg, S.L., Warnow, T. (eds.) WABI 2009. LNCS, vol. 5724, pp. 97–107. Springer, Heidelberg (2009) 25. Klein, D., Manning, C.D.: A* parsing: Fast exact viterbi parse selection. In: HLTNAACL, pp. 119–126 (2003) 26. Jansson, J., Ng, S., Sung, W., Willy, H.: A faster and more spaceeﬃcient algorithm for inferring arcannotations of RNA sequences through alignment. Algorithmica 46, 223–245 (2006) 27. Wexler, Y., Zilberstein, C.B.Z., ZivUkelson, M.: A study of accessible motifs and RNA folding complexity. Journal of Computational Biology 14, 856–872 (2007) 28. ZivUkelson, M., GatViks, I., Wexler, Y., Shamir, R.: A faster algorithm for RNA cofolding. In: Crandall, K.A., Lagergren, J. (eds.) WABI 2008. LNCS (LNBI), vol. 5251, pp. 174–185. Springer, Heidelberg (2008) 29. Backofen, R., Tsur, D., Zakov, S., ZivUkelson, M.: Sparse RNA folding: Time and space eﬃcient algorithms. In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009. LNCS, vol. 5577, pp. 249–262. Springer, Heidelberg (2009) 30. Salari, R., Mohl, M., Will, S., Sahinalp, S., Backofen, R.: Time and Space Eﬃcient RNARNA Interaction Prediction via Sparse Folding. In: Berger, B. (ed.) RECOMB 2010. LNCS, vol. 6044, pp. 473–490. Springer, Heidelberg (2010) 31. Havgaard, J., Lyngso, R., Stormo, G., Gorodkin, J.: Pairwise local structural alignment of RNA sequences with sequence similarity less than 40%. Bioinformatics 21, 1815–1824 (2005) 32. Will, S., Reiche, K., Hofacker, I.L., Stadler, P.F., Backofen, R.: Inferring noncoding RNA families and classes by means of genomescale structurebased clustering. PLOS Computational Biology 3, 65 (2007) 33. Baker, J.K.: Trainable grammars for speech recognition. The Journal of the Acoustical Society of America 65, S132 (1979) 34. Goto, K., Geijn, R.: Anatomy of highperformance matrix multiplication. ACM Transactions on Mathematical Software (TOMS) 34, 1–25 (2008) 35. Robinson, S.: Toward an optimal algorithm for matrix multiplication. News Journal of the Society for Industrial and Applied Mathematics 38 (2005)
Reconstruction of Ancestral Genome Subject to Whole Genome Duplication, Speciation, Rearrangement and Loss Denis Bertrand1 , Yves Gagnon1 , Mathieu Blanchette2 , and Nadia ElMabrouk1
2
1 DIRO, Universit´e de Montr´eal, H3C 3J7, Canada
[email protected],
[email protected],
[email protected] McGill Centre for Bioinformatics, McGill University, H3A 2B4, Canada
[email protected] Abstract. Whole genome duplication (WGD) is a rare evolutionary event that has played a dramatic role in the diversiﬁcation of most eukaryotic lineages. Given a set of species known to have evolved from a common ancestor through one or many rounds of WGD together with a set of genome rearrangements, and a phylogenetic tree for these species, the goal is to infer the preduplication ancestral genomes. We use a two step approach: (1) Compute a score for each possible ancestral adjacency at each internal node of the phylogeny; (2) Combine adjacencies to form ancestral chromosomes. We ﬁrst apply our method on simulated datasets and show a high accuracy for adjacency prediction. We then infer the preduplicated ancestor of a set of 11 yeast species and compare it to a manually assembled ancestral genome obtained by Gordon et al. (2009).
1
Introduction
Whole genome duplication (WGD) is a spectacular evolutionary event that has the eﬀect of simultaneously doubling all the chromosomes of a genome. Evidence for WGD events has shown up across the whole eukaryote spectrum, from the protist Giardia to the yeast species, including most plant lineages, several insect, ﬁsh, amphibians, and even to mammalian species. For some genomes, recent duplication is easily detected by the presence of a nearly complete set of duplicated chromosomes. However, in most cases, due to a series of rearrangements disrupting the initial perfectly doubled structure of the genome, all that we can observe is a set of duplicated blocks (chromosomal segments or genes) representing a high proportion of the genome, scattered throughout the genome. Studying the evolution of a lineage that have been subject to one or many WGD is challenging due to the high rates of paralogy in their genomes. Inferring the content and chromosome organization of ancestral genomes preceding the WGD is a major step towards solving this diﬃculty, and also answering biological questions such as the mechanisms of polyploid formation and the consequence of such variations on the genetic and physiological speciﬁcities of species. In 2003, we have presented the ﬁrst formal result related to genome duplication, which is an exact lineartime algorithm for solving the genome halving V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 78–89, 2010. c SpringerVerlag Berlin Heidelberg 2010
Reconstruction of Ancestral Genome
79
problem [5]: Given a presentday genome G represented as a set of strings (chromosomes) with each block present exactly twice, infer a perfectly duplicated genome H (a genome with exactly two copies of each chromosome) minimizing the rearrangement distance to G (inversions, reciprocal translocations or both). Our results have been reformulated recently by Alekseyev and Pevzner [1] using an alternative representation of the breakpoint graph. Subsequently, Sankoﬀ and colleagues [13,14], and more recently Gavranovi´c and Tannier [6], used variations of the genome halving strategy (Guided Genome Halving or GGH) to ﬁnd the preduplicated ancestor of a doubled genome in the presence of a nonduplicated outgroup [13,14]. As noticed in [7], the GGH algorithms can hardly be generalized to a complete phylogenetic tree, with more than one WGD event on a path from an extant species to the root of the tree, and an arbitrary number of postWGD genomes and nonWGD outgroups. Moreover, as for genome halving, GGH algorithms can only consider genes that have retained two copies after the WGD. In the case of reconstructing the ancestor of Saccharomyces cerevisiae, Gordon et al. [7] have noticed that less than 20% of all genes can be taken into account by the GGH strategy. Subsequent work shows that this limitation can be circumvented by grouping genes into double conserved syntenies [3,6]. In this paper, we consider the general problem of inferring the preduplicated genome preceding the ﬁrst duplication event in a multispecies evolutionary history involving WGDs, rearrangement events, and block losses. The input of our problem is a set of extant genomes, each represented as a set of strings on an alphabet of blocks (each block potentially present more than once in each genome), and a phylogenetic tree representing the evolution of the species, with speciﬁc branches marked with WGD events. Such data and phylogenetic information is available for a variety of eukaryotic lineages, such as the yeast species [7], grass genomes [12], and many other lineages. Our approach for ancestral genome prediction is to maximize the conservation of block adjacencies in the phylogeny. We use a twostep methodology: (1) at each node of the phylogeny, compute the adjacency score of each pair of blocks; (2) infer a preduplicated ancestral genome by an optimal chaining of adjacencies. The main contribution of our method is the computation of a rigorous score for each potential ancestral adjacency (a, b), reﬂecting the maximum number of times a and b can be adjacent in the whole phylogeny, for any setting of ancestral genomes. As it is the case for the other local approaches [4], in the absence of a complete set of reliable syntenies, the output of our algorithm is a set of Contiguous Ancestral Regions fragments (CAR) [4,10], rather than a completely assembled ancestral genome. The approaches most comparable to ours are those developed by Ma et al. (see the method in [10] for single gene copies, and its generalization to genomes with duplications in [11]). We show that our approach outperforms the former on simulated data. The latter can only be used if accurate gene trees, with branch lengths, are available, which is often limiting. In contrast, our approach works under stronger assumptions but requires only a species tree and extant genomes as input. Our paper is structured as follows: after introducing basic notations, we introduce the notion of adjacency scores, show how to compute it, and how
80
D. Bertrand et al.
to use it to assemble putative ancestral genomes by solving an instance of the traveling salesperson problem. We then show, using simulated data, that the predicted preWGD genomes are highly accurate, even in the presence of a large number of rearrangements. Finally, we apply our approach to the prediction of the ancestral preWGD yeast genome and obtain results very similar to the handcurated ancestral genome produced by Gordon et al. [7].
2
Preliminaries
Notation: Let B be a set of unsigned blocks (e.g. genes, or any other type of genomic markers). A string is a sequence of blocks from B, where each block is signed (+ or −) to mark its orientation. A genome G is a collection of strings C1 , C2 , . . . , CN called its chromosomes, where each element of B may be present more than once. To represent chromosomal ends, we add an artiﬁcial block O, which is also added to our alphabet B, at an extremity of each chromosome, and consider each chromosome as circular. We denote by ΣG ⊆ B the set of blocks present in G (including O), by mult(a, G) the multiplicity of block a in G , and by ±ΣG the set obtained from ΣG by considering each block in its positive and negative directions. The artiﬁcial block O is always considered positively signed. A multiset of ±ΣG is a subset of ±ΣG with possibly repeated blocks. Let a ∈ ΣG and b ∈ ±ΣG . We say that b is a leftadjacency of a in G iﬀ “b + a” or “−a b” is a substring of G. Symmetrically, b is a rightadjacency of a in G iﬀ “+a b” or “b − a” is a substring of G. We denote by LA(G, a) and RA(G, a) the multisets of left and rightadjacencies of the one or more copies of a in G. Evolutionary model: A Whole Genome Duplication (or WGD for short) is an event transforming a genome G = {C1 , C2 , . . . , CN } into a genome GD con }, where, for taining 2N chromosomes, i.e. GD = {C1 , C1 , C2 , C2 , . . . , CN , CN each 1 ≤ i ≤ N , Ci = Ci . Let G1 , G2 , . . . , Gn be a set of n related species at the leaves of a species tree T , assumed to have evolved from a common ancestor through WGD events, intrachromosomal (inversions or transpositions) and interchromosomal (reciprocal translocations, fusions, or ﬁssions) rearrangements, and block losses. A phylogeny for (Gi )ni=1 is a tree T with n leaves, where Gi , for 1 ≤ i ≤ n, is the label of leaf i, and each internal node (also called speciation node) has exactly two children and represents a speciation event. In our model, WGDs are the only duplication events responsible for block multiplicity (in particular, singleblock duplications are not considered). In order to account for those duplication events, we create new internal nodes in T , called WGD nodes, and position them appropriately on the edges of T . Contrary to speciation nodes, each WGD node has only a single child. Moreover, if all leaf genomes have multiplicity greater than 1, then we add one or more WGD nodes above the root r of T and we create a new root D, that we call the duplication root of T . Assuming a model with no convergent evolution and minimum losses, the multiset of blocks Σu present at node u can be obtained as follows (see Figure 1(a)). Let A(a) be the node of T representing the least common ancestor of the leaves
Reconstruction of Ancestral Genome
81
that contain a given block a. Then, we assign a to each node belonging to a path from A(a) to any leaf containing a. In order to deﬁne the multiset Σu , we also need to know the multiplicity of each block at u. The multiplicity of a in Σu is recursively obtained as the maximum of its multiplicities in u’s two children.
(a)
{a,b,c} {a,b,c} {a,b,c}
{a,b,c}
Ocba 2 Oba
1
{b,b}: 9 1 {c,c}: 8 2 {b,b}: 6 {b,c}: 5 {c,c}: 4 {b,b}: 2 {b,b}: 2 2 {b,c}: 1 {b,c}:1 {c,c}: 0 {c,c}: 0
2
2
Oba 2Oba
{b}: 10 {c}: 9
(b)
1
2
Oba Oca
1 Oba
Ocba 2 Oba
Oba 2Oba
1
{b,b}: 1 {b,c}: 2 {c,c}: 1
2
Oba Oca
{b}: 1 {c}: 0
1Oba
Fig. 1. (a) A species tree with each leaf labeled with its corresponding genome and multiplicity number, and each internal node labeled with the multiplicity and block set of the ancestral genome just preceding the speciation or WGD event. Squares indicate speciation nodes, and the double circle indicates a WGD node. (b) An illustration of the algorithm computing Lbelow for the adjacencies of gene a.
3
Problem Definition
Given a species tree T for the genomes (Gi )ni=1 , augmented with WGD nodes as described in the previous section, we want to infer the preduplicated ancestral genomes, i.e. the ancestral genomes just preceding the ﬁrst WGD nodes on the paths from the root D of T to a leaf. We will use a parsimony criteria seeking a solution with a maximum number of adjacency conservations along the branches of T , or, equivalently, a maximum of adjacency conservation. Ancestral genome assignment. A genome assignment G(u) at u is a genome on B respecting the content and multiplicity constraints given by Σu . If u is a WGD node, G(u) must be a duplicated genome. Let u and v be two nodes of T with u being the parent of v. In the case of genomes with single gene copies, it is easy to deﬁne the number of adjacencies preserved along branch (u, v) as the number of common substrings of size 2 between G(u) and G(v). This deﬁnition is not directly transposable to the case of genomes with multiple gene copies, as the one to one orthology between genes is not set. Instead, for each block a, we compare its left and rightadjacency multisets in G(u) and G(v). More precisely, we deﬁne adjCons(a, G(u), G(v)) = LA(G(u), a)∩LA(G(v), a)+RA(G(u), a)∩ RA(G(v), a), as the number of left and right conserved adjacencies of a on the branch (u, v), and adjCons(G(u), G(v)) = a∈Σu ∩Σv adjCons(a, G(u), G(v)) as the total number of left and right conserved adjacencies on the branch (u, v). In both formulas, intersections and cardinalities are taken over multisets. Notice that adjCons(G(u), G(v)) accounts for each adjacency conservation twice.
82
D. Bertrand et al.
We then deﬁne adjCons(T ) as the maximum number of conserved adjacencies in T , over all possible ancestral genome assignments G(u1 ), . . . G(uk ) at all internal (speciation and WGD) nodes n1 , . . . nk of T : adjCons(T ) = max adjCons(G(u), G(v)) G(u1 ),...,G(uk )
(u,v)∈E(T )
Finally, for a given ancestral node ui with genome assignment H(ui ), deﬁne adjCons(T G(ui )=H(ui ) ) =
max
G(u1 ),...,G(uk )G(ui )=H(ui )
adjCons(G(u), G(v)),
(u,v)∈E(T )
which is the maximum number of adjacencies that can be preserved along the branches of T , if the genome at node ui is set to H(ui ). We can now state our optimization problem precisely. Ancestral Genome Assignment Problem: Input: A species tree T for the genomes (Gi )ni=1 augmented with one or more WGD nodes as described in the previous section; The multiset of blocks at each internal node; A particular WGD node u of interest. Output: An ancestral genome assignment H(u) to u such that adjCons(T G(u)=H(u) ) is maximized. In this paper, we focus on inferring the preduplicated genomes preceding a ﬁrst WGD event on a branch from the root of T to a leaf. In other words, u is the ﬁrst WGD node on a branch from the root of T to a leaf.
4
Method
We start by deﬁning an upper bound on our objective function, adjCons(T G(u)=H(u) ). We deﬁne adjCons(a, T C ) as the maximum number of left and right adjacencies of a that can be preserved over the whole tree, for any assignment G(u1 ), ..., G(uk ) of ancestral genomes subject to a set of constraints C. Then, it is straightforward to show that: adjCons(T G(u)=H(u) ) ≤
adjCons(a, T LA(a,G(u))=LA(a,H(u)),RA(a,G(u))=RA(a,H(u)))
a
≤ 1/2 ·
adjCons(a, T LA(a,G(u))=LA(a,H(u))) +
a
adjCons(a, T RA(a,G(u))=RA(a,H(u)))
Our ancestral reconstruction algorithm thus seeks a genome H such that the above term is maximized. It proceeds in two steps: (1) For each internal node u of the tree (speciation or WGD node), each block a ∈ Σu , and each multisets X of possible left adjacencies of a at node u, we compute adjCons(a, T LA(a,G(u))=X ), using a dynamic programming algorithm. We then proceed similarly for right adjacencies. (2) We obtain the desired preduplicated genome at WGD node u by chaining the adjacencies at node u in a optimal way.
Reconstruction of Ancestral Genome
4.1
83
Computing Adjacency Scores
We ﬁrst describe how to compute adjCons(a, T LA(a,G(ui ))=X ), for any node ui , block a ∈ Σui , and candidate leftadjacencies X. The algorithm to compute rightadjacencies is very similar. Consider an edge (u, v) in T , where u is the parent of v. Let X be a multisubset of ±Σu and G(u) be a genome assignment at node u such that LA(a, G(u)) = X. We deﬁne Lbelow (u,v) (a, X) as the maximum number (over all possible genome assignments of T ’s internal nodes) of leftadjacencies involving the copies of a that can be preserved along the branch (u, v) and all the branches of the subtree rooted at node u. Similarly, we deﬁne Labove (u,v) (a, X) as the maximum number of leftadjacencies involving a that can be preserved, along branch (u, v) and all the branches outside the subtree rooted at node u. Then, for an internal node u with children v and w and parent p, we below above obtain adjCons(a, T LA(a,G(u))=X ) = Lbelow (u,v) (a, X)+L(u,w) (a, X)+L(p,u) (a, X). Notice that, if u is a WGD node, then u has a single child v, and thus the term Lbelow (u,w) (a, X) should be removed from the above formula. Similarly, if u is the root of the tree, then the term Labove (p,u) (a, X) should be removed. Algorithm 1: Lbelow (u,v) (a, X) if v is a leaf then if u is a speciation node then Lbelow (u,v) (a, X) = X ∩ LA(G(v), a); if u is duplication node then Lbelow (u,v) (a, X) = (X ∪ X) ∩ LA(G(v), a); else v is an internal node if v is a speciation node with children x and y then if u is a speciation node then below below Lbelow (u,v) (a, X) = maxX {L(v,x) (a, X ) + L(v,y) (a, X ) + X ∩ X }; if u is a duplication node then below below Lbelow (u,v) (a, X) = maxX {L(v,x) (a, X ) + L(v,y) (a, X ) + (X ∪ X) ∩ X }; else v is a duplication node with one child w below Lbelow (u,v) (a, X) = maxX {L(v,x) (a, X ) + X ∩ X };
Algorithm 2: Labove (p,u) (a, X) if u is the root r of T then p = D and Labove (p,u) (z, X) = 0; else let p be the parent of p if p is a speciation node and s is the sibling of u then above below Labove (p,u) (a, X) = maxX {L(p ,p) (a, X ) + L(p,s) (a, X ) + X ∩ X }; if p is a duplication node (its only child is u) then above Labove (p,u) (a, X) = maxX {L(p ,p) (a, X ) + X ∩ (X ∪ X )};
above We are thus interested in calculating the tables Lbelow (u,v) and L(u,v) for each edge (u, v) of T . Those are obtained by the dynamic programming algorithms shown in Algorithms 1 and 2. An illustration of this algorithm is given in Figure 1(b). Although expressed in a recursive manner for simplicity, both
84
D. Bertrand et al.
algorithms can be rewritten using a dynamic programming approach that proceeds in a bottomup fashion to obtain Labove and in a topdown fashion to obtain Lbelow . The running time to compute adjCons(a, T LA(a,G(u))=X ) is thus O(Σ(u,v)∈T ( ± Σu mult(a,G(u)) ×  ± Σv mult(a,G(v)) )). 4.2
Assembling an Preduplication Ancestral Genome
We now seek to build a solution to the Ancestral Genome Assignment Problem, i.e. to chain blocks at u so as to maximize the objective function. We achieve this by solving a Traveling Salesperson Problem (TSP) on a complete undirected graph where vertices correspond to blocks. We initially weighted edges according to our upper bound Lall u . However, this weighting gives too much importance to adjacencies involving blocks with high multiplicity. Thus, we decided to weight all the edges according to the ratio rLall u (a, X) = Lu (a, X)/adjConsM ax(a, T ), where adjConsM ax(a, T ) = Σ(u,v)∈E(T ) min(mult(a, Gu ), mult(a, Gv )). Notice that adjConsM ax(a, T ) represents the number of conserved adjacencies for the block a in T if a is always adjacent to the same gene in all leaves of T . This ratio allows us to evaluate the conﬁdence of an inferred adjacency (see Figures 3 and 4 top right). More precisely, we build an undirected graph Q that contains a pair of vertices at , ah for each block a ∈ Σu , as well as a set of vertices O1 , O2 , Ok marking chromosome ends, where k is chosen to be at least as large as (but possibly larger than) the maximum number of chromosomes in the ancestral genome we seek to = j ∈ {1, ..., k}, and infer. Edge weights are chosen as follows, for a = b ∈ Σu , i M some large number: w(ah , bt ) = rRuall (a, {+b}) + rLall u (b, {+a}) w(ah , bh ) = rRuall (a, {−b}) + rRuall (b, {−a}) all w(at , bt ) = rLall u (b, {−a}) + rLu (a, {−b}) t h all w(a , b ) = rLu (a, {+b}) + rRuall (b, {+a})
w(at , ah ) = M w(Oi , at ) = 2 × rLall u (a, {O}) w(Oi , ah ) = 2 × rRuall (a, {O}) w(Oi , Oj ) = 0
Because at and ah are connected by heavy edges, any maximum weight hamiltonian cycle must include all of them. A hamiltonian cycle through Q thus deﬁnes a set of strings (chromosomes; delimited by O vertices), with some possibly empty (two consecutive O vertices). Starting from O1 , the cycle visits pairs (at , ah ) (corresponding to +a) or (ah , at ) (corresponding to −a). The heaviest hamiltonian cycle through Q thus corresponds to an hypothetical ancestral genome H at u that preserves a large number of adjacencies. The instance of the TSP we need to solve is a symmetrical weighted graph with 2 · Σu  + k vertices. In the case of the reconstruction of the ancestral preduplication yeast genome, Σu  = 4705, so the graph is quite large. Although an NPComplete problem, TSP is one of the best studied algorithmic problems and excellent heuristics exist. We considered two of them. The ﬁrst is a simple greedy approach that repeatedly selects the heaviest edge remaining unless this results in the premature closing of a cycle. The second is the Chained LinKernighan heuristic [9] implemented in Concorde [2], referred as TSP from now on.
Reconstruction of Ancestral Genome
5
85
Results
A strong prerequisite for reconstructing accurate ancestral genomes is to have enough data on extant species, and suﬃcient colinearity of gene order among a reasonably large number of related species. Yeast genomes are a perfect example of a data set satisfying all these conditions. Following the extensive work of Wolfe and colleagues during the last decade, it is now almost universally accepted that Saccharomyces cerevisiae is the descendant of an ancient wholegenome duplication event. Moreover, the availability of a large number of completely sequenced yeast genomes as well as the Yeast Gene Order Browser [7], provides the material for an accurate ancestral genome reconstruction. We therefore focus, in this paper, on the study of the yeast species data sets. 5.1
Simulated Data Sets
We ﬁrst test our method on a data set obtained through a simulated evolution that is as close as possible to the one observed for yeast species. The phylogenetic tree given in Figure 2(a) reﬂects the evolution of the 11 yeast species recorded in the Yeast Gene Order Browser, as given by [8]. Gene sets at leaves are those provided in [7], and gene sets at internal nodes, as well as the number of gene losses on each branch, are directly inferred from those at the leaves. Based on this tree, we simulate the evolution of 11 genomes, starting from an ancestor with 4705 genes distributed among 8 chromosomes (the number of genes and chromosomes of the preduplicated ancestor as predicted by Gordon et al.), and performing a certain number of rearrangements and gene losses on each branch of the tree. The number of gene losses is simply the one observed in the phylogenetic tree of Figure 2 . The number of rearrangements is selected randomly from an interval [μ/2, μ], where μ is a parameter chosen prior to the generation, and the size of each rearrangement is random. As for the rate of rearrangement operations it is chosen to be similar to that reported for S. cerevisiae in [7]. More precisely we choose the rates (Inv : Trans : Fus+Fiss) = (5 : 4 : 1). Notice that four of the species represented in the phylogenetic tree of Figure 2 (those indicated by * ), are partially sequenced species for which only scaﬀolds are available. To account for this speciﬁcity of the data, we perform random ﬁssions on four of our simulated genomes. Moreover, as scaﬀolds just represent parts of chromosomes, adjacencies at the extremities are not relevant to our study and are not taken into account. Simulations without WGD. In order to measure the eﬃciency of our approach in absence of WGD events, we compare our results with those obtained by the algorithm of Ma et al. [10]. We refer to this software as the Ma method. We simulate data sets based on the subtree of the yeast phylogeny containing only the six nonduplicated yeast species. Moreover, as the Ma et al. algorithm does not support losses, we only consider the set of genes present in all six species. We performed our simulations with 10 diﬀerent values of μ, varying from 100 to 1000. For each of those 10 μ values, 50 diﬀerent data sets are obtained, an ancestor is inferred for each dataset and compared to the “true” known ancestor.
D. Bertrand et al.
(a)
6 120
pre−duplicated ancestor
527
186 245
0
377
3692
342 700
0 (0.4)
107 (0.2) 73 (0.2)
140 (0.1) 97 (0.1)
17 (0.2)
Saccharomyces bayanus*
242 4636
Candida galabrata
13 4906
Naumovia castellii*
249 5127
(b) Post−WGD species
46 (0.1) 65 (0.2)
Gordon et al. [6] reconstructed ancestor
8 4705
Zygosaccharomyces rouxii
7 4557
Kluyveromyces lactis
6 4503
Eremothecium gossypii
7 4384
Lachancea walti*
19 4429
Lachancea thermotolerans
8 4523
Lachancea kluveri
8 4601
Non−WGD species
120 100
TSP 1.6 TSP 1.7
80 60 40 20 0 5 >4 5 4 40 0 4 35 5 3 30 0 3 25 5 2 20 0 2 15 5 1 10 10 55 b in the component to be m − (b − a). The templates can be applied directly to the condensed component. For example, take the component C = (2 4 6 3 7) in Figure 1 where the component (4−5 6) is contained in it. The condensed version of C is (2 4 3 5). The condensed version of any component can be computed in linear time.
4 Detecting Ominous Substrings We now turn to the task of detecting an ominous substring associated with a smallest element e. The following methods can be adapted to detect the negative analogue of each template, so we only describe the detection of the templates as they were presented in Section 3.1. The general outline used in each of the following algorithms is the same: we visit the permutation starting with element e, proceeding to element e + 1, then e + 2 and so on. At each step we maintain enough information to check whether certain conditions hold that indicate we have found an ominous substring. Call the set of elements that we visit through the first i steps Si (those with absolute value in the interval [e, e + i]). To check for each template at step i, so that f would be the element e + i, we maintain the following values. – Rightmost positive index visited: rp = max({π−1 ( j) j ∈ Si , j > 0}) – Leftmost positive index visited: l p = min({π−1 ( j) j ∈ Si , j > 0}) – Rightmost negative index visited: rn = max({π−1 ( j) j ∈ Si , j < 0}) – Leftmost negative index visited: ln = min({π−1( j) j ∈ Si , j < 0}) Template 1 (eAX − f −B) exists, with unsafe reversal ρ(rp + 1, rn), if and only if the following conditions hold: 1. l p = π−1 (e) (e is the leftmost element visited) 2. ln > rp (the negative elements are to the right of the positive) 3. rn − ln + rp − l p = i − 1 (the positive and negative elements are all contiguous) 4. π−1 (e + i) = ln (the last element visited is the leftmost negative element) 5. i ≥ 3 (the FCI has at least 4 elements) Template 2 (−A−eXB f ) exist, with unsafe reversal ρ(ln, l p − 1), if and only if the following conditions hold: 1. rn = π−1 (e) (e is the rightmost negative element) 2. l p > rn (the negative elements are to the left of the positive)
108
K.M. Swenson, G. Badr, and D. Sankoff
3. rn − ln + rp − l p = i − 1 (the positive and negative elements are all contiguous) 4. π−1 (e + i) = rp (the last element visited is the rightmost element visited) 5. i ≥ 3 (the FCI has at least 4 elements)
To check for template 3 we maintain another value neg = { j j ∈ Si , j < 0}, the number of negative values visited. We know that we have found template 3 (eA−BC f ) with unsafe reversal ρ(ln, rn) if and only if all of the following conditions hold: 1. l p = π−1 (e) (e is the leftmost element visited) 2. ln > l p (the negative elements are to the right of some positive) 3. rp > rn (the negative elements are to the left of some positive) 4. rp − l p = i (we have visited a contiguous substring) 5. rn − ln = neg − 1 (the negative elements of B are contiguous) 6. π−1 (e + i) = rp (the last element visited is the rightmost element visited) 7. i ≥ 3 (the FCI has at least 4 elements) Note that if at some iteration i during our scan conditions 1 or 2 for any of the templates are broken, we know that e can no longer match that template.
5 The Algorithm We begin by proving the following theorem. Theorem 1. For a permutation without a bad component, there is an O(n2 ) algorithm for listing all sorting reversals. Proof. Use the methods of Section 4 to obtain a blacklist of all ominous substrings associated with each possible smallest frame element e. Since the list of all ominous substrings associated with a single smallest frame element is obtained by a linear scan for all possible right endpoints f , the time to build the blacklist is O(n2 ). Each element of the list is associated with a bad reversal, the indices of which we mark in an n by n matrix; an entry r at row i and column j indicates that the bad reversal r acts on elements from position i to position j in the permutation. Obtain the list of all cyclesplitting reversals in O(n2 ) time using the standard methods [9]. Finally, examine this list one reversal at a time, removing from the list any reversal that has a corresponding entry marked in the matrix.
Listing All Sorting Reversals in Quadratic Time
109
The methods described so far are applicable to permutations with no bad components. Permutations with bad components can be easily handled by combining our algorithm with that of Siepel [15] in the following way. First make a linear scan of the permutation to detect bad components [2,5]. If there are bad components, use the O(n3 ) algorithm of Siepel, otherwise, use our algorithm. Theorem 2. Pick a signed permutation uniformly at random, the expected time the above algorithm takes to list all sorting reversals is O(n2 ). Proof. The probability of seeing a bad component in a permutation taken uniformly at random from the set of all signed permutations is O(n−2 ) [17]. The bound follows since n3 × n−2 < n2 .
6 Conclusions We presented the first quadratic time algorithm for listing all sorting reversals for a signed permutation. This pattern matching algorithm is simple in that it requires no special data structures. It is optimal in the sense that most permutations can have Ω(n2 ) sorting reversals [20,13]. An improvement on our bound would be an algorithm that runs in O(n + k) time where k is the number of sorting reversals. It is currently unclear how to modify our algorithm to obtain this bound.
References 1. Ajana, Y., Lefebvre, J.F., Tillier, E.R.M., ElMabrouk, N.: Exploring the set of all minimal sequences of reversals  an application to test the replicationdirected reversal hypothesis. In: Guig´o, R., Gusfield, D. (eds.) WABI 2002. LNCS, vol. 2452, pp. 300–315. Springer, Heidelberg (2002) 2. Bader, D.A., Moret, B.M.E., Yan, M.: A lineartime algorithm for computing inversion distance between signed permutations with an experimental study. J. Comput. Biol. 8(5), 483– 491 (2001); A preliminary version appeared in WADS 2001, pp. 365–376 3. Baudet, C., Dias, Z.: An Improved Algorithm to Enumerate All Traces that Sort a Signed Permutation by Reversals. In: SIGAPP 2010: Proceedings of the Twenty Fifth Symposium on Applied Computing (2010) 4. Bergeron, A.: A very elementary presentation of the Hannenhalli–Pevzner theory. Discrete Applied Mathematics 146(2), 134–145 (2005) 5. Bergeron, A., Heber, S., Stoye, J.: Common intervals and sorting by reversals: a marriage of necessity. In: Proc. 2nd European Conf. Comput. Biol. ECCB 2002, pp. 54–63 (2002) 6. Braga, M.D.V., Sagot, M., Scornavacca, C., Tannier, E.: The Solution Space of Sorting by Reversals. In: M˘andoiu, I.I., Zelikovsky, A. (eds.) ISBRA 2007. LNCS (LNBI), vol. 4463, pp. 293–304. Springer, Heidelberg (2007) 7. Caprara, A.: On the tightness of the alternatingcycle lower bound for sorting by reversals. J. Combin. Optimization 3, 149–182 (1999) 8. Hannenhalli, S., Pevzner, P.A.: Transforming mice into men (polynomial algorithm for genomic distance problems). In: Proc. 36th Ann. IEEE Symp. Foundations of Comput. Sci. (FOCS 1995), pp. 581–592. IEEE Press, Piscataway (1995) 9. Hannenhalli, S., Pevzner, P.A.: Transforming cabbage into turnip: Polynomial algorithm for sorting signed permutations by reversals. J. ACM 46(1), 1–27 (1999)
110
K.M. Swenson, G. Badr, and D. Sankoff
10. Kaplan, H., Shamir, R., Tarjan, R.E.: Faster and simpler algorithm for sorting signed permutations by reversals. SIAM J. Computing 29(3), 880–892 (1999) 11. Kaplan, H., Verbin, E.: Efficient data structures and a new randomized approach for sorting signed permutations by reversals. In: BaezaYates, R., Ch´avez, E., Crochemore, M. (eds.) CPM 2003. LNCS, vol. 2676, pp. 170–185. Springer, Heidelberg (2003) 12. Lefebvre, J.F., ElMabrouk, N., Tillier, E.R.M., Sankoff, D.: Detection and validation of single gene inversions. In: Proc. 11th Int’l. Conf. on Intelligent Systems for Mol. Biol. (ISMB 2003). Bioinformatics, vol. 19, pp. i190–i196. Oxford U. Press (2003) 13. Sankoff, D., Haque, L.: The distribution of genomic distance between random genomes. Journal of Computational Biology 13(5), 1005–1012 (2006) 14. Sankoff, D., Lefebvre, J.F., Tillier, E.R.M., Maler, A., ElMabrouk, N.: The distribution of inversion lengths in bacteria. In: Lagergren, J. (ed.) RECOMBWS 2004. LNCS (LNBI), vol. 3388, pp. 97–108. Springer, Heidelberg (2005) 15. Siepel, A.C.: An algorithm to find all sorting reversals. In: Proc. 6th Ann. Int’l. Conf. Comput. Mol. Biol. (RECOMB 2002). ACM Press, New York (2002) 16. Swenson, K.M., Rajan, V., Lin, Y., Moret, B.M.E.: Sorting signed permutations by inversions in O(n log n) time. In: Batzoglou, S. (ed.) RECOMB 2009. LNCS, vol. 5541, pp. 386–399. Springer, Heidelberg (2009) 17. Swenson, K.M., Lin, Y., Rajan, V., Moret, B.M.E.: Hurdles hardly have to be heeded. In: Nelson, C.E., Vialette, S. (eds.) RECOMBCG 2008. LNCS (LNBI), vol. 5267, pp. 239– 249. Springer, Heidelberg (2008) 18. Tannier, E., Bergeron, A., Sagot, M.F.: Advances on sorting by reversals. Disc. Appl. Math. 155(67), 881–888 (2007) 19. Tannier, E., Sagot, M.: Sorting by reversals in subquadratic time. In: Sahinalp, S.C., Muthukrishnan, S.M., Dogrusoz, U. (eds.) CPM 2004. LNCS, vol. 3109, pp. 1–13. Springer, Heidelberg (2004) 20. Yang, Y., Szkely, L.A.: On the expectation and variance of reversal distance. Acta Univ. Sapientiae, Mathematica 1(1), 5–20 (2009)
Discovering Kinship through Small Subsets Daniel G. Brown1 and Tanya BergerWolf2 1
2
Cheriton School of Computer Science, University of Waterloo Waterloo, ON N2L 3G1, Canada
[email protected] Department of Computer Science, University of Illinois at Chicago Chicago, IL 60607, USA
[email protected] Abstract. In kinship inference, we identify genealogical relationships among organisms. One such problem is sibgroup reconstruction: given a population of samegeneration individuals, partition it into sibgroups resulting from mating events. Minimizing the number of matings is NPhard to approximate, yet a simple heuristic, based on identifying population triplets that can be from the same sibgroup, performs comparably to better than integer programming algorithms in a fraction of the running time. With high probability if we study many loci in the genome, and large populations, our polynomialtime heuristic finds the true sibgroups, assuming a standard probabilistic inheritance model.
1
Introduction
A natural ﬁeld biology question is to characterize genealogical relationships in wild populations, such as which organisms are siblings. Scientists use genetic markers from highly variable genomic loci to detect parentage: if three diploid organisms are father, mother and oﬀspring, then at every position in the genome, the oﬀspring has one copy of a paternal chromosome and one copy of a maternal chromosome. Assuming no mutations, if neither copy of a putative parent’s DNA is found in the oﬀspring, they cannot be parent and child. Similar arguments identify diploid siblings when many loci are considered. At each locus, siblings inherit one maternal and one paternal chromosome, from a choice of two in each case, so any overlap can be used to evaluate possible relationships. Still, any two individuals can be siblings, making studies of pairs of individuals problematic. However, it is not possible for any three individuals to be siblings. This observation underlies our methods here in ﬁnding sibgroups of siblings in wild populations of diploid organisms. We identify all triplets of individuals that could be found in the same sibgroup. If two population members are found in many compatible triplets, they are likely siblings. We develop an extremely simple polynomialtime heuristic for ﬁnding sibgroups that gives comparable or superior results to the state of the art in much smaller runtimes. Finally, we give our work a probabilistic basis. In a simple population generation model, a variant of our heuristic has failure probability shrinking exponentially with the number of loci sampled and the population size. V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 111–123, 2010. c SpringerVerlag Berlin Heidelberg 2010
112
D.G. Brown and T. BergerWolf
Kinship inference consists of a wide range of problems: identifying sibgroups is one of the simplest. However, our methods oﬀer the suggestion of a new procedure for solving this entire class of problems heuristically and accurately.
2
Related Work
Statistical methods for this problem, as in COLONY [15], compute the likelihoods of putative sibgroups in a probabilistic model. More recently, KINALYZER [2] has introduced a combinatorial approach: it identiﬁes subsets that could be complete sibgroups, and partitions the population in some optimal way (largely, minimizing the number of sibgroups). Minimizing this objective is NPhard [1]; integer programming or other bruteforce methods have worked for small data sets. This approach gives reasonable results [5], though much remains to be done for populations with small numbers of large families. However, the approach of computing the minimum total number of sibgroups has limitations. First, the integer programs can be huge: the number of maximal potential sibgroups can be exponential in the size of the problem instance. Second, the problem often shows multiple optima: there may be many distinct partitions of the population sample into the same minimum number of sibgroups, and it is not obvious how to choose a preferred answer from this set of optima; Sheikh et al. develop a consensus approach, but it is still challenging to ﬁnd a universally good answer [13]. Finally, it does not always solve the core problem, as evidenced by its moderate accuracy on some instances.
3
Preliminaries and Notation
We have a population of n oﬀspring from the same generation, whom we wish to divide into sibgroups from individual mating events between unknown parents. Individuals are diploid: they have two chromosomes of each type (we do not consider the sex chromosomes). One chromosome is inherited from each parent. At a single locus in the genome, an oﬀspring inherits one copy of the local DNA from its mother, and one from its father. In both cases, the inherited copy is one choice from the two possibilities corresponding to the parent’s two chromosomes. At some loci in the genome, there is much variability in the DNA found at that locus in the population, so oﬀspring may inherit diﬀerent DNA at those loci from each parent. For example, microsatellites, (“TATATA...”, for example), which are also known as Short Tandem Repeats (STRs) or Simple Sequence Repeates (SSRs), can be repeated a diﬀerent number of times. An individual might have 5 copies on one chromosome, and 12 on the other, indicated by the genotype “(5,12)”, denoting the pair of alleles. We assume such marker DNA is available at m diﬀerent genetically unlinked sites for each population member. (This requirement of no linkage is veriﬁed in microsatellite marker development.) We cannot identify which chromosome is derived from which parent of a population member. However, the genotype “(5,12)” indicates that one parent of the individual has allele 5 on one of its two chromosomes, and the other parent has allele 12 on one of its two chromosomes.
Discovering Kinship through Small Subsets
113
Some genotypes can be homozygotic, such as “(8,8)”, where the oﬀspring inherits the same allele from both parents, so each parent must have that allele on one of its chromosomes. Also, at diﬀerent loci, the meaning of the alleles diﬀers: at one locus, the allele 4 may indicate the presence of the sequence “TATATATA”, while at another, it might indicate the presence of “GGAGGAGGAGGA”. Our input data is an n × m matrix of genotypes: each row corresponds to a single population member pi and each column to a single locus j . Our goal is to partition the set P = {p1 . . . pn } into families {F1 . . . Ff } where each member of family Fi consists of full siblings from the same mating event. For parsimony reasons, we minimize the total number of families, which is NPhard to approximate to within a 153/152 ratio [1]. We give a heuristic which does well for this goal, and also at returning the true set of families.
4
Forbidden Sets
Previous work has focused on sets of population members that can be in the same sibgroup. We focus on sets that cannot be part of the same sibgroup. These are based on 3element subsets of the population, a polynomialsized group. This gives a small integer program, and some successful simple heuristics. 4.1
Forbidden Sets Are Triplets
Considering only the rules of genetic inheritance, any two oﬀspring x and y can, in principle, be full siblings: if at a single locus x has genotype (a, b) and y has genotype (c, d), their parents may have genotypes (a, c) and (b, d). However, it is not always possible that three oﬀspring {x, y, z} can be full siblings. If at the same locus x, y and z have genotypes (1, 2), (3, 4) and (5, 2), they cannot all be siblings: in the two genotypes of their parents, we must place ﬁve distinct alleles into four slots. Even with only three or four alleles in a set of oﬀspring at a locus, a triplet of individuals may be incompatible: for example, the genotypes (1, 1), (2, 3), (3, 4) cannot come from full siblings: the ﬁrst indicates that both parents have the 1 allele, leaving three remaining alleles and only two slots. This leads to the 2allele rule for a general set of oﬀspring who can feasibly be siblings due to BergerWolf et al. [4]. Let a be the number of distinct alleles at a locus in a set of individuals T , and let R be the number of alleles that are found either homozygously or paired with at least three other alleles. The members of T can all be siblings iﬀ at all loci, a + R ≤ 4. In fact, if a set of oﬀspring cannot all be siblings, they must have an incompatible triplet as a subset. Theorem 1. If T = {p1 , . . . pk } cannot form a valid sibgroup, then there must exist a subset {x, y, z} ⊂ T that is incompatible at at least one locus . Proof. There must be at least one locus where T does not satisfy the 2allele rule: at that locus, a + R > 4. Assume for contradiction that T  > 3 and all 3element subsets of T do satisfy the 2allele rule. We will have three cases. 1. If R = 0, then a ≥ 5. Pick one member x ∈ T with genotype (a1 , a2 ). At most two members of T share an allele with x, so since T  ≥ 4, there is a member
114
D.G. Brown and T. BergerWolf
of T with genotype (a3 , a4 ) with which x shares no alleles. Finally, pick a member of T with the ﬁfth allele, with genotype (a5 , ∗) for some choice for ∗. These three members form the forbidden triplet {(a1 , a2 ), (a3 , a4 ), (a5 , ∗)}. 2. If R = 1, then a ≥ 4. Either some allele a1 appears with three other alleles, giving the forbidden triplet {(a1 , a2 ), (a1 , a3 ), (a1 , a4 )}, or there is a homozygous member with genotype (a1 , a1 ). Pick that member, a member with genotype (a2 , a3 ) that shares no allele with it and a member with the fourth allele, (a4 , ∗). They form the forbidden triplet {(a1 , a1 ), (a2 , a3 ), (a4 , ∗)}. 3. If R = 2, then a ≥ 3. Either an allele is found with three others (a forbidden triplet), or there are two homozygotes, (a1 , a1 ) and (a2 , a2 ). Joined to (a3 , ∗), this gives the forbidden triplet {(a1 , a1 ), (a2 , a2 ), (a3 , ∗)}. 4.2
Forbidden Triplets as a Means of Finding a Partition
Three incompatible members {x, y, z} cannot be in the same sibgroup. We can verify in O(m) time if a triplet is compatible: at each locus it is a constanttime test. In O(n3 m) time, we can consider each such triplet. An Integer Programming Formulation. This observation gives a polynomialsized integer programming formulation of the problem of sibgroup reconstruction to minimize the number of sibgroups. Let xi,j = 1 iﬀ pi and pj belong to the same family (0 otherwise), and let qi = 1 iﬀ pi is the numerically ﬁrst member of the population in its sibgroup. We want to optimize this integer program: minimize qi subject to i
xi,j + xj,k + xi,k ≤ 1 if {pi , pj , pk } are incompatible xi,j + xj,k − xi,k ≤ 1 for all i, j.k distinct xj,i for all i = 1, . . . , n qi ≥ 1 − j=1...i−1
qi , xi,j ∈ {0, 1} for all i, j The ﬁrst set of constraints prevents incompatible triplets from joining the same family. The second set ensures the x relation is transitive. The rules for the qi variables ensure we count each family. The program has Θ(n2 ) variables, Θ(n3 ) constraints, and is impractical in early experiments: for the 59member shrimp population discussed below, the IP took 52 minutes to solve; our heuristic took 97 ms, and KINALYZER took a few minutes. A Heuristic for Finding Likely Pairings. An alternative approach uses valid triplets. If Fi is a true sibgroup, then for any {x, y} ⊂ Fi and z ∈ Fi , {x, y, z} is a compatible triplet; {x, y, z} may often form compatible triplets even if z ∈ Fi : at the loci studied, x and y may be similar, or the parents of z may be similar to the parents of x and y. If x and y are not from the same family, then the probability that they form a compatible triplet with an unrelated individual z is small, particularly if we study many loci.
Discovering Kinship through Small Subsets
115
This suggests a heuristic: if a pair {x, y} is part of many compatible triplets, they likely belong to the same sibgroup. We build a weighted graph G with nodes for population members: the weight w(e) of edge e = {x, y} is the number of population members z that do not make {x, y, z} a forbidden triplet. The graph Gt obtained when we ﬁlter out all edges with weight below t is highly clustered: its connected components often correspond to parts of true sibgroups. For example, consider the graph shown in Figure 1: here, nodes represent population members, and the groups indicated are known population sibgroups. Nodes x and y share an edge if they are part of the at least three compatible triplets; it is red if they participate in at least six. The graph is highly clustered, with three obvious sibgroups. Further, three quarters of the edges in this graph are within sibgroups, and all edges of weight greater than 3 are within sibgroups.
Fig. 1. Graph of compatibility found in a population of 59 shrimp. Nodes correspond to edges, clusters in the graph to true sibgroups. An edge exists between two nodes if they are found in at least 3 compatible triplets; it is red if they are found in at least 6. The highly clustered nature of this graph supports our simple heuristic.
We join clusters discovered together (if they are compatible) into putative sibgroups. Our algorithm has the following steps: 1. For each e = {x, y}, let we be the number of z where {x, y, z} is compatible. 2. Let threshold T = 0 and X be the entire population. Set C = ∅ be our set of discovered clusters. 3. While X is nonempty: (a) Compute the connected components of the graph GT with all edges e = {x, y} such that we ≥ T .
116
D.G. Brown and T. BergerWolf
(b) For each connected component c, if all elements of c are mutually compatible, add c to C and remove c from X. (c) Raise the threshold T by 1. 4. While there are still two clusters in C that can be joined together: (a) Join together the two compatible clusters c1 , c2 ∈ C that maximize the number of additional compatible triplets in a single cluster. This simple procedure runs in O(n3 m) time: the dominant step is the ﬁrst one. We have explored alternative rules for picking which clusters to join, such as maximizing the average number of compatible triplets per node newly joined into the same cluster; all had similar performance on simulated data. Alternatively, instead of removing edges below a ﬁxed threshold, we can start with singletons and keep adding heavy edges until there are clusters, which we join as before. We end up with a similar solution in a similar amount of time.
5
Experimental Results
We have validated the use of our heuristic for kinship inference on simulated and real data sets previously used by Chaovalitwongse et al. [5]. 5.1
Accuracy Measure
To evaluate the performance of heuristics for this problem, the standard measure is 1 minus the partition distance [9]. If the true partition of the original set into families is P , and we computed partition C, the distance between the two is the minimum fraction of population members that must be removed from the population in order to make P and C identical on the remaining members. This is computable in polynomial time using maximum matching algorithms [9], and gives an accuracy score ranging from min(1/P , 1/C) to 1. 5.2
Simulation Results
The simulation data sets explore a wide variety of parameters: the number of adult females (and the equal number of males), p; the number of loci, m; the number of distinct alleles present at each locus, a; the number of families, f ; and the size of each family (sibgroup), k. The model has the parents chosen at random from a pool of ten males and ten females, for each family. As such, two sibgroups may be halfsibs (sharing a parent), with both genders being promiscuous, which makes the problem harder. The simulations include data where a = 2, so any trio of population members are compatible. Our approach fails here (as does KINALYZER): both return a single family with all f k members. We report statistics for the simulated data set, and compare our results to those for the IMCS method [5] used in KINALYZER. We implemented our approach in Python 2.6 on a 3.06 GHz Macintosh with 2 GB of memory. Our new method, whose results are shown in Table 1, is approximately 5% more accurate than the IMCS procedure. The one exception is that for k = 10, our method gives results comparable to IMCS. (It is also 1000 times faster.)
Discovering Kinship through Small Subsets
117
Table 1. Simulation results for our new method, and those reported for the IMCS method. Our method is approximately 5% more accurate, and 700 times faster. Fixed parameter
Parameter IMCS New method settings runtime accuracy runtime accuracy 2 2.28 s 57.6% 66.9 ms 62.4% 4 8.28 s 66.5% 71.9 ms 69.6% m: number of loci 6 29.0 s 71.4% 75.3 ms 75.6% 10 239 s 71.9% 86.7 ms 79.2% 2 0.21 s 26.7% 97.2 ms 26.7% 5 30.5 s 72.2% 62.5 ms 75.6% a: number of alleles 10 225 s 81.8% 70.6 ms 90.4% 20 22.8 s 86.8% 70.5 ms 94.2% 2 0.72 s 78.1% 1.9 ms 82.1% f : number of sibgroups 5 3.65 s 64.6% 27.4 ms 69.4% 10 205 s 57.9% 196 ms 63.7% 2 2.67 s 54.4% 2.6 ms 65.1% k: size of sibgroup 5 14.4 s 69.8% 28.5 ms 74.1% 10 192 s 76.4% 195 ms 75.9%
Where k = 10, if we remove the results from the instances where a = 2, our method gives 92.3% success, while IMCS gives 92.9%. Our method is also much faster: 700 times faster for the entire experiment, and consistently much faster except for the degenerate cases like a = 2, where our algorithm must discover each triplet is compatible. The runtime is stable with some parameters that slow IMCS down, such as a (number of alleles per locus) and m (number of loci). We discover most incompatible triplets quickly, so increasing the number of loci or alleles has minimal eﬀect. Increasing the population size slows both methods, though this eﬀect is smaller for the new heuristic than for IMCS. We can also use the heuristic to study far larger families: using the same breadth of choices for the other parameters, we ﬁnd that if k = 30, our procedure requires an average of 10.9 s, and gives overal accuracy 76.7% (93.3% if a = 2), while for k = 50, our procedure takes 50.4 s and gives overall accuracy 77.3% (94.1% if a = 2). Note that for k = 50, f = 10, we are computing tests on populations of size 500, enumerating all 20.8 million triplets and testing them for compatibility; these runs averaged 132 s (102 s when a = 2), of which 95% or more of the runtime was spent enumerating and testing triplets. 5.3
Real Data
Benchmark data for kinship inference with known ground truth and no genotyping errors are uncommon. Here, we present results for a handful of data sets for which the data collection method allows some certainty in knowing which population members are from the same sibgroup. These data originate from wild populations of shrimp, ants, salmon, turtles, ﬂies and radishes. Despite their simplicity, our methods perform comparably to
118
D.G. Brown and T. BergerWolf
Table 2. Results for biological data. Our procedure continues to be much faster than the IMCS procedure, though the enumeration of all triplets is slow for large populations like the radishes. Accuacy is comparable for the two systems.
Species Sibgroups Loci Shrimp [12] 13 7 6 2 Flies [3] Salmon [11] 6 4 Radishes [6] 2 5 26 3 Turtles [7] Ants [10] 10 6
Population size 59 190 351 531 175 377
IMCS runtime accuracy 185 s 100% 22.8 s 47.4% 149 s 98.3% 26.3 s 52.5% N/A N/A N/A N/A
New method runtime accuracy 97 ms 100% 12.9 s 46.3% 20.8s 98.3% 316 s 52.3% 9.35 s 41.3% 62.6 s 98.4%
that of the IMCS method on the four sets for which the results of that method are available, while being substantially faster, as shown in Table 2. In particular, our algorithm is 2000 times faster on the small shrimp population. One exception is the radish population: here, the population is properly divided into two very large subgroups, and only three loci oﬀer any kinship information at all; most pairs of population members from the same family or diﬀerent families are compatible with members of both groups, and there are many genotyping errors. Our algorithm enumerates all triplets, and then must move to a very high threshold in the clustering algorithm, and then essentially returns a random partition (and, indeed, the result is similar for IMCS, which simply takes less time producing this result). Similarly, for the turtle population, since there are only three loci, we cannot easily separate sibgroups.
6
Probabilistic Arguments
Why does such a simple heuristic work so well for a problem known not only to be NPhard, but MAXSNPhard? We give a partial answer to the question: assuming that families are fairly large, we separate between the number of compatible triplets {x, y, z} of which members x and y of the same family are part and the number of compatible triplets of which members x and y of diﬀerent families are part. In particular, if we sample populations from a natural probabilistic model at enough loci, then with high probability, the weighted graph we described in our heuristic will, at the correct threshold, divide cleanly into cliques exactly corresponding to the true families we seek. Our bounds are fairly coarse; still, this argument goes far toward justifying the heuristic in the previous section. 6.1
A Probabilistic Model
We assume we are studying a population that arises from the following probabilistic model. There is a pool of adults who are not kin (ﬁrst degree relatives). There are f ≥ 5 matings of the adult pairs, with monogamy of both sexes, each mating producing k juvenile oﬀspring. The juveniles are sampled at m loci. We
Discovering Kinship through Small Subsets
119
assume that the parents have a ≥ 5 alleles in each locus and each parent has two of these alleles chosen with replacement uniformly at random from among those a (thus, each allele has probability 1/a). The oﬀspring then have one of the two alleles of each parent (with probability 1/2) at each locus. The resulting population of juvenile oﬀspring has kf members. 6.2
A Simplified Algorithm
Next, we assume k is known. For each pair of oﬀspring population members e = {x, y}, let we be the number of compatible triplets {x, y, z} containing x and y. Now, let G be a graph whose nodes are population members, and for which e = {x, y} is an edge when we ≥ k − 2. G contains as a subgraph f clique of size k corresponding to the families: for any pair {x, y} in a single family Fi , it is compatible with all k − 2 other members of Fi , so e = {x, y} is in G. If G contains other edges, then our clustering idea may fail: we may need to raise the threshold T in our algorithm too high for the connected components to correspond to a true sibgroup. Thus, we consider whether any pair e of members of diﬀerent families will have we ≥ k − 2. 6.3
A Bound with Two Families
First, let f = 2, so we have 2k oﬀspring, divided into families F1 and F2 . We bound the failure probability by looking at a single pair x ∈ F1 and y ∈ F2 : Theorem 2. Suppose we are given a 2family population from our model. For an arbitrary x ∈ F1 and y ∈ F2 , let c1 (x, y) = {z ∈ F1  {x, y, z} are compatible}. The c1 variables are identically distributed, and the failure probability of the clustering algorithm is bounded above by 2k 2 p, where p = Pr[c1 (x, y) ≥ k−2 2 ]. Proof. All population members are drawn from the same distribution, so by symmetry, the c1 random variables share the same distribution, though they are not independent. We know that the algorithm only fails if there exist x ∈ F1 and y ∈ F2 such that w{x,y} ≥ k − 2; for this to happen, one of the two families must contain k−2 2 valid third members of a compatible triplet. But this is equally likely for each family, so we can bound the probability by 2p. Since there are k choices for each of i and j, the 2k 2 p bound holds. The Probability that k1 is Very Large. Now, what is the distribution of k1 ? Once we consider only y ∈ F2 , we no longer care about the parents for F2 ; at each locus, the genotype for y is the conﬂation of the toss of two asided dice. We also choose the genotype for x by tossing two asided dice. The ﬁnal choice we must make is the choice of the two alleles (one paternal, one maternal) of the parents of F1 not found in the genotype of x at that locus; these choices are also independent of the choices of genotypes for x and y. For any z ∈ F1 , let qz be the event that {x, y, z} are compatible. These events are independent, conditioned on x, y and the hidden alleles in the parents of F1 : we make independent choices at each locus to pick the alleles at that site in z. At each locus, the probability that z is compatible with x and y is a multiple of
120
D.G. Brown and T. BergerWolf
1/4, and is at least 1/4, since we might choose both alleles for z that were found in x. The overall probability that {x, y, z} are compatible is the product of these locus probabilities, and so is a multiple of 4−m . Let this probability be q. Then k1 is the sum of f − 1 independent Bernoulli trials, each with probability q. Consider two kinds of bad events. First, if q is large, there will likely be many members of F1 that make compatible triplets with x and y: this is when y appears closely related to F1 . The other bad event is that q is small, and yet many members of F1 are compatible with x and y. We ﬁrst bound the second bad event. Since f is at least 5, we must have at least 2/5 of the members of F1 − {x} form a compatible triplet with x and y. 1 Assume q < 5e . By a standard application of the Chernoﬀ bound [8], Pr[k1 ≥ −.4(k−1) .4(k − 1)] ≤ 2 < .76k+1 . 1 Now, consider the other bad event, where q ≥ 5e . Recall that q is the product of m multiples of 1/4, one for each locus. If, at two loci, the probability that x 1 and y are compatible with a member of F1 is 1/4, then q < 1/16, so q < 5e . At any locus, we picked the six alleles (two in x, two in y and the two “hidden” alleles of F1 ) uniformly from {1 . . . a}. Let r be the probability that the only way {x, y, z} can be compatible at a site is if z shares the alleles of x. This probability rises as a function of a, and is 0.08064 if a = 5, which can be shown by enumeration. So, at each locus, with at least 0.08 probability, the value of 1/4 is multiplied into q. The probability that at most one such value of 1/4 is multiplied in, then, is at most .92m + .08m(.92)m−1 , as the loci are independent. is bounded above by .76k+1 + The overall probability, then, that k1 ≥ k−2 2 m m−1 .92 + .08m(.92) , and the overall failure probability for our clustering algorithm is at most 2k 2 (.76k+1 + .92m + .08m(.92)m−1 ), which drops exponentially as both k, the family size, and m, the number of loci, grow. Because of the quadratic dependency on k, however, it takes a while for this bound to become strong. For example, if k = 40, m = 40, a = 10, we have a bound of 0.05 on the failure probability; in practice, problems of size k = 10, m = 10, a = 10 never failed in 10,000 instances, despite the bound oﬀering no guarantee for problems of this size. 6.4
Extending to Multiple Families
If f > 2, the problem becomes more diﬃcult. As before, the 2f parents have their genotype at each locus chosen uniformly from {1 . . . , a}. Now, the question is: are there pairs x, y from diﬀerent families that have at least k − 2 compatible population members? If so, then there exists a family Fi such that {z ∈ . Let us call these events A(x, y, i), where x < y Fi {x, y, z} compatible} > k−2 f and x and y are in diﬀerent families; we are interested in Pr[ x,y,i A(x, y, i)] ≤ k Pr[A(x, y, i)] x,y,i Pr[A(x, y, i)]. By symmetry, this bound equals (f k)(f −1) 2 k for any x ∈ F1 and y ∈ F2 ; this, then equals (f k)(f − 1) 2 (2 Pr[A(x, y, 1)] + (f − 2) Pr[A(x, y, 3)]), also by symmetry arguments. Consider these two events A(x, y, 1) and A(x, y, 3) in turn. The ﬁrst of these is parallel to what we had before: we need to bound the probability that x and y ﬁnd many compatible third members in F1 , the family that contains x.
Discovering Kinship through Small Subsets
121
The genotype of z ∈ F1 is chosen at each locus by two coin tosses, so the probability q that a member of F1 − {x} is compatible with x and y is a multiple 2 of 1/4. If q < 5ef , then by the same use of the Chernoﬀ bound as before, 2 ] < 2−.8k/f < .58k/f , dropping exponentially as k grows. Pr[A(x, y, 1)q < 5ef 2 What is the probability that q < 5ef ? Consider how often we multiply 1/4 as one of the factors from the m loci that makes up q. If we include at least 1 2 + log4 f such factors of 1/4, then q will certainly be less than 16f , so less than the minimum threshold needed. At each locus, we multiply a 1/4 into q with probability at least 0.08, and each locus is independent. Using straightforward 2 by Chernoﬀ bounding techniques, we can bound the probability that q < 5ef 2+log4 f m−4−2 log4 f .92 , dropping exponentially in m. (2 + log4 f )m The second bad event, A(x, y, 3), is easier to analyze: if we choose x and y randomly and the two parents for a third family F , at any given locus randomly, the probability that no child of F could be compatible with x and y is at least .16 if a ≥ 5. As such, Pr[A(x, y, 3)] ≤ .84m . So the overall probability that the algorithm fails is at most: k (f k)(f − 1) [2(.58k/f + (2 + log4 f )m2+log4 f .92m−4−log4 f ) + (n − 2) · .86m )], 2 dropping exponentially as both k and m grow. 6.5
Extending to More Robust Models
This proof, which also has a weak bound, can be extended to models with nonidentical allele frequencies; the only change is the constant corresponding to the probability that two members of one family and one of another will be compatible (found in both proofs) or that three members of diﬀerent families will be compatible. The overall result, that the failure probability falls exponentially with the number of members per family and the number of loci, is still the case. One situation that does not easily work is for variable family sizes: for small families, it is entirely possible that we will not compute the correct assignment. We note ﬁnally that this heuristic algorithm experiences better performance as populations and loci expand. The runtime is cubic in the population size; moreover, as the overwhelming majority of the runtime is in the testing of triplets for compatibility, the heuristic is embarrassingly parallel.
7
Future Work
This simple heuristic approach to a single kinship discovery problem, that of full sibgroup detection, may be extended to other areas of this general problem domain. Recent work has moved to the discovery of halfsibling groups, with a diﬀerent combinatorial goal [14], but it is likely that our simple procedures can discover good subgroups of true families here as well. It is not obvious how easily to move from the simple combinatorial goal of discovering sibgroups to more complex kinships, such as multigenerational families; however, this is a major challenge for current software in general.
122
D.G. Brown and T. BergerWolf
Our current procedure is extremely fast, but still could easily be sped up: at the present time, the vast majority of work time is spent enumerating triplets, and comparing their values to triplets already known to be compatible or incompatible. However, with the three orders of magnitude of speedup that our procedure gives on small populations, it may make more sense to concentrate on solving instances more successfully. In particular, we might focus on joining the clusters found in the early stage of our algorithm using a more intelligent method than just looking at pairs of clusters. Still, our current work gives an almost embarrassingly simple procedure for discovery of sibgroups, with extremely fast performance and success comparable to the state of the art. A probabilistic argument gives a justiﬁcation for the argument: for large families and many loci, a generalization of our procedure has high probability of identifying exactly the correct families. This result is interesting, given the M AXSN P hardness of ﬁnding the minimum number of sibgroups: can we give a complexity result, for example using parameterized complexity, that justiﬁes this surprising dichotomy?
References 1. Ashley, M., BergerWolf, T., Berman, P., Chaovalitwongse, W., DasGupta, B., Kao, M.Y.: On approximating four covering and packing problems. J. Comp. and Sys. Sci. 75(5), 287–302 (2009) 2. Ashley, M.V., Caballero, I.C., Chaovalitwongse, W., DasGupta, B., Govindan, P., Sheikh, S., BergerWolf, T.Y.: Kinalyzer, a computer program for reconstructing sibling groups. Mol. Ecol. Res. 9, 1127–1131 (2009) 3. Wilson, A., Barker, J.: Isolation and characterization of 20 polymorphic microsatellite loci for Scaptodrosophila hibisci. Mol. Ecol. Notes 2, 242–244 (2002) 4. BergerWolf, T., Sheikh, S., DasGupta, B., Ashley, M., Caballero, I., Chaovalitwongse, W., Putrevu, S.L.: Reconstructing sibling relationships in wild populations. Bioinf. 23(13); Proceedings of ISMB 2007 (2007) 5. Chaovalitwongse, W., Chou, C., BergerWolf, T., DasGupta, B., Sheikh, S., Ashley, M.V., Caballero, I.C.: New optimization model and algorithm for sibling reconstruction from genetic markers. INFORMS J. Comp. 22(1), 180–194 (2010) 6. Conner, J.K.: Personal Communication (2006) 7. Crim, J., Spotila, L., Spotila, J., O’Connor, M., Reina, R., Williams, C., Paladino, F.: The leatherback turtle, Dermochelys coriacea. Mol. Ecol. 11(10), 2097–2106 (2002) 8. Devdatt, D., Panconesci, A.: Concentration of measure for the analysis of randomized algorithms. Cambridge Press, New York (2009) 9. Gusfield, D.: Partitiondistance: A problem and class of perfect graphs arising in clustering. Info. Proc. Lett. 82(3), 159–164 (2002) 10. Hammond, R.L., Bourke, A.F.G., Bruford, M.W.: Mating frequency and mating system of the polygynous ant, Leptothorax acervorum. Mol. Ecol. 10(11), 2719–2728 (1999) 11. Herbinger, C.M., O’Reilly, P.T., Doyle, R.W., Wright, J.M., O’Flynn, F.: Early growth performance of atlantic salmon fullsib families reared in single family tanks versus in mixed family tanks. Aquaculture 173(14), 105–116 (1999)
Discovering Kinship through Small Subsets
123
12. Jerry, D., Evans, B., Kenway, M., Wilson, K.: Development of a microsatellite DNA parentage marker suite for black tiger shrimp Penaeus monodon. Aquaculture, 542– 547 (2006) 13. Sheikh, S., BergerWolf, T., Khokhar, A., DasGupta, B.: Consensus methods for reconstruction of sibling relationships from genetic data. In: Proceedings of the 4th Workshop on Advances in Preference Handling (2008) 14. Sheikh, S., BergerWolf, T., Khokhar, A., Caballero, I., Ashley, M., Chaovalitwongse, W., DasGupta, B.: Parsimonybased reconstruction of halfsibling groups. J. Bioinf. and Comp. Biol. (to appear) 15. Wang, J.: Sibship reconstruction from genetic data with typing errors. Genetics 166, 1968–1979 (2004)
FixedParameter Algorithm for Haplotype Inferences on General Pedigrees with Small Number of Sites Duong D. Doan and Patricia A. Evans Faculty of Computer Science, University of New Brunswick, Fredericton, New Brunswick, Canada, E3B 5A3 {b89ct,pevans}@unb.ca
Abstract. The problem of computing the minimum number of recombination events for general pedigrees with a small number of sites is investigated. We show that this NPhard problem can be parametrically reduced to the Bipartization by Edge Removal problem with additional 2 parity constraints. The problem can be solved by an O(2k 2m n2 m3 ) exact algorithm, where n is the number of members, m is the number of sites, and k is the number of recombination events.
1
Introduction
Human genomes contain two copies of each chromosome. Research shows that single chromosomes, called haplotypes, are useful to study complex genetic diseases. While genomic data, called genotypes, are abundant and easy to collect, haplotypes are rare and much more diﬃcult to obtain by a biochemical method. Therefore, computationally inferring haplotypes from genotype data, called haplotyping, is necessary. Genotypes can be obtained from a population group where relationships between members are unknown or from a family pedigree with known relationships between members. We only consider pedigree data. In the absence of recombination events, haplotypes of members in a pedigree follow the Mendelian law of inheritance, where the two haplotypes of a child are transferred from its parents, one haplotype from its father and the other from its mother. Various haplotyping algorithms exist for nonrecombinant pedigree data [1,3], especially a linear algorithm for tree pedigrees [1] and a nearlinear algorithm for general pedigrees [3]. Haplotype inference is complicated by recombination events and the complex structures of the data. In recombination events, complementary parts of both of a parent’s haplotypes can be inherited as a single combined haplotype of a child. Structures of the pedigree can be complex, where there are multiple inheritance paths between some family members. When recombination events are allowed, the problem of inferring haplotypes for pedigrees with the minimum number of recombination events is NPhard, even for general pedigrees with only two sites or tree pedigrees with multiple sites [8]. For reconstructing haplotype conﬁgurations for pedigree data, Qian and Beckmann [11] proposed a rulebased algorithm with a time complexity V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 124–135, 2010. c SpringerVerlag Berlin Heidelberg 2010
FixedParameter Algorithm for Haplotype Inferences on General Pedigrees
125
O(2d n2 m3 ), for n members, m sites, and family size ≤ d. The main principle of their algorithm is that the best haplotype conﬁguration for pedigree data is the one that minimizes the number of recombination events (the MRHC problem). Li and Jiang [7] proposed an integer linear programming (ILP) formulation for the MRHC problem. When the number of recombination events is strictly smaller than a positive number k, an O(mn · logk+1 n) time probabilistic algorithm is given on tree pedigrees [12]. Doan and Evans [4] presented an O(2k · n2 ) time ﬁxedparameter algorithm for general pedigrees where each member has two sites, a special case of the problem that is still NPcomplete. We study the haplotype inference for general pedigrees with recombination events when the number of recombination events k and the number of sites m in an input pedigree are small. We also assume that there are no data missing and no data errors. We prove that our problem can be reduced to the problem of ﬁnding the line index of a signed graph [13] with additional parity constraints. We further show that ﬁnding the line index of a signed graph can also be reduced to the Graph Bipartization by Edge Removal (GBER) problem with parity constraints. The GBER problem is ﬁxedparameter tractable, but the existing solution [5] cannot satisfy the additional parity constraints. We present an algorithm that solves the problem while still satisfying the additional constraints, and thus show that the Recombinant Haplotype Conﬁguration problem can be 2 solved by a ﬁxedparameter algorithm with a running time of O(2k 2m n2 m3 ), for n members, m sites, and k recombination events. This result extends our prior work for pedigrees with two sites to an arbitrary small number of sites.
2
Preliminaries
A member is an individual. A set of members is called a family if it includes only two parents and their children; it is a parentoﬀspring trio (hereafter a trio) if only two parents and one child are considered. A set of families connected through known family relationships is a pedigree. In diploid organisms, a cell contains two copies of each chromosome. The description data of the two copies are called a genotype while those of a single copy are called a haplotype. A speciﬁc location in a chromosome is called a site and its state is called an allele. There are two main types of sites, microsatellites and single nucleotide polymorphisms. A microsatellite site has several diﬀerent states while a single nucleotide polymorphism (SNP) site has exactly two possible states, denoted by 0 and 1. Only SNPs with two possible states are considered in this paper, as in other works on haplotype inference. If the states at a speciﬁc site in two haplotypes are the same, then this site is a homozygous site (00 or 11); if they diﬀer, it is heterozygous (01 or 10). Two haplotypes combine together to form one genotype. Each member u has two haplotypes, denoted by h1u and h2u , which are vectors of 0 and 1’s of length m, where m is the number of sites. The genotype of u, gu , is a vector of 0’s, 1’s and 2’s of length m, where gu [i] = 0 means h1u [i] = 0 = h2u [i], gu [i] = 1 means h1u [i] = 1 = h2u [i], and where gu [i] = 2 means {h1u [i], h2u [i]} = {0, 1}. We say
126
D.D. Doan and P.A. Evans
h1u and h2u are consistent with gu . The complement haplotype of a haplotype ¯ where h ¯ = 1 − h so, ¯0 = 1 and ¯1 = 0. h at a heterozygous site is denoted by h, The problem in this paper is to ﬁnd the haplotypes h1u and h2u for all members u that minimize the number of recombination events, given their genotypes gu . A set of haplotypes found for all members is called a haplotype conﬁguration. When gu [i] = 0 or 1, then h1u [i] and h2u [i] are known, but if gu [i] = 2, we may not yet know the value of h1u [i] and h2u [i], in which case we give them the value “?”, and say that the site is unresolved. Our problem is deﬁned as follows. RHCopt : Given the genotypes of a general pedigree P containing n members, where each member has m sites (m is small), ﬁnd a haplotype conﬁguration that minimizes the number of recombination events. This optimization problem, called Recombination Haplotype Conﬁguration (RHCopt ) which is identical to MRHC, was proven NPhard [8]. We investigate the corresponding decision version of RHCopt . RHCk : Given positive integers k and the genotypes of a general pedigree P containing n members, where each member has m sites (m is small), is there a haplotype conﬁguration with at most k recombination events explaining P ?
3
Setting Up Graphs
Given a general pedigree with n members, where each member has m sites, we set up a pedigree graph G = (V, E) and parityconstraint sets Spc . A recombination event can only be detected if there is at least one heterozygous site on each side of a recombination breakpoint, e.g. we cannot detect if a recombination event happens between homozygous sites 1 and 3 of member u in Figure 1. We capture constraints between pairs of closest heterogynous sites and pairs of closest homozygous sites to detect possible recombination events in pedigrees.
c 2 2 2 1 2 a. Pedigree structure and genotype data
u
u12 u23
[
0 1 1 2 2
u45
v
v12
[
v
u 1 0 0 2 2
v23 v45
c c12 positive edge
c23
negative edge
c35
b. Pedigree graph is created
u
v
2 1 2 2
2 2 1 2 c 2 negative edge 1 1 1
c. Additional vertices created
Fig. 1. Pedigree graph created from pedigree structure and genotype data. ⊕ denotes a red vertex, denotes a green vertex, and O denotes a grey vertex.
FixedParameter Algorithm for Haplotype Inferences on General Pedigrees
3.1
127
Pedigree Graph
Create grey vertices. Let i be a heterozygous site in u (i = 1, ..., m − 1). Let j > i be the closest heterozygous site to i in u. We create a vertex uij from site i and site j and label this vertex grey. A grey vertex is an unresolved vertex and will later be resolved green if h1u [i] = h1u [j] = 0 or h1u [i] = h1u [j] = 1. It is resolved red otherwise. The resolution of a grey vertex depends on its adjacent vertices. Figure 1 shows a grey vertex u45 created from sites 4 and 5 of u. Create red and green vertices. Let i be a homozygous site in u (i = 1, ..., m− 1). Let j > i be the closest homozygous site to i in u. We create a vertex uij from site i and site j, and label this vertex red if gu [i] = gu [j] and green if gu [i] = gu [j]. A red or green vertex is a resolved vertex. Figure 1 shows a red vertex u12 created from sites 1 and 2, and a green vertex u23 from sites 2 and 3. Insert positive edges. We insert positive edges between a parent u and its direct child v. For each vertex uij in u, if there is a vertex vij in v we insert a positive edge between uij and vij . If there is not a vertex vij in v and i and j are both homozygous sites or both heterozygous sites in v, we create a vertex vij in v and label this vertex properly, inserting a positive edge between uij and vij . We call vij a supplementary vertex as it is created by the need of member u. Similarly, for each vertex vij in v, if there is not a vertex uij in u, and i and j are both homozygous sites or both heterozygous sites in u, we create a supplementary vertex uij in u and label this vertex properly, inserting a positive edge between uij and vij . Figure 1.b shows four positive edges linking u12 and c12 , u23 and c23 , v12 and c12 , v23 and c23 . A positive edge between vertices uij and vij means vertex uij and vij should be resolved with the same color (both red or both green) unless a recombination event occurs in u. The reason for this is that if there is no recombination event in u, then v receives one full haplotype from u and another full haplotype from another parent. Therefore, the label of uij and the label of vij should be the same if there is no recombination event; otherwise, there is a recombination event in u. If uij is a resolved vertex and there is a positive edge between uij and a grey vertex vij , we color vij the same as the color of uij , since a recombination event at uij is not detectable and does not aﬀect the color of vij . Insert negative edges. We insert negative edges between two parents u and v of a common child c. If uij is a vertex in u but there is not a vertex cij in c (sites i and j are one homozygous and one heterozygous in c), two situations happen. If there is a vertex vij in v, we insert a negative edge between uij and vij . Otherwise, if there is not a vertex vij in v and i and j are both homozygous sites or both heterozygous sites, we create a supplementary vertex vij in v and label it properly. We insert a negative edge between uij and vij . Similarly, if vij is a vertex in v but there is not a vertex cij in c, there are two situations. If there is not a vertex uij in u, and i and j are both homozygous or both heterozygous, we create a supplementary vertex uij in u, and insert a negative edge between uij and vij . Figure 1.b shows a negative edge linking u45 and v45 .
128
D.D. Doan and P.A. Evans
A negative edge between uij and vij means vertices uij and vij should be resolved with diﬀerent colors unless a recombination event occurs in one parent of c. This phenomenon can be explained as follows. If there is no recombination event and uij and vij have the same label (both red or both green), then sites i and j of c must be both homozygous or both heterozygous based on the Mendelian law of inheritance. Because sites i and j of c are one homozygous and one heterozygous, one recombination occurs if uij and vij have the same label when resolved, but no recombination event occurs if they are resolved diﬀerently. Create additional vertices. Consider a grey vertex uij in u (i < j). It is possible that uij has no incident edge but there is one recombination event occurring between site i and j. In this case none of the other two members in the trio has vertex created for site i and j. We delete vertex uij and create an additional vertex to capture the recombination event. Let j be the closest heterozygous site from j in u (j < j ), where i and j are both heterozygous sites or both homozygous sites in at least one member among the other two members, say v. If there is not a vertex uij in u, we create an additional grey vertex uij in u and create a supplementary vertex cij from sites i and j in c if it does not exist. We color cij properly and insert a corresponding edge (positive or negative) between uij and vij depending on the relationship between u and v. Figure 1.c shows an additional vertex u14 created represented by a dashed edge between sites 1 and 4. A negative edge is inserted between u14 and v14 . Pedigree graph. Pedigree graph G = (V, E) created as described above is an undirected graph. Each vertex y ∈ V has three possible labels, red, green, and grey. Each edge e(y, z) ∈ E is either a positive edge, e ∈ Epos , or a negative edge, e ∈ Eneg , with E = Epos ∪ Eneg . Graph G, set up this way, is a signed graph [13]. Let N (y) be the set of adjacent vertices of y. Let w(e) be the weight of edge e. If e is a positive edge, w(e) = +1 . If e is a negative edge, w(e) = −1. Observation 1. There are at most O(n · m2 ) vertices and O(n · m2 ) edges in the pedigree graph. Each member has m sites. The total number of vertices created from pairs of sites for each member is O(m2 ). The whole pedigree graph with n members has O(n · m2 ) vertices. A vertex has at most two positive edges linking it to two vertices in its parents. Therefore, the number of positive edges is linear in the number of vertices. The number of negative edges is also linear to the number of vertices. Thus the number of edges in the pedigree graph is O(n · m2 ). 3.2
ParityConstraint Sets
When a supplementary grey vertex uij is created in u by the need of an adjacent member, there must be more than one grey vertex already created from site i to site j in u. It is important to ensure that these grey vertices and uij when resolved will not result in an odd number of red vertices. Recall that a grey vertex is resolved red if h1u [i] = h1u [j]. In other words, the value of h1u ﬂips
FixedParameter Algorithm for Haplotype Inferences on General Pedigrees
[
u23
u15
u34 u45
a. Member u with 5 grey vertices created
[
u45
u15
b. An invalid solution
u23
u34
u45
[
u34
u12
[
u12
u23
[
u12
129
u15
c. A valid solution
Fig. 2. Parity conﬂict between vertices within each member
from 0 to 1 and vice versa for a red vertex uij . Therefore there is a parity conﬂict if the number of red vertices from site i to site j including uij is odd. In Figure 2.a, there are ﬁve grey vertices created for member u where vertices u12 , u23 , u34 and u45 are created from closest heterozygous sites, and a supplementary vertex u15 is created for a member adjacent to u. Figure 2.b shows an invalid solution with three resolved red vertices u23 , u34 and u15 in member u. A valid solution with an even number of red vertices is shown in Figure 2.c. We create parityconstraint sets Spc to capture parity constraints between each supplementary vertex and other vertices within each member. Let uij be a supplementary vertex and uip , ..., uqj be grey vertices from site i to site j. These vertices form a parityconstraint set, and its total number of red vertices must be even. There are O(m2 ) parityconstraint sets in each member and O(nm2 ) parityconstraint sets for the whole pedigree graph. A valid solution for RHCk must ensure that the number of red vertices in each parityconstraint set is even.
4
Signed Graph
A graph G = (V, E) is a signed graph if it has both positive and negative edges (E = Epos ∪ Eneg ) [13], where w(epos ) = 1 and w(eneg ) = −1. Let (V1 , V2 ) be a partition of V , and E ∗ be the set of edges between V1 and V2 . The line index of the cut (V1 , V2 ) is deﬁned as: w(e) + w(e) (1) l(V1 , V2 ) = e∈E ∗ ∩Epos
e∈Eneg \E ∗
The line index of graph G is deﬁned as: l(G) = min l(V1 , V2 ) V1 ⊆V
(2)
The decision version of the line index of graph G is deﬁned as follows. LineIndexk : Given a signed graph G and a positive integer k, is there a line index of G at most k? Given a pedigree graph G = (V, E), the RHCk problem can be solved by determining if we can label every grey vertex in G either red or green such that if we
130
D.D. Doan and P.A. Evans
partition the set of vertices V into (Vred , Vgreen ) and let E ∗ be the set of edges between Vred and Vgreen then e∈E ∗ ∩Epos
w(e) +
 w(e) ≤ k
(3)
e∈Eneg \E ∗
and this partition (Vred , Vgreen ) must satisfy parityconstraint sets Spc . Given a pedigree graph, any two adjacent members linked by a positive edge should be in the same partition, and any two adjacent members linked by a negative edge should be in diﬀerent partitions. Any edge whose constraint is not satisﬁed represents a recombination event between the two adjacent members, or, in the case of a negative edge having endpoints in the same partition, between one parent and the child. Equation 3 thus counts the number of recombination events in the whole pedigree and ensures that it is at most k. Clearly, the RHCk problem can be reduced to the LineIndexk problem with additional parityconstraint sets Spc on its vertices. We will show that the LineIndexk problem can be reduced to the GBER problem, a classic NPcomplete problem that is ﬁxedparameter tractable. The RHCk can therefore be solved through the GBER problem with additional parityconstraint sets Spc . Theorem 1. A pedigree has at most k recombination events if and only if its corresponding signed graph has the line index of size at most k. Proof. We will show that one recombination event in the pedigree corresponds to exactly one negative edge within each partition or one positive edge crossing partitions in the signed graph. ⇒ Consider a recombination event in member u. To detect this recombination event there must be at least one heterozygous site on each side of the recombination breakpoint. Let i and j be the two closest heterozygous sites on the two sides of the recombination breakpoint. There are three possible types of vertices associated with this recombination event: a grey vertex uij , an additional vertex uij , and supplementary vertices upq (p ≤ i, j ≤ q). If vertex uij has an incident positive edge to a vertex cij , the color uij should be diﬀerent from the color of cij because of the recombination event and the positive edge between them would cross between partitions. On the other hand, if uij has an incident negative edge to a vertex vij , the color uij and vij should be the same because of the recombination event and the negative edge between them would be within the same partition. In both cases the line index increases by one. An additional vertex uij replaces uij when uij has no incident edge. The resolution of an additional vertex uij is similar to that of uij . Consider a supplementary vertex upq constrained by a parityconstraint set Spc where upq has an incident positive edge to a vertex cpq . The color upq is determined by the swap of values in h1u by red vertices and recombination events from p to q, including the recombination from i to j. If no more recombinations happen, upq and cpq must have the same color and the line index of the signed graph is the same. If upq and cpq have diﬀerent colors, there must be another
FixedParameter Algorithm for Haplotype Inferences on General Pedigrees
131
recombination from sites p to q and the line index increases by one. A similar explanation follows for upq with an incident negative edge. ⇐ A negative edge links two vertices of two parents in a trio, and the two vertices are supposed to have diﬀerent colors based on the Mendelian law of inheritance. Similarly, a positive edge links two vertices of a parent and a child and the two vertices are supposed to have the same color. Therefore, if a negative edge linking two vertices with the same color or a positive edge linking two vertices with diﬀerent colors, one recombination event must happen.
5
FixedParameter Algorithm
A NPhard problem cannot be solved by a polynomial time algorithm unless P=NP. However, if we can restrict some parameters of the problem to small values, the running time of an algorithm for the problem can potentially be greatly reduced [10]. In this case, the problem is a parameterized problem and an algorithm that can solve the parameterized problem eﬃciently is a ﬁxedparameter algorithm, deﬁned as follows [10]. Definition 1. A parameterized problem is a language L ⊆ Σ ∗ x Σ ∗ , where Σ is a ﬁnite alphabet. The second component is called the parameter of the problem. Practically, the parameter is a nonnegative integer or a set of nonnegative integers and therefore L ⊆ Σ ∗ x N. For (x, k) ∈ L, the size of the input is n = (x, k), and the parameter is k. Definition 2. A parameterized problem L is ﬁxedparameter tractable (in class FPT) if it can be determined in f (k) · nO(1) time whether or not (x, k) ∈ L, where f is a computable function only depending on k. 5.1
Transforming to Bipartization by Edge Removal Problem
We review an important property of a signed graph given by [13]. Theorem 2. Let G be a signed graph. If we replace each edge with weight w(e) > 0 by two consecutive edges with weight w(e) to get a graph G then l(G) = l(G ). The pedigree graph is transformed into a new graph by replacing every positive edge by two consecutive negative edges and adding new intermediate vertices (dum vertices). We obtain a new weighted graph G with all negative edges. This transformation does not aﬀect the parityconstraint sets Spc . The graph G still has only O(n · m2 ) vertices and O(n · m2 ) edges. Equation 3 becomes w(e) ≤ k (4) e∈Eneg \E ∗
This equation is to ensure that the total number of edges within V1 and edges within V2 is at most k. Removing these edges will make the graph bipartite.
132
D.D. Doan and P.A. Evans
To make the GBER algorithm [5] works on our partially colored graph, we merge all red vertices into one red vertex and all green vertices into one green vertex. We relabel the merged red vertex and the merged green vertex into two grey vertices, and insert k + 1 negative edges between them. This transformation does not aﬀect the parityconstraint set Spc . We further transform our negative graph into a new graph with all positive edges by multiplying the weight of every edge by 1. Our problem becomes the GBER problem [5] with additional parityconstraint set Spc . The kBipartization by Edge Removal problem is deﬁned as follows. Definition 3. Given a graph G=(V,E) and a positive integer k, is there a set C ⊆ E with C ≤ k whose removal produces a bipartite graph? GBER is a classical NPhard problem [6] and is in FPT [5]. 5.2
FPT Algorithm for Bipartization by Edge Removal
There are many techniques to solve an FPT problem such as kernelization, depthbounded search trees, dynamic programming, crown reduction, greedy localization, and iterative compression. The iterative compression technique is used by Guo et al. [5] to solve the GBER problem with a running time of O(2k · E2 ), where E is the number of edge in the graph and k is the number of edges to be deleted to make the graph bipartite. However, this algorithm does not enforce our parity constraints that require the number of red vertices in each set to be even. We thus need to modify this algorithm [5] to solve the RHCk problem while respecting the additional parityconstraint sets Spc . Given a graph G = (V, E) where E = {e1 , ..., em }, let Gi be a graph induced by edges {e1 , ..., ei } of G (1 ≤ i ≤ m). If i = 1, the optimal edge bipartization set of G1 is empty. If i > 1, let X be an optimal edge bipartization set of Gi = G[e1 , ..., ei ] and X = k . Consider graph Gi+1 = G[e1 , ..., ei+1 ]. If X is not an optimal edge bipartization set for Gi+1 then X = X ∪ {ei+1 } is clearly an optimal edge bipartization set for Gi+1 . From the edge bipartization set X of size k + 1, we ﬁnd an edge bipartization set of size at most k or show that no such edge bipartization set of size at most k exists. The algorithm assumes that an edge bipartization Y which is smaller than X must be disjoint from X , Y ∩ X = ∅. This assumption can be made without loss of generality by a simple graph transformation, replacing each edge in X by three consecutive edges and choosing the middle edge to be in the new X . This graph transformation preserves the parities of lengths of all cycles and does not aﬀect the parity constraint sets Spc . Therefore the transformed graph has an edge bipartization set of size k if and only if the original graph has an edge bipartization set of size k . Let mapping Φ: V (X ) → {A, B} be a valid partition of V (X ) if for each {y, z} ∈ X, we have Φ(y) = Φ(z). Let AΦ be Φ−1 (A) and BΦ be Φ−1 (B). We k enumerate all 2 valid partitions Φ of V (X ). For each valid partition Φ we ﬁnd a minimum edge cut Y in G\X between AΦ and BΦ . In other words, we use X to partially color G and from the partially colored graph we compute a smaller bipartization set Y . This compression step is the core of the algorithm.
FixedParameter Algorithm for Haplotype Inferences on General Pedigrees
c. Mincut Y
[
[
b. Bipartization set X’
[
[
[
a. Graph G
[
[
[
133
d. G bipartized by Y
Fig. 3. Compression step
Theorem 3. [5] Consider a graph G = (V, E) and a minimal edge bipartization set X for G. For a set of edges Y ⊆ E with X ∩ Y = ∅, the following are equivalent: (1) Y is an edge bipartization set for G. (2) There is a valid partition Φ for V (X ) such that Y is an edge cut in G\X between AΦ =Φ−1 (A) and BΦ =Φ−1 (B). Consider a graph G in Figure 3.a where ⊕ denotes a red vertex, a green vertex, and O a grey vertex. A minimal edge bipartization set X of size 4 illustrated by dashed lines is given in Figure 3.b. We compute a mincut Y for G\X as in Figure 3.c. Set Y is the edge bipartization set of size 3 for G in Figure 3.d. It remains to ﬁnd a minimum edge cut Y between AΦ and BΦ that satisﬁes (1) Y  ≤ k and (2) graph Gi with set Y satisﬁes parityconstraint sets Spc . (st) Mincuts with parity constraints. A minimum edge cut Y between AΦ and BΦ can be computed in O(k · E) time by the EdmondsKarp algorithm [2] by ﬁnding at most k augmenting paths; each path takes O(E) time to ﬁnd. If no min edge cut Y of size k is found, we skip the current partition Φ and check a new valid partition. If a min edge cut Y of size k is found, we need to check if Gi bipartized by Y satisﬁes the parityconstraint sets Spc . Note that there can be many mincuts Y of size k between AΦ and BΦ , and it is possible that the current mincut Y found does not make Gi satisfy Spc while another mincut Y of size k makes Gi satisfy Spc . However, enumerating all mincuts in a graph is expensive. Consider a simple directed graph with n disjoint paths of length 2 from a source s to a sink t, where the weight of each edge is 1. Each (st) mincut has weight n and we have up to 2n (st) mincuts. If a graph is an undirected graph, we replace each undirected edge by two directed edges with opposite directions and the number of (st) mincuts is still 2n . Therefore enumerating all (st) mincuts in a graph in polynomial time, or in FPT, is impossible. We do not enumerate all mincuts. Instead, we examine the structure of all mincuts in a graph by an algorithm in [9]. Given a graph G = (V, E) including a source s and a sink t, where each directed edge (i, j) ∈ E has a capacity cij , an (st) cut (S, S ) is a cut where S = V − S, s ∈ S and t ∈ S . If a graph is not directed, we replace every undirected edge by two oppositely directed edges. If a graph has multiple sources and sinks, we can transform the graph into a new graph with only a single source and a single sink by inserting edges of ∞ weights
134
D.D. Doan and P.A. Evans
from a super source s to all sources, and from all sinks into a super sink t. Flows and mincuts in the new and old graphs correspond [2]. An (st) mincut is an (st) cut where the total capacity of all the edges between S and S is minimum. We will call an (st) mincut a mincut hereafter. Ford and Fulkerson [2] show that the value of a minimum cut between s and t is equal the value of the maximum ﬂow from s to t. Consider a binary relation R on V , a subset of vertices V ⊆ V is a closure for R if and only if for any two vertices i and j in V with iRj and i ∈ V we also have j ∈ V . Given a relation iRj, we say that i is the predecessor of j and j is a successor and i. Picard and Queyranne [9] present the relationship between mincuts and closures as follows. Theorem 4. [9]. Let f be a maximum ﬂow in G. Deﬁne a relation R on the set of vertices V as follows: iRj iﬀ (i, j) ∈ E and fij < cij , or (j, i) ∈ E and fji > 0. Then a cut (S,S’) separating s from t is a minimum cut if an only if S is a closure for R containing s and not t. Suppose we ﬁnd a maximum ﬂow in a graph by the EdmondsKarp algorithm [2]. Clearly, the residual graph Gr = (V, Er ) of G is deﬁned by relation R where edge (i, j) ∈ Er iﬀ iRj. We ﬁnd strongly connected components in Gr and shrink each of them into a single vertex. Finding strongly connected components of a directed graph Gr can be done in O(V + E) time using two depth ﬁrst searches, one search on Gr and the other search on the transpose graph GTr of Gr [2]. ¯ on V by ¯iR ¯ ¯j Let V be the reduced vertex set of V , we deﬁne a relation R iﬀ iRj for some i ∈ ¯i, j ∈ ¯j, and ¯i, ¯j ∈ V¯ . We eliminate component S containing source s and its successor components, and eliminate component T containing sink t and its predecessor components. Combining S and all successor components with any closure induced from the remaining components will produce a mincut. When the number of sites m is small, we can check if a member can satisfy its parityconstraint sets by a backtracking search on at most O(m2 ) components. Since the parity constraints involve vertices for an individual member, these searches can be done independently. Therefore we need to examine if a 2 valid partition Φ satisﬁes Spc on at most 2m · n cuts for the whole pedigree. 2
Theorem 5. The RHCk problem is solvable in O(2k 2m n2 m3 ) time. Proof. Setting up the pedigree graph G = (V, E) takes O(V ) time, where V  = E = O(nm2 ). Generating parityconstraint sets Spc takes O(nm3 ). Transforming the pedigree graph into a graph with all negative edges takes O(E) time. The GBER problem can be solved by trying at most 2k valid partitions Φ. For each partition, we can ﬁnd the ﬁrst mincut in O(k · E) time by ﬁnding at most k augmenting paths using EdmondsKarp algorithm. We can ﬁnd strongly connected components in O(E) time. We do backtracking in at 2 most 2m cuts for each member to check if one can satisfy Spc ; each check takes 2 O(E) time. Therefore, each partition takes O(k · E + E + 2m · E · n). The 2 overall time complexity of the algorithm is O(2k 2m n2 m3 ).
FixedParameter Algorithm for Haplotype Inferences on General Pedigrees
6
135
Conclusion
We have shown that given a general pedigree with n members, m sites, and k recombination events, where m and k are small, the haplotype inference can be 2 done in O(2k 2m n2 m3 ) time.
References 1. Chan, B.M.Y., et al.: Lineartime haplotype inference on pedigrees without recombinations. In: B¨ ucher, P., Moret, B.M.E. (eds.) WABI 2006. LNCS (LNBI), vol. 4175, pp. 56–67. Springer, Heidelberg (2006) 2. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn. MIT Press, McGrawHill (2001) 3. Doan, D.D., Evans, P.A., Horton, J.D.: A NearLinear Time Algorithm for Haplotype Determination on General Pedigrees. Submitted to Journal of Computational Biology (2009) (Submission ID: JCB20090133) 4. Doan, D.D., Evans, P.A.: FixedParameter Algorithm for General Pedigrees with a Single Pair of Sites. In: Borodovsky, M., Gogarten, J.P., Przytycka, T.M., Rajasekaran, S. (eds.) ISBRA 2010. LNCS, vol. 6053, pp. 29–37. Springer, Heidelberg (2010) 5. Guo, J., et al.: CompressionBased FixedParameter Algorithms for Feedback Vertex Set and Edge Bipartization. Journal of Computer and System Sciences 72(8), 1386–1396 (2006) 6. Karp, R.M.: Reducibility Among Combinatorial Problems. In: Miller, R.E., Thatcher, J.W. (eds.) Complexity of Computer Computations, pp. 85–103. Plenum, New York (1972) 7. Li, J., Jiang, T.: An exact solution for ﬁnding minimum recombinant haplotype conﬁgurations on pedigrees with missing data by integer linear programming. In: Proceedings of Research in Computational Molecular Biology, pp. 20–29 (2004) 8. Liu, L., Chen, X., Xiao, J., Jiang, T.: Complexity and approximation of the minimum recombinant haplotype conﬁguration problem. Theoretical Computer Science 378, 316–330 (2007) 9. Picard, J., Queyranne, M.: On the structure of all minimum cuts in a network and applications. Mathematical Programming Study 13, 8–16 (1980) 10. Niedermeier, R.: Invitation to FixedParameter Algorithms. Oxford University Press, Oxford (2006) 11. Qian, D., Beckmann, L.: Minimumrecombinant haplotyping in pedigrees. American Journal of Human Genetics 70(6), 1434–1445 (2002) 12. Xiao, J., Lou, T., Jiang, T.: An eﬃcient algorithm for haplotype inference on pedigrees with a small number of recombinants. In: Fiat, A., Sanders, P. (eds.) ESA 2009. LNCS, vol. 5757, pp. 325–336. Springer, Heidelberg (2009) 13. Xu, S.: The line index and minimum cut of weighted graphs. European Journal of Operational Research 109, 672–682 (1998)
Haplotypes versus Genotypes on Pedigrees Bonnie Kirkpatrick Electrical Engineering and Computer Sciences, University of California Berkeley and International Computer Science Institute
[email protected] Abstract. Genome sequencing will soon produce haplotype data for individuals. For pedigrees of related individuals, sequencing appears to be an attractive alternative to genotyping. However, methods for pedigree analysis with haplotype data have not yet been developed, and the computational complexity of such problems has been an open question. Furthermore, it is not clear in which scenarios haplotype data would provide better estimates than genotype data for quantities such as recombination rates. To answer these questions, a reduction is given from genotype problem instances to haplotype problem instances, and it is shown that solving the haplotype problem yields the solution to the genotype problem, up to constant factors or coeﬃcients. The pedigree analysis problems we will consider are the likelihood, maximum probability haplotype, and minimum recombination haplotype problems. Two algorithms are introduced: an exponentialtime hidden Markov model (HMM) for haplotype data where some individuals are untyped, and a lineartime algorithm for pedigrees having haplotype data for all individuals. Recombination estimates from the general haplotype HMM algorithm are compared to recombination estimates produced by a genotype HMM. Having haplotype data on all individuals produces better estimates. However, having several untyped individuals can drastically reduce the utility of haplotype data.
Pedigree analysis, both linkage and association studies, has a long history of important contributions to genetics, including diseasegene ﬁnding and some of the ﬁrst genetic maps for humans. Recent contributions include ﬁnescale recombination maps in humans [4], regions linked to Schizophrenia that might be missed by genomewide association studies [11], and insights into the relationship between cystic ﬁbrosis and fertility [13]. Algorithms for pedigree problems are of great interest to the computer science community, in part because of connections to machine learning algorithms, optimization methods, and combinatorics [7,16,12,10,15]. Singlemolecule sequencing is an attractive alternative to genotyping and would yield haplotypes for individuals in a pedigree [6]. Such technologies are being developed and may become commercial within ﬁve to ten years. Sequencing methods would apparently yield more information from the same set of sampled individuals, which is critical due to the limited availability of individuals for V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 136–147, 2010. c SpringerVerlag Berlin Heidelberg 2010
Haplotypes versus Genotypes on Pedigrees
137
sampling in multigenerational pedigrees (i.e. individuals usually must be living at the time of sampling). There is substantial evidence that haplotypes can be more useful than genotypes for both population and family based studies when using methods such as association studies [1,3] and pedigree analysis [2,8]. While it is intuitive that haplotypes provide more information than genotypes, there are instances with family data in which there are few enough typed individuals that there is little practical diﬀerence between haplotype and genotype data. Additionally, in order to exploit the information contained in haplotype data, we need to understand the instances where diploid inheritance is computationally tractable given haplotype data. Pedigree analysis with genotype data is well studied in terms of complexity [12,10] and algorithms [5,9,14]. Less is known about haplotype data on pedigrees. This paper shows that, given haplotype data on a pedigree, ﬁnding both minimum recombination and maximum probability haplotypes is as tractable as computing the same quantities for pedigrees with genotype data (i.e., these problems are NP and #Phard, respectively). To obtain a reduction that applies equally well to several types of pedigree calculations, we will consider a modular polynomialtime mapping from the genotype problem to the haplotype problem. The reduction preserves the solutions to the analyses, meaning that the solution to the haplotype problem is the solution to the genotype problem after adjusting by constant factors or coeﬃcients. Since the reduction uses a biologically unlikely recombination scenario, we will investigate the accuracy and information of realistic examples with haplotypes and genotype data on the same pedigree. Pedigree data was simulated having a known number of recombinations. The recombination distributions were computed at a particular locus of interest and compared to the groundtruth. Since both the haplotypes and genotypes of a speciﬁc person contain the same alleles, the diﬀerences between the haplotype and genotype recombination distributions were determined by the extra information in the haplotype data. As expected, the haplotype data reliably yields greater accuracy when all the pedigree individuals are typed. However, as fewer pedigree individuals are typed, there is less practical diﬀerence between the utility of haplotype versus genotype data. The number of untyped generations that separate typed individuals inﬂuences whether haplotype data are actually more accurate than genotype data. For instance with two halfsiblings, having two untyped parents results in estimates from genotype data that are nearly as accurate as the estimates computed from haplotype data. Finally, there is an important instance where haplotype data is more computationally tractable than genotype data. When all individuals in the pedigree are typed, although unlikely from a practical perspective of obtaining genetic samples, the computational problem decomposes into conditionally independent subproblems, and has a lineartime algorithm. This can be contrasted with the known hardness of the genotype problem even when all individuals are genotyped. The existence of this lineartime algorithm for haplotype data could facilitate useful approaches that combine population genetic and pedigree methods.
138
B. Kirkpatrick
For instance, if the haplotypes of the founders are drawn from a coalescent and the pedigree individuals are all haplotyped, the probability of a combined model could easily be computed for certain coalescent models.
1
Introduction to Pedigree Analysis
A pedigree is a directed acyclic graph where the set of nodes, I, are individuals, and directed edges indicate genetic inheritance between parent and child. A diploid pedigree (i.e. for humans) necessarily has either zero or two incoming edges for each person. The set, F , of individuals without incoming edges are referred to as pedigree founders. An individual, i, with two parents is a nonfounder, and we will refer to their two parents as m(i) and p(i). As is commonly done to accommodate inheritance of genetic information, we will extend this model to include a representation of the alleles of each individual and of the inheritance origin of each allele. More formally, we represent a single chromosome as an ordered sequence of variables, xj , where each variable takes on an allele value in {1, ..., kj }. Each variable represents a polymorphic site, j, in the genome, where there are kj possible sequence variants. Since diploid individuals have two copies of each chromosome, one copy inherited from each parent, we will use a superscript m and p to indicate the maternal and paternal chromosomes respectively. For a particular individual i, the information on both p copies of a particular chromosome at site j is represented as xm i,j and xi,j . Furthermore, we assume that inheritance in the pedigree proceeds with recombination and without mutation (i.e. Mendelian inheritance at each site). This imposes consistency rules on parents and children: the allele xm i,j must appear in the mother m(i)’s genome as either the grandmaternal or grandpaternal alp lele, xm m(i),j or xm(i),j , and similarly for the paternal allele and the father p(i)’s genome. p Let x be a vector containing all the haplotypes xm i , xi for all individuals i ∈ I, then we are interested in the probability m p m P[xpf ]P[xm P[xpi xpp(i) , xm (1) P[x] = f ] p(i) ]P[xi xm(i) , xm(i) ], f ∈F
i∈I\F
where the superscript m and p indicate maternal and paternal alleles, while the functions m(i) and p(i) indicate parents of i. The ﬁrst product is over the independent founder individuals whose haplotypes are drawn from a uniform prior distribution, while the second product, over the nonfounders, contains the probabilities for the children to inherit their haplotypes from their parents. The unobserved vector x is not immediately derived from observed haplotype data, since vector x contains haplotype alleles labeled with their parental origins for all the individuals. To compute this quantity, we need notation to represent the parental origins of each allele where diﬀering origins for neighboring haplotype alleles will indicate recombination events. For each nonfounder, let us indicate the source of each maternal allele using m the binary variable sm i,j ∈ {m, p}, where the value m indicates that xi,j allele has
Haplotypes versus Genotypes on Pedigrees
139
grandmaternal origin and p indicates grandpaternal origin. Similarly, we deﬁne spi,j for the origin of i’s paternal allele. For a particular site, these indicators for all the individuals, sj , is commonly referred to as the identitybydescent (IBD) inheritance path. A recombination is observed at consecutive sites as a change m in the binary value of a source vector, for instance, sm i,j = p and si,j+1 = m. To compute the inheritance portion of Equation 1, we will sum over the inheritance options P[x] = s P[xs]P[s] where P[s] = 1/22I\F . We can observe two kinds of data for pedigree individuals whose genetic material is available. The ﬁrst, and most common, is genotype data, a tuple of p 0 1 , gi,j ) that must appear in the variables xm alleles (gi,j i,j and xi,j for each site j. Since these alleles are unlabeled for origin, we do not know which allele was inherited from which parent. The second type of data is haplotypes, where we observe two sequences of alleles h0i and h1i and each sequence represents alleles that were inherited together from the same parent. However, we do not know which sequence is maternal and which is paternal. For either type of data deﬁne a function Ci,j for locus j which indicates compatibility of the assigned haplotype alleles with the data and requires inheritance consistency between generations. sp
sm
p i,j i,j Speciﬁcally, for genotype data Ci,j = 1 if xm i,j = xm(i),j , xi,j = xf (i),j , and p 0 1 {xm i,j , xi,j } = {gi,j , gi,j }. Under haplotype data, the Ci,j = 1 when the ﬁrst two p 0 1 equalities, above, hold and {xm i,j , xi,j } = {hi,j , hi,j }, which are the haplotype alleles at locus j. Now, we write Equation 1 as a function of the persite recombination probap bility θ ≤ 0.5. For particular values of all the haplotype alleles xm i,j and xi,j , the haplotype probability conditional on the inheritance options and the observed data through Ci,j is
P[xs] =
l f ∈F
j=1
Cf,j P[xpf,j ]P[xm f,j ]
i∈I\F
Ci,1
l
m
p
m
p
Ci,j · θ(Ri,j +Ri,j ) · (1 − θ)(2−Ri,j −Ri,j )
j=2
p p m where Ri,j = I[sm = sm = spi,j ]. i,j−1 i,j ] and Ri,j = I[si,j−1
1.1
Pedigree Problem Formulations
Given a pedigree and some observed genotype or haplotype data, there are three problem formulations that we might be interested in. The ﬁrst is to compute the probability of some observed data, while the last two problems ﬁnd values for the unobserved haplotypes of individuals in the pedigree. Likelihood. Find the probability of the observed data by summing over all the possible unobserved haplotypes, i.e. x s P[xs]P[s]. p m Maximum Probability. Find the values of xi,j and xi,j that maximize the probability of the data, i.e. maxx s P[xs]P[s]. p Minimum Recombination. Find the values of xm i,j and xi,j that minimize the numberof required recombinations, i.e. minx,s i j≥2 I[spi,j−1 = spi,j ] + I[sm = sm i,j−1 i,j ].
140
B. Kirkpatrick
The likelihood is commonly used for estimating sitespeciﬁc recombination rates, relationship testing, computing pvalues for association tests, and performing linkage analysis. Haplotype and/or IBD inferences, obtained by maximizing the probability or minimizing the recombinations, are useful for nonparametric association tests, tests on haplotypes, and tests where there is disease information for unobserved genomes.
2
Hardness Results
With genotype data, the likelihood and minimum recombination problems are NPhard, while the maximum probability problem is #Phard. Piccolboni and Gusﬁeld [12] proved the hardness of the likelihood and maximum probability computations by relying on a single locus subpedigree with halfsiblings. Although their paper discussed a more elaborate setting involving a phenotype, their proof, however, applies to this setting. Li and Jiang proved the minimum recombination problem to be hard by using a twolocus subpedigree with halfsiblings [10]. In all these proofs, halfsiblings were pivotal to establishing reductions from well known NP and #P problems. In this paper, we introduce a simple and powerful reduction that converts any genotype problem on a pedigree of n individuals into a haplotype problem on a pedigree of at most 6n individuals. This reduction is simple, because it merely introduces four fullsiblings and an extra parent for each genotyped individual. We do not need complicated structures involving inbreeding or halfsiblings. The reduction works equally well for all three problem formulations. Mapping. Given a pedigree with genotype data, for any of the three pedigree problems, we deﬁne a polynomial mapping to a corresponding haplotype problem with exactly 5G individuals haplotyped. First we create the pedigree graph for the new haplotype instance, and later we construct the required haplotype observations from the genotype data. Let G ⊂ I represent the set of genotyped individuals in a pedigree having individuals I and edges E. We will create a haplotype instance of the problem, with individuals H ∪ I and edges R ∪ E. To obtain the set H, we add ﬁve individuals, i0 , i1 , i2 , i3 , i4 , to H for every individual i ∈ G. The set of new relationship edges, R, will connect individuals in sets H and G. Speciﬁcally, the edges stipulate that i and i0 are the parents of fullsiblings i1 , i2 , i3 , and i4 by including the edges: i0 → i1 , i0 → i2 , i0 → i3 , i0 → i4 , i → i1 , i → i2 , i → i3 , and i → i4 . We will refer to these ﬁve individuals, i0 , i1 , i2 , i3 , and i4 , and their relationships with i as the proxy family for individual i. For example in Figure 1, the 6individual genotype pedigree in becomes a 21individual haplotype pedigree. This produces a pedigree graph with exactly 5G + I individuals and 8G + E edges. To obtain the new haplotype data from the genotype data, we type only individuals in H such that the corresponding genotyped individual in G is required, by the rules of inheritance, to have the observed genotypes. Without loss 0 1 < gi,j . of generality, assume that the genotype alleles are sorted such that gi,j
Haplotypes versus Genotypes on Pedigrees 111 000 000 111 000 111
000 1111 0
11 00 00 1 11 00 11 00 11
111 000 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 11 12 13 14 00 11 00 11 00 11 00 3 11
2
1
2
3
4
141
5
0
111 000 3 000 111 000 111 000 111 000 111 Untyped Female Typed Female
Untyped Male
11 00 00 00 11 11 00 11
Typed Male
4
00 11 11 6 00 00 11 00 11 00 11
5
111 000 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 31
32
33
34
11 6 0 00 00 11 00 11 00 11
6
000 111 000 111 000 111 000 111 111 000 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 000 111 61
62
63
64
Fig. 1. Genotype and Haplotype Pedigrees. Values are averages computed from 500 simulations. (Left) Genotyped individuals are shaded, and all the individuals are labeled. Individuals 1, 2, and 5 are the founders, and individual 6 is the grandchild of 1 and 2. (Right) Haplotyped individuals are shaded, and individuals have the same labels. For each of the genotyped individuals, i, from the previous ﬁgure, the mapping adds a nuclear family containing ﬁve new individuals labeled i0 , i1 , i2 , i3 , i4 .
Now we can easily constrain the parental genotype for individual i ∈ G by giving the spouse, i0 , homozygous haplotypes of all ones while giving child i1 the haplotypes {1, gi0 }, child i2 haplotypes {1, gi1 }. This guarantees the correct genotype, but does not ensure that the haplotypes of that genotype have the same probability or number of recombinations. Since there is an arbitrary assorting of genotype alleles at neighboring loci into the parent haplotypes xpi and xm i , we will use the remaining two children to represent possible reassortments of the genotyped parent’s Ti heterozygous loci, indexed by tj where 1 ≤ j ≤ Ti . In addition to the haplotype 1, child i3 , will 1−j mod 2 have haplotype consisting of hi3 ,tj := gi,t while child i4 has the genotyped j
j mod 2 parent’s complementary alleles hi4 ,tj := gi,t . This results in child i3 and i4 j alternating in having the smaller allele at every other heterozygous locus. This reduction preserves the solutions to the three problems up to constant factors or constant coeﬃcients. Speciﬁcally, the solution to the haplotype version of the problem is the solution to the genotype version with the values of the functions being related by constant factors or coeﬃcients, depending on whether the function is a recombination count or a probability.
Lemma 1. Let rg be the minimum number of recombinations in the genotype problem instance. The mapping yields a haplotype problem instance having rh = rg + i∈G 2(Ti − 1) for the minimum number of recombinations, where Ti is the number of heterozygous sites in genotype i. To prove this result, we exploit the alternating pattern of alleles assigned to the four children. This pattern forces there to be two recombinations, among the four children, between consecutive heterozygous loci.
142
B. Kirkpatrick
After applying the mapping, the haplotype probability turns out to have a coeﬃcient that is independent of the haplotype assignment to the nonfounding parent of the proxy family. This coeﬃcient can be computed in linear time from the genotype data using a Markov chain. The Markov chain has 16 states and has a transition step between each pair of neighboring loci. This small Markov model can be thought of in the sumproduct algorithm as an elimination of the typed individuals in the proxy family; alternatively, it is also equivalent to peelingoﬀ the typed proxy individuals in the ElstonStewart algorithm [5]. Once we have this coeﬃcient, independent of the haplotype assignment, it is clear that the likelihood and maximum probability haplotype problems also have haplotype solutions related proportionally to the genotype solution. Lemma 2. The mapping yields a haplotype problem instance having haplotype probabilities proportional to the haplotype probabilities of the genotype instance. Specifically, for all x, Ph [x] = Pg {xi i ∈ I} pt (i) P[xpi0 ,j = 1]P[xm i0 ,j = 1] i∈G
j
where the proxy family transmission probability is a function of genotype gi , the recombination rate θ ≤ 0.5, and of the transition matrices P , Q0110 , and Q1001 , pt (i) =
1 16
1 · P h0
Ti Oj Q0110 + (1 − Oj )Q1001 · P hj · 1T j=0
and Oj indicates whether index j is odd, h0 is the number of homozygous loci that begin proxy parent’s genotype, and hj is the number of consecutive homozygous loci after the j’th heterozygous locus where there are Ti heterozygous loci for proxy parent i. The transition probabilities are given by Pij = θH(i,j) (1 − θ)4−H(i,j) where H(i, j) is the Hamming distance between inheritance states i and j. Let Q0110 be a transition matrix having nonzero recombination probabilities only in column 0110 (i.e. Q0110,i,j = Pij when j = 0110). Similarly, let Q1001 be a transition matrix with nonzero recombination probabilities only in column 1001. Although this reduction establishes the hardness of these haplotype pedigree problems, it does so by constructing children whose haplotypes require many recombinations and would be extremely unlikely to occur naturally. Accordingly, we suspect that realistic instances of these haplotyping problems may provide more information about the locations of recombinations than genotype instances.
3
Algorithms and Accuracy of Estimates
One indication that the haplotype problem might be practically more tractable is the amount of information in the haplotype data relative to the genotype data. To understand this, we can consider a pedigree with a ﬁxed set of sampled individuals. Assume that there are two input data sets available, either the
Haplotypes versus Genotypes on Pedigrees
143
haplotype or the genotype data, for all the sampled individuals. Note that the alleles observed will be identical in both the haplotype and genotype data, so we are interested in the distribution that these data impose on the inheritance probabilities. By comparing the accuracy of the recombination estimates under these two data sets, we can get an idea for how useful the respective probability distributions are. Let Rj be a random variable representing the number of recombinations in the whole pedigree that occur between loci j − 1 and j. Similar to our notation p m + Ri,j . We want to compute the distribution of Rj under before, Rj = i∈I Ri,j both the genotype and haplotype inheritance probability distributions. These two inheritance distributions are diﬀerent precisely because there are haplotypes and inheritance paths that are consistent with the genotype constraints but disallowed by the haplotype constraints. These distributions are obtained by constructing a hidden Markov model for the linkage dependencies along the genome. At each locus, the HMM considers the constraints given by either the haplotype or genotype data (i.e. the haplotype data HMM is a variation on the LanderGreen algorithm [9]). We ﬁrst use the forwardbackward algorithm to compute the marginal inheritance probabilities for each locus using a hidden Markov model. Once we have the marginal probabilities, we can easily obtain the distribution for Rj . 3.1
General Haplotype and Genotype HMMs
The likelihood can be modeled using a hidden Markov model along the genome with inheritance paths as hidden states. An inheritance path is a graph with nodes being the alleles of individuals and directed edges between alleles that are inherited from parent to child. The transition probabilities are functions of θ and the number of recombinations between a given pair of inheritance graphs. Given the data, we compute the marginal inheritance path probabilities at each site by using the forwardbackward algorithm for HMMs. Sobel and Lange described a method for enumerating the inheritance paths compatible with the allele data observed at each locus [14]. There are at most k = 22I\F  inheritance paths when I \ F is the set of nonfounder individuals, and both the forward and backward recursions do an O(k 2 ) calculation at each site. To compute the analogous probability for haplotype data, we use a similar HMM. For haplotypes, the hidden states must consider the haplotype orientations, which specify the parental origins of all the observed haplotypes. Notice that these orientations are not equivalent to inheritance paths, since they only specify inheritance edges between haplotyped individuals and their parents. For each of the 22H haplotype orientations, where H is the set of haplotyped individuals, we enumerate the inheritance paths compatible with the haplotype alleles, their orientations, and the pedigree relationships. Alternatively, each of the inheritance paths enumerated for the genotype algorithm induces a particular orientation on the haplotypes heterozygous for that locus (i.e. parental origin of the entire haplotype). Thus, the hidden states for the haplotype HMM are the crossproduct of the orientations and the inheritance paths.
144
B. Kirkpatrick
The haplotype HMM has transition probabilities that are nearly identical to the genotype HMM with the exception that transitions between inheritance paths with diﬀerent haplotype orientations have probability zero. Recombinations are only allowed when they do not occur between typed haplotypes. The forwardbackward algorithm is also used on the haplotype HMM. However, there are 22(I+H−F ) hidden states, yielding a slightly slower calculation. Fortunately, the haplotype recursions can be run simultaneous with the genotype recursions, meaning that the inheritance paths need only be enumerated once. 3.2
Haplotype Likelihoods in Linear Time
There is one obvious instance of the haplotyping problems where there are polynomialtime algorithms. Even though it is impractical to assume that we can sample genetic material from deceased individuals in a multigenerational pedigree, for a moment, let us consider the case where all the individuals in the pedigree are haplotyped. The ElstonStewart algorithm [5] for genotype data has a direct analogue for haplotype data. This algorithm calculates the likelihood via the belief propagation algorithm by eliminating individuals recursively from the bottom up. Each individual is “peeled oﬀ”, after their descendants have been peeled oﬀ, by using a forwardbackward algorithm on the HMM for the motherfatherchild trio. The haplotype version of this algorithm is linear when all the individuals are haplotyped, since each elimination step is conditionally independent of all the others. Given the parents’ haplotypes, regardless of which was inherited from which grandparent, the probability of the child’s haplotype is independent of all other trios. Therefore, we can take a product over the likelihoods for all the trios, and compute each trio likelihood using a 4state HMM. Then for k nonfounding individuals, and l loci, this algorithm has O(kl) running time. This same intuition carries through to the minimum recombination problem, and each trio can be considered independent of the others. This contrasts with the genotype minimum recombination problem which is known to be hard, even when all the individuals are genotyped [10]. 3.3
Results
To simulate realistic pedigree data, SNPs were selected from HapMap that span 100mb on both sides of a looselylinked pair of sites. There are 40 SNPs total, with 20 tightly linked SNPs on each side of a strong recombination breakpoint having θ = 0.25. The haplotypes for these SNPs were selected randomly from HapMap. Pedigree haplotype and genotype data were simulated for each child by uniformly selecting one of the parental alleles for the ﬁrst locus, and subsequent loci were selected on the same parental haplotype with probability θj for each locus j. Inheritance was simulated for 500 simulation replicates. The simulation yielded completely typed pedigrees. For each pedigree, we removed the genotype and haplotype information for increasing numbers of untyped individuals. For each instance of a speciﬁc number of untyped individuals,
Haplotypes versus Genotypes on Pedigrees
145
two values were computed on the estimated number of recombinations between the central pair of loci: the haplotype and genotype accuracies. Accuracy was computed as a function of the l1 distance between the deterministic number of recombinations and the calculated distribution. Speciﬁcally, accuracy was 2 − i≥0 xi − ai , where xi was the estimated probability for i recombinations and ai was the deterministic indicator of whether there were i recombinations in the data simulated on the pedigree. In all the instances we observed a trend where the best accuracy was obtained with haplotype data where everyone in the pedigree was haplotyped. For example, a ﬁveindividual pedigree with two halfsiblings is shown in Figure 2, left panel. With the three founders untyped, the haplotype data yielded similar accuracy as the genotype data. Consider a threegeneration pedigree having two parents, their two children, an inlaw, and a grandchild for a total of six individuals, three of them founders. This pedigree has a similar trend in accuracy as the number of untyped founders increases, Figure 2, right panel. As the number of untyped individuals increases, the accuracies of genotype and haplotype estimates appear to converge.
1
Accuracy
1
Accuracy
2
Three−Generation Pedigree
2
Half−Sibling Pedigree
HMM
HMM
0
Haplo Geno
0
0
Haplo Geno 1
2
Number of Untyped Individuals
3
0
1
2
3
Number of Untyped Individuals
Fig. 2. Predicting Recombinations. The left panel is the average accuracy for predictions from a pedigree with two halfsiblings and three parents. The right panel shows results from a sixindividual, threegeneration pedigree. In both cases, 500 simulation replicates were performed, and the average accuracy of estimates from the haplotype data is superior to those from genotype data. However, as the number of untyped founders increases, in both cases, the accuracy of estimates from haplotype data drop relative to the accuracy from genotype data. The accuracies of genotype and haplotype estimates appear to converge.
4
Discussion
Sequencing technologies would seem to solve the phasing problem by yielding haplotype data. However, if we wish to consider diploid inheritance with recombination, the phasing problem remains, even when we are given chromosomelength haplotype data. This is demonstrated by reduction of the phasing problem for
146
B. Kirkpatrick
genotypes to the phased version of the same problem for three common pedigree problems. This theoretical result is due largely to the unavailability of genetic material for deceased individuals. Three pedigree calculations were discussed: likelihood, maximum probability, and minimum recombination. Each of these calculations on haplotype data have the same computational complexity as the same computation on genotype data. In the worst case, it takes only a single generation to remove the correlation between sites in the haplotype. This worst case provided the reduction that proves the the complexity results for the haplotype computations, and it worked equally well for all three pedigree computations. The worstcase is not biologically realistic, since it requires roughly 2(m − 1) recombinations for m sites in 4 meioses. This is very unlikely to occur under typical models for inheritance. To investigate more likely scenarios, sequences were simulated in a region of the genome surrounding a recombination breakpoint. From haplotype and genotype data, we estimated the distribution of the number of recombinations at the breakpoint and compared the estimates to the groundtruth for accuracy. When typing everyone in the pedigree, the estimates from haplotype data were very accurate, because the haplotype data provides enough constraints to determine where the recombinations must have occurred. With decreasing numbers of typed individuals, the accuracy of haplotypebased estimates dropped until it seemed to converge to the genotype accuracy due to a lack of constraints. From the structure of the calculations, we observed that with fewer typed individuals there were more haplotype orientations to consider, and the haplotype calculation more closely resembled the genotype calculation. However, the haplotype calculation had more constraints and lost accuracy at a slower rate. Several interesting open problems remain. First, approximation algorithms might be a useful approach for haplotypes on pedigrees. The existence of a lineartime algorithm when all individuals are haplotyped may suggest that the general haplotype problem instance could be amenable to approximation algorithms. Second, these proofs apply when there is no missing data in a genotyped individual (i.e. a proxy parent). The proof requires knowing whether the proxy parent is heterozygous or homozygous at each locus, and this is unknown when there is missing data. Third, there is an interesting case of mixed haplotypes and genotypes. For this case to be interesting, the ends of haplotypes must occur at diﬀerent locations in diﬀerent individuals in the pedigree. Otherwise, the haplotypes that start and end at the same positions in all individuals can easily be converted into multiallelic genotypes, with an allele for each haplotype. The mixed haplotypegenotype problem is not amenable to the proof techniques used here. However, the haplotype HMM in Section 3.1 can easily be revised to handle the mixed case. This is important because the data produced by single polymer sequencing is more likely to resemble the mixed case than either the haplotype or the genotype cases.
Haplotypes versus Genotypes on Pedigrees
147
Acknowledgments. I want to thank Richard Karp for reviewing a draft of the manuscript and the National Science Foundation for support through the Graduate Research Fellowship.
References 1. Barrett, J.C., Hansoul, S., Nicolae, D.L., Cho, J.H., Duerr, R.H., Rioux, J.D., Brant, S.R., Silverberg, M.S., Taylor, K.D., Barmada, M.M., et al.: Genomewide association deﬁnes more than 30 distinct susceptibility loci for crohn’s disease. Nature Genetics 40, 955–962 (2008) 2. Burdick, J.T., Chen, W., Abecasis, G.R., Cheung, V.G.: In silico method for inferring genotyeps in pedigrees. Nature Genetics 38, 1002–1004 (2006) 3. Chen, W.M., Abecasis, G.R.: Familybased association tests for genomewide association scans. American Journal of Human Genetics 81, 913–926 (2007) 4. Coop, G., Wen, X., Ober, C., Pritchard, J.K., Przeworski, M.: HighResolution Mapping of Crossovers Reveals Extensive Variation in FineScale Recombination Patterns Among Humans. Science 319(5868), 1395–1398 (2008) 5. Elston, R.C., Stewart, J.: A general model for the analysis of pedigree data. Human Heredity 21, 523–542 (1971) 6. Eid, J., et al.: RealTime DNA Sequencing from Single Polymerase Molecules. Science 323(5910), 133–138 (2009) 7. Geiger, D., Meek, C., Wexler, Y.: Speeding up HMM algorithms for genetic linkage analysis via chain reductions of the state space. Bioinformatics 25(12), i196 (2009) 8. Kirkpatrick, B., Halperin, E., Karp, R.M.: Haplotype inference in complex pedigrees. Journal of Computational Biology (2010) (in press) 9. Lander, E.S., Green, P.: Construction of multilocus genetic linkage maps in humans. Proceedings of the National Academy of Science 84(5), 2363–2367 (1987) 10. Li, J., Jiang, T.: An exact solution for ﬁnding minimum recombinant haplotype conﬁgurations on pedigrees with missing data by integer linear programming. In: Proceedings of the 7th Annual International Conference on Research in Computational Molecular Biology, pp. 101–110 (2003) 11. Ng, M.Y., Levinson, D.F., et al.: Metaanalysis of 32 genomewide linkage studies of schizophrenia. Mol. Psychiatry 14, 774–785 (2009) 12. Piccolboni, A., Gusﬁeld, D.: On the complexity of fundamental computational problems in pedigree analysis. Journal of Computational Biology 10(5), 763–773 (2003) 13. Romero, I.G., Ober, C.: CFTR mutations and reproductive outcomes in a population isolate. Human Genet. 122, 583–588 (2008) 14. Sobel, E., Lange, K.: Descent graphs in pedigree analysis: Applications to haplotyping, location scores, and markersharing statistics. American Journal of Human Genetics 58(6), 1323–1337 (1996) 15. Thatte, B.D.: Combinatorics of pedigrees (2006) 16. Xiao, J., Liu, L., Xia, L., Jiang, T.: Eﬃcient Algorithms for Reconstructing ZeroRecombinant Haplotypes on a Pedigree Based on Fast Elimination of Redundant Linear Equations. SIAM Journal on Computing 38, 2198 (2009)
Haplotype Inference on Pedigrees with Recombinations and Mutations Yuri Pirola1, Paola Bonizzoni1 , and Tao Jiang2 1
DISCo, Univ. degli Studi di MilanoBicocca, Milan, Italy {pirola,bonizzoni}@disco.unimib.it 2 Department of Computer Science and Engineering, University of California, Riverside, CA
[email protected] Abstract. Haplotype Inference (HI) is a computational challenge of crucial importance in a range of genetic studies, such as functional genomics, pharmacogenetics and population genetics. Pedigrees have been shown a valuable data that allows us to infer haplotypes from genotypes more accurately than population data, since Mendelian inheritance restricts the set of possible solutions. In order to overcome the limitations of classic statistical haplotyping methods, a combinatorial formulation of the HI problem on pedigrees has been proposed in the literature, called MinimumRecombinant Haplotype Configuration (MRHC) problem, that allows a single type of genetic variation events, namely recombinations. In this work, we deﬁne a new problem, called MinimumChange Haplotype Configuration (MCHC), that extends the MRHC formulation by allowing also a second type of natural variation events: mutations. We propose an eﬃcient and accurate heuristic algorithm for MCHC based on an Lreduction to a wellknown coding problem. Our heuristic can also be used to solve the original MRHC problem and it can take advantage of additional knowledge about the input genotypes, such as the presence of recombination hotspots and diﬀerent rates of recombinations and mutations. Finally, we present an extensive experimental evaluation and comparison of our heuristic algorithm with several other stateoftheart methods for HI on pedigrees under several simulated scenarios.
1
Motivations
After the ﬁrst draft of the human genome was published in 2000, a lot of research eﬀorts have been devoted to the discovery of genetic diﬀerences among samespecies individuals and to the characterization of their impact to the expression of diﬀerent phenotypic traits such as disease susceptibility or drug resistance. Most of these eﬀorts are driven by the International HapMap Project [14], which discovered, investigated and characterized millions of genomic positions (called loci or sites) where diﬀerent individuals carry diﬀerent genetic subsequences (called alleles). In practice, unordered pairs of alleles coming from both parents of each individual studied are routinely collected, since determining the parental source V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 148–161, 2010. c SpringerVerlag Berlin Heidelberg 2010
Haplotype Inference on Pedigrees with Recombinations and Mutations
149
of each allele is too much timeconsuming and expensive to be performed on large studies [3]. The pairs of alleles located at a given set of loci of an individual are called the (multilocus) genotype of the individual, while the sequence of alleles that were inherited from a single parent is called a haplotype. The advance of highthroughput and highdensity genotyping technologies, combined with a consistent reduction of genotyping costs, had led to a great abundance of genotypic data. Such genotypes (also called SNP genotypes) are generally biallelic (i.e., at each locus only two distinct alleles are observed in the population) and they will be the focus of this work. A number of association studies based on SNP genotypes have been carried out but, since haplotypes substantially increase the power of genetic variation studies [15], accurate and eﬃcient computational prediction of haplotypes from genotypes is highly desirable. Mendelian inheritance laws, which govern the transmission of genetic material from parents to children, have been eﬀectively used to improve the accuracy of haplotyping methods. However, the increasing density and length of SNP genotypes challenge classic statisticsbased methods (such as LanderGreen [7] and ElsonStewart [4] methods) because they do not scale well on large datasets and they do not take directly into account the presence of Linkage Disequilibrium among loci. Combinatorial formulations have been proposed to overcome such limitations. Among them, the most popular formulation is represented by the MinimumRecombinant Haplotype Configuration (MRHC) problem [12,9]. The aim of this formulation is the computation of a haplotype conﬁguration which is consistent with an input genotyped pedigree and induces the minimum number of recombinations. The formulation naturally arises since recombinations are the most common form of variation events. However, with the progressive increase of the size of genetic variation studies, the incidence of other types of variation events (such as mutations) will inevitably become noticeable. The above observation motivates the work in this paper, where the Haplotype Inference (HI) problem on pedigrees admitting recombination and mutation events, called MinimumChange Haplotype Configuration (MCHC), is studied. Polynomialtime exact algorithms for MCHC are unlikely to exist since it is possible to prove that MCHC is APXhard even on simple instances. The main contribution of this paper is an eﬃcient and accurate heuristic algorithm for MCHC. Our algorithm is based on an Lreduction [2] of MCHC to a fundamental problem of coding theory: the Nearest Codeword Problem (NCP) [2, probl. MS3]. Although NCP is theoretically hard to approximate [1], there exists several heuristics that compute nearoptimal solutions of NCP in practice [6]. Our idea is to transform the instance of MCHC to an instance of NCP, to solve it with a customtailored version of a heuristic for NCP, and, ﬁnally, to reconstruct a solution of the original instance of MCHC from the solution of NCP. Our Lreduction guarantees that the transformation of the instance and the reconstruction of the solution are performed in polynomialtime while preserving the solution cost. The work is structured as follows. First, in Section 2, we formalize the MinimumChange Haplotype Configuration problem and deﬁne the
150
Y. Pirola, P. Bonizzoni, and T. Jiang
related basic terminology. Then, in Section 3, we present a heuristic algorithm based on an Lreduction from MCHC to NCP. Finally, in Section 4, we discuss the results of an experimental evaluation of our algorithm under several simulated scenarios and compare the accuracy and eﬃciency of our algorithm with those of several stateoftheart methods for HI on pedigrees in the literature.
2
The Computational Problem
In this section we deﬁne the basic concepts and formalize the computational problem that will be studied in the rest of the work. A pedigree graph is an oriented acyclic graph P = (V, E) such that (i) vertices correspond to individuals and are partitioned into male and female vertices (i.e., V = M ∪ F , with M and F disjoint), (ii) each vertex has indegree 0 or 2, and (iii) if a vertex has indegree 2, then one edge must come from a male node and the other from a female node. For each edge (p, c) ∈ E, we say that p is a parent of c and c is an oﬀspring (or child) of p. More precisely, we say that p is the father (mother, resp.) of c if p is male (female, resp.). A trio is a triplet (f, c, m) where f is the father and m is the mother of c. Individual f and individual m are said to be mates in such a trio. A pedigree graph contains a mating loop if there exists two nodes a and d such that they are connected by two distinct paths. A pedigree graph is a tree pedigree if it does not contain mating loops. Let Σ be an ordered set l1 , . . . , lm of m loci and c an individual of the pedigree P . A haplotype of individual c is an mdimensional vector over the set {0, 1}. The genotype gc of individual c is an mdimensional vector over the set {0, 1, 2}, where the ith element (denoted with gc [i]) represents the pair of alleles that individual c possesses at locus li . We follow the convention of encoding pair {0, 0} as 0, {1, 1} as 1, and {0, 1} as 2. A genotyped (haplotyped, respectively) pedigree is a pedigree such that every individual has been associated with a genotype (an ordered pair of haplotypes, respectively). We use gc to denote the genotype associated with an individual c of a genotyped pedigree and h0c , h1c the haplotypes associated with an individual c of a haplotyped pedigree. Moreover, we say that h0c is the paternal haplotype of c and h1c is the maternal haplotype of c. A haplotyped pedigree Ph is consistent with a genotyped pedigree Pg of the same set of individuals if for each individual c, the genotype gc is resolved by the pair of haplotypes h0c , h1c . An individual is called a founder if its indegree is 0. Otherwise it is called a nonfounder. The grandparental source vector of a nonfounder individual c w.r.t. one of its parents p, is an mlong binary vector sp,c deﬁned as follows. Let li be a locus of Σ. If p is the father (mother, resp.) of c, then sp,c [i] = 0 if the allele of the paternal (maternal, resp.) haplotype of c at locus li has been inherited from the paternal haplotype of p. On the other hand, sp,c [i] = 1 if the allele has been inherited from the maternal haplotype of p. Given a genotyped pedigree Pg , a (consistent) haplotype configuration of Pg is a pair (Ph , S) where Ph is a (consistent) haplotyped pedigree of Pg and S an assignment of two grandparental source vectors to each individual of P .
Haplotype Inference on Pedigrees with Recombinations and Mutations
151
The Haplotype Inference (HI) problem on pedigrees asks for a haplotype conﬁguration (or the set of haplotype conﬁgurations) consistent with a given genotyped pedigree. However, since there can exist an exponential number of consistent haplotype conﬁgurations, additional constraints are generally imposed. A particularly successful approach is the formulation that attempts to minimize the number of genetic variation events that are induced in the resulting haplotyped pedigree [12,9]. Two types of variation events will be considered, recombinations and mutations, deﬁned as follows. Let (Ph , S) be a consistent haplotype conﬁguration of a genotyped pedigree Pg . The haplotype conﬁguration induces (or contains) a recombination at locus li between an individual c and one of its parents p if sp,c [i] = sp,c [i+1]. The haplotype conﬁguration induces (or contains) a mutation at locus li between = hsp [i] where s = sp,c [i] and j = 0 (j = 1, resp.) if p is c and its parent p if hjc [i] the father (mother, resp.) of c. In this work we are interested in the computational problem of computing a haplotype conﬁguration that is consistent with a given genotyped pedigree and that induces the minimum number of variation events. We call such a problem MinimumChange Haplotype Configuration (MCHC) problem. The MCHC problem is a generalization of two problems proposed in the literature: the MinimumRecombinant Haplotype Configuration (MRHC) problem (where only recombinations are allowed [9]), and the MinimumMutation Haplotype Configuration (MMHC) problem (where only mutations are allowed [16]). Diﬀerently from [16], in the following we do not restrict the number of mutations at each locus (among all individuals) to be at most one. It is possible to prove that MCHC is APXhard even on instances where genotypes are deﬁned on only 2 loci or where each individual has at most one mate and one child. Due to the page limit, the proof is deferred to the full version of this paper.
3
A Heuristic Algorithm for MCHC
The presentation of the heuristic algorithm that we propose is divided into three parts. First, we give an extension of the system of linear equations over the ﬁeld Z2 proposed by Xiao et al. [17] for representing the set of haplotype conﬁgurations that are consistent with the input genotyped pedigree. In the extended system that we propose, recombinations and mutations are explicitly modeled as variables of the equations. In the second part, we establish an Lreduction from MCHC to the wellknown Nearest Codeword Problem (NCP) by splitting the system into two parts where one part contains only variables needed for the haplotype reconstruction and the other contains only recombination and mutation variables. Finally, we present a tailored version of a wellknown heuristic algorithm for NCP. Using this heuristic, we can guarantee that a feasible solution for NCP (and hence for MCHC) is found. 3.1
A System of Linear Equations for MCHC
In this part, we ﬁrst illustrate the linear system over Z2 proposed in [17] for the HI problem where no recombinations or mutations are permitted (i.e., the zerorecombinant haplotype conﬁguration problem or ZRHC), and then we describe
152
Y. Pirola, P. Bonizzoni, and T. Jiang
how it can be extended to accommodate recombinations and mutations events. For simplicity of presentation, we denote with the symbol + the addition over Z2 instead of using ⊕. 3.2
A Linear System for ZRHC
Computing the paternal haplotypes of all individuals is suﬃcient to fully describe the haplotyped pedigree because the maternal haplotype can be reconstructed from the paternal haplotype and the genotype of the individual. Therefore, we introduce a variable hi [l] for each individual i and locus l which represents the allele present at locus l of the paternal haplotype of i. Secondly, we need to represent the grandparental source. Let i be an individual and p one of its parents. Since no recombinations are admitted, the grandparental source is denoted as a single variable sp,i . Variable sp,i is equal to 0 if i has inherited from p the paternal haplotype of p, or 1 otherwise. To express concisely the linear equations, we need two additional sets of constants: the w and the dconstants. For each locus l and individual i, constant wi [l] is equal to 0 if i is homozygous at locus l, and 1 otherwise. For each locus l and pair of individuals p and i such that p is a parent of i, constant dp,i [l] is equal to 0 if p is the father of i and equal to wi [l] if p is the mother of i. Finally, since the paternal haplotype (and hence the maternal haplotype) is known at homozygous loci, we set hi [l] = gi [l] for every individual i and locus l such that gi [l] = 2. A casebycase analysis shows that any solution of the following linear system over Z2 is a zerorecombinant haplotype conﬁguration consistent with the genotyped pedigree (and vice versa) [17]. For all loci l and individuals i, ⎧ hp [l] + sp,i · wp [l] = hi [l] + dp,i [l] ⎪ ⎪ ⎪ ⎪ ⎪ h i [l] = gi [l] ⎪ ⎪ ⎪ ⎨ wi [l] = 0 ⎪ wi [l] = 1 ⎪ ⎪ ⎪ ⎪ ⎪ d p,i [l] = 0 ⎪ ⎪ ⎩ dp,i [l] = wi [l]
for each parent p of i if gi [l] = 2 if gi [l] = 2 if gi [l] = 2 if p is the father of i if p is the mother of i
(1)
Notice that, if the pedigree has n members and the genotypes are deﬁned over a set of m loci, then we have nm hvariables, at most 2n svariables, and at most 2nm equations. 3.3
A Linear System for MCHC
We now show how the previous linear system can be modiﬁed for representing all the consistent haplotype conﬁgurations that may contain recombinations and mutations. To accommodate recombinations, we introduce a set of δvariables deﬁned as follows. For each locus l, variable δp,i [l] is equal to 1 if a recombination has occurred at locus l between an individual p and one of its children i, and 0 otherwise. The grandparental source vector of a consistent haplotype conﬁguration can be expressed as a (linear) function of an svariable and a subset of
Haplotype Inference on Pedigrees with Recombinations and Mutations
153
δvariables. In particular, by induction on l, it is easy to prove l that the grandparental source of i w.r.t. p at locus l, sp,i [l], is equal to sp,i + j=1 δp,i [j]. Denote l as Δp,i [l] the sum j=1 δp,i [j]. By replacing sp,i with (sp,i + Δp,i [l]) in Eq. 1, we obtain a linear system that represents all the haplotype conﬁgurations consistent with the genotyped pedigree and allows recombination events. Since mutations are point events that replace an allele inherited from the parent with another allele, it suﬃces to add a term in the ﬁrst equation of the original linear system to model mutation events. We denote this term as μp,i [l] and set μp,i [l] = 1 if a mutation at locus l between p and i has occurred, and μp,i [l] = 0 otherwise. The following lemma is straightforward. Lemma 1. Let Pg be a genotyped pedigree. Then each solution of the system ⎧ hp [l] + (sp,i + Δp,i [l]) · wp [l] = hi [l] + dp,i [l] + μp,i [l] ⎪ ⎪ ⎪ ⎪ ⎪ hi [l] = gi [l] ⎪ ⎪ ⎪ ⎨ wi [l] = 0 ⎪ wi [l] = 1 ⎪ ⎪ ⎪ ⎪ ⎪ d p,i [l] = 0 ⎪ ⎪ ⎩ dp,i [l] = wi [l]
for each parent p of i if gi [l] = 2 if gi [l] = 2 if gi [l] = 2 if p is the father of i if p is the mother of i
(2)
concerning all loci l and individuals i represents a haplotype configuration consistent with Pg that admits recombination and mutation events. Conversely, a haplotype configuration consistent with Pg that admits recombination and mutation events is represented by a solution of the linear system. By construction, a haplotype conﬁguration that induces k variation events is represented by a solution of the linear system where exactly k δ and μvariables are nonzero. 3.4
Reducing MCHC to NCP
The Nearest Codeword Problem is the problem of coding theory that reconstructs the original codeword of a given received message by minimizing the Hamming distance between them. More formally, given an r × n matrix H over Z2 , and a column vector q ∈ Zr2 , the Nearest Codeword Problem [2, probl. MS3] asks for a vector e ∈ Zn2 with the minimum number of nonzero entries such that H · e = q. The number of nonzero entries of a vector v is called the weight of the vector and is denoted as v. The basic idea of our reduction is to split the linear system of Lemma 1 into two linear systems: one containing only h and svariables, and the other one containing only δ and μvariables. The second part of the system is, directly, an instance of NCP. Since all wi [l] and dp,i [l] assume constant (predetermined) values, we can write the linear system of Eq. 2 as the following matricial equation: Ah,s · xh,s + Aδ,μ · xδ,μ = b
(3)
154
Y. Pirola, P. Bonizzoni, and T. Jiang
where: xh,s is the column vector of the h and svariables, xδ,μ the column vector of the δ and μvariables, Ah,s the n × m1 matrix of the coeﬃcients of the h and svariables, Aδ,μ the n × m2 matrix of the coeﬃcients of the δ and μvariables, and b a column vector composed by constant entries. Let k be the rank of the matrix Ah,s and ATh,s be its transpose. Suppose w.l.o.g. that the ﬁrst k rows of Ah,s are linearly independent. Now, we construct the instance of NCP associated to an instance of MCHC as follows. Let B = {v1 , . . . , vr  vi ∈ Zn2 } be a basis of the vector space ker(ATh,s ) = {y ∈ Zn2  ATh,s · y = 0}, where 0 denotes the allzero column vector. Collate vectors vi to form a r × n matrix V such that the ith row is equal to viT . Then, the instance I of NCP associated with an instance I = (Ah,s , Aδ,μ , xh,s , xδ,μ , b) of MCHC is the pair I = (H, q) where H = V Aδ,μ and q = V b. Clearly, the transformation of I into I can be computed in polynomialtime via Gaussian elimination (to compute V ) and two matrix multiplications (to compute H and q). We complete the Lreduction from MCHC to NCP by proving the following two lemmas. Lemma 2 illustrates how to reconstruct in polynomialtime a solution of an MCHC instance given a solution for the associated NCP instance, and Lemma 3 shows how to compute (in polynomialtime) a solution for an instance I of NCP associated with an instance I of MCHC given a solution for I. Since both above transformations preserve the cost of solutions, the reduction is an Lreduction with parameters β = γ = 1. See [2, Def. 8.4] for the formal deﬁnition of Lreduction and an explanation of these parameters. Due to the page limit, the proofs of the lemmas are deferred to the full version of the paper. Lemma 2. Let I = (Ah,s , Aδ,μ , xh,s , xδ,μ , b) be an instance of MCHC and I = (H, y˜) the NCP instance associated with I. Then, given a solution e of NCP on I , it is possible to compute in polynomialtime a haplotype configuration δ,μ ) of I that induces e variation events. ( xh,s , x δ,μ ) be a solution of MCHC on the instance I = Lemma 3. Let S = ( xh,s , x (Ah,s , Aδ,μ , xh,s , xδ,μ , b) and I = (H, q) the NCP instance associated with I. Then, vector e := x δ,μ is a solution of NCP on I . The following corollary easily follows from Lemma 2 and Lemma 3. Corollary 1. MCHC is Lreducible to NCP with parameters β = γ = 1. 3.5
The Heuristic Algorithm
In this section, we present an eﬃcient heuristic algorithm that solves the MCHC problem. In addition, this heuristic can be also used to solve the MRHC and MMHC problems by restricting the types of variation events that are allowed. An implementation of the heuristic described below can be freely downloaded from the web page http://www.algolab.eu/HeuMCHC/. The algorithm is based on the above Lreduction from MCHC to NCP. Since NCP ∈ APX [1], there do not exist algorithms that can guarantee a good (i.e., constant) approximation ratio unless P = NP. Nevertheless, it has been
Haplotype Inference on Pedigrees with Recombinations and Mutations
155
shown that the sumproduct (SP) algorithm [6] (independently proposed in Artiﬁcial Intelligence as the beliefpropagation algorithm [11]) is an eﬀective and eﬃcient heuristic for NCP. The SP algorithm computes an approximation of the likelihood that each bit of the received message has been “ﬂipped” during the transmission of the message. Such an approximation is computed by employing the set of parity constraints of the linear code and a vector q (called syndrome) representing the constraints that are not satisﬁed by the received message. Our idea is to consider the variation events (recombinations and mutations) as the “errors” that we have to reconstruct and, once the “errors” (variation events) have been determined, it is easy to reconstruct the haplotyped pedigree (by Gaussian elimination). The Lreduction in Corollary 1 formalizes this idea. The set of parity constraints and the syndrome q are obtained from the genotyped pedigree (represented by the matrices Ah,s and Aδ,μ ) as illustrated in the previous section. The likelihoods computed by the SP algorithm on this instance represents the likelihoods that each δ or μvariable is equal to 1. In other words, for each possible variation event, it computes the likelihood that the event has occurred on the pedigree. Our heuristic iteratively adds the most likely variation event (as computed by the SP algorithm) to a set E of imputed variation events until a haplotype conﬁguration that induces exactly the imputed events can be found. Given a set of variation events E, the reconstruction of the haplotype conﬁguration that induces E can be performed eﬃciently. Indeed, it suﬃces to solve the linear system of Lemma 1 with the δ and μvariables assigned to 1 if the corresponding events (the mutations or the recombinations they represent) belong to E, or 0 otherwise. Initially, no variation events are imputed (thus E = ∅) while a set N contains all the possible variation events (represented by the corresponding δ and μvariables). For each binary linear code, the set of parity constraints is represented by a particular binary matrix H, called the check matrix, such that H · y = 0 if and only if y is a valid codeword. In our Lreduction, the check matrix associated with the MCHC instance is computed as H = V · Aδ,μ for some matrix V . As a consequence, matrix H has the same number of columns as Aδ,μ , each of which is associated with a δ or μvariable. We associate each column i of H with the δ or μvariable that is associated with the ith column of Aδ,μ . For simplicity, we identify each column i of H with the associated variable. The haplotype conﬁguration is computed in two steps: ﬁrst the set of variation events E that makes the reconstruction of a haplotype conﬁguration possible is computed, then the haplotype conﬁguration is recovered using the imputed events E. The ﬁrst step iteratively constructs the set of variation events. Using the SP algorithm, it computes an event e∗ that most likely is induced in a haplotype conﬁguration consistent with the pedigree. If more than one event have the maximum likelihood, one of them is chosen at random. Once e∗ has been determined, the corresponding δ or μvariable is set to 1, and the syndrome is updated according to the check matrix H. Then, the column of H associated with event e∗ can be removed, and e∗ can be moved from the set of possible events N to the set of imputed events E. Based on the remaining parity constraints, we
156
Y. Pirola, P. Bonizzoni, and T. Jiang
check if the presence (or absence) of other variation events is implied by e∗ and the other events contained in E. This check can be performed by the Gaussian elimination algorithm. This step ends if all the remaining parity constraints are satisﬁed. The second step reconstructs the haplotype conﬁguration consistent with the input genotyped pedigree by solving the linear system of Eq. 2 using, as a partial solution, the set E of imputed events. An important remark is in order. The SP algorithm considers as an additional input the prior probability that each variation event e has occurred. Although we have not incorporated this feature into the current algorithm, it could be extremely useful to model recombination hotspots (by increasing the prior probability of recombination events in regions where recombinations occurs more frequently), to diﬀerentiate the rates of recombinations and mutations (by increasing the prior probability of a recombination event with respect to a mutation event), and/or to model additional knowledge about the input genotypes. This feature of the SP algorithm could also allow us to combine the combinatorial formulation of the problem presented here with some elements of statisticsbased methods. The time complexity of the heuristic depends on several parameters. Let n be the number of individuals of the genotyped pedigree and m the number of loci. The NCP instance I is calculated by the Gaussian elimination algorithm on ATh,s and by two matrix multiplications, requiring O(n3 m3 ) time. The checkmatrix H has O(nm) rows and at most 4nm columns (one for each variation event). Therefore the reduction from the pedigree to the NCP instance is computed in O(n3 m3 ) time. The time required by each iteration is bounded by O(n3 m3 ) since the check of the existence of predetermined events (by Gaussian elimination) requires O(n3 m3 ) time, the SP algorithm requires linear time in the number of oneentries of matrix H, and the other operations that update parity constraints and the syndrome can be accomplished in O(n2 m2 ) time. The resolution of the ﬁnal linear system can be performed in O(n3 m3 ) time by the Gaussian elimination algorithm. Let k be the number of events that are imputed, then the overall time complexity of the heuristic is O(kn3 m3 ).
4
Experimental Results
Our approach has been experimentally analyzed under several simulated scenarios. The experimental analysis is divided into two parts. In the ﬁrst part, we evaluate the accuracy and eﬃciency of our heuristic on randomly generated MCHC instances. In the second part, we compare the performance of our heuristic with that of three stateoftheart approaches for MRHC and MMHC: PedPhase v2.1 [10], SimWalk2 [13], and MMPhase [16]. 4.1
Evaluation on Random Instances
The ﬁrst part of our experimentation involves randomly generated instances under several choices of 4 parameters: pedigree size (n), the number of loci (m),
Haplotype Inference on Pedigrees with Recombinations and Mutations
157
recombination probability (θr ), and mutation probability (μr ). For each choice of the parameters, we generated 30 haplotype conﬁgurations on 6 diﬀerent random pedigree graphs. We applied a variation event at each locus with probability θr for recombinations and μr for mutations. For each instance, we ran our heuristic 10 times and we picked the solution with the minimum number of induced events. We evaluated the quality of the results considering phase error (the ratio between the number of incorrectly predicted haplotype alleles and twice the number of heterozygous loci) and approximation ratio (the ratio between the number of predicted events and the number of generated events). The approximation ratio can be less than 1.0 because the generated haplotype conﬁguration might be suboptimal. Finally, we also evaluated the total running time required by the heuristic on all 10 executions. We chose a base set of values for the parameters n, m, θr , and μr and we conducted three series of tests. In each series, we modiﬁed the value of one of these parameters: pedigree size in the ﬁrst, genotype length in the second, and the two probabilities θr and μr in the third. The base values were: pedigree size n = 40, number of loci m = 40, recombination probability θr = 0.02, and mutation probability μr = 0.004. The detailed results of the three series of tests are summarized in Table 1. In the ﬁrst series of tests, we varied the pedigree size n and analysed the cases n = 40, n = 60, and n = 100 on both tree pedigrees and “general” pedigrees (i.e., pedigree with mating loops). In all cases, the heuristic never required more than 6 minutes (169 seconds on average) on a standard PC with a 1.66GHz CPU and 2GB of main memory and it always found a haplotype conﬁguration that induces fewer variation events than the generated one (i.e., the approximation ratio is always smaller than 1.0). Although this fact does not imply that the heuristic computed the optimal solution, it increases our conﬁdence in the soundness of the approach. The values of the quality measures are similar in all cases and, on average, are equal to 0.02 and 0.97 for phase error and approximation ratio, respectively. In the second series of tests, we varied the number of loci m and considered the following cases: m = 40, m = 60, and m = 100. Similarly to the previous series, we obtained 0.039 as the average phase error and 0.96 as the average approximation ratio, with an average running time of 182 seconds. In the third series of tests, we varied the probabilities of recombinations and mutations in the range of (0.02, 0.004) to (0.10, 0.02). In this case, the quality of the results decreases with the increase of the number of generated events. The worst results were obtained when recombination and mutation probabilities were at the maximum. Note that when this happens, the generated haplotype conﬁguration signiﬁcantly deviates from the parsimony principle that MCHC assumes. In fact, our heuristic reconstructs a solution with much fewer events than the generated haplotype conﬁguration (in such a situation the average approximation ratio is 0.85). 4.2
Comparison with StateoftheArt Methods
In the second part of the experimental evaluation, we compare the accuracy and eﬃciency of our heuristic with those of some stateoftheart approaches
158
Y. Pirola, P. Bonizzoni, and T. Jiang
Table 1. Summary of the results obtained by our heuristic on randomly generated instances. Each table reports the quality and performance measures of the heuristic on a subset of instances where a parameter has been varied. The default settings of the parameters are: pedigree size n = 40, number of loci m = 40, recombination probability θr = 0.02, and mutation probability μr = 0.004. (a) Increasing pedigree size (n) Tree pedigrees Pedigree size n = Avg. Avg. Avg. Avg. Avg.
no. of generated events no. of predicted events phase error approximation ratio time (in seconds)
General pedigrees
40
60
100
40
60
100
22.0 21.3 0.027 0.968 36
30.4 29.5 0.029 0.975 73
55.2 53.2 0.028 0.965 265
25.5 24.5 0.022 0.963 62
35.8 34.9 0.024 0.975 118
63.6 61.8 0.024 0.972 460
Mean 38.7 37.5 0.026 0.970 169
(b) Increasing the number of loci (m) Tree pedigrees Number of loci m = Avg. Avg. Avg. Avg. Avg.
no. of generated events no. of predicted events phase error approximation ratio time (in seconds)
General pedigrees
40
60
100
40
60
100
24.0 23.1 0.035 0.964 41
34.7 33.0 0.057 0.956 95
53.2 51.2 0.042 0.964 247
26.4 25.7 0.026 0.975 76
38.0 36.9 0.026 0.972 148
61.0 59.6 0.044 0.976 485
Mean 39.6 38.3 0.039 0.968 182
(c) Increasing recombination and mutation probabilities (θr and μr ) Tree pedigrees
General pedigrees
Recombination prob. θr = Mutation probability μr =
0.02 0.004
0.04 0.01
0.10 0.02
0.02 0.004
0.04 0.01
0.10 0.02
Avg. Avg. Avg. Avg. Avg.
24.5 23.8 0.035 0.973 45
48.8 45.7 0.061 0.937 74
111.5 94.8 0.114 0.848 164
24.9 24.0 0.020 0.963 63
48.9 45.8 0.053 0.939 86
121.8 105.3 0.099 0.866 248
no. of generated events no. of predicted events phase error approximation ratio time (in seconds)
Mean 63.4 56.6 0.064 0.921 113
for HI on pedigrees. Popular approaches to HI on pedigrees do not allow for both recombinations and mutations at the same time. Therefore, we separately considered two classes of algorithms. The ﬁrst one consists of algorithms for MRHC (i.e., only recombinations are allowed) and the second class consists of algorithms for MMHC (i.e., only mutations are allowed). We adapted our heuristic algorithm to the two problems by keeping only the variables associated with the type of events that are allowed (δvariables for MRHC and μvariables for MMHC). Comparison with MRHC Algorithms. Several algorithms for MRHC have been proposed in the literature. For our comparison, we chose two popular approaches with diﬀerent computational characteristics: PedPhase v2.1 [10] (an exact ILPbased algorithm) and SimWalk2 [13] (a popular statistical approach for HI). We generated 750 instances using SimPed [8], a simulation program for the generation of haplotyped pedigrees based on usersupplied biological information
Haplotype Inference on Pedigrees with Recombinations and Mutations
159
Table 2. Summary of the comparison with other methods for MRHC on 750 instances whose sizes vary from pedigrees with 8 members and 10 loci to pedigrees with 100 members and 100 loci. For each method, we report the number of instances that have been solved within an hour of computation (i.e., completed instances), the average number of predicted recombinations, the average phase error, and the average running time. To facilitate the comparison, for each row, we report in brackets the same performance measure values obtained by our heuristic on the instances completed by the other two methods. Heuristic Completed instances Avg. no. of recombinations Avg. phase error Avg. running time (s)
PedPhase 2.1 [10]
750 26.42 0.030 4.7
565 14.25 (14.27) 0.030 (0.031) 35.8 (1.0)
SimWalk2 [13] 495 17.37 (7.21) 0.037 (0.029) 787.7 (0.2)
Table 3. Summary of the comparison with another method for MMHC on 300 instance whose sizes vary from pedigrees with 50 members and 50 loci to pedigrees with 150 members and 150 loci. For each method, we report the number of instances that have been solved within an hour (i.e., completed instances), the average number of computed mutations, the average phase error, and the average running time. Heuristic Completed instances Avg. no. of mutations Avg. phase error Avg. running time (s)
298 38.83 0.0030 483.58
MMPhase [16] 297 37.77 0.0030 167.54
(such as intramarker distances and allele frequencies). The same biological information have then been used to correctly initialize the input parameters of SimWalk2. The instance sizes ranged from pedigrees with 8 members and 10 loci to pedigrees with 100 members and 100 loci. We limited the running time on each instance to 1 hour. Our heuristic was the only method that completed all the 750 instances within this time limit. PedPhase completed 565 instances and SimWalk2 only 495 of them. PedPhase took over 5 hours to solve the 565 instances that it was able to tackle, while our heuristic on the same instances took only 575 seconds. Our heuristic was able to compute a solution with the same number of recombinations as PedPhase (i.e., an optimal solution) in 560 of the 565 cases. SimWalk2 is a much slower approach; it took nearly 108 hours of computation while our heuristic completed the same set of instances in less than 90 seconds. Moreover, SimWalk2 never computed a solution with fewer recombinations than our heuristic. On the other hand, the average phase errors of the three approaches are almost identical (PedPhase 0.030, SimWalk2 0.037, and our heuristic 0.030), implying that the sets of recombinations computed by the three approaches, albeit diﬀerent, are similar. A summary of the results is presented in Table 2.
160
Y. Pirola, P. Bonizzoni, and T. Jiang
Comparison with MMPhase. We compared our heuristic with MMPhase [16], the only other algorithm that has been explicitly proposed for MMHC in the literature (to the best of our knowledge). MMPhase is an ILPbased approach for MMHC with two restrictions: the model explicitly forbids two mutations at the same locus in diﬀerent individuals (called the infinitesite assumption) and the current implementation is only able to handle tree pedigrees. Therefore, we generated 300 random instances of diﬀerent sizes according to these restrictions. In particular we considered 4 diﬀerent pedigree sizes (50, 75, 100, 150) and 3 diﬀerent numbers of loci (50, 100, 150) and we generated 25 instances for each possible combination of the two parameters. The comparison revealed that MMPhase is noticeably faster than our heuristic (on average MMPhase required 167 seconds per instance vs. 483 seconds for our heuristic). However we observe that MMPhase exploits the inﬁnitesite assumption in order to reduce the solution space, while our method allows more than one mutation on the same locus. Moreover, while MMPhase was able to solve 297 of the 300 instances within an hour, our method was able to solve 298 instances in the same time limit. Although our heuristic obtained solutions with slightly more mutations than MMPhase on 38 of the 298 instances, the average phase errors of the two methods are identical (0.0030). A summary of the comparison results is presented in Table 3.
5
Conclusion
In this paper, we presented a heuristic method for the haplotype inference problem on pedigrees allowing two types of variation events: recombinations and mutations. The experimental evaluation under several simulated scenarios showed that the heuristic is both accurate and eﬃcient. The heuristic also compares favorably with several other stateoftheart methods. It is faster than (but as accurate as) the other methods that consider only recombinations. Moreover, the only method considered in this study that is faster than our heuristic (MMPhase, which allows only point mutations) requires and exploits more restrictive assumptions about the input data than our method. The heuristic algorithm could handle moderately large pedigrees very well (in some of our tests, it was able to process tree pedigrees with 50 individuals and 1000 loci in approximately 2.5 hours of computation time on a standard PC). However, it cannot be applied directly to genomescale data with millions of loci. Fortunately, the haplotype block structure observed in the human genome [5] provides a straightforward way of partitioning long genotypes into short blocks which can be readily handled by our method. Acknowledgments. This research was supported in part by FAR MIUR 60% grant “Algorithmic methods and combinatorial structures in Bioinformatics” (Univ. di MilanoBicocca) to YP and PB, and NIH grant 2R01LM008991 and NSF grant IIS0711129 to TJ. Part of the work was done when YP was visiting at University of California, Riverside. We would like to thank WeiBung Wang for valuable discussions and sharing the MMPhase code with us.
Haplotype Inference on Pedigrees with Recombinations and Mutations
161
References 1. Arora, S., Babai, L., Stern, J., Sweedyk, Z.: The hardness of approximate optima in lattices, codes, and systems of linear equations. J. of Computer and System Sciences 54(2), 317–331 (1997) 2. Ausiello, G., Crescenzi, P., Gambosi, G., Kann, V., MarchettiSpaccamela, A., Protasi, M.: Complexity and Approximation: Combinatorial optimization problems and their approximability properties. Springer, Heidelberg (1999) 3. Bonizzoni, P., Della Vedova, G., Dondi, R., Li, J.: The haplotyping problem: An overview of computational models and solutions. J. of Computer Science and Technology 18(6), 675–688 (2003) 4. Elson, R.C., Stewart, J.: A general model for the analysis of pedigree data. Human Heredity 21, 523–542 (1971) 5. Gabriel, S.B., Schaﬀner, S.F., Nguyen, H., Moore, J.M., et al.: The structure of haplotype blocks in the human genome. Science 296(5576), 2225–2229 (2002) 6. Gallager, R.G.: LowDensity ParityCheck Codes. MIT Press, Cambridge (1963) 7. Lander, E., Green, P.: Construction of multilocus genetic linkage maps in human. Proceedings of the National Academy of Sciences USA 84, 2363–2367 (1987) 8. Leal, S.M., Yan, K., M¨ ullerMyhsok, B.: SimPed: a simulation program to generate haplotype and genotype data for pedigree structures. Human heredity 60(2), 119– 122 (2005) 9. Li, J., Jiang, T.: Eﬃcient inference of haplotypes from genotypes on a pedigree. J. of Bioinformatics and Computational Biology 1(1), 41–69 (2003) 10. Li, J., Jiang, T.: Computing the minimum recombinant haplotype conﬁguration from incomplete genotype data on a pedigree by integer linear programming. J. of Computational Biology 12(6), 719–739 (2005) 11. Pearl, J.: Reverend Bayes on inference engines: A distributed hierarchical approach. In: Proc. of the American Ass. of Artiﬁcial Intelligence National Conference on AI, Pittsburgh, PA, pp. 133–136 (1982) 12. Qian, D., Beckmann, L.: Minimumrecombinant haplotyping in pedigrees. American J. of Human Genetics 70(6), 1434–1445 (2002) 13. Sobel, E., Lange, K.: Descent graphs in pedigree analysis: applications to haplotyping, location scores, and markersharing statistics. American J. of Human Genetics 58(6), 1323–1337 (1996) 14. The International HapMap Consortium: A second generation human haplotype map of over 3.1 million SNPs. Nature 449(7164), 851–861 (2007) 15. Tr´egou¨et, D.A., K¨ onig, I.R., Erdmann, J., et al.: Genomewide haplotype association study identiﬁes the SLC22A3LPAL2LPA gene cluster as a risk locus for coronary artery disease. Nature genetics 41(3), 283–285 (2009) 16. Wang, W.B., Jiang, T.: Eﬃcient inference of haplotypes from genotypes on a pedigree with mutations and missing alleles (extented abstract). In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009. LNCS, vol. 5577, pp. 353–367. Springer, Heidelberg (2009) 17. Xiao, J., Liu, L., Xia, L., Jiang, T.: Eﬃcient algorithms for reconstructing zerorecombinant haplotypes on a pedigree based on fast elimination of redundant linear equations. SIAM J. on Computing 38(6), 2198–2219 (2009)
Identifying Rare Cell Populations in Comparative Flow Cytometry Ariful Azad1 , Johannes Langguth2 , Youhan Fang1 , Alan Qi1 , and Alex Pothen1 1
Dept. Computer Science, Purdue University, West Lafayette, IN 47907, USA 2 Department of Informatics, University of Bergen, Bergen, Norway {aazad,yfang,alanqi,apothen}@cs.purdue.edu,
[email protected] Abstract. Multichannel, high throughput experimental methodologies for ﬂow cytometry are transforming clinical immunology and hematology, and require the development of algorithms to analyze the highdimensional, largescale data. We describe the development of two combinatorial algorithms to identify rare cell populations in data from mice with acute promyelocytic leukemia. The ﬂow cytometry data is clustered, and then samples from the leukemic, preleukemic, and Wild Type mice are compared to identify clusters belonging to the diseased state. We describe three metrics on the clustered data that help in identifying rare populations. We formulate a generalized edge cover approach in a bipartite graph model to directly compare clusters in two samples to identify clusters belonging to one but not the other sample. For detecting rare populations common to many diseased samples but not to the Wild Type, we describe a cliquebased branch and bound algorithm. We provide statistical justiﬁcation of the signiﬁcance of the rare populations. Keywords: ﬂow cytometry, edge cover, clique, mixture modeling, KL divergence, acute promyelocytic leukemia (APL).
1
Introduction
We describe two algorithms to identify rare cell populations characteristic of diseases such as leukemia by analyzing ﬂow cytometric data obtained from diseased and healthy samples. The recent development of highthroughput, multichannel ﬂow cytometry creates highdimensional and largescale data that requires the concomitant development of algorithms for comparative analyses of data from diseased and healthy samples, and from diseased samples at various stages of disease. Speciﬁcally, we need algorithms that can match cell populations among diseased samples, and diﬀerentiate between cell populations that belong to diseased and healthy states. Such studies could distinguish cancer cells from healthy cells, and identify cancer stem cells that are responsible for generating new cancerous cells, which could lead to therapies targeting such cells. In ﬂow cytometry, ﬂuorescently labeled antibodies are bound to antigens on the cell, and on excitation with a laser as cells ﬂow in a ﬂuid stream, the ﬂuorochrome emits light of a speciﬁc wavelength, thus identifying the cell V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 162–175, 2010. c SpringerVerlag Berlin Heidelberg 2010
Identifying Rare Cell Populations in Comparative Flow Cytometry
163
populations that express the antigen. Flow cytometry is routinely used in the diagnosis of diseases and has many applications in clinical practice and research. Initially ﬂow cytometry permitted the investigation of only one ﬂuorophore, but recent advances allow close to twenty parallel channels to be monitored [5,12]. Various techniques have been developed in the past [7,10] to analyze this high dimensional data. A recent survey of data analysis methods in ﬂow cytometry is provided in [2]. Early work on analyzing this high dimensional data has relied on projecting the data to lower dimensions and manual gating, which is labor intensive and inﬂuenced by analyst bias. Hence the development of eﬃcient and accurate algorithms for analyzing the largescale, high dimensional data is a critical need. Performing comparative analysis of samples at the cell level is computationally expensive, and hence a more practical approach is to cluster cells in each sample ﬁrst, and then perform the comparative analyses across the samples. Various techniques have been proposed to cluster ﬂow cytometry data and form groups of cells [3,4,7], but there has been little work on the postprocessing of the clustered data to identify common and distinct cell populations among diseased and healthy states. A recent approach for downstream analysis of clustered data, ﬂow analysis with automated multivariate estimation (FLAME), was proposed by Pyne et al. [10]. The ﬂuorescense intensity matrix with rows corresponding to cells and columns corresponding to antibodies is ﬁrst clustered into cell populations using the skew t distribution. The clusters across all samples are then pooled and a set of global metaclusters are obtained from them using an approach called Partitioning across Medoids. Each sample is then compared with the set of global metaclusters using an integer programming formulation of a weighted bmatching in a bipartite graph with additional constraints. Our work is closest to the FLAME approach, while diﬀering from it in significant ways. First, we use a nonparametric inﬁnite mixture model in clustering phase, whereas FLAME used the skew t mixture model. Second, we compare clusters in two or more samples directly without creating metaclusters from the clusters in all samples. We propose a generalized edge cover formulation in a bipartite graph as a model for discovering outlying clusters using pairwise comparisons of samples. Third, we propose a weighted clique approach to compare multiple samples to identify outlying clusters and classify them further into distinctive and common outliers.
2 2.1
Problem Formulation Description of Data
We analyze two diﬀerent ﬂow cytometry datasets on mouse bone marrow cells from Brigham and Women’s Hospital in Boston [15]. In this work, an oncogene PMLRARα, was expressed in mice leading to acute promyelocytic leukemia (APL) in a course of weeks. Each dataset consists of ﬂow cytometry data of cells from three leukemic mice (P i ), one preleukemic mouse (H) that has the
164
A. Azad et al.
oncogene expressed but has not developed APL yet, and a Wild Type (WT) sample that does not have the oncogene expressed. Each sample consists of multidimensional (6 or 7dimensional) ﬂow cytometry data of cells from a single mouse with each dimension representing a speciﬁc characteristic of the cell. A sample is represented as a matrix of size N × d, where N is the number of cells, and d is the dimension of data. The data is shown in Table 1. We normalize each column of the matrix by converting it to a vector with mean equal to zero and standard deviation equal to one, and then apply a clustering method to be described in Sec. 3.1. 2.2
Model of the Data
Let each dataset consist of samples from N patients, labeled P 1 P 2 , . . ., P N , and one W T . The ith patient P i has nP i clusters P i = {ui1 , ui2 , . . . , uinP i }, where uij is the jth cluster in the ith patient data. Similarly, WT has nW T clusters W T = {w1 , w2 , . . . , wnW T }. If multiple WT samples are available they can be combined beforehand to construct a unique WT model. We use the KullbackLeibler divergence as the measure of distance between two clusters. The KLdivergence [6], also known as the relative entropy, between two probability density functions p(x) and q(x) is: q(x) KL(pq) = − p(x)ln dx. (1) p(x) For two ddimensional Gaussian distributions N0 and N1 with means μ0 , μ1 and covariance matrices Σ0 , Σ1 , respectively, the KL divergence has a closedform expression: det Σ1 1 KL(N0 N1 ) = ln + tr(Σ1−1 Σ0 ) 2 det Σ0 d T −1 + (μ1 − μ0 ) Σ1 (μ1 − μ0 ) − . (2) 2 We make the distance measure symmetric by setting the average of KL(pq) and KL(qp) as the distance d(p, q) between two clusters p and q. A few additional terms are needed to discuss our objective function. 2.3
Basic Deﬁnitions
Deﬁnition 1. Cohesion Index(CI): Given a set of clusters from N patients, S = {u1 , u2 ...uN } such that ui ∈ P i , and d(ui , uj ) is the distance between clusters ui and uj , the Cohesion Index of the set S is the average distance between pairs of clusters (ui , uj ) in the set S: CI(S) =
2 N (N − 1)
ui ,uj ∈S i<j
d(ui , uj ).
(3)
Identifying Rare Cell Populations in Comparative Flow Cytometry
165
A small value of CI means that the clusters in S are similar, while large values indicate that they are dissimilar. The Cohesion Index CI for set S consisting of clusters represented by the large ﬁlled circles (within the circles denoting the P i vertices) in Fig. 1 is the sum of the weights of the edges joining these clusters divided by ten. P2
P1 WT
P3
P5 P4
Fig. 1. Graph model of data with 5 patients and 1 Wild Type. The data from each individual has been clustered; vertices in the graph are the clusters, and the edge weights are derived from the KullbackLeibler divergences between clusters.
Deﬁnition 2. Divergence Index(DI): Given a set of clusters from N patients, S = {u1 , u2 ...uN } such that ui ∈ P i , and d(w, ui ) is the KLdivergence between clusters w ∈ W T and ui ∈ S, the Divergence Index (DI) is the minimum sum of distances between each pair (w, ui ) in the set S:
1 DI(S) = min d(w, ui ) . (4) N w∈W T ui ∈S
A large value of DI means clusters in S are dissimilar from any WT cluster, while a small value of DI means the clusters in S are similar to some cluster in WT. In Fig. 1, the central grey circle represents the WT sample, the large ﬁlled circle within it corresponds to a cluster in WT with the least sum of distances from a set S of patient clusters denoted by the ﬁlled circles, and the average length of the edges between the WT and patient clusters yields DI for the set S. To identify groups of similar outliers we look for sets of clusters S with low values of CI(S) and high values of DI(S). However, maximizing (DI(S)−CI(S)) does not suﬃce to guarantee both a low value of CI and a high value of DI. This observation leads to the next deﬁnition. Deﬁnition 3. Coherence Conﬁdence (CC): Given a set of clusters S = {u1 , u2 ...uN } such that ui ∈ P i , the Coherence Conﬁdence (CC) is the product of the normalized diﬀerence between DI(S) and CI(S) and a damping factor: CC(S) =
DI(S) − CI(S) 1 − a−(CI(S)+DI(S)) , DI(S) + CI(S)
(5)
where a is a constant greater than one. The damping factor prevents the ratio from becoming unstable for small values of the sum CI(S) + DI(S). If this sum is small, then the factor is small enough to keep the value of CC(S) low. As
166
A. Azad et al.
the sum increases, the factor increases to its maximum value of one, and does not signiﬁcantly inﬂuence the CC value. The range of values of CC is [−1, 1]. The constant a in the damping factor is chosen so that it should not grow too quickly to its maximum value. We tried various values for the constant and a ∼ 1.2 worked reasonably well with the data here. We will identify groups S consisting of similar outlying clusters from sets with large positive values of CC(S). 2.4
Objectives
We now state the objectives of our analysis. 1. Pairwise Outliers: Identify dissimilar clusters in a diseased sample by pairwise comparison with WT. These are pairwise outliers which contain both distinctive and common outliers described below. 2. Distinctive Outliers: Identify the clusters in a diseased sample that are dissimilar to any WT clusters as well as clusters from other diseased samples. These are distinctive outliers that fail to form groups with low values of CI. 3. Common Outliers: Identify group of similar outliers, i.e., groups with members similar to each other in diseased samples but dissimilar to any WT cluster. These common outliers have high values for CC.
3 3.1
Methods Clustering
We denote the ﬂow cytometry data from a sample as X = [xT1 , xT2 , . . . , xTN ], where xTi corresponds to the data from the ith cell. We assume the data are generated from a hierarchical Bayesian model. First, the observation xi is sampled from a likelihood function f (θi ) where θi is the likelihood parameter for the ith observation. Second, the parameter θi follows a distribution G, which is sampled from a Dirichlet process DP (α, G0 ) with a concentration parameter α and a base distribution G0 . Note that the use of a Dirichlet prior will make many {θi }’s share the same value, naturally inducing clustering of data. The model is known as the Dirichlet Process Mixture (DPM) model [1,9] and can be summarized as follows: xi θi ∼ F (θi ), θi G ∼ G, G ∼ DP (α, G0 ),
(6)
where X ∼ S means that X follows the distribution S. Since G is a distribution, G ∼ DP (α, G0 ) suggests that the Dirichlet Process DP (α, G0 ) is a distribution over distributions. We used a publicly available Matlab implementation of DPM clustering by Teh [14], which is based on a Chinese Restaurant Process representation of the DPM model and uses simple Gibbs sampling. The computational cost per iteration is O(N d2 k), where N is the number of rows in a data sample matrix
Identifying Rare Cell Populations in Comparative Flow Cytometry
167
X, d is the number of columns of X, and k is the number of clusters in the current iteration (k changes with iterations). The value of N is large (see Table 1 in Sec. 4), which makes each iteration computationally expensive even for a small number of clusters. Moreover, the quality of clustering improves with the number of iterations. In our experiments, a hundred iterations work reasonably well for the data as the clustering changes relatively little after that. Although the DPM inference is expensive for large samples, we prefer the nonparametric model, DPMs, over classical parametric cluster methods, e.g, Kmeans. The reason is that the computational cost of selecting the number of clusters for a parametric model is prohibitively expensive for ﬂow cytometry data analysis. DPMs circumvents the model selection problem by automatically determining the number of clusters for each sample, making it well suited as a clustering tool before the application of our outlier detection algorithms. The DPM model is an inﬁnite model in the sense that it contains a mixture of countably inﬁnite components. For example, if F (·) is a Gaussian distribution, the DPM model can be viewed as a mixture of inﬁnite Gaussians [11]. Given a ﬁnite number N data points, however, we compute the posterior distribution of the DPM model using Bayes theorem; the expected number of components in the posterior distribution is always ﬁnite and, often, much smaller than the number of data points. 3.2
Pairwise Comparison: Generalized Edge Cover
One method we used to identify outliers in the clustered data is pairwise comparison between samples. We model a pair of samples, say A1 and A2 , using a complete bipartite graph with each cluster represented by a vertex, and edges joining pairs of clusters in diﬀerent samples. Formally G = (V1 , V2 , E) is a complete bipartite graph, where V1 contains all clusters from A1 , V2 contains all the clusters from A2 , and the edge weight function is c : E → R where cij is the weight of edge {ui , uj }, with ui ∈ V1 and uj ∈ V2 . The weight of an edge is the average KL divergence of its endpoint clusters. In this bipartite graph we seek to identify clusters that are common to samples A1 and A2 , and also those that belong to only one sample. Since low edge weight implies high similarity among clusters we could ﬁnd a minimumweight matching among all maximum cardinality matchings in the graph G and declare unmatched vertices to be outliers. However, this attempt at a model for outlier detection has a signiﬁcant drawback. Since the number of clusters in the two samples is generally not the same, some clusters will remain unmatched even if they are highly similar to another cluster, and should not be identiﬁed as outliers. We address this issue by formulating the problem as a minimumweight edge cover on a complete bipartite graph. An edge cover is a subset of edges such that each vertex in the graph has at least one edge incident on it, whereas a matching is a subset of edges such that each vertex in the graph has at most one edge incident on it. However, even an edge cover fails to accurately model the problem since clusters that represent outliers should not be covered in an edge cover. Hence we ﬁnd a generalized edge cover that permits
168
A. Azad et al.
some vertices not to be covered, at the cost of a penalty, by adding a weight λ for each uncovered vertex to the weight of an edge cover. Thus λ acts as a cutoﬀ value for long edges that would not be included in a generalized edge cover. This leads to a generalized edge cover formulation of the problem, where the cover EC leaves some uncovered vertices Vuc ⊆ V1 ∪ V2 , while minimizing the objective function: ⎛ ⎞ min ⎝ cij + λ ∗ Vuc ⎠ . (7) (vi ,vj )∈EC
A generalized edge cover in G can be computed from an edge cover in a transformed graph G . Let the graph G be obtained from G by introducing two new distinguished vertices v1 ∈ V1 and v2 ∈ V2 , and adding an edge {v1 , v2 } with c({v1 , v2 }) = 0, and edges {v1 , u2 } for each u2 ∈ V2 , {v2 , u1 } for each u1 ∈ V1 , with c({u1 , v2 }) = c({u2 , v1 }) = λ. If a minimumweight edge cover includes added edges with weight λ, for each such edge, we leave the original vertex in G incident on this edge uncovered in a generalized edge cover of the original graph, thus paying a price of λ for the vertex, without changing the weight or structure of the remaining edge cover. A minimumweight edge cover in a graph can be computed in polynomial time by making a copy of the graph and connecting each vertex to its twin in the copy by an edge with weight equal to twice the minimum weight among original edges incident on it. A minimumweight perfect matching in this graph can be used to compute a minimumweight edge cover in the original graph [13]. Following the above discussion, our pairwise comparison algorithm for outlier detection can be formulated in the following stages: 1. Preprocessing: Add distinguished vertices v1 ∈ V1 and v2 ∈ V2 , and an edge {v1 , v2 } with c({v1 , v2 }) = 0. Given a cutoﬀ value λ, add edges {v1 , u2 } for each u2 ∈ V2 , and {v2 , u1 } for each u1 ∈ V1 , all with a weight of λ. Let G = (V , E ) be the resulting graph. ˜ = (V˜ , E ˜ ) be a disjoint copy of G . Let G ¯ be 2. Duplicate Graph: Let G ˜ the the graph formed by taking the union of G and G and adding an edge {v, v˜} connecting every v ∈ V with its twin v˜ ∈ V˜ . Let c({v, v˜}) = 2μ(v) for each v ∈ V , where μ(v) is the minimum weight of the edges of G incident on v. ¯ 3. Matching: Compute a minimumweight perfect matching M in G. 4. Edgecover: Obtain a minimumweight edge cover EC of G by replacing every edge {v, v˜} ∈ M by an edge of weight μ(v) in G incident on v. 5. Postprocessing: Remove all edges {v1 , o}, {v2 , o} from EC , where o denotes an original vertex in V1 ∪ V2 ; add each vertex o to the set of outliers O. Remove the distinguished vertices v1 and v2 from EC . The resulting edge cover EC ∗ together with the set of uncovered vertices O is a solution to the generalized edge cover problem in G. Lemma: The Algorithm described above computes an optimal generalized edge cover in G.
Identifying Rare Cell Populations in Comparative Flow Cytometry
169
Proof: The correctness of the algorithm for computing the edge cover EC in the graph G was shown in [13]. We obtain a generalized edge cover in G by deleting, the vertices v1 and v2 , the edges incident on these vertices in EC , and all vertices adjacent to these vertices in EC . Let O be the set of the deleted vertices adjacent to v1 and v2 , which will be identiﬁed as outliers. Let EC be the edges remaining from the edge cover EC in the modiﬁed graph G = G \ O. We claim that EC together with O is an optimal solution for the generalized edge cover problem in G. Assume that there is an optimal solution in G consisting of a set of outliers O and an edge cover EC ∗ in G\ O. Clearly c(EC ) = c(EC ∗ ), for otherwise one of the solutions could be improved upon, thereby contradicting their minimality in G or G \ O respectively. It remains to prove that there is no solution in G with a diﬀerent outlier set and smaller cost. Let EC ∗ together with O be such a solution for G having a smaller cost c < c(EC ). Then EC ∗ together with an edge {o, v1 } or {o, v2 } for every o ∈ O and the edge {v1 , v2 } is an edge cover in G with cost c < c(EC ), contradicting the optimality of EC .
Thus we obtain a generalized edge cover. Note that a vertex u ∈ Vk , where k = 1 or 2, and μ(u) is the minimum weight among the edges of G incident on u, will always be an outlier if μ(u) ≥ 2λ, and can never be an outlier if μ(u) < λ. Otherwise, it will be an outlier if and only if it is not matched to a vertex in G during step 3 of the algorithm. For a graph with n vertices and m edges, an edge cover of minimum weight can be computed in time O(n(n + m log n)) [13]. In this context, since there are at most K clusters in each patient, n ≤ 2K, and m ≤ K(K − 1)/2, and thus the time complexity of pairwise comparison to identify outliers is O(K 3 log K). 3.3
Comparing Multiple Clusters
Formation of Coherent Groups. We now consider an approach that compares multiple diseased samples to identify clusters common to them but not belonging to the Wild Type. A group of clusters S is a set of distinct clusters from each patient, S = {u1 , u2 ...uN }, with ui ∈ P i . In Sec. 4.5 we relax this to form groups that do not cover all patients. To identify common outliers we ﬁnd such groups that exhibit high similarity among their clusters while being dissimilar to the Wild Type. A graph representation of a group S of clusters is a clique consisting of one cluster from each patient. The cost of a group S is the average weight of all the edges of the corresponding clique, which is the Cohesion Index CI(S). It is easy to show that ﬁnding a group with minimum CI score is NPhard via a reduction from MAXCLIQUE. To identify groups with low CI score we use a branch and bound technique, which provides good performance for a reasonable number of clusters and patients. We omit the details here due to space considerations. The branch and bound procedure is called once with each cluster as seed, and it ﬁnds a group with minimum cost CI(S) containing the seed cluster, resulting in N K groups in total. The method works very well in practice, although it has
170
A. Azad et al.
a worstcase running time exponential in N . Since the distance measure is not metric, no obvious approximation guarantee exists. Once we have obtained coherent groups of clusters with small CI scores, we calculate the DI and CC scores for those sets. Since we have a single Wild Type sample with K clusters we can ﬁnd the minimum Divergence Index for a group S in O(N K) time. The decision about distinctive and common outliers is based on the following rules: Distinctive Outliers: If a group has high value for CI, then declare the seed cluster of that set as a distinctive outlier, since it fails to form a close group with clusters from other patients. Common Outliers: Among the remaining groups with small CI scores, ﬁnd those groups having large CC values. These sets are close to one another while being distinct from any WT cluster.
4 4.1
Results Clustering Results
We cluster each normalized sample using a DPM clustering algorithm and the results are shown in Table 1. All subsequent downstream analysis is built upon these clustering results. Table 1. Clustering the ﬂow cytometry data for two datasets. WT represents the Wild Type, P i denotes a leukemic mouse, and H is a preleukemic mouse with an oncogene expressed. Dataset1
Dataset2
Sample Dimension #Cells #Clusters Sample Dimension #Cells #Clusters WT H P1 P2 P3
6 6 6 6 6
115,407 131,850 107,299 131,575 236,392
18 23 22 28 31
WT H P1 P2 P3
7 7 7 7 7
49,316 68,886 78,406 6,050 48,998
21 22 21 12 21
The computational cost of the clustering step using the Matlab DPM code is about six to ten hours depending on the dataset size, while the edge cover and branch and bound computations run under a minute on a 3 GHz PC. The DPM clustering code should be much faster when it is implemented eﬃciently in a noninterpreted environment, but it would still be the dominant cost of the current computation. Improving its performance was not the scope of this work. 4.2
Pairwise Comparison Results
The generalized edge cover approach compares leukemic mouse samples with WT and identiﬁes outliers depending on a cutoﬀ value λ. The optimal cutoﬀ
Identifying Rare Cell Populations in Comparative Flow Cytometry
171
value is dependent on the KullbackLeibler divergences of the clusters involved. The number of outliers is inversely related to λ in that a large value of λ yields very few outliers, and vice versa. A plot is shown in Figure 2. 35
Dataset1
30 25
P1WT
20
P2WT
15
P3WT
Number of Outliers
Number of Outliers
35
10 5
0
Dataset2
30 25
P1WT
20
P2WT
15
P3WT
10 5
0 0
20
40
60
80
Cutoff (λ)
100
0
20
40
60
80
100
Cutoff (λ)
Fig. 2. Outliers from pairwise comparison between WT and leukemic samples with diﬀerent cutoﬀ (λ) values for two datasets.
The outlier proﬁle in both datasets shows a sharp change approximately at λ = 20, which we choose to be a good cutoﬀ value for the detection of extreme outliers. Table 2 shows all the outliers obtained for two diﬀerent values of λ. Note that pairwise comparison of a leukemic sample with the WT sample cannot distinguish between distinctive and common outliers. Table 2. Outlying clusters in leukemic samples (Dataset 1) for two cutoﬀ λ values Sample 1
P P2 P3
4.3
Outliers at λ = 20 2,10,13,14 4,12,17,18,20,24,25,28 11,12,13,16,17,18,19,20,21,29
Outliers at λ = 10 2,3,10,12,13,14,16,17,18,19,21 2,3,4,11,12,16,17,18,19,20,21,22,24,25,26,27,28 8,9,11,12,13,15,16,17,18,19,20,21,23,24,26,28,29,31
Coherent Groups
Every cluster in each sample is used as a seed cluster to construct a group S with a minimum value of the Cohesion Index. The signiﬁcance of the CI scores of the identiﬁed groups can be assessed using the permutation test [8]. We randomly select one cluster from each leukemic mouse to form a group and construct Nperm = 100, 000 random groups in total. For any (nonrandomly constructed) group S, let NS be the number of random groups (Srand ) having CI(Srand ) ≤ CI(S). The signiﬁcance measure, the pvalue of S, can then be calculated as p(CI(S)) = (NS + 1)/(Nperm + 1). Groups with small p(CI(S)) values are signiﬁcant since the chance of ﬁnding them at random is small. The histogram of the Nperm permutations is shown in the left subﬁgure in Figure 3 with the broken vertical line indicating 5% conﬁdence level. We observe that most of the nonrandom groups fall within the 5% conﬁdence interval.
172
A. Azad et al. (a) Permutation Test for CI
(b) Permutation Test for CC 0.05
Relative Frequency
Relative Frequency
0.04 0.03 0.02 0.01 0 0
20
40
60
0.04 0.03 0.02 0.01 0 −1
80
Cohesion Index (CI)
−0.5
0
0.5
1
Coherence Confidence (CC)
Fig. 3. Histogram of the permutation tests for CI (left) and CC (right) scores from Dataset 1. Groups at a 5% conﬁdence level are to the left of the broken vertical line for CI scores, and to the right of the broken vertical line for CC scores. Table 3. Groups with CI scores and pvalues of CI scores. Seed clusters are shown in grey and distinctive outliers are shown in boxed squares. Dataset1 P1 P2 P3 1 2 4 10 11 14 15 15 17 18
7 4 7 26 13 1 11 11 21 26
CI
Dataset2 p(CI)
8 0.62 0.00024 18 296.7 8 1.404 0.0002 18 154.658 14 1.27 0.00013 30 74.604 28 3.031 0.00335 21 49.91 17 1.675 0.00046 31 3.054 0.00345
P1 P2 P3 3 6 8 10 11 12 13 14 18 21
6 8 10 10 4 5 5 4 5 12
CI
p(CI)
4 1.232 0.00064 9 24.495 14 1.204 0.00043 7 0.627 0.00012 12 44.63 15 3.397 0.00815 15 3.918 0.01196 10 107.167 15 3.326 0.0076 21 7.234 0.053099
Several representative groups with their pvalues are presented in the Table 3, where seed clusters are highlighted in grey. Notice that multiple seeds may construct the same group (e.g., {4, 7, 8} in dataset1). Such groups are usually tight with low pvalues. Also notice the three groups in {12, 5, 15}, {13, 5, 15}, {18, 5, 15} in Dataset2, where the same clusters from P 2 and P 3 are grouped with diﬀerent clusters from P 1 with similar CI scores. If clusters 12, 13, 18 from P 1 all have small KL divergence from each other, then merging these three clusters produces a uniﬁed cluster. Thus we can use the group formation approach to reﬁne clusters obtained from the clustering algorithm. 4.4
Distinctive and Common Outliers
Seed clusters that fail to form a group with signiﬁcantly low CI scores are declared as distinctive outliers and are shown in boxed squares in Table 3. The pvalues for such groups will be large, bearing little signiﬁcance in this context.
Identifying Rare Cell Populations in Comparative Flow Cytometry
173
Common outliers are groups of clusters with high Cohesion Conﬁdence (CC) values, and do not have a distinctive outlier as a member. We performed the permutation test on the CC value to assess its signiﬁcance in the same way as we did for the CI score. However, we are now interested in the conﬁdence limit to the right side of the broken vertical line in the histogram in the right subﬁgure of Figure 3. Again, we ﬁnd that groups with high CC values are signiﬁcant since the chance of ﬁnding them at random is small. We report distinctive and common outliers discovered by the clique approach in Table 4. All distinctive and common outliers identiﬁed by this approach were also identiﬁed by the pairwise comparison approach (Table 2), but the converse is generally not true. Hence the clique approach is more powerful in detecting and classifying outliers than the edge cover approach. Table 4. Distinctive and Common Outlying clusters identiﬁed by the weighted clique approach. Here ui is a cluster belonging to a leukemic mouse P i . Distinctive Outliers Dataset1 Sample 1
P P2 P3
4.5
Clusters 2,10,14,16 4,20 12,16,19,20,21
Common Outliers
Dataset2
Dataset1
Dataset2
Sample Clusters {u1 , u2 , u3 } CC p(CC) {u1 , u2 , u3 } CC p(CC) P1 P2 P3
6,11 4 5,10
17,21,17 1,7,8 9,5,3
0.64 0.00007 0.63 0.00011 0.58 0.00015
10,10,7 4,9,1 17,2,6
0.78 0.00013 0.64 0.00078 0.612 0.0016
Probabilistic Model for Groups
We describe a probabilistic model to reﬁne the groups by relaxing our initial requirement that a group must necessarily include one cluster from each patient. Let fij be the number of times two clusters ui and uj are grouped together, and let fi = j=i fij be the number of times cluster ui appears in any group. Then for a group S = {u1 , u2 ...uN } the probability of ui being a member of S, P (ui S), and the probability of the whole group, P (S) can be calculated by uj ∈S fij i=j , and P (S) = P (ui S). (8) P (ui S) = fi ui ∈S 1≤i≤N
Within a group, a low P (ui S) value and high P (uj S) value for all j = i, suggests that ui is a member with weak cohesion to S. We can reﬁne the group S by deleting the weak member ui , and inserting a gap in that position. A high P (ui S) and low P (uj S), for all j = i, also indicates a weakly formed group. In this case, we allow ui to form a group by itself deleting all other members of S, making ui a distinctive outlier. We present several representative groups from Dataset1 in Table 5, where clusters with high support are marked in grey.
174
A. Azad et al.
Consider the groups in rows 2 and 3 of the Table. Each has one weak member(u1 and u3 , respectively) that can be safely removed from the corresponding groups. However, rows 4 and 5 show groups with only one strong member (u2 and u1 , respectively), which can be declared as a distinctive outlier by removing all other members from the groups. The group in the sixth row has a low probability. Table 5. Groupuniqueness probabilities for Dataset1. Clusters in grey have the highest probabilities of belonging to the group. u1 P (u1 S) u2 P (u2 S) u3 P (u3 S) P (S) 11 17 19 2 21 18
4.6
1 .29 .83 .33 1 .17
13 16 22 4 6 19
1 1 .83 1 .20 .23
14 6 28 18 27 27
1 1 .33 .33 .25 .25
1 .29 .23 .11 .05 .01
Eﬀect of APL on Bone Marrow Cells
Wojiski et al. [15] compared the populations of a number of cell types in the bone marrow of WT, leukemic and preleukemic (with oncogene PMLRARα expressed in the latter two groups) mice. They reported that WT and preleukemic (H) mice had similar cell populations of hematopoietic stem cells (LSKs), common myeloid progenitor cells (CMPs), granulocytemonocyte progenitor cells (GMPs), and megakaryocyte erythrocyte progenitor cells (MEPs); but in leukemic mice (P) cell populations of LSKs, CMPs and MEPs are reduced and GMPs are increased, relative to the WT and preleukemic mice. They also found that mature granulocytes were increased in preleukemic mice relative to WT. In a pairwise comparison of ﬂow cytometry data from WT and H using the edge cover approach, we found that of the 18 clusters in WT and 23 clusters in H in the ﬁrst data set, only 3 clusters from each set were left uncovered when a value λ = 20 was used. Similar results were obtained for the second data set also, conﬁrming the general correspondence of populations of various cell types in these two kinds of mice. Generally, a group of clusters from leukemic mice that has a high value of CC (hence it is distant from any cluster in the WT) also has a high value of CC when clusters from a preleukemic mouse are used in the place of WT. However, we found some clusters in the preleukemic mouse that were closer to the leukemic mice rather than the WT. We performed this experiment by treating the preleukemic sample as an additional leukemic sample, and using the branch and bound algorithm to identify sets with high CC values. In Dataset1, we found the clusters {8, 14, 15, 5} and {17, 21, 17, 18}; and in Dataset2, we found the clusters {4, 9, 1, 4} and {10, 10, 7, 8}; here in each set the ﬁrst three clusters are from leukemic mice and the last is from the preleukemic mouse, and these clusters are all distant from any cluster in the WT. Identifying these speciﬁc cell types through further experimental work could shed light on disease progression in the murine model of APL.
Identifying Rare Cell Populations in Comparative Flow Cytometry
175
Acknowledgments. This research was supported through a PRF grant from the College of Science at Purdue, NSF grant CCF0830645, and Department of Energy grant DEFC0208ER25864 (CSCAPES Institute).
References 1. Antoniak, C.E.: Mixtures of Dirichlet processes with applications to Bayesian nonparametric problems. Annals of Statistics 2(6), 1152–1174 (1974) 2. Bashashati, A., Brinkman, R.: A survey of ﬂow cytometry data analysis methods. In: Advances in Bioinformatics, pp. 1–19 (December 2009) 3. Boedigheimer, M., Ferbas, J.: Mixture modeling approach to ﬂow cytometry data. Cytometry A 73, 421–429 (2008) 4. Chan, C., Feng, F., Ottinger, J., et al.: Statistical mixture modeling for cell subtype identiﬁcation in ﬂow cytometry. Cytometry A 73(A), 693–701 (2008) 5. Herzenberg, L., Tung, J., Moore, W., et al.: Interpreting ﬂow cytometry data: A guide for the perplexed. Nature Immunology 7(7), 681–685 (2006) 6. Kullback, S.: Information Theory and Statistics. Dover Publications Inc., Mineola (1968) 7. Meur, N., Rossini, A., Gasparetto, M., Smith, C., Brinkman, R., Gentleman, R.: Data quality assessment of ungated ﬂow cytometry data in high throughput experiments. Cytometry A 71A, 393–403 (2007) 8. Moore, D., McCabe, G.: Introduction to the Practice of Statistics. W. H. Freeman & Co., New York (2006) 9. Neal, R.: Markov chain sampling methods for Dirichlet process mixture models. Journal of Computational and Graphical Statistics 9, 249–265 (2000) 10. Pyne, S., Hu, X., Wang, K., et al.: Automated highdimensional ﬂow cytometric data analysis. PNAS 106(21), 8519–8524 (2009) 11. Rasmussen, C.E.: The inﬁnite Gaussian mixture model. In: Solla, S., Leen, T., Muller, K.R. (eds.) Advances in Neural Information Processing Systems, vol. 12. MIT Press, Cambridge (2000) 12. De Rosa, S., Brenchley, J., Roederer, M.: Beyond six colors: A new era in ﬂow cytometry. Nature Medicine 9(1), 112–117 (2003) 13. Schrijver, A.: Combinatorial Optimization — Polyhedra and Eﬃciency, Volume A: Paths, Flows, Matchings. Algorithms and Combinatorics, vol. 24. Springer, New York (2003) 14. Teh, Y.W.: DPM Software (2010), http://www.gatsby.ucl.ac.uk/~ ywteh/research/software.html 15. Wojiski, S., Gubal, F.C., Kindler, T., et al.: PMLRARα initiates leukemia by conferring properties of selfrenewal to committed promyelocytic progenitors. Leukemia 23, 1462–1471 (2009)
Fast Mapping and Precise Alignment of AB SOLiD Color Reads to Reference DNA Mikl´ os Cs˝ ur¨ os1 , Szilveszter Juhos2 , and Attila B´erces2 1
Department of Computer Science and Operations Research, University of Montr´eal, Canada
[email protected] 2 Omixon, Chemistry Logic Kft, Budapest, Hungary www.omixon.com
Abstract. Applied Biosystems’ SOLiD system oﬀers a lowcost alternative to the traditional Sanger method of DNA sequencing. We introduce two main algorithms of mapping SOLiD’s color reads onto a reference genome. The ﬁrst method performs mapping by adapting a greedy alignment framework. In such an alignment, reads are mapped to approximate genome positions, allowing for a prespeciﬁed bound on sequence diﬀerence that combines nucleotide mismatches, gaps, and sequencing errors. The second method for precise alignment relies on a pair hidden Markov model framework, combining a DNA sequence evolution model and sequencing errors (from read quality ﬁles).
1
Introduction
Nextgeneration sequencing (NGS) methods [1] provide economical alternatives to the traditional Sanger method of DNA sequencing. Various commercially available platforms can generate large amounts of information which enable important biological and medical applications [2], including, perhaps most notably, the sequencing of personal and somatic genomes [3,4], or even entire ecosystems [5]. In a typical genome analysis pipeline, NGS reads are mapped to reference sequences, and the alignments are further examined to detect variations within the target DNA sample, and with respect to the reference. Currently available software for largescale NGS mapping [6] use indexing techniques in order to speed up the search for similarities. The underlying algorithms rely either on hashtablebased indexes (seedandextend ), or on compressed indexes exploiting the BurrowsWheeler Transformation (BWT). BWTbased methods use little memory, and have an impressive computing speed [7,8]. Seedandextend has an increasing advantage with higher sequence divergences, due to ﬂexible tailoring choices for seeding methods [9]. The AB SOLiD sequencing platform from Applied Biosystems, Inc. (Foster City, Cal.) poses even greater challenges for bioinformatics than other widely used NGS technologies, due to the sheer size of the produced data (up to about a billion 35bp or 50bp reads in one production run), and the employed dinucleotide encoding by “colors.” We introduce algorithmic solutions to diﬀerent problems encountered when mapping AB SOLiD reads to a reference genome. First, we V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 176–188, 2010. c SpringerVerlag Berlin Heidelberg 2010
Fast Mapping and Precise Alignment of AB SOLiD Color
177
propose a seedandextend framework for mapping color reads to locations along a reference DNA. The novelty of the framework is a greedy extension procedure employed in ﬁltering the hits, which combines sequencing errors and DNA sequence diﬀerences. The seeding and the extension use the same “phase” representation of the color sequences, in order to minimize the number of executed arithmetic operations. The mappings are immediately useful for inferring structural variations [10] or phylogenetic classiﬁcations [11] (when multiple reference genomes are considered). Our second algorithmic solution addresses ﬁnescale alignments in a statistical framework. A notable feature of the approach is that color read quality values (sequencing error probabilities) are incorporated into a pair hidden Markov model. The statistical framework helps inferring the alignment with maximum expected accuracy or alignment metric accuracy (AMAP). The model assigns posterior probabilities to all target sequence variations, which can be used directly to deduce the consensus between overlapping reads without a multiple alignment.
2 2.1
Methods Sequences and Numerical Encoding
The AB SOLiD system relies on the ligasedriven synthesis of PCRampliﬁed target DNA fragments. The sequencing read is produced in “color” encoding, where colors correspond to the dinucleotides sampled by ﬂuorescently labeled probes in iterated synthesis cycles, arranged in their physical order along the target fragment. In the rest of the paper, we use a convenient numerical encoding for nucleotides and colors (or ﬂuorescent dies): A = 0, C = 1, G = 2, T = 3 FAM/blue = 0, Cy3/green = 1, TXR/orange = 2, Cy5/red = 3. With this encoding, the mapping between colors and dinucleotides is simply the bitwise exclusive OR operation, denoted by ⊕: dinucleotide xy is encoded by the color c = x ⊕ y. The errorfree color encoding for a DNA sequence t = t0..m is the sequence s = c1..m where ci = ti ⊕ ti−1 . Notice that the same c translates into four possible t determined by t0 . The read alignment problem is that of aligning an unknown target sequence t to a known reference DNA sequence s = s1..n , using a color sequence c that encodes t but may contain sequencing errors. The alignment is evaluated with respect to the implied nucleotide mismatches and gaps, as well as the implied sequencing errors. Figure 1 illustrates this concept. An alignment is composed of column types M1–M4, D and I1–I2, where each column contains three cells: a reference cell s, a color cell c and a target cell t. For all three, s, c, t ∈ {0, 1, 2, 3, 2}, where 2 is the indel character. Concatenated nonindel characters in the color cells give the complete sequence c1..m , and those in the reference cells yield a reference region si..i . Indel characters may not occupy all three cells, and indels appear together in the color and target cells.
178
M. Cs˝ ur¨ os, S. Juhos, and A. B´erces
Reference sequence Color sequence Target sequence (inferred)
C C G A A ... T A T C G A A C C T T G A C G A C G T A A 1 2 1 3 1 3 0 2 2 1 0 3 2 3 3 3 2 3 0 1 1 2 0 0 G A C G T A A G A C C G A A T A T C G A A C T T T color error
Column
Description
Pattern
Example
x M1
nucleotide match, correct color
=
nucleotide match, color error
3
y = ≠ y =
nucleotide mismatch, correct color
=
M4
Pattern
Example
x D
deletion
A
y 
T
A 1 
T A A
I1
insertion. correct color
A
≠
0
y ≠
T G
=
2
y z
G A

T G
x nucleotide mismatch, color error
Description
1
y ≠
insertion
deletion
T A
x M3
Column
A
x M2
substitution
...
I2
insertion, color error
≠
3
y z
G A
Fig. 1. Alignment between reference DNA, color sequence, and target sequence. The tables on the bottom enumerate possible alignment columns. Every column is annotated by the preceding nucleotide y in the target, deﬁning sequencing errors.
Here we consider the simplest alignment scoring system, called the edit distance, which is computed by penalizing columns of type M2, M3, D and I1 with 1, and columns of type M4 and I2 with 2. Columns of type M1 are not penalized. The classic SmithWatermanGotoh alignment [12,13] is readily adaptable to ﬁnd an optimal alignment [14,15]. In order to track sequencing errors, it is necessary to include dinucleotide information in the formulas. Formally, there is a color error in a nonD column that is not the leftmost such column, if t ⊕ t = cj where t is in the target cell, cj is in the color cell, and t is the target cell content in the closest preceding nonD column. The following lemma (proof omitted) shows that there is an optimal alignment that contains no columns with penalty 2. Lemma 1. There is an alignment with minimum edit distance that contains neither M4 nor I2 columns. In a run of consecutive perfect matches (M1) between si..i+−1 and cj..j+−1 , cj = y ⊕ si cj+k = si+k−1 ⊕ si+k
{1 ≤ k < },
(1a) (1b)
where y denotes the last aligned target nucleotide preceding the run. For convenience, we introduce the phase representation φ0..m of the color sequence: φ0 = 0, and φk = c1 ⊕ c2 ⊕ c3 ⊕ · · · ⊕ ck = φk−1 ⊕ ck for k > 0. From (1), si+k = y ⊕ cj ⊕ cj+1 ⊕ · · · ⊕ cj+k = y ⊕ φj−1 ⊕ φj+k
(2)
for all k = 0, . . . , − 1. In other words, there exists an u (in particular, u = y ⊕ φj−1 ) with which si+k = u ⊕ φj+k holds for all k < . The phase representation
Fast Mapping and Precise Alignment of AB SOLiD Color
179
φ0..m = t0..m is thus the translation of the color read into DNA, assuming that the target sequence starts with t0 = φ0 = 0 (A). 2.2
Color Read Indexing
In a seedandextend framework [9], local alignments between two DNA sequences R, T are found by using a seeding function h : {A, C, G, T} → H, which ﬁlters the (i, j) position pairs where local alignments are worth being looked for. −1 Speciﬁcally, an index table is built for R which gives the set of positions hR (x) = i : h Ri..i+−1 = x for all x ∈ H. A pair (i, j) is hit when h Tj..j+−1 = h Ri..i+−1 , or i ∈ h−1 R h(Tj..j+−1 ) . Hits are found by sliding a window along T and consulting the index table for h Tj..j+−1 in each position j. Hits are extended by performing a local alignment in a region around (i, j). In the simplest case, h is the identity function, and hits correspond to matching mers. Other widely used seeding functions rely on socalled spaced seeds. An (, w) spaced seed is deﬁned by a set {δ1 , δ2 , . . . , δw } ⊆ {1, 2, . . . , } of sampled positions, corresponding to the seeding function h(x1.. ) = xδ1 · · · xδw . Accordingly, (i, j) pairs are hit when Ri+δk −1 = Tj+δk −1 for all k = 1, . . . , w. Spaced seeds perform theoretically and practically better [9] than mers as seeding functions. Seeding is not straightforward with color reads, because s and c do not encode DNA in the same way. Equation (2) suggests a possible way of adapting spaced seeds to indexing color reads. For a hit, si+δk −1 = tj+δk −1 holds in all sample positions k = 1, . . . , w. Assuming no sequencing errors in cj..j+−1 , Eq. (2) implies that si+δ1 −1 ⊕ si+δk −1 = φj+δ1 −1 ⊕ φj+δk −1 for all k = 2, . . . , w. Consequently, the hits can be found by indexing the reads in the phase representation: the seeding function is h(x1.. ) = y1..w−1 with yk = xδ1 ⊕ xδk+1 . For a corresponding hit, h(si..i+−1 ) = h(φj..j+−1 ). (Existing tools like [14] translate instead the reference sequence into color space, so that for an (i, j)hit, si+δk −2 ⊕ si+δk −1 = cj+δk −1 = φj+δk −2 ⊕ φj+δk −1 at all k, which corresponds to a seeding function h(x0.. ) = y1..w with yk = xδk −1 ⊕ xδk in our notation.) 2.3
Greedy Alignment between Color Read and DNA Sequence
Hits are extended by adapting the classic greedy procedure of Wu et al. [16]. An (i, j) hit between the reference DNA s1..n and color read c1..m is extended by computing the longest preﬁx of the color sequence that can be aligned starting at reference position (i − j + 1) within prespeciﬁed bounds on the edit distance. Speciﬁcally, the procedure uses an argument dmax bounding the number of allowed indels between the reference and the inferred target sequence, and an argument emax that bounds the edit distance. The procedure is explained best in terms of the edit graph. The edit graph’s vertices are {(i, j, t) : 0 ≤ i ≤ n; 0 ≤ j ≤ m; 0 ≤ t ≤ 3}. The edges are weighted, and correspond to alignment columns of Fig. 1. By Lemma 1, it suﬃces to consider column types M1–M3, D and I1. The t component of the vertex triple contains phase information on the color sequence. An edge of type M1 has weight 0, and by (2), connects (i, j, t) to (i + 1, j + 1, t) where t = si+1 ⊕ φj+1 . All other edge types have weight 1: M2
180
M. Cs˝ ur¨ os, S. Juhos, and A. B´erces
(i, j, t) → (i+1, j+1, si+1 ⊕φj+1 ) with t = si+1 ⊕φj+1 , M3 (i, j, t) → (i+1, j+1, t) with t = si+1 ⊕ φj+1 , I1 (i, j, t) → (i, j + 1, t), and D (i, j, t) → (i + 1, j, t). A path in the edit graph corresponds to an alignment. Given a bound emax , we restrict our attention to paths from any of the (i, 0, t) vertices reach some (i , j, t ) with maximum j ≤ m, and have at most emax nonM1 edges. In other words, we are searching for the longest alignable preﬁx within the bound. Deﬁne the diagonal d = 0, 1, . . . , n as the vertex set (i, i − d, t) . Our greedy algorithm considers paths along diagonals 0, . . . , 2dmax only. Let Rtd (e) = j if (j + d, j, t) is the farthest reachable vertex from any (i, i − d, t ) on a path with vertices on diagonals d ≤ 2dmax , and with edge weight sum at most e ≤ emax . Algorithm Greedy computes all Rtd (e).
Algorithm Greedy s1..n , φ0..m , dmax Output: longest preﬁx of φ alignable within emax errors on diagonals 0, . . . 2dmax . G1 for t ← 0, . . . , 3 and d = 0, . . . , 2dmax do Rtd (0) ← 0; ∀e > 0 : Rtd (e) ← −∞ G2 for e ← 0, . . . , emax do G3 for t ← 0, . . . , 3 and d = 0, . . . , 2dmax do G4 j ← Rtd (e); i ← j + d G5 if j = −∞ then G6 while i + 1 < n and j + 1 < m and si+1 ⊕ φj+1 = t do G7 i ← i + 1; j ← j + 1 run of M1 edges G8 if j ≥ m − (emax − e) then return m else Rtd (e) ← j G9 if e = emax then G10 for t ← 0, . . . , 3 and d = 0, . . . , 2dmax do G11 j ← Rtd (e); i ← j + d G12 if j = −∞ then G13 if d = 2dmax then Update(d + 1, t, e + 1, j) D edge G14 if d = 0 then Update(d − 1, t, e + 1, j + 1) I1 edge G15 if i < n then G16 Update(d, t, e + 1, j + 1) M3 edge M2 edge G17 Update(d, si+1 ⊕ φj+1 , e + 1, j + 1) G18 return maxt=0,...,3;d=0,...,2dmax {Rtd (emax )}
Algorithm Update(d, t, e, j) U1 if Rtd (e) < j then Rtd (e) ← j
When extending a hit at (i, j) for the reference sequence s and the phase sequence φ0..m , Algorithm Greedy si ..i +m+2dmax −1 , φ0..m , dmax is called, where i = i − j + 1 − dmax is the starting position of the region within which the extension is performed. By an analogous argument to [16], the running time is O(m + dmax emax ) on average (for random sequences), and O(mdmax ) in the worst case. The greedy framework can be adapted to slightly more general scoring systems (match/mismatch penalties), but it is unclear whether it could accommodate symboldependent scoring and aﬃne gap penalization [17]. Therefore, Greedy is more useful for ﬁltering hits than for retrieving optimal alignments. 2.4
Statistical Alignment for Color Reads
We perform statistical alignment by using a pair hidden Markov model [18], or pairHMM. A pairHMM deﬁnes a probability distribution over alignments.
Fast Mapping and Precise Alignment of AB SOLiD Color
181
The advantages of having a welldeﬁned probabilistic model are manifold [19]. Likelihoods can be used to recognize unrelated sequence pairs, or to optimize model parameters. Posterior probabilities quantify discrepancies between the two sequences in a statistically principled manner. For the alignment of color reads to a reference DNA, we introduce a pairHMM with state set Q = {S, E} ∪ {M, I, D} × {0, 1, 2, 3} . The HMM generates a state sequence q0 , . . . , q ∈ Q as a random Markov chain determined by transition probabilities between the states. A transition is followed by the random emission of a pair w = (s, c) where s ∈ {0, 1, 2, 3, 2} is a numerically encoded nucleotide and c ∈ {0, 1, 2, 3, 2} is a numerically encoded color. A run of the hidden Markov model [20] consists of a random state sequence q0 , . . . , q coupled with the random emitted pairs w1 , . . . , w . States S and E emit unaligned preﬁxes and suﬃxes of the reference sequence. States (M, t), (D, t), (I, t) encode the rightmost inferred target nucleotide t, and correspond to match, deletion, and insertion. A transition from (x, t) to (x , t ) with x ∈ {M, I} entails the emission of a color character c: the color is correct if t ⊕ t = c. The SOLiD sequencing system provides error estimates in socalled quality ﬁles that encode the error probability ν on an integer scale using a formula originally introduced for Sanger sequencing in the phred program [21]: qual = −10 · log10 ν. We thus assume that a sequence of error probabilities ν1..m is available with the color sequence c1..m . Subsequently to a state transition (x, t) → (x , t ), the emission of the color character cj occurs with probability γj (t ⊕ t ), where γj (cj ) = 1 − νj
and c = cj : γj (c) = νj /3.
(3)
The emission of reference nucleotides is dictated by an assumed Markov model of DNA sequence evolution [22], like the F84 model [23]. In general, we assume that the nucleotide substitutions between reference and target happen according to a Markov model that speciﬁes the stationary distribution π and the substitution probabilities p(s → t), and that the model is reversible (πs p(s → t) = πt p(t → s)). Transitions to states (x, t) with diﬀerent t ∈ {A, C, G, T} thus happen by probabilities proportional to πt . The emission of a reference nucleotide s = 2 occurs with probability p(t → s) on arrival to state (M, t). Transition probabilities determine the expected lengths of unaligned preﬁxes and suﬃxes, as well as the frequency and length of gaps. In particular, we assume that the preﬁx and suﬃx regions have a geometric prior length distribution with mean 1/η, that insertions and deletions start with a probability δ, and that gaps have a geometric prior length distribution with mean 1/(1 − ). When aligning a color sequence of length m, we are interested in state sequences with exactly m states emitting color characters (M and I). For that reason, we impose the nonemitting state transition M → E and I → E after emitting m color characters. The transition out of state S to (M, t) or (I, t), which sets the ﬁrst target nucleotide t0 = t, is also nonemitting. Figure 2 summarizes the state transitions and the emissions.
182
M. Cs˝ ur¨ os, S. Juhos, and A. B´erces
ε I2
I1
I3
c t s
δ
1δε
ηδ
emission δ
S
M0
M2
M1
M3
–
1η emission
δ
emission s
t
E
η(1δ)
–
c
12δ
1η start
I0
– emission
s –
δ
1δε D0
D2
D1
D3
s emission
–
– –
ε
Transition S→S S → (M, t) S → (I, t) (M, t) → (M, t ) (M, t) → (D, t) (M, t) → (I, t ) (M, t) → E (D, t) → (M, t ) (D, t) → (D, t) (D, t) → (I, t ) (I, t) → (M, t ) (I, t) → (D, t) (I, t) → (I, t ) (I, t) → E E→E
probability 1−η η(1 − δ)πt ηδπt (1 − 2δ)πt δ δπt 1[after m colors] (1 − − δ)πt δπt (1 − δ − )πt δ πt 1[after m colors] 1−η
Emission probability (s, 2) πs (2, 2) 1 (2, 2) 1 (s, t ⊕ t ) p(t → s) (s, 2) πs (2, t ⊕ t ) 1 (2, 2) 1 (s, t ⊕ t ) p(t → s) (s, 2) πs (2, t ⊕ t ) 1 (s, t ⊕ t ) p(t → s) (s, 2) πs (2, t ⊕ t ) 1 (2, 2) 1 (s, 2) πs
Fig. 2. Pair HMM for alignment of color reads and the reference DNA. π and p are the parameters of the nucleotide subsitution model (stationary distribution, and Markovchain transition probabilities, respectively); δ, and η are the HMM’s state transition parameters (gap open, gap extend, and overhang, respectively). Only the correct colors are shown in the Emission column, i.e., the sequencing error probability ν is 0 in this table.
Fast Mapping and Precise Alignment of AB SOLiD Color
2.5
183
Likelihood and Posterior Probabilities
A run of the pairHMM in Fig. 2 produces an alignment, but the indels cannot be observed, only the produced sequences. Given a reference s1..n and a color sequence c1..m , we can compute the likelihood that such a pair is generated by the model, while admitting color errors by known probabilities ν1..m . In order to compute the likelihood (and various posterior probabilities later), we use forward and backward probabilities [18,20]. The forward probabilities are denoted by S[i] = S[i, 0], E[i] = E[i, m], Mt [i, j], It [i, j], Dt [i, j] with i = 0, . . . , n and j = 0, . . . m. The quantity q[i, j] denotes the probability that the pairHMM generates the preﬁxes s1..i and c1..j in a run that ends with state q. Forward probabilities can be computed in a recursive manner, as shown in Table 1. Table 1. Recursions for forward probabilities S[0] = 1;
E[0] = 0
S[i] = πsi · (1 − η) · S[i − 1]
{i > 0}
Mt [i, 0] = πt · η(1 − δ) · S[i]; It [i, 0] = πt · ηδ · S[i]; γj (t ⊕ t) Mt [i, j] = πt p(t → si ) ×
Dt [i, 0] = 0
{i ≥ 0} {i, j > 0}
t
(1 − 2δ) · Mt [i − 1, j − 1]
+(1 − δ − ) · It [i − 1, j − 1] + Dt [i − 1, j − 1] It [i, j] = πt γj (t ⊕ t) · It [i, j − 1] t +δ · Mt [i, j − 1] + Dt [i, j − 1] Dt [i, j] = πsi · Dt [i − 1, j] + δ · Mt [i − 1, j] + It [i − 1, j] E[i] = πsi (1 − η) · E[i − 1] + Mt [i, m] + It [i, m]
{i ≥ 0, j > 0}
{i, j > 0} {i > 0}
t
The backward probabilities S [i] = S [i, 0], E [i] = E [i, m], Mt [i, j], It [i, j], capture a symmetric concept. The quantity q [i, j] is the probability that the pairHMM produces the suﬃxes si+1..n and cj+1..n in a run starting with state q. The backward probabilities are calculated by analogous recursions to those in Table 1. Now, given the color error probabilities ν1..m , the likelihood for the observed sequences is L(s1..n , c1..m ) = E[n] = S [0]. The forward and backward probabilities are combined to calculate posterior probabilities for visiting various states. q[i,j]·q [i,j] The posteriors are ψ(q)[i, j] = L(s for q = Mt , It , Dt and ψ(q)[i] = 1..n ,c1..m ) Dt [i, j]
q[i]·q [i] L(s1..n ,c1..m )
for q = S, E. The posterior probabilities can be used to assign conﬁdence to a triple alignment column. A state transition to q = (M, t),
184
M. Cs˝ ur¨ os, S. Juhos, and A. B´erces
followed by the emission of (s, c) corresponds to an alignment column (s, c, t) of type M1–M4. Hence, p(i 3 j, t) = ψ(Mt )[i, j] is the probability that such a column aligning s = si and c = cj is correct. The probability that si is deleted in the target sequence is p(i 3 ·) = j,t ψ(Dt )[i, j] = 1 − j,t pt (i 3 j, t). The probability that a column of type I1 or I2 containing (2, cj , t) should appear in the alignment is p(· 3 j, t) = i ψ(It )[i, j]. Finally, the probability that reference nucleotide i is part of the skipped preﬁx or suﬃx is α(i) = ψ(S)[i] + ψ(E)[i] − t ψ(Mt )[i, m] + ψ(It )[i, m] , where the nonemitting transitions into E are taken into account. With the posterior probabilities at hand, we can ﬁnd the socalled AMAP alignment that maximizes metric accuracy [24]. Consider an alignment with columns (sk , ck , tk ) : k = 1, . . . , Let T (k) be the type of column k, and let # s# k , ck denote the number of nonindel reference and color characters emitted in columns 1, . . . , k. Using a gapfactor G ∈ [0, 1], the alignment maxi # # # mizes the score (1 − G) · k : T (k)∈M p(sk 3 ck , tk ) + G · k : T (k)=D p(sk 3 ·) +
# # k : T (k)∈I p(· 3 ck , tk ) + k : T (k)∈S α(sk ) , where M = {M1, M2, M3, M4}, I = {I1, I2} and S = {S, E}. The gapfactor sets a tradeoﬀ between speciﬁcity and sensitivity: G = 0 corresponds to the alignment with maximum expected accuracy [18], and G = 1/3 provides a neutral setting. Computing the AMAP alignment is straightforward by dynamic programming after the posterior probabilities are calculated. Smallscale variations such as nucleotide substitutions and short gaps can be readily identiﬁed with statistical conﬁdence. The probability that si is aligned with a target nucleotide t ∈ {0, 1, 2, 3} is p(i ∼ t) = j p(i 3 j, t). The probability that the reference nucleotide si is aligned with a gap is p(i 3 ·). Figure 3 illustrates AMAP alignments and sequence variants. The probabilities of the
(a)
(b)
Fig. 3. AMAP alignments and sequence variations. “Conﬁdence” is the probability of the column being correct. Shading indicates the quality values along the color sequence; a dot ‘.’ denotes a color error. Sequence variants are shown by the logos. The height of each logo box is proportional to the probability 1 − α(i) that the nucleotide is covered by the alignment; posterior probabilities for homology statements are shown by the relative symbol height. (a) Mismatches with diﬀerent credibility. (b) Homology statements may be stronger than alignment conﬁdence (see GACC before the deletion).
Fast Mapping and Precise Alignment of AB SOLiD Color
185
homology statements can be combined across diﬀerent reads that align to the same reference region, in order to infer sequence variations in the target DNA.
3
Experiments
We implemented the algorithms in a Java software package called Crema, and used it on sequencing reads for Escherichia coli DH10B. The reads (35bp long reads, no mate pairs) were downloaded from the Applied Biosystems website (http: //download.solidsoftwaretools.com/frag/R1a007_20080307_2_EG017_F3. csfasta.zip), with the accompanying quality ﬁle. We selected 1 million reads randomly, and mapped them against the genome of Shigella flexneri 2a str. 301 (Genbank accession number NC 004337.1). In the experiments, we compared our implementation with Bowtie [8] version 0.12.5, and SHRiMP [14] version 1.3.2. All programs were tested on an ordinary Linux machine (Amazon Elastic Compute Cloud, Standard Instance). Read mapping. Table 2 shows the mapping results. In the greedy extension, we mapped the reads by retaining hits where all 35 positions be aligned within an edit distance of emax = 6, along a band of ±3 diagonals. At comparable sensitivities, the greedy extension (with a platformindependent implementation) is faster than Bowtie, or SHRiMP. Table 2. Mapping DH10B sequencing reads to S. flexneri. Mappings with diﬀerent seeds (numbers denote length and weight) are compared with other tools at parameter settings resulting in comparable sensitivities. “Unique” reads are mapped to a single locus with maximal alignment score. Method SHRiMP (M 35bp,fast) SHRiMP (M 35bp,sensitive) Bowtie (best) Crema (19,17)seed + greedy Crema (16,14)seed + greedy Crema (14,12)seed + greedy
CPU time Mapped reads Unique 263 s 593785 561301 717 s 605348 572317 216 s 488137 118 s 511263 492230 192 s 569865 546495 581 s 605938 576419
Read alignment. We computed the alignments for uniquely mapped reads by ﬁrst optimizing the pairHMM parameters using a random subset of 100 thousand reads. We employed the F84 model [23] of DNA sequence evolution, with equal base frequencies (GCcontent of E. coli is close to 50%), and a transition/transversion ratio of 2. The sequence divergence, and the gap open/extend probabilities were set in an ExpectationMaximization procedure by computing the expected numbers of substitutions and indels: convergence was achieved after four iterations with a divergence of 0.0145, gap open probability δ = 0.00025 and gap extension probability = 0.5. Instead of directly using the Phred formula for transforming quality scores into probabilities, we used our own mapping based on the expected number of color errors at diﬀerent scores, as computed by the pairHMM model.
186
M. Cs˝ ur¨ os, S. Juhos, and A. B´erces
Table 3. Alignments of DH10B sequencing reads with S. flexneri. “Validated” reads and nucleotides appear in BLAST alignments to the DH10B reference. “Incorrect” nucleotides diﬀer from the DH10B genome sequence. Reads
All inferred nucleotides
Substitutions
Insertions
unique
validated
validated
incorrect
validated incorrect validated incorrect
Bowtie (best)
465 024
463 785
15 274 713
13 862 (0.09%)
70 110
2 783 (4.0%)
SHRiMP (sensitive)
572 317
570 107
19 569 714
42 863 (0.22%)
184 254
28 364 (15.4%)
290
10 (3.4%)
Crema (AMAP alignment)
576 419
574 490
19 962 920
40 308 (0.20%)
249 107
27 162 (10.9%)
1 108
72 (6.5%)
(does not infer indels)
prob(correct)
In order to validate alignment results, we used blastn [25] to align the inferred target sequences to the assembled DH10B genome (Genbank accession number NC 010473.1), with default parameters and an Evalue cutoﬀ of 10−6 . BLAST found an alignment for 99.7–99.6% of the reads. The alignments (as reported in SAM [http://samtools.sourceforge.net/] format’s CIGAR strings) of uniquely mapped reads were scanned to validate the inferred target nucleotides. Table 3 shows the results. Bowtie, designed to map human sequence variants, captures only very similar sequences, with an overall error rate of 0.09%. SHRiMP and Crema are much more sensitive, but have a similar 0.2% overall error. Crema is, however, better than SHRiMP at ﬁnding actual sequence diﬀerences: about 35% more substitutions are predicted, with 30% fewer errors. The framework is especially useful in annotating the computed alignments. The posterior probabilities for the inferred nucleotides can be encoded in the QUAL ﬁeld of the SAM format using the phred transformation [21]. Figure 4 illustrates that highscoring
BLAST validation
99.9%
99%
aligned positions
1M predicted correctness
90% 10
20
30
40
50
60
70 quality score
Fig. 4. Quality scores for inferred nucleotides and actual correctness (“BLAST validation”) in validating BLAST hits. The horizontal dashed line shows the overall fraction of correctly inferred nucleotides. “Predicted correctness” uses the Phred formula with small bars denoting rounding errors. Vertical bars plot the frequency of quality scores with scaling shown on the right.
Fast Mapping and Precise Alignment of AB SOLiD Color
187
positions have a much lower error level. For instance, inferred nucleotides with a quality score at least 20 (96% of positions) are wrong only 0.045% of the time. The plot also shows that quality values under 30 are predicted fairly accurately (Bowtie quality values are underestimated by more than 20 on the same interval — data not shown).
4
Conclusion
We presented a seedandextend framework for eﬃcient color read mapping, and a statistical alignment framework for precise alignments. The experiments demonstrate that they oﬀer valuable options in the comparative sequencing of bacterial genomes.
References 1. Shendure, J., Li, H.: Nextgeneration DNA sequencing. Nat. Biotechnol. 26(10), 1135–1145 (2008) 2. Shendure, J., Mitra, R.D., Varma, C., Church, G.M.: Advanced sequencing technologies: Methods and goals. Nat. Rev. Genet. 5, 335–344 (2004) 3. Wheeler, D.A., et al.: The complete genome of an individual by massively parallel DNA sequencing. Nature 452, 872–876 (2008) 4. Pleasance, E.D., et al.: A comprehensive catalogue of somatic mutations from a human cancer genome. Nature 463, 191–196 (2010) 5. Venter, J.C., et al.: Environmental genome shotgun sequencing of the Sargasso Sea. Science 304, 66–74 (2004) 6. Flicek, P., Birney, E.: Sense from sequence reads: methods for alignment and assembly. Nat. Methods 6(11s), S6–S12 (2009) 7. Li, H., Durbin, R.: Fast and accurate short read alignment with BurrowsWheeler transform. Bioinformatics 25(14), 1754–1760 (2009) 8. Langmead, B., Trapnell, C., Pop, M., Salzberg, S.L.: Ultrafast and memoryeﬃcient alignment of short DNA sequences to the human genome. Genome Biol. 10 (2009) 9. Brown, D.G., Li, M., Ma, B.: A tutorial of recent developments in the seeding of local alignment. J. Bioinform. Comput. Biol. 2(4), 819–842 (2004) 10. Medvedev, P., Stanciu, M., Brudno, M.: Computational methods for discovering structural variation with nextgeneration sequencing. Nat. Methods 6(11s), S13– S20 (2009) 11. Huson, D.H., Auch, A.F., Qi, J., Schuster, S.C.: MEGAN analysis of metagenomic data. Genome Res. 17, 377–386 (2007) 12. Smith, T.F., Waterman, M.S.: Identiﬁcation of common molecular subsequences. J. Mol. Biol. 147, 195–197 (1981) 13. Gotoh, O.: An improved algorithm for matching biological sequences. J. Mol. Biol. 162(3), 705–708 (1982) 14. Rumble, S.M., Lacroute, P., Dalca, A.V., Fiume, M., Sidow, A., Brudno, M.: SHRiMP: Accurate mapping of short colorspace reads. PLoS Comput. Biol. 5(5), e1000386 (2009) 15. Homer, N., Merriman, B., Nelson, S.F.: Local alignment of twobase encoded DNA sequence. BMC Bioinformatics 10, 175 (2009)
188
M. Cs˝ ur¨ os, S. Juhos, and A. B´erces
16. Wu, S., Manber, U., Myers, G., Miller, W.: An O(N P ) sequence comparison algorithm. Inform. Process. Lett. 35(6), 317–323 (1990) 17. Zhang, Z., Schwartz, S., Wagner, L., Miller, W.: A greedy alignment for aligning DNA sequences. J. Comput. Biol. 7(1/2), 203–214 (2000) 18. Durbin, R., Eddy, S.R., Krogh, A., Mitchison, G.: Biological Sequence Analysis: Probabilistic Models of Proteins and Nucleic Acids. Cambridge University Press, UK (1998) 19. Lunter, G., Drummond, A.J., Mikl´ os, I., Hein, J.: Statistical alignment: Recent progress, new applications, and challenges. In: Nielsen, R. (ed.) Statistical Methods in Molecular Evolution. Springer, Heidelberg (2005) 20. Rabiner, L.R.: A tutorial on Hidden Markov Models and selected applications in speech recognition. Proc. IEEE 77(2), 257–286 (1989) 21. Ewing, B., Green, P.: Basecalling of automated sequencer traces using phred: II. error probabilities. Genome Res. 8, 186–194 (1998) 22. Li` o, P., Goldman, N.: Models of molecular evolution and phylogeny. Genome Res. 8, 1233–1244 (1998) 23. Felsenstein, J., Churchill, G.A.: A Hidden Markov Model approach to variation among sites in rate of evolution. Mol. Biol. Evol. 13(1), 93–104 (1996) 24. Schwartz, S.A., Pachter, L.: Multiple alignment by sequence annealing. Bioinformatics 23(2), 24–29 (2007) 25. Altschul, S.F., Gish, W., Miller, W., Myers, E.W., Lipman, D.J.: Basic local alignment search tool. J. Mol. Biol. 215(3), 403–410 (1990)
Design of an Eﬃcient OutofCore Read Alignment Algorithm Arun S. Konagurthu1,2,, , Lloyd Allison1, , Thomas Conway1,2 , Bryan BeresfordSmith1,2 , and Justin Zobel2,1 1
National ICT Australia (NICTA) Victoria Research Laboratory, Department of Electronics and Electrical Engineering The University of Melbourne, Parkville, Victoria 3010 Australia 2 Department of Computer Science and Software Engineering, The University of Melbourne, Parkville, Victoria 3010 Australia {firstname.lastname}@nicta.com.au
Abstract. New genome sequencing technologies are poised to enter the sequencing landscape with signiﬁcantly higher throughput of read data produced at unprecedented speeds and lower costs per run. However, current inmemory methods to align a set of reads to one or more reference genomes are illequipped to handle the expected growth of readthroughput from newer technologies. This paper reports the design of a new outofcore read mapping algorithm, Syzygy, which can scale to large volumes of read and genome data. The algorithm is designed to run in a constant, userstipulated amount of main memory – small enough to ﬁt on standard desktops – irrespective of the sizes of read and genome data. Syzygy achieves a superior spatial localityofreference that allows all large data structures used in the algorithm to be maintained on disk. We compare our prototype implementation with several popular read alignment programs. Our results demonstrate clearly that Syzygy can scale to very large read volumes while using only a fraction of memory in comparison, without sacriﬁcing performance.
1
Introduction
The landmark publications of Margulies et al. [1] and Shendure et al. [2] in 2005 heralded a new era of nonSanger based, massively parallel genome sequencing technologies. Today’s major commercial nextgeneration sequencing (NGS) systems include Roche’s (454) Genome Sequencer FLX, IlluminaSolexa’s Genome Analyzer (GA) II, and Applied Biosystem’s SOLiD. The volume of data generated from these new sequencers is already staggering. (For example, Illumina’s latest GA IIe sequencer produces about 1.75 × 109 bases of read data in a day’s run.) More recently, several new sequencing systems, such as Helicos’ Genetic
Corresponding author. These authors contributed equally to this work.
V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 189–201, 2010. c SpringerVerlag Berlin Heidelberg 2010
190
A.S. Konagurthu et al.
Analysis system, Paciﬁc Biosciences’ Single Molecule Real Time (SMRT) system, Oxford Nanopores’ Nanopore sequencer, and Visigen’s Genetic sequencer, have been announced promising higher read throughput at faster speeds and signiﬁcantly reduced costs per run. Some of these technologies are already in business. Mapping (or aligning) a set of reads to a reference genome is a fundamental task in genome resequencing studies. Massive volumes of read data (growing faster than Moore’s law) and very large genome sizes make the read mapping problem computationally very challenging. Neither the classical methods for pattern matching on strings [3–5] nor the methods from traditional sequence bioinformatics [6, 7] can cope with the large volumes of data from modern sequencers. Since 2007, several methods catering speciﬁcally to NGS were published [8–19].1 These methods can be broadly classiﬁed into four groups: 1. 2. 3. 4.
Methods which rely on hashing the read set (e.g. see [8–12]); Methods which rely on hashing the reference (e.g. see [13–15]); Methods based on advances in Stringology (e.g. see [16–18]); A method [19] based on a sortandjoin approach.
Methods in categories 1 and 2 maintain a large hash index in main memory when performing read alignment. The growth of data (read or genome, depending on which set is maintained as a hash index) translates to increasing demands on main memory for these methods. Methods in category 3, especially those that use the BurrowsWheeler index [20] of the reference sequence are comparatively memory eﬃcient when aligning reads to a single genome [16, 17]. However if reads were to be mapped on more than one large genome (for example, multiple human genomes simultaneously), even these methods begin to have impractical memory demands. Slider [19] is currently a solitary method in category 4 which relies on a simple sortandjoin strategy. The program is slow and requires both a large amount of memory as well as disk space. A common problem with the current programs is that they do not scale elegantly to handle very large data volumes due to impractical memory requirements or very long run times (in some cases, both). Moreover, the random nature of data accesses to the index structures maintained by the methods in the ﬁrst three categories pose a major hurdle for their implementation out of core. This paper describes the design of a new method, Syzygy, to eﬃciently align massive numbers of reads simultaneously against multiple genomes. The design allows the program to run in a ﬁxed, userstipulated amount of memory, small enough to be deployed even on standard computers. Broadly, our method is based on a sortandjoin strategy similar to the one used by Slider [19]. However the details of our algorithm and its implementation is radically diﬀerent, especially in the way it handles the approximate read mapping problem. Syzygy reorganizes the read mapping problem to achieve a superior spatial locality of accesses to various data structures maintained by the method. This reorganization results 1
A comprehensive list of NGS read mapping tools is maintained by Heng Li at http://lh3lh3.users.sourceforge.net/NGSalign.shtml
Design of an Eﬃcient OutofCore Read Alignment Algorithm
191
in accesses to all data structures being predominantly linear, facilitating an outofcore implementation among other performance optimizations; all large data structures in the algorithm are maintained on disk, requiring only a small inmemory working set to proceed with the alignment.
2 2.1
Algorithm Deﬁnitions
DNA sequence: A DNA sequence of length n is a string S = (s1 · · · sn ) con
taining n ‘bases’, where each base is from the alphabet of DNA nucleotides, ℵ = {A, C, G, T }. Reference genome set: Let G = {G 1 · · · G N } be a set containing N reference genomes where any genome G i = (g1i · · · gni i ) (assume) is a DNA sequence containing ni bases. Read set: Let R = {r1 · · · rm } be a set containing m sequence reads, where any i read ri = (r1i · · · rL ) ∈ R of length L is a short DNA sequence. kmer: Given any sequence S = (s1 · · · sl ) of length l and a constant k ≤ l, a kmer of S deﬁnes another sequence K = (si · · · si+k−1 ), 1 ≤ i ≤ l − k + 1 which is a substring of S. Reverse complement: A reverse complement of a DNA sequence S, denoted by S, is a sequence of bases which reverses S and replaces each base with its WatsonCrick conjugate (A with T , G with C, and vice versa). Key: A key(S) denotes an integral hash value of a sequence S using some keygeneration function which transforms strings uniquely to integers. A straightforward key generation function of DNA sequences over the alphabet ℵ is the integral value as a result of representing the sequence using a 2 bitsperbase encoding. (For example, {00, 01, 10, 11} for {A, C, G, T }.) 2.2
The Basic SortandJoin Method
We build our exposition by introducing ﬁrst the basic sortandjoin method to align reads simultaneously to a set of genomes. In the basic approach we use the ideal scenario where reads R are matched exactly (that is, without errors) with the genome set G. (To make the exposition clearer, in the entire paper we assume that all reads in the set R are of a ﬁxed length L. We note, however, that it is straightforward to generalize our algorithm to variable length reads.) The basic algorithm involves three simple steps: Step 1: Reference list generation. A reference list deﬁnes a sorted list of i records G corresponding to every Lmer in G. Each Lmer, L = (gji · · · gj+L−1 ), 1 ≤ i ≤ N, 1 ≤ j ≤ ni − L + 1, contributes the ﬁelds (h, p) to form a record in G, where h = key(L) is the key of L, and p = [i, j] is the positional coordinate (sequence number and oﬀset in sequence) of L in G. The records in list G are sorted on the ﬁeld h.
192
A.S. Konagurthu et al.
Step 2: Read list generation. For each read r = (r1 · · · rL ) ∈ R, construct a read list R = {(h, r)} where h =key(r). R is also sorted on the ﬁeld h. Step 3: Join list generation. A join list J = G 1 R is derived by joining G = {(h, p)} and R = {(h, r)} on the ﬁeld h, resulting in J = {(p, r)}. Each record in this list gives a position p of the exact occurrence of a read r. Observe the predominantly linear nature of data accesses in this method. In Steps 1 and 2, genome and reference data are read sequentially while creating G and R respectively. Again, the generation of the join list J requires all sequential accesses through the sorted lists G and R, giving the list of matches of reads against the genome(s). We note here that sorting of small keys (of ﬁxed size) is nearlinear [21, 22]. Below, we use the framework of the basic sortandjoin strategy to address the problem of approximate matching of reads to multiple genomes. 2.3
SortandJoin Method for Mapping with Errors
In practice, a large number of reads will not map exactly to reference sequence(s) due to the presence of sequencing errors in the reads as well as other natural genomic variations between the sample and the reference draft assembly. Therefore it becomes necessary to map the reads to the reference genomes allowing a certain number of errors or mismatches. A common strategy to handle approximate matches is based on a lossless kmer ﬁltering technique. This technique relies on the observation that two sequences of length L which are at a Hamming L distance of at most δ should share at least one kmer of size k = δ+1 . Indeed this observation generalizes to Levenshtein distances between two strings. Our method for approximate matching uses this observation. Below we describe the extension of the basic sortandjoin strategy to map the reads in the presence of errors under a threshold of Hamming distance δ: Step 1: Reference list generation. Build a sorted reference list G such that the tuples correspond to kmers (instead of Lmers, previously) such that k = L (δ+1) . Step 2: Read list generation. Each read is partitioned into ﬁxed size (nonL overlapping) tiles of length k = δ+1 . The pigeonhole principle suggests that if a read matches under a threshold of δ at some position in the reference, then there must be at least one of the δ + 1 read tiles that must match exactly to a corresponding kmer in the reference. Note that due to the chemistry involved in the sequencing process each read should also be examined for a match against the reference using its reverse complement. Each read, therefore, contributes 2 × (δ + 1) nonoverlapping (tiled) kmers (in both forward and reverse complement directions), where k = L i (δ+1) . Speciﬁcally, a read ri = (r1i · · · rL ) and its corresponding reverse complement ri = (ri 1 · · · ri L ) contributes to these nonoverlapping k i i i i mer tiles: (r1i · · · rki ), (rk+1 · · · r2k ), · · ·, (rδ×k+1 · · · r(δ+1)×k ) and (r i 1 · · · r i k ),
(r i k+1 · · · r i 2k ), · · ·, (r i δ×k+1 · · · r i (δ+1)×k ) .
Design of an Eﬃcient OutofCore Read Alignment Algorithm
193
Hence each tile of a read now contributes to the following ﬁelds: (h, r, o, s), where h is the key of a tile, r the read from which it came, o the oﬀset of the tile from the start of the read, and s the ‘sense’ (forward or reverse complement) of the tile. For example, the kmer tile K = (ri k+1 · · · ri 2k ) and its corresponding re i i versecomplement K = (ri k+1 · · · r 2k ) contribute to R: key(K), r , (k + 1), → , and key(K), ri , (k + 1), ← , where ‘→’ and ‘←’ indicate matching in the sense
(forward) and antisense (reverse complement) directions of the kmer tiles respectively. Finally, the list R ≡ {(h, r, o, s)} is sorted on the ﬁeld h. Step 3: Join list generation. Join the sorted lists G = (h, p) and R = (h, r, o, s), to give a new list J = G 1 R ≡ {(p , r, s)}, where p = p − o is the adjusted positional coordinate on the genome set which allows diﬀerent tiles of the same read to coalesce back together. (See Step 4.) For a given read if more than one tile matches exactly at some position in the genome, the adjustment p ensures that they point to the same starting position on the reference. This provides the necessary eﬃciency in the postprocessing step below. Step 4: Veriﬁcation and postprocess. The list J is sorted on the ﬁelds p , r, and s in that order. Let a context in J deﬁne a set of items in J that have the same (adjusted) position, read, and sense tuples. Sorting J on (p , r, s) ensures that tiles which share the same context will group together. Each context, containing one or more tiles, identiﬁes a unique position p ∈ G, read r, and the directionality of the match s. While traversing linearly in the newly sorted list J, for each unique context, just one tile is enough to verify the Hamming distance of the Lmer in G starting at position p with respect to the read r, in the direction speciﬁed by s. The result of the veriﬁcation is a list of mappings of the set R on G under the approximate Hamming distance threshold δ. We note that the extension of the sortandjoin strategy to approximate matching still retains its sequential data access characteristic which is important for any outofcore implementation. In step 4, each Hamming distance veriﬁcation of the join record requires the extraction of a readlength sized substring from the reference (string) data set which is then compared with the corresponding read available in the join record. Since the join list is sorted primarily on the (adjusted) position in the reference, accesses to the reference string(s) are sequential, giving the crucial advantage of spatial locality of reference.
3 3.1
Implementation of Syzygy Encoding, Key Generation and Other Bitwise Tricks
A nucleotide sequence from the alphabet containing four bases {A, T, G, C} is packed into an array of unsigned 64bit integer data types, where each base is represented using a 2 bitsperbase encoding. Speciﬁcally, Syzygy uses the {00, 01, 10, 11} binary encoding for {A, C, G, T } respectively. Each unsigned 64bit word (or, plainly, word ) can encode information of up to 32 bases of a sequence. For example, a DNA sequence of length 100 is packed into an array of 4 encoded words. (This requires an implicit convention to align strings to
194
A.S. Konagurthu et al.
a consistent word boundary, necessary to decode strings whose length are not an integral multiple of 32. Assuming a littleendian architecture, in Syzygy, the start of strings are aligned to the mostsigniﬁcant word boundary). In the implementation of Syzygy, the key of a kmer is simply the integer deﬁned by its encoded word(s). In practice, both the genome and #define MASK 0x5555555555555555UL read sequences come from an extended uint8_t hammingDistance( alphabet to account for ambiguous or uint64_t *w1, unknown bases. On the genome side, uint64_t *w2, size_t n we store the strings in the encoded ) { uint64_t tmp ; form by converting each ambiguous uint8_t d = 0 ; base to a random unambiguous base for( size_t i = 0 ; i < n ; i++ ) { in ℵ, while ignoring the contributions /* XOR ith words */ to the reference list G by the kmers tmp = w1[i] ^ w2[i]; in the regions containing ambiguous /* convert to a popcount problem */ bases. For the read set we ignore all tmp = (tmp & MASK)  (tmp>>1 & MASK) ; sequences containing more than two ambiguous bases. /* count set bits in tmp */ d += popcount( tmp ) ; This encoding has some convenient } advantages. Hamming distance and return d ; reverse complement generation can be } performed cheaply using a few bitwise Fig. 1. Code for Hamming distance compuoperations. The code for determining tation of two strings packed into an array Hamming distance is shown in Fig. 1. of n words w1 and w2 (There are several bitwise tricks to facilitate fast population count using popcount() in Fig. 1. See [23] for a comprehensive summary on accelerated population counting. Alternatively, a rapid way to perform this operation would be to invoke a POPCNT instruction which comes as a part of the instruction set on most modern microprocessors.) Coincidentally, the speciﬁc encoding used in Syzygy also allows a fast computation of reverse complements of DNA sequencing which relies on the fact that, in our encoding, WatsonCrick conjugates have their bits ﬂipped. (See Fig. 2 below.) 3.2
Main List Data Structures
Reference list: Recall, the reference list G is a list of records of the form {(h, p)}. The ﬁeld h, storing the key (the integer encoding) of a kmer, can be denoted using an array of one or more words depending on the size of the kmer. Field p on the other hand can be simply stored in a single word. In Syzygy, however, the reference list is generated using 32mers from the reference genome set, requiring just one word each to store the ﬁelds h and p. (See also the special construction of the reference list, explained in section 3.3, to handle ‘blowups’ in the join.) In addition, we observe that a 32mer based reference list containing (h, p) tuples subsumes all reference lists corresponding to any (k < 32)mers. This holds primarily due to the encoding Syzygy uses and the nature of its key generation function. A fully sorted 32mer keys implies the sorted order of any of its preﬁxes. For example, a
Design of an Eﬃcient OutofCore Read Alignment Algorithm
195
16mer reference list can be derived from a 32mer list by trivially masking out the encoded bits corresponding to the trailing 16 bases. (Note however that some (k < 32)mers in the end of each genome – or any discontinuous region – will be lost when sliding along the genome set with a window of size 32. But this is a minor issue which can be trivially remedied.) Using the above observation, a 32mer reference list can be preprocessed and used for mapping under variable tile sizes, calculated based on the hamming distance threshold and the read length. This is especially meaningful because often it is the read set which changes while the set of reference genomes remains mostly static. Read list: Reference list R is a list of records of the form {(h, r, o, s)}. To conserve space, we do not store the ﬁeld h but, instead, it is calculated on the ﬂy using the remaining ﬁelds: r, o and s. Field r is an array of words representing the encoded read. In addition to the encoded read data, it makes practical sense to carry along a read identiﬁer. Read identiﬁer (a number) and ﬁelds o and s are packed together into one word. We will call this word, read metadata. Syzygy computes an appropriate tile size depending on the read length L and the parameters for approximate matching δ as min {L/(δ + 1), 32}.
#define #define #define #define
MASK1 MASK2 MASK3 MASK4
0x3333333333333333UL 0x0F0F0F0F0F0F0F0FUL 0x00FF00FF00FF00FFUL 0x0000FFFF0000FFFFUL
void reverseComplement( uint64_t *w, size_t n ) { uint64_t tmp ; /* First, reverse complement one word at a time */ for( size_t i = 0 ; i < n ; i++ ) { /* A base complement trick on whole word */ w[i] = ~w[i] ; /* Reverse base (NOT bits) order in each word*/ w[i] = ((w[i]>>2)&MASK1)  ((w[i]&MASK1)4)&MASK2)  ((w[i]&MASK2)8)&MASK3)  ((w[i]&MASK3)16)&MASK4)  ((w[i]&MASK4)32))  (w[i] 0 do n(j)+ = wr,j f (j)/sum end for end for s = j n(j)/(l(j) − µ + 1) for each isoform j do f (j) = n(j)/(l(j)−μ+1) s end for end while
of fragments of that length to be proportional to the number of valid starting positions for a fragment of that length in the isoform. If p(k) denotes the probability of a fragment of length k and n(j) denotes the number of reads coming from isoform j then E[n(j)] ∝ k p(k)(l(j) − k + 1) = l(j) − μ + 1. Thus, if the isoform of origin is known for each read, the maximum likelihood estimator for f (j) is given by c(j)/(c(1) + . . . + c(N )), where c(j) = n(j)/(l(j) − μ + 1) denotes the lengthnormalized fragment coverage. Unfortunately, some reads match multiple isoforms, so their isoform of origin cannot be established unambiguously. The IsoEM algorithm (see Algorithm 1) overcomes this diﬃculty by simultaneously estimating the frequencies and imputing the missing read origin within an iterative framework. After initializing frequencies f (j) at random, the algorithm repeatedly performs the next two steps until convergence: – Estep: Compute the expected number n(j) of reads that come from isoform j under the assumption that isoform frequencies f (j) are correct, based on weights wr,j – Mstep: For each j, set the new value of f (j) to c(j)/(c(1) + . . . + c(N )), where normalized coverages c(j) are based on expected counts computed in previous step
3 3.1
Experimental Results Simulation Setup
We tested IsoEM on simulated human RNASeq data. The human genome sequence (hg18, NCBI build 36) was downloaded from UCSC together with the coordinates of the isoforms in the KnownGenes table. Genes were deﬁned as clusters of known isoforms deﬁned by the GNFAtlas2 table. The dataset contains a total of 66803 isoforms pertaining to 19372 genes. The isoform length distribution and the number of isoforms per genes are shown in Figure 1.
M. Nicolae et al. 100000
25000
Numberofgenes umberofgenes rofgenes nes
Numberofisoforms mberofisoforms
208
20000 15000 10000 5000 0 10
100
1000
10000
Isoformlength
100000
10000 1000 100 10 1 0
5
10 15 20 25 30 35 40 45 50 55
Numberofisoforms
Fig. 1. Distribution of isoform lengths (left panel) and gene cluster sizes (right panel) for the UCSC KnownGenes dataset
Single and pairedend reads were randomly generated by sampling fragments from the known isoforms. Each isoform was assigned a true frequency based on the abundance reported for the corresponding gene in the ﬁrst human tissue of the GNFAtlas2 table, and a probability distribution over the isoforms inside a gene cluster. Thus, the true frequency of isoform j is a(g)p(j), where a(g) is the abundance of the gene g for which j is an isoform and p(j) is the probability of isoform j among all the isoforms of g. We simulated datasets with uniform and geometric (p = 0.5) distributions for the isoforms of each gene. Fragment lengths were simulated from a normal probability distribution with mean 250 and standard deviation 25. We simulated between 1 and 60 million single and paired reads of lengths ranging from 25 to 100 base pairs, with or without strand information. We compared IsoEM to several existing IE and GE algorithms. For IE we included in the comparison the isoform analogs of the Uniq and Rescue methods used for GE [12], an improved version of Uniq (UniqLN) that estimates isoform frequencies from unique read counts but normalizes them using adjusted isoform lengths that exclude ambiguous positions, the Cuﬄinks algorithm of [18], and the RSEM algorithm of [11]. For the GE problem, the comparison included the Uniq and Rescue methods, our implementation of the EM algorithm described in [13] (GeneEM), and estimates obtained by summing isoform expression levels inferred by Cuﬄinks, RSEM, and IsoEM. All methods except Cuﬄinks use alignments obtained by mapping reads onto the library of isoforms with Bowtie [10] and then converting them to genome coordinates. As suggested in [18], Cuﬄinks uses alignments obtained by mapping the reads onto the genome with TopHat [17], which was provided with a complete set of annotated junctions. Frequency estimation accuracy was assessed using the coeﬃcient of determination, r2 , along with the error fraction (EF) and median percent error (MPE) measures used in [11]. However, accuracy was computed against true frequencies, not against estimates derived from true counts as in [11]. If fˆi is the frequency estimate for an isoform with true frequency fi , the relative error is deﬁned as fˆi − fi /fi if fi = 0, 0 if fˆi = fi = 0, and ∞ if fˆi > fi = 0. The error fraction with threshold τ , denoted EFτ is deﬁned as the percentage of isoforms with relative error greater or equal to τ . The median percent error, denoted MPE, is deﬁned as the threshold τ for which EFτ = 50%.
Estimation of Alternative Splicing isoform Frequencies from RNASeq Data
209
Table 1. r 2 for isoform and gene expression levels inferred from 30M reads of length 25 from reads simulated assuming uniform, respectively geometric expression of gene isoforms Isoform Expression Gene Expression Algorithm Uniform Geometric Algorithm Uniform Geometric Uniq 0.466 0.447 Uniq 0.579 0.586 Rescue 0.693 0.675 Rescue 0.724 0.724 GeneEM 0.636 0.637 UniqLN 0.856 0.838 Cuﬄinks 0.778 0.757 Cuﬄinks 0.661 0.618 RSEM 0.919 0.911 RSEM 0.939 0.934 IsoEM 0.988 0.978 IsoEM 0.979 0.964
3.2
Comparison between Methods
Table 1 gives r2 values for isoform, respectively gene expression levels inferred from 30M reads of length 25, simulated assuming both uniform and geometric isoform expression. IsoEM signiﬁcantly outperforms the other methods, achieving an r2 values of over .96 for all datasets. For all methods the accuracy diﬀerence between datasets generated assuming uniform and geometric distribution of isoform expression levels is small, with the latter one typically having a slightly worse accuracy. Thus, in the interest of space we present remaining results only for datasets generated using geometric isoform expression. For a more detailed view of the relative performance of compared IE and GE algorithms, Figure 2 gives the error fraction at diﬀerent thresholds ranging between 0 and 1. The variety of methods included in the comparison allows us to tease out the contribution of various algorithmic ideas to overall estimation accuracy. The importance of rigorous length normalization is demonstrated by the IE accuracy gain of UniqLN over Uniq – clearly larger than that achieved by ambiguous read reallocation as implemented in the IE version of Rescue. Proper length normalization is also the main reason for the accuracy gain of isoformaware GE methods (Cuﬄinks, RSEM, and IsoEM) over isoform oblivious GE methods. Similarly, the importance of modeling insert sizes even for single read data is underscored by the IE and GE accuracy gains of IsoEM over RSEM. For yet another view, Tables 2 and 3 report the MSE and EF.15 measures for isoform, respectively gene expression levels inferred from 30M reads of length 25, computed over groups of isoforms with various expression levels. IsoEM consistently outperforms the other IE and GE methods at all expression levels except for isoforms with zero true frequency, where it is dominated by the more conservative Uniq algorithm and its UniqLN variant. 3.3
Influence of Sequencing Parameters
Although highthroughput technologies allow users to make tradeoﬀs between read length and the number of generated reads, very little has been done to determine optimal parameters even for common applications such as RNASeq.
M. Nicolae et al.
soformsoverthreshold threshold %ofisoformsoverthreshold d soverthreshold
210
100 90 80 70 60 50 40 30 20 10 0
Uniq Cufflinks
%ofgenesoverthreshold soverthreshold hreshold fgenesoverthreshold
0
0.2
0.4
Rescue RSEM
0.6
Relativeerrorthreshold
100 90 80 70 60 50 40 30 20 10 0
UniqLN IsoEM
0.8
1
Uniq Rescue GeneEM Cufflinks RSEM IsoEM
0
0.2
0.4
0.6
Relativeerrorthreshold
0.8
1
Fig. 2. Error fraction at diﬀerent thresholds for isoform (top panel) and gene (bottom panel) expression levels inferred from 30M reads of length 25 simulated assuming geometric isoform expression.
Table 2. Median percent error (MPE) and 15% error fraction (EF.15 ) for isoform expression levels inferred from 30M reads of length 25 Expression range # isoforms Uniq Rescue MPE UniqLN Cuﬄinks RSEM IsoEM Uniq Rescue EF.15 UniqLN Cuﬄinks RSEM IsoEM
0 13290 0.0 0.0 0.0 0.0 0.0 0.0 0.2 48.4 0.2 17.6 19.9 5.1
(0, 10−6 ] (10−6 , 10−5 ] (10−5 , 10−4 ] (10−4 , 10−3 ] (10−3 , 10−2 ] 10024 23882 18359 1182 66 100.0 98.4 97.1 98.5 96.6 294.7 75.5 49.2 30.4 28.3 100.0 80.8 30.3 26.4 24.8 100.0 49.7 25.5 27.2 44.6 100.0 31.9 13.5 11.4 13.0 100.0 22.7 7.3 3.5 2.5 98.4 97.2 96.9 97.0 95.5 95.5 86.2 73.1 61.5 56.1 97.2 86.2 82.8 83.3 77.3 96.4 81.3 71.0 74.7 80.3 93.7 71.1 46.4 39.8 47.0 91.2 62.8 29.3 15.8 7.6
All 66803 95.4 71.9 36.0 34.1 21.2 11.8 78.0 76.0 69.8 67.9 56.9 45.5
The intuition that longer reads are better certainly holds true for many applications such as de novo assembly. Surprisingly, [11] found that shorter reads are better for IE when the total number of sequenced bases is ﬁxed. Figure 3 plots
Estimation of Alternative Splicing isoform Frequencies from RNASeq Data
211
Table 3. Median percent error (MPE) and 15% error fraction (EF.15 ) for gene expression levels inferred from 30M reads of length 25 Expression range (0, 10−6 ] (10−6 , 10−5 ] (10−5 , 10−4 ] (10−4 , 10−3 ] (10−3 , 10−2 ] All # genes 120 5610 11907 1632 102 19372 Uniq Rescue MPE GeneEM Cuﬄinks RSEM IsoEM Uniq Rescue EF.15 GeneEM Cuﬄinks RSEM IsoEM
37.4 32.8 30.6 33.0 23.6 18.3 77.5 74.2 72.5 73.3 64.2 57.5
43.6 28.7 28.2 21.1 11.0 8.4 82.4 74.0 73.8 64.7 37.3 28.3
42.7 26.0 25.7 19.0 7.2 3.3 81.7 71.6 71.5 62.3 17.4 6.8
43.0 25.1 25.1 20.2 7.9 2.2 79.7 72.8 73.0 66.2 16.3 6.5
48.2 28.8 28.0 40.2 11.4 2.1 82.4 76.5 74.5 82.3 41.2 4.9
43.0 26.7 26.3 19.7 8.1 4.0 81.7 72.4 72.3 63.5 23.5 13.3
edianPercentError MedianPercentError
25 20 15 10 Pairedreads 5
Singlereads
0 25
35
45
55
65
Readlength
75
85
95
0.985
r2
0.980 0.975 0.970 Pairedreads 0.965 0 965
Singlereads
0.960 25
35
45
55
65
75
85
95
Readlength
Fig. 3. IsoEM MPE (top panel) and r 2 values (bottom panel) for 750Mb of data generated using single and pairedend sequencing with read length between 25 and 100
212
M. Nicolae et al.
0.98 0.975 0.97 0.965
r2
RandomStrandͲPairs
0.96
CodingStrandͲpairs
0.955 0 955
RandomStrandͲSingle
0.95
CodingStrandͲsingle
0.945 0
10
20
30
40
50
60
20
25
30
MillionReads
160
RandomStrandͲPairs CodingStrandͲPairs RandomStrandͲSingle CodingStrandͲSingle
CPUsec.
140 120 100 80 60 40 20 0 0
5
10
15
MillionFragments
Fig. 4. IsoEM r 2 (top panel) and CPU time (bottom panel) for 160 million single/paired reads of length 75, with or without strand information
IE estimation accuracy for reads of length between 25 and 100 when the total amount of sequence data is kept constant at 750M bases. Our results conﬁrm the ﬁnding of [11], although the optimal read length is somewhat sensitive to the accuracy measure used and to the availability of pairing information. While 25bp reads optimize the MPE measure regardless of the availability of paired reads, the read length that maximizes r2 is 36 for paired reads and 50 for single reads. While more experiments are needed to determine how the optimum length depends on the amount of sequence data and transcriptome complexity, this does suggest that, for isoform and gene expression estimation accuracy, increasing the number of reads may be more useful than increasing read length beyond a certain limit. The top panel of Figure 4 shows, for reads of length 75, the eﬀects of paired reads and strand information on estimation accuracy as measured by r2 . Not surprisingly, for a ﬁxed number of reads, paired reads yield better accuracy than single reads. Also not very surprisingly, adding strand information to paired sequencing yields no beneﬁts to genomewide IE accuracy (although it may be helpful, e.g., in identiﬁcation of novel transcripts). Quite surprisingly, performing
Estimation of Alternative Splicing isoform Frequencies from RNASeq Data
213
strandspeciﬁc single read sequencing is actually detrimental to IsoEM IE (and hence GE) accuracy under the simulated scenario, most likely due to the reduction in sampled transcript length. As shown in the bottom panel of Figure 4, the runtime of our Java implementation of IsoEM scales roughly linearly with the number of fragments, and is largely insensitive to the type of sequencing data (single or paired reads, directional or nondirectional). IsoEM was tested on a DELL PowerEdge R900 server with 4 Six Core E7450Xeon Processors at 2.4Ghz (64 bits) and 128Gb of internal memory. None of the datasets require more than 16GB of memory to complete, however, increasing the amount of memory made available to the Java virtual machine signiﬁcantly decreases runtime by reducing the time needed for garbage collection. The runtimes in Figure 4 were obtained by allowing IsoEM to use up to 32GB of memory, in which case none of the datasets took more than 3 minutes to solve.
4
Conclusions and Ongoing Work
In this paper we have introduced an expectationmaximization algorithm for isoform frequency estimation assuming a known set of isoforms. Our algorithm, called IsoEM, explicitly models base quality scores, insert size distribution, strand and read pairing information. Experiments on synthetic data sets generated using two diﬀerent assumptions on the isoform distribution show that IsoEM consistently outperforms existing algorithms for isoform and gene expression level estimation with respect to a variety of quality metrics. The open source Java implementation of IsoEM is freely available for download at http://dna.engr.uconn.edu/software/IsoEM/. In ongoing work we are extending IsoEM to perform allelic speciﬁc isoform expression and exploring integration of isoform frequency estimation with identiﬁcation of novel transcripts using the iterative reﬁnement framework proposed in [4].
References 1. Anton, M., Gorostiaga, D., Guruceaga, E., Segura, V., CarmonaSaez, P., PascualMontano, A., Pio, R., Montuenga, L., Rubio, A.: SPACE: an algorithm to predict and quantify alternatively spliced isoforms using microarrays. Genome Biology 9(2), R46 (2008) 2. Birol, I., Jackman, S.D., Nielsen, C.B., Qian, J.Q., Varhol, R., Stazyk, G., Morin, R.D., Zhao, Y., Hirst, M., Schein, J.E., Horsman, D.E., Connors, J.M., Gascoyne, R.D., Marra, M.A., Jones, S.J.M.: De novo transcriptome assembly with ABySS. Bioinformatics 25(21), 2872–2877 (2009) 3. Carninci, P., et al.: The Transcriptional Landscape of the Mammalian Genome. Science 309(5740), 1559–1563 (2005) 4. Feng, J., Li, W., Jiang, T.: Inference of isoforms from short sequence reads. In: Berger, B. (ed.) RECOMB 2010. LNCS, vol. 6044, pp. 138–157. Springer, Heidelberg (2010)
214
M. Nicolae et al.
5. Hansen, K.D., Brenner, S.E., Dudoit, S.: Biases in Illumina transcriptome sequencing caused by random hexamer priming. Nucl. Acids Res. p. gkq224 (2010) (advance access) 6. Hiller, D., Jiang, H., Xu, W., Wong, W.H.: Identiﬁability of isoform deconvolution from junction arrays and RNASeq. Bioinformatics 25(23), 3056–3059 (2009) 7. Jackson, B., Schnable, P., Aluru, S.: Parallel short sequence assembly of transcriptomes. BMC Bioinformatics 10(suppl. 1), S14+ (2009) 8. Jiang, H., Wong, W.H.: Statistical inferences for isoform expression in RNASeq. Bioinformatics 25(8), 1026–1032 (2009) 9. Lacroix, V., Sammeth, M., Guigo, R., Bergeron, A.: Exact transcriptome reconstruction from short sequence reads. In: Crandall, K.A., Lagergren, J. (eds.) WABI 2008. LNCS (LNBI), vol. 5251, pp. 50–63. Springer, Heidelberg (2008) 10. Langmead, B., Trapnell, C., Pop, M., Salzberg, S.: Ultrafast and memoryeﬃcient alignment of short DNA sequences to the human genome. Genome Biology 10(3), R25 (2009) 11. Li, B., Ruotti, V., Stewart, R.M., Thomson, J.A., Dewey, C.N.: RNASeq gene expression estimation with read mapping uncertainty. Bioinformatics 26(4), 493– 500 (2010) 12. Mortazavi, A., Williams, B.A.A., McCue, K., Schaeﬀer, L., Wold, B.: Mapping and quantifying mammalian transcriptomes by RNASeq. Nature methods (2008) 13. Pa¸saniuc, B., Zaitlen, N., Halperin, E.: Accurate estimation of expression levels of homologous genes in RNAseq experiments. In: Berger, B. (ed.) RECOMB 2010. LNCS, vol. 6044, pp. 397–409. Springer, Heidelberg (2010) 14. Richard, H., Schulz, M.H., Sultan, M., Nurnberger, A., Schrinner, S., Balzereit, D., Dagand, E., Rasche, A., Lehrach, H., Vingron, M., Haas, S.A., Yaspo, M.L.: Prediction of alternative isoforms from exon expression levels in RNASeq experiments. Nucl. Acids Res. 38(10), e112+ (2010) 15. She, Y., Hubbell, E., Wang, H.: Resolving deconvolution ambiguity in gene alternative splicing. BMC Bioinformatics 10(1), 237 (2009) 16. Temple, G., et al.: The completion of the Mammalian Gene Collection (MGC). Genome Research 19(12), 2324–2333 (2009) 17. Trapnell, C., Pachter, L., Salzberg, S.L.: TopHat: discovering splice junctions with RNASeq. Bioinformatics 25(9), 1105–1111 (2009) 18. Trapnell, C., Williams, B.A., Pertea, G., Mortazavi, A., Kwan, G., van Baren, M.J., Salzberg, S.L., Wold, B.J., Pachter, L.: Transcript assembly and quantiﬁcation by RNASeq reveals unannotated transcripts and isoform switching during cell diﬀerentiation. Nature biotechnology 28(5), 511–515 (2010) 19. Wang, E.T., Sandberg, R., Luo, S., Khrebtukova, I., Zhang, L., Mayr, C., Kingsmore, S.F., Schroth, G.P., Burge, C.B.: Alternative isoform regulation in human tissue transcriptomes. Nature 456(7221), 470–476 (2008) 20. Wang, Z., Gerstein, M., Snyder, M.: RNASeq: a revolutionary tool for transcriptomics. Nat. Rev. Genet. 10(1), 57–63 (2009)
Improved Orientations of Physical Networks Iftah Gamzu1 , Danny Segev2 , and Roded Sharan1 1
Blavatnik School of Computer Science, TelAviv University, TelAviv 69978, Israel {iftgam,roded}@tau.ac.il 2 Department of Statistics, University of Haifa, Haifa 31905, Israel
[email protected] Abstract. The orientation of physical networks is a prime task in deciphering the signalingregulatory circuitry of the cell. One manifestation of this computational task is as a maximum graph orientation problem, where given an undirected graph on n vertices and a collection of vertex pairs, the goal is to orient the edges of the graph so that a maximum number of pairs are connected by a directed path. We develop a novel approximation algorithm for this problem with a performance guarantee of O(log n/ log log n), improving on the current logarithmic approximation. In addition, motivated by interactions whose direction is preset, such as proteinDNA interactions, we extend our algorithm to handle mixed graphs, a major open problem posed by earlier work. In this setting, we show that a polylogarithmic approximation ratio is achievable under biologicallymotivated assumptions on the sought paths.
1
Introduction
A fundamental problem in the study of biological networks is the inference of causal relations that are often not covered by current experimental techniques. One prime example for such deﬁciency concerns proteinprotein interaction (PPI) networks. While PPIs have been measured at large scale across tens of organisms for over a decade now, current technologies do not provide information on the direction in which signal ﬂows. Such information may be indirectly obtained from perturbation experiments in which a gene is perturbed and as a result other genes change their expression levels. Assuming that the expression changes imply directed pathways from the perturbed, or causal, gene to the aﬀected genes, several authors have successfully inferred interaction directions [15]. The inference of interaction directions that best ﬁt the perturbation experiments can be cast as a maximum graph orientation (MGO) problem. An instance of this problem consists of an undirected graph on n vertices, representing the PPI network, and a collection C of requests. Each request is given as an ordered pair of sourcetarget vertices, representing a causal gene and an aﬀected gene. The goal is to orient the graph, i.e., choose a single direction for each of its edges, such that a maximal number of requests admit a directed path from the source to the target. We note that any instance of MGO can be reduced to one V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 215–225, 2010. c SpringerVerlag Berlin Heidelberg 2010
216
I. Gamzu, D. Segev, and R. Sharan
where the underlying graph is a tree. Indeed, if the input graph contains cycles, one can sequentially contract them, one after the other. In each step, the edges of an arbitrary cycle are all oriented in the same direction (either clockwise or counterclockwise). As a result, every pair of vertices on this cycle admit a directed path between them and, thus, the cycle can be contracted into a single vertex. Medvedovsky et al. [15] were the ﬁrst to study MGO. They demonstrated that the seemingly simple setting when the underlying graph is a star is equivalent to the maximum directed cut problem. The latter problem admits a semideﬁnite programming based 0.874approximation algorithm [4,13], while approximating it within factors of 11/12 ≈ 0.916 and αGW ≈ 0.878 is NPhard [10] and Unique Gameshard [12], respectively. These hardness bounds clearly follow to MGO. On the positive side, they devised an O(log n) approximation algorithm for arbitrary trees, and proposed an exact dynamicprogramming algorithm for the special case of path graphs. Further research along these lines focused on variants of the maximum graph orientation problem. For instance, Hakimi, Schmeichel, and Young [8] studied the special setting in which the set of requests contains all vertex pairs, and developed an exact polynomial time algorithm. Arkin and Hassin [2] established hardness results for the problem of deciding whether one can orient a mixed graph, i.e., a graph in which the orientation of some edges is predetermined, to satisfy a given set of requests. Our contribution in this paper is twofold: (i) We propose a deterministic algorithm for the maximum graph orientation problem whose approximation ratio is O(log n/ log log n). This result improves on the current O(log n) approximation due to Medvedovsky et al. [15]. Our algorithm optimizes with respect to the optimal solution, which is crucial to our sublogarithmic performance guarantee. In contrast, previous results made use of the request set cardinality, C, as a reference point, and were therefore limited by the observation that there are certain trees in which any orientation cannot satisfy more than a logarithmic fraction of the entire set of requests [14]. (ii) We devise an approximation algorithm for the generalized scenario of mixed graphs. This scenario is motivated by the need to include in the network proteinDNA interactions (PDIs), which are both fundamental to signal transduction and key mediators in the observed expression changes. The approximation guarantee of our algorithm depends on the number of PDI segments in the underlying pathways. For typical cases, in which the pathways contain at most one segment, our algorithm achieves an approximation ratio of O(log n). The rest of the paper is organized as follows: In Section 2, we describe and analyze the algorithm for the maximum graph orientation problem, while in Section 3, we study the mixedgraphs scenario.
2
Orienting Undirected Graphs
In this section, we devise a deterministic algorithm that achieves an approximation guarantee of O(log n/ log log n) for MGO. The algorithm employs the
Improved Orientations of Physical Networks
217
classifyandselect paradigm, that is, it exploits various structural properties of the input graph to partition the collection of requests into O(log n/ log log n) pairwisedisjoint classes. For each such class, given the additional structure imposed, we separately compute a graph orientation that satisﬁes a constant fraction of the optimal number of satisﬁable requests in this class. Consequently, the abovementioned approximation ratio follows by picking, out of the set of all the computed orientations, the one that satisﬁes a maximum number of requests. Below we describe the classiﬁcation and orientation steps in detail. 2.1
The Classification Process
To specify the process by which requests are partitioned into classes, we begin by presenting the notion of an almostbalanced decomposition, which can be viewed as a generalization of the wellknown centroid decomposition [5]. Note that structural properties in this spirit have been explored and exploited in various settings (see, e.g., [3,7,9]). Definition 1. Let T = (V, E) be a tree. An almost balanced kdecomposition of T is a partition of T into k edgedisjoint subtrees T1 , . . . , Tk such that each subtree contains between E/(3k) and 3E/k edges. Lemma 1. ([6]) Let T = (V, E) be a tree with E ≥ k. An almost balanced kdecomposition of T exists and can be found in polynomial time. In addition, the number of vertices that are shared by at least two subtrees is less than k. The classiﬁcation process corresponds to a recursive decomposition of the input tree T . Let T1 = {T1 , . . . , Tk } be an almost balanced kdecomposition of T into k edgedisjoint subtrees. We say that a decomposition separates a request i when its endpoints si and ti reside in diﬀerent subtrees of the decomposition (see Figure 1 for an example). The ﬁrst class of requests, C1 , consists of all requests separated by T1 . To classify the remaining set of requests, C \ C1 , we recursively apply the previouslydescribed procedure with respect to the collection of subtrees in T1 . Speciﬁcally, in the second level of the recursion, an almost balanced kdecomposition is computed in each of the subtrees T1 , . . . , Tk , to obtain a set T2 , comprising of k 2 subtrees. The second class of requests, C2 , consists of all yetunclassiﬁed requests separated by T2 . In other words, the endpoints of each request i ∈ C2 reside in diﬀerent subtrees of T2 , but in the same subtree of T1 . The remaining classes C3 , C4 , . . . are deﬁned in a similar manner. It is important to note that the recursive process ends as soon as we arrive at a subtree with strictly less than k edges. In this case, we make use of the trivial decomposition, where the given subtree is broken into its individual edges. In the above description, k was treated as a parameter whose value has not been determined yet. To obtain the desired approximation ratio, we set k = log n. It follows that the overall number of levels in the recursion, or equivalently, the number of request classes is O(logk n) = O(log n/ log log n). This claim is immediately implied by observing that the maximum size of a subtree in level of the recursion is at most (3/k) · E.
218
I. Gamzu, D. Segev, and R. Sharan
t1 s5 s2 s3
s1
t4 t2
t5
s4 t3
Fig. 1. An almost balanced 9decomposition. Here, requests 1, 2, and 3 are separated, whereas requests 4 and 5 are not.
2.2
An Orientation Algorithm for a Single Decomposition
Notice that a class of requests, say C , generally consists of several subsets of requests, each created when diﬀerent subtrees in T−1 are partitioned by the decomposition T . More speciﬁcally, assuming that the subtrees in T−1 are T1 , T2 , . . ., the class C can be written as the disjoint union of C1 , C2 , . . ., where Cj is the set of requests that are ﬁrst separated when Tj is partitioned. Recall that the path of any request separated by some subtree decomposition must be contained in that subtree (otherwise, this request would have been separated in previous recursion steps). This observation implies that it is suﬃcient to compute an orientation for a single subtree decomposition and its induced set of separated requests. Given a polynomialtime algorithm that computes such an orientation, one can sequentially apply it to each of the subtree decompositions in the same recursion level. The resulting orientations (in edgedisjoint subtrees) can then be “glued” to form a single orientation, deﬁned for the entire edge set, satisfying at least as many requests as the overall number of requests satisﬁed in all individual subtrees. In what follows, we focus our attention on a single decomposition, and devise a randomized algorithm that computes an orientation which satisﬁes, in expectation, a constant fraction of the optimal number of satisﬁable requests for this decomposition. Formally, an instance of the problem in question consists of a tree T = (V, E), and a partition T = {T1 , . . . , Tk } of this tree into k edgedisjoint subtrees, where k ≤ log n, and the number of vertices shared by at least two subtrees is less than k. In addition, we are given a collection C of requests, where each request path is separated by T , meaning that si and ti reside in diﬀerent subtrees of the decomposition T . We need the following notation (exempliﬁed in Figure 2). Let OPT denote the number of satisﬁed requests in some ﬁxed optimal orientation of T . Let VB ⊆ V
Improved Orientations of Physical Networks
219
T6
T5
T1
T2
T3
T4
Fig. 2. An almost balanced 6decomposition. Note that black vertices are border vertices, gray vertices are junction vertices, and bold edges make up the skeleton of the decomposition.
be the set of border vertices of T , that is, the set of vertices that are shared by at least two subtrees in T . Moreover, let S ⊆ T be the skeleton of T , namely, the minimal subtree spanned by all border vertices. Note that this subtree consists of the union of paths connecting any two vertices in VB . Finally, let VJ ⊆ V the set of junction vertices, deﬁned as nonborder skeleton vertices with degree at least 3 (counting only skeleton edges). The algorithm. We are now ready to present the orientation algorithm. Our algorithm consists of two phases: segment guessing, where the optimal direction state of disjoint subpaths of the skeleton is attained, followed by randomized assignment, in which individual edges are assigned a direction. Phase I: segment guessing. Let us name the vertex set VB ∪ VJ the core of the skeleton S. One can easily verify that VB ∪ VJ  < 2k as VJ  < VB  < k, by Lemma 1. We now partition the skeleton into a collection Σ(S) of edgedisjoint paths, which are referred to as segments. Each such segment is a subpath of S whose endpoints are core vertices, but its interior traverses only noncore vertices. Clearly, Σ(S) = VB ∪ VJ  − 1 < 2k. We now argue that one could obtain in polynomial time the direction state that the optimal orientation induces on each segment σ ∈ Σ(S), simultaneously for all segments. To this end, notice that any skeleton segment σ = v1 , v2 , . . . , v may be in one of three possible direction states: 1. Right direction: all edges are consistently directed from v1 towards v , i.e., v1 → v2 , v2 → v3 , . . . , v−1 → v . 2. Left direction: all edges are consistently directed from v towards v1 , namely, v1 ← v2 , v2 ← v3 , . . . , v−1 ← v . 3. Mixed direction: the direction of segment edges is nonconsistent. These deﬁnitions imply that the total number of segment direction states to be examined is of polynomial size since 3Σ(S) = 3O(k) = 3O(log n) = nO(1) . As a consequence, we may assume without loss of generality that the set of direction states induced by the optimal orientation on all the segments of Σ(S) is known in advance. This assumption can be easily enforced by enumerating over all nO(1) possible segment direction states.
220
I. Gamzu, D. Segev, and R. Sharan
Phase II: randomized assignment. The goal of this phase is to orient the graph while making sure that the edge directions respect the outcome of the segment guessing phase. For this purpose, we begin by considering skeleton segments that have a consistent direction, namely, segments in either right or left direction states, and assign all the edges in these segments their implied direction. The assignment procedure proceeds with two randomized assignment steps: 1. Each segment in a mixed direction state is assigned, independently and uniformly at random, a right or left direction. All segment edges are oriented according to the chosen direction. 2. Each of the decomposition subtrees T1 , . . . , Tk is assigned, independently and uniformly at random, the role of a sender or a receiver. All the edges of each sender subtree are oriented towards the skeleton (in its simplest form, when the subtree contains a single border vertex, all edges are oriented toward that vertex). In contrast, all the edges of each receiver subtree are oriented away from the skeleton. We refer the reader to an example in Figure 3(a).
rsi
rti vti
v si si
ti
T si
(a)
Tti
(b)
Fig. 3. (a) An orientation of a sender subtree, where the bold edges are part of the skeleton. (b) A partition of a request path into ﬁve parts.
We turn to prove that the expected number of satisﬁed requests is within a constant factor of optimal, as formally stated in the following theorem. Theorem 1. The resulting orientation satisfies at least OPT/16 requests in expectation. Proof. Recall that we have previously assumed the endpoints of each request to reside in diﬀerent subtrees of the decomposition T . In particular, this implies that each request path must traverse at least one border (core) vertex. For this reason, as shown in Figure 3(b), we can divide each request path, with endpoints si and ti , into ﬁve (some possibly empty) parts: 1. A subpath between si and its closest skeleton vertex vsi . 2. A subpath, along a partial skeleton segment, between vsi and its closest core vertex rsi .
Improved Orientations of Physical Networks
221
3. A subpath between ti and its closest skeleton vertex vti . 4. A subpath, along a partial skeleton segment, between vti and its closest core vertex rti . 5. A subpath between rsi and rti , along a sequence of complete skeleton segments. With these deﬁnitions in mind, let us focus on some request i that is satisﬁed in the optimal orientation. We now argue that, with probability at least 1/16, this request is satisﬁed in the random orientation constructed by the algorithm. Consequently, by linearity of expectation, the overall expected number of satisﬁed requests is OPT/16. A key observation one should make to establish this argument is that all the segments along the subpath between rsi and rti must have a consistent direction in the optimal orientation; otherwise, this request would not have been satisﬁed. Accordingly, we may assume that our algorithm assigned the same direction to all the edges in these segments. Now, notice that the request under consideration is satisﬁed if the following four probabilistic events occur: (1) the edges in the subpath between si and vsi are oriented towards vsi ; (2) the edges in the subpath between vsi and rsi are oriented towards rsi ; (3) the edges in the subpath between vti and rti are oriented towards vti ; and (4) the edges in the subpath between ti and vti are oriented towards ti . One can easily validate that these four events are independent, and that each one of them occurs with probability of at least 1/2. For example, the edges in the subpath between si and vsi are oriented towards vsi if the underlying subtree Tsi is selected as a sender. As a result, the probability that request i is satisﬁed in the random orientation is at least 1/16. Derandomization. The avid reader may have already noticed that the extent to which we utilize randomization is rather limited, and that its foremost purpose is to make the presentation of our algorithm simpler. Speciﬁcally, each segment in a mixed direction state is randomly assigned one of two possible directions, while each decomposition subtree is randomly assigned one of two possible roles. In other words, all we need to obtain a deterministic algorithm is a uniform sample space, with two possible values for O(log n) independent random variables. This can be constructed in polynomial time either explicitly, as there are only nO(1) possible outcomes, or in a more compact way, by observing that fourwiseindependence is suﬃcient for the preceding analysis (see, for instance, [1, Chap. 15]). A semioblivious property. In view of the derandomization procedure, we may reinterpret our algorithm as the following twostage process: initially, we generate a set of polynomiallymany potential orientations, determined by all possible outcomes of both the segment guessing and randomized assignment phases, and then, we select an orientation that maximizes the number of satisﬁed requests. Now, notice that the ﬁrst stage of this process is semioblivious. Speciﬁcally, the set of generated orientations is independent of the collection of requests, and only builds on the structure of the underlying network. This property allows us to employ the algorithm in generalized requests settings. For
222
I. Gamzu, D. Segev, and R. Sharan
instance, a natural generalization of maximum graph orientation is when each request is characterized by a collection of ordered sourcetarget pairs, rather than a single pair. In this setting, a request is regarded as satisﬁed if at least one of its sourcetarget pairs admits a directed path in the oriented graph. One can easily verify that our algorithm attains the same performance guarantees for this setting by applying nearly identical analysis. One interesting scenario that is captured by the abovementioned generalization is of maximum graph orientation with groups. In this scenario, a request i is satisﬁed if there is a directed path from some vertex si ∈ Si to some vertex ti ∈ Ti in the oriented graph. Here, Si and Ti are vertex sets that characterize the request.
3
Orienting Mixed Graphs
Thus far, we have restricted our attention to undirected graphs. In practice, signaling pathways contain various types of interactions whose direction is speciﬁed in advance, most notably proteinDNA interactions. This implies that the input to the graph orientation problem is, in its utmost general setting, a mixed graph. A key diﬃculty in this setting is that, unlike the seemingly easiertohandle scenario of unoriented edges, there is no trivial reduction to tree instances. What prevents us from contracting cycles is the possible existence of cycles with oriented edges pointing in opposite directions, for which there does not seem to be an easy way to decide in advance on the orientation of remaining edges. Despite the inherent diﬃculty in a mixed graph input, the biological setting provides us with several constraints on the input graph, which we exploit in our approximation algorithm. The ﬁrst biologicallymotivated constraint relates to the occurrence of PDI edges along pathways. Reviewing real pathways, we observed that signaling pathways do not jump back and forth between PPIs and PDIs, rather in the vast majority of the cases there is a single switch from PPIs to PDIs. Precisely, deﬁne a PDI segment in a linear path as a series of consecutive PDIs along the path that is ﬂanked by PPI edges or by the start/end of the path. To gather statistics on the number of PDI segments in real pathways, we downloaded 116 human pathways from KEGG [11]. For each pathway, we counted the number of PDI segments in its longest linear path. Only 35 of the 116 pathways contained PDIs, and 18 of which had at least one PDI segment in their longest path. Notably, 17 of the 18 contained a single PDI segment; the remaining pathway contained two segments. A second constraint is a reﬁnement of the ﬁrst one: In two thirds of the 18 KEGG pathways with at least one PDI segment, the segment occurred at the end of the pathway. Interestingly, our algorithm can be directly applied to this latter scenario (of a single PDI segment that occurs at the end of the pathway) as each causeeﬀect pair can then be translated into a group request where the cause should connect to any of the genes that have a directed PDIs path to the eﬀect. Below, we consider the general case and show that if the sought pathways contain at most segments then an O(log n) approximation is possible.
Improved Orientations of Physical Networks
3.1
223
The Approximation Algorithm
Let G = (V, E) be a mixed graph whose edge set can be described as E = EO ∪ EU , where EO consists of edges with predeﬁned directions, and EU are unoriented edges. Even though the input graph may contain cycles with oriented edges pointing in opposite directions, we can still contract unoriented cycles, and more generally, cycles where all oriented edges are consistently pointing in the same direction. Therefore, from this point on we assume that such cycles have already been contracted. With this setting in mind, an unoriented component (or, Ucomponent, for short) is deﬁned as a maximal connected component of the unoriented subgraph (V, EU ). It is worth noting that any Ucomponent is necessarily a tree, or otherwise, there must be unoriented cycles, which should have been contracted earlier on. Also note that there are no oriented edges with both head and tail residing in the same Ucomponent since any such edge induces a cycle that should have been contracted before. As a consequence of the preprocessing steps described above, the input graph can be represented as a directed acyclic graph on the Ucomponents, as illustrated in Figure 4(a). That is, the collection of Ucomponents can be topologically sorted such that all oriented edges between them are pointing from left to right. Let T = (VT , ET ) be some Ucomponent. We ﬁrst show how to compute a random orientation of ET such that any pair of vertices in T is connected with probability Ω(1/ log n). For this purpose, suppose we execute the classiﬁcation process suggested in Section 2.1 where the collection of requests consists of all vertex pairs in T . However, rather than using almostbalanced kdecompositions with k = log n, we will simplify the process by picking k = 2. Even though the number of resulting request classes slightly blows up to O(log n), each time a tree is being decomposed, we obtain only two almostbalanced edgedisjoint subtrees which intersect in a common vertex. On top of picking an alternative value of k, instead of testing all O(log n) request classes as potential candidates for the class that separates the maximal number of pairs, we will pick one such class uniformly at random. Given this class, the orientation of each decomposed tree (two edgedisjoint subtrees) is determined, independently and uniformly at random, from one of the following two alternatives, as shown in Figure 4(b):
right: ... left:
(a)
(b)
Fig. 4. (a) A directed acyclic graph on Ucomponents. (b) The two possible orientations of a decomposed tree.
224
I. Gamzu, D. Segev, and R. Sharan
– Right orientation: All edges of the ﬁrst subtree are oriented towards the common root and all edges of the second subtree are oriented away from that root. – Left orientation: All edges of the second subtree are oriented towards the common root and all edges of the ﬁrst subtree are oriented away from that root. Following Section 2.1, it is not diﬃcult to verify that any pair of vertices (s, t) ∈ VT × VT is connected with probability Ω(1/ log n) since the particular class that separates s and t is picked with probability Ω(1/ log n), and given that this class has been picked, there is a directed path from s to t with probability 1/2. We handle an arbitrary mixed graph G = (V, EO ∪ EU ), which has already been brought to the structural form of a directed acyclic graph on the collection of its Ucomponents, by independently running the randomized singletree procedure in each Ucomponent. As a result, we obtain a random orientation of the graph, whose performance guarantee depends on the minimal number of Ucomponents that must be traversed in order to satisfy any request. Speciﬁcally, let (si , ti ) be the ith request pair, and suppose i stands for the minimal number of components that have to be traversed in an orientation that connects si to ti . Then the following result can be stated: Theorem 2. The random orientation algorithm constructs an orientation that satisfies Ω(OPT/ log n) requests in expectation, where = max i . Proof. Let us focus on request i, and let Pi be a directed si ti path that traverses i components in some orientation of G; we denote these Ucomponents by U 1 , . . . , U i , indexed in topological order. Furthermore, let xj and yj be the entry vertex and exit vertex of Pi in U j , respectively. Notice that every (xj , yj ) pair is connected with probability Ω(1/ log n) since the randomized singletree procedure is independently run in each Ucomponent. This implies that si and ti are connected with probability Ω(1/ logi n). Consequently, the expected number of satisﬁed requests is Ω(OPT/ log n) by linearity of expectation.
4
Conclusions
We have designed a novel approximation algorithm for maximum graph orientation that achieves an O(log n/ log log n) ratio. We have further shown an extension of the algorithm that handles mixed graphs and provides a polylogarithmic approximation ratio under biologicallymotivated assumptions. On the theoretical side, we believe that the techniques presented here are of independent interest, and may be applicable in other settings as well. On the practical side, the algorithmic extension to mixed graphs tackles a major open problem posed in [14] and is expected to yield much more realistic network orientations by integrating knowledge on PDIs into the orientation process.
Acknowledgments We thank Yael Silberberg for her help in gathering statistics on the KEGG pathways. I.G. was supported by the Israel Science Foundation, by the European
Improved Orientations of Physical Networks
225
Commission under the Integrated Project QAP funded by the IST directorate as Contract Number 015848, by a European Research Council (ERC) Starting Grant, and by the Wolfson Family Charitable Trust. R.S. was supported by a research grant from the Israel Science Foundation (grant no. 385/06).
References 1. Alon, N., Spencer, J.H.: The Probabilistic Method, 2nd edn. Wiley, Chichester (2000) 2. Arkin, E.M., Hassin, R.: A note on orientations of mixed graphs. Discrete Applied Mathematics 116(3), 271–278 (2002) 3. Even, G., Garg, N., K¨ onemann, J., Ravi, R., Sinha, A.: Covering graphs using trees and stars. In: Arora, S., Jansen, K., Rolim, J.D.P., Sahai, A. (eds.) RANDOM 2003 and APPROX 2003. LNCS, vol. 2764, pp. 24–35. Springer, Heidelberg (2003) 4. Feige, U., Goemans, M.X.: Aproximating the value of two prover proof systems, with applications to MAX 2SAT and MAX DICUT. In: Proceedings 3rd Israel Symposium on Theory and Computing Systems, pp. 182–189 (1995) 5. Frederickson, G.N., Johnson, D.B.: Generating and searching sets induced by networks. In: de Bakker, J.W., van Leeuwen, J. (eds.) ICALP 1980. LNCS, vol. 85, pp. 221–233. Springer, Heidelberg (1980) 6. Gamzu, I., Segev, D.: A sublogarithmic approximation for highway and tollbooth pricing. In: Proceedings of the 37th International Colloquium on Automata, Languages and Programming (to appear, 2010), http://arxiv.org/abs/1002.2084 7. Goldschmidt, O., Hochbaum, D.S., Levin, A., Olinick, E.V.: The SONET edgepartition problem. Networks 41(1), 13–23 (2003) 8. Hakimi, S.L., Schmeichel, E.F., Young, N.E.: Orienting graphs to optimize reachability. Information Processing Letters 63(5), 229–235 (1997) 9. Hassin, R., Segev, D.: Robust subgraphs for trees and paths. ACM Transactions on Algorithms 2(2), 263–281 (2006) 10. H˚ astad, J.: Some optimal inapproximability results. Journal of the ACM 48(4), 798–859 (2001) 11. Kanehisa, M., Goto, S., Furumichi, M., Tanabe, M., Hirakawa, M.: KEGG for representation and analysis of molecular networks involving diseases and drugs. Nucleic Acids Research 38(2), D355–D360 (2010) 12. Khot, S., Kindler, G., Mossel, E., O’Donnell, R.: Optimal inapproximability results for MAXCUT and other 2variable CSPs? SIAM Journal on Computing 37(1), 319–357 (2007) 13. Lewin, M., Livnat, D., Zwick, U.: Improved rounding techniques for the MAX 2SAT and MAX DICUT problems. In: Proceedings 9th International Conference on Integer Programming and Combinatorial Optimization, pp. 67–82 (2002) 14. Medvedovsky, A.: An algorithm for orienting graphs based on causeeﬀect pairs and its applications to orienting protein networks. Master’s thesis, TelAviv University, Israel (2009) 15. Medvedovsky, A., Bafna, V., Zwick, U., Sharan, R.: An algorithm for orienting graphs based on causeeﬀect pairs and its applications to orienting protein networks. In: Crandall, K.A., Lagergren, J. (eds.) WABI 2008. LNCS (LNBI), vol. 5251, pp. 222–232. Springer, Heidelberg (2008)
Enumerating Chemical Organisations in Consistent Metabolic Networks: Complexity and Algorithms Paulo Vieira Milreu1,2 , Vicente Acu˜ na1,2 , Etienne Birmel´e3, 4 Pierluigi Crescenzi , Alberto MarchettiSpaccamela5, MarieFrance Sagot1,2 , Leen Stougie6,7 , and Vincent Lacroix1,2 1 Universit´e de Lyon, F69000 Lyon, Universit´e Lyon 1, CNRS, UMR5558, Laboratoire de Biom´etrie et Biologie Evolutive, F69622 Villeurbanne, France 2 INRIA Rhˆ oneAlpes, 38330 Montbonnot SaintMartin, France {milreu,viacuna,lacroix}@biomserv.univlyon1.fr,
[email protected] 3 ´ Lab. Statistique et G´enome, CNRS UMR8071 INRA1152, Universit´e d’Evry, France
[email protected] 4 Universit` a di Firenze, Dipartimento di Sistemi e Informatica, I50134 Firenze, Italy
[email protected] 5 Sapienza University of Rome, Italy
[email protected] 6 VU University and CWI, Amsterdam, The Netherlands
[email protected] Abstract. The structural analysis of metabolic networks aims both at understanding the function and the evolution of metabolism. While it is commonly admitted that metabolism is modular, the identiﬁcation of metabolic modules remains an open topic. Several deﬁnitions of what is a module have been proposed. We focus here on the notion of chemical organisations, i.e. sets of molecules which are closed and selfmaintaining. We show that ﬁnding a reactive organisation is NPhard even if the network is ﬂuxconsistent and that the hardness comes from blocking cycles. We then propose new algorithms for enumerating chemical organisations that are theoretically more eﬃcient than existing approaches.
1
Introduction
Until recently, metabolism was analysed via the pathways composing it, which were traditionally established in a non automatic way by experts interested in some speciﬁc function (glycolysis for instance, or anaerobic respiration). The pathways were studied independently from each other, even though molecules could be shared. The advent of full genome sequences now enables to infer genomescale metabolic networks (see [8] for an overview) and the study of these networks has revealed extensive crosstalk between traditionally deﬁned pathways, as well as the use by diﬀerent organisms of alternative pathways, that is, diﬀerent metabolic routes to a same ﬁnal overall product goal. While the notion V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 226–237, 2010. c SpringerVerlag Berlin Heidelberg 2010
Enumerating Chemical Organisations in Consistent Metabolic Networks
227
of metabolic pathway remains useful as a reference deﬁnition of functional modules, the exact frontiers between pathways can now be questioned, and other deﬁnitions of the concept of metabolic module can be proposed. While several formal deﬁnitions have already been suggested, none of them is able to capture all the expert knowledge that led to the ﬁrst pathways while at the same time providing an insight into alternative functional ones. It is actually an open question in the ﬁeld whether such deﬁnition exists. Most likely, not a single model will suﬃce. The motivation of this paper is to explore one model for metabolic modules called chemical organisations, both in terms of the complexity of enumerating such modules and of exact algorithms for performing the enumeration. The results obtained constitute a solid algorithmic ground for the study of chemical organisations, a necessary ﬁrst step to widen the use of this notion for the computational analysis of metabolic networks. Several formal deﬁnitions of pathways and modules can be found in the literature on metabolism, the best known of which may be elementary modes [12] or any of its close cousins (see [8,9] for a survey). Elementary modes may be informally described as metabolic subnetworks that can function at steady state, meaning that all internal metabolites are produced and consumed in equal rates (that is, nothing accumulates internally). This is a ﬁne deﬁnition, but has at least one drawback: it is restricted to the analysis of the system at steady state and does not allow to describe states of the system where metabolites can accumulate. However, such states are relevant as they could correspond to intermediary steps in the evolution of metabolism, or temporary states in the dynamics of metabolism. As far as we know, two models in the literature enable to study such states. One is Petri nets and the other is a more recent model called chemical organisations. Because it is algebraically easier to manipulate chemical organisations as their formulation follows closely that of (hyper)graphs and matrices, we focus our attention in this paper on chemical organisations. The concept was introduced in 2005 by Peter Dittrich and his group [4], building on earlier work by Fontana and Buss [6] and can be used not only for metabolism, but also for any kind of reaction system, including regulatory networks. In this paper, however, we focus exclusively on metabolism. Chemical organisations are sets of molecules that are selfmaintaining and closed (in this paper, we use the terms metabolite and molecule with no distinction). Informally, a selfmaintaining set is a set where molecules can accumulate – the feature we were seeking – provided no molecule vanishes. A set is closed if all metabolites produced from reactions for which all the inputs are present in the set will also be present and thus part of the set. By convention, this includes all reactions that take their input from the environment, i.e. are external. All external inputs are therefore considered as being available and used. This introduces a second contrast with elementary modes (EMs). Indeed, EMs may use only part of the externally available inputs. More generally, EMs are not closed. Finally, as we have already said, the theory of chemical organisations has been proposed for general reaction systems. Its application to metabolic networks
228
P.V. Milreu et al.
raises new speciﬁc questions, as the networks have speciﬁc properties. They are indeed expected to be ﬂuxconsistent (each reaction belongs to at least one elementary mode). The objectives of this paper are thus twofold. The ﬁrst is to revisit chemical organisations in the context of ﬂuxconsistent networks. In particular, ﬁnding a chemical organisations was shown to be hard in [2]. A legitimate and non trivial question is whether this remains true in biologically more realistic ﬂuxconsistent networks. Section 2 presents the main deﬁnitions on chemical organisations and consistency of networks. Section 3 shows that even for consistent networks the enumeration problem is hard. We go however further by identifying the speciﬁc structural properties of the network that account for this hardness. Those are discussed in Section 4, while Section 5 fulﬁlls the second objective of this paper. This is to describe a new algorithm that takes advantage of such properties to obtain an exact method that is in all cases theoretically more eﬃcient for consistent networks than the enumeration algorithms presented in [2] because, at best, a smaller part of the solution space needs to be explored. Due to space limitations some of the proofs are omitted here and will be presented in the journal version.
2
Preliminaries
A metabolic network, like any reaction system, can be modelled as a weighted directed hypergraph G = (M, R) with M the set of vertices corresponding to the metabolites and R the set of hyperarcs corresponding to the reactions. A directed hyperarc (i.e. a reaction) r ∈ R is an ordered pair of sets of vertices (i.e. metabolites) r = (subs(r), prod(r)) where subs(r) is the set of substrates of r and prod(r) is the set of products of r. For each x in subs(r) (in prod(r)) the weight of x with respect to r denotes the stoichiometric coeﬃcient of x in r, that is, the number of units of x consumed (or produced) when r ﬁres. Note that x can belong to both subs(r) and prod(r); in this case there are two weights associated to x w.r.t. r. Note also that, according to the above deﬁnitions, the set of substrates of a reaction r can be empty: in this case, we say that the metabolites in prod(r) are inputs of the network. Metabolic networks have also been often modelled using matrices [11]. The stoichiometric matrix S has M  rows and R columns where Si,j is the stoichiometric coeﬃcients of molecule i in reaction j. Si,j is negative if i is consumed and it is positive if i is produced. We notice here that while the stoichiometric matrix can always be derived from the weighted hypergraph, the reverse is not true. Indeed, metabolites involved as substrates and products of the same reaction cannot be handled in the matrix representation. For some of the results presented, we also use the concept of the underlying graph of G, which is a directed multigraph with the same set of vertices of G and arcs x → y for every pair of vertices x, y for which there is an hyperarc r such that x ∈ subs(r) and y ∈ prod(r). A reaction is said to be on a path/cycle of the underlying directed graph if any of its (substrate,product)pairs is an arc of the path/cycle.
Enumerating Chemical Organisations in Consistent Metabolic Networks
229
In the context of metabolic networks, we say that a flux over the network is the rate at which each reaction occurs. A ﬂux can be represented as a flux vector v ∈ RR with v[i] denoting the rate of reaction i. A metabolic network is fluxconsistent if there exists a ﬂux vector v > 0,i.e ∀i ∈ R the ﬂux v[i] > 0, such that Sv = 0 [1]. This is the same as saying that every reaction of the network belongs to at least one elementary mode, thus checking for the usefulness of each reaction. For more information on elementary modes, see [12] and [11]. We denote by RA ⊆ R the subset of reactions that can be ﬁred when the metabolites in set A ⊆ M are present, i.e., RA = {r ∈ Rsubs(r) ⊆ A}. We now introduce the basic deﬁnitions that will be used throughout the paper. Definition 1. A set C ⊆ M is closed if, for all reactions r ∈ RC , prod(r) ⊆ C. Moreover, given a set C ⊆ M , the closure of C, denoted by ClC , is the smallest closed set H that contains C. Note that if C is a closed set of molecules, then C must contain all inputs of the network (since the empty set is a subset of C and input reactions therefore belong to RC ). In particular, the closure of the empty set will contain all inputs and whatever can be produced from them. Definition 2. A set of molecules C ⊆ M is selfmaintaining if there is a flux vector v such that: 1. for all reactions r ∈ RC , v[r] > 0; 2. for all reactions r ∈ RC , v[r] = 0; 3. for all molecules i ∈ C, the production rate (Sv)[i] ≥ 0. A set of molecules is selfmaintaining if there exists a ﬂux vector such that the molecules present in the set can accumulate ((Sv)[i] > 0) or be consumed and produced at the same rate ((Sv)[i] = 0) but none of them may disappear (3rd condition). Conditions 1 and 2 basically specify that all reactions that can ﬁre with molecules from the set will ﬁre. In particular, reactions which produce molecules outside the set will also ﬁre. A selfmaintaining set is therefore really selfmaintaining, even in the presence of “leaks”. Definition 3. A set of molecules O ⊆ M is an organisation if it is closed and selfmaintaining. O is said to be reactive connected if: – (reactive) each metabolite in O takes part as substrate or product in at least one reaction inside RO ; – (connected) for any two molecules x and y in O, there is a path from x to y in the underlying undirected graph. We present a network in Figure 1 that has 3 connected components and 8 organisations but only 2 of them are reactive connected organisations. The others are just combinations of organisations which cannot directly interact among them. Notice also that some sets are not organisations, such as for instance the sets
230
P.V. Milreu et al.
{s, p} and {b, c, d}, since they are not closed, or the sets {s, q, r} and {c, d} that are not closed nor selfmaintaining. On the other hand, the closure of the empty set is {s} and it is an organisation. This organisation must be present in all organisations even if there is no possible interaction between their molecules as in the case of organisation {s, a}. Clearly, any set of disconnected nodes will form an organisation, as long as we consider its union with the closure of the empty set. In the following, we shall ignore such organisations and focus on organisations where the molecules interact among them. This is our motivation to ﬁnd only reactive connected organisations.
Fig. 1. A metabolic network with (a) 3 connected components, (b) 8 organisations: {{s}, {s, p, q, r}, {s, a}, {s, b, c, d}, {s, a, b, c, d}, {s, a, p, q, r}, {s, b, c, d, p, q, r}, {s, a, b, c, d, p, q, r}}, and (c) 2 reactive connected organisations: {{s}, {s, p, q, r}}
For this reason, from now on we restrict our networks to have only one connected component and some input and output metabolites. For general networks, indeed, we can without loss of generality work on each connected component separately and then combine the results. Since throughout the paper we need to compute closures of sets, we recall here the forward propagation procedure [10] that in an iterative process enables to obtain the closure of a given set C. Informally, this consists in starting from C itself, adding prod(r) for every r ∈ RC , and repeating this procedure until no new metabolites are added to C. As already mentioned, all inputs of the network need to be considered together in order to compute organisations. This is a modelling choice that implies that if one wished to compute organisations for diﬀerent subsets of the inputs, then it would be necessary to edit the network and recompute the organisations for the subsets of interest.
3
Chemical Organisations in Consistent Networks
It was shown that deciding whether a network contains at least one organisation is NPcomplete [2]. However the proof was based on a network that was not ﬂuxconsistent. We now characterise organisations in consistent networks. First of all, we observe that it is easy to check whether a set C is an organisation by inspecting the reaction rules to check closure and selfmaintenance using linear programming. The following theorem shows how to compute two possible organisations. Theorem 4. If a network is fluxconsistent then the whole network and the closure of the empty set are organisations.
Enumerating Chemical Organisations in Consistent Metabolic Networks
231
Proof. The whole network is always closed. By deﬁnition of ﬂuxconsistency, we have a ﬂux vector v that covers the whole network, satisfying the condition of selfmaintenance. Therefore the whole network is an organisation. Analogously, if the closure of the empty set produces the whole network then it is an organisation. Otherwise, since every metabolite is produced from the empty set, we can easily obtain a valid ﬂux vector v satisfying the condition of selfmaintenance. Notice that the closure of the empty set is the smallest possible organisation since it has to be contained in all other organisations.In the following, we say that the whole network and the closure of the empty set are trivial organisations. Observe that the closure of the empty set may not always produce the whole network. An example is given in Figure 2 since the closure of the empty set for that network is {a}.
Fig. 2. Network in which the closure of the empty set does not produce the whole network
Theorem 5. If the network is fluxconsistent and acyclic, i.e. the underlying directed graph of the hypergraph is acyclic, then the whole network is the only organisation. Proof. The smallest organisation is given by the closure of the empty set, which can be obtained by applying the forward propagation algorithm to the empty set. As the network is ﬂuxconsistent and acyclic, from the inputs any metabolite can be reached, i.e., produced. Hence, the closure of the empty set is the entire network. From the ﬂuxconsistency of the network and from Theorem 4, it follows that the smallest organisation is the whole network. The next result shows that the problem of ﬁnding a non trivial organisation in a ﬂuxconsistent network is NPhard. The proof is based on a reduction from the 3SAT problem, which is an appropriate modiﬁcation of the original reduction given in [2], that showed that ﬁnding a reactive organisation in a general reaction system is NPhard. Theorem 6. Deciding if a fluxconsistent network contains a non trivial organisation is NPhard.
4
Enumerating Chemical Organisations
Theorem 6 immediately implies that it is not possible to enumerate all organisations in a ﬂuxconsistent network in polynomialtimedelay in the size of the network.
232
P.V. Milreu et al.
We now observe that Theorem 5 indicates that for ﬂuxconsistent networks, the diﬃculty of ﬁnding non trivial organisations comes from the presence of cycles in the network. Indeed, as shown in Figure 3(b), cycles may interrupt the forward propagation if there exists a reaction that can produce a new metabolite a but needs for this a metabolite b which is not available and therefore blocks the reaction.
Fig. 3. (a) Non blocking cycle that will be traversed by the forward propagation procedure. (b) Forward propagation blocked by a unreached metabolite b.
In order to ﬁnd the reactive connected organisations, we need to process cycles every time the forward propagation procedure stops. This simple observation gives an upper bound of 2k on the number of reactive connected organisations in ﬂuxconsistent networks, where k is the number of cycles in the network. In order to proceed we ﬁrst deﬁne cycles formally. By a cycle in the metabolic network we mean a simple directed cycle in the underlying graph. Selfloops are also considered as cycles. Definition 7. A hitting set of a set of cycles is a set of metabolites such that each cycle contains at least one element of the hitting set. Theorem 8. Let H be a hitting set of all the cycles of a directed hypergraph. The set of all reactive connected organisations, denoted as O, is such that {ClC } O⊆ C⊆H
Proof. It is suﬃcient to show that if A is a reactive connected organisation then A = ClC , where C = A ∩ H. First observe that, since A is closed and C is a subset of its metabolites, it follows that ClC ⊆ A. Let us suppose that A contains vertices which are not in ClC . We colour these vertices white and the vertices of ClC black. Consider any white metabolite a1 . Since A is an organisation, a1 cannot be vanishing. Moreover, it is not an input of the network as otherwise it would be black. Therefore, there exists a reaction = a1 , r ﬁred by A that has a1 as product and has a white substrate a2 , a2 otherwise a1 would again be black by closure. By iterating the above reasoning, it follows that the subgraph of the underlying directed graph induced by white vertices has minimum indegree at least 1 and contains a directed cycle. This contradicts the fact that H hits all the cycles. The set of white vertices is therefore empty and A = ClC .
Enumerating Chemical Organisations in Consistent Metabolic Networks
233
The bound of the previous theorem is tight. Indeed, an example where the number of organisations reaches 2H is given in Figure 4 where from the input, k metabolites are produced by k independent reactions and all of them are blocked by cycles. Any combination of these independent paths can be deblocked and produce a new organisation, and therefore we have 2k organisations.
Fig. 4. Example with k parallel blocking cycles and 2k organisations
However, some cycles never interrupt the forward propagation procedure as illustrated in Figure 3(a). Other cycles, on the other hand, exhibit structural properties that may lead to a blocking situation. Such cycles are called potentially blocking cycles. A basic solution to ﬁnd all organisations is to know how to unblock all cycles of the network independently of whether they are potentially blocking cycles or not. Therefore, instead of ﬁnding a hitting set for all cycles of the network, it is enough to break all potentially blocking cycles to compute all reactive connected organisations. In order to prove this, we ﬁrst introduce a more formal deﬁnition of potentially blocking cycle. Definition 9. A potentially blocking cycle is a cycle such that there exists a reaction r = ({s1 , . . . , sh } , {p1 , . . . , pk }) in the network satisfying the following two conditions: (1) there exists i and j such that (si , pj ) is an edge of the cycle, and (2) there exists such that s is not in the cycle. A potentially blocking cycle may or may not interrupt the forward propagation depending on the metabolites that were produced by the procedure once the cycle is reached. Figure 5(a) shows an example in which the cycle will be traversed, while Figure 5(b) shows an example in which it will block the forward propagation algorithm.
Fig. 5. Example of a potentially blocking cycle formed by the vertices a and c and reactions a + b → c and c → a + b (note that vertices b and c also form a symmetric cycle). If the forward propagation procedure (FP) reaches the cycle through c, the cycle is traversed, but if it reaches it through a, it is blocked.
234
P.V. Milreu et al.
Theorem 10. Let H be a hitting set of all the potentially blocking cycles of a directed hypergraph. The set of all reactive connected organisations, denoted as O, is such that O⊆ {ClC } C⊆H
Proof. As in the proof of Theorem 8, it is suﬃcient to show that, given a reactive connected organisation A, A = ClC , where C = A∩H (in the following, all paths and cycles are meant directed in the underlying directed graph). Once again, it is easy to see that ClC ⊆ A. Let us then suppose that A contains vertices which are not in ClC and let us colour them white and those of ClC black. Let ai (i = 1, 2, . . . , k) be the set of white vertices such that there exists a reaction ri having ai as product and at least one black substrate. Then ri has also at least one white substrate, which we denote by wi , as otherwise ai would be black by closure. Note that a white vertex does not have to belong to the set of the ai ’s, but that this set is not empty as the organisation is connected and the set of white vertices is not empty. If wi = ai , the selﬂoop induced by ri is a potentially blocking cycle that contains no vertex of H, leading to a contradiction. Thus we may assume that wi is distinct from ai . For 1 ≤ i ≤ k, deﬁne Ti as follows: a vertex w is in Ti if either w = wi or there exists a white path starting from w and ending in wi . Up to a reordering, we may assume that T1  ≤ Ti  for 2 ≤ i ≤ k. As T1 is not empty, it has to contain at least one vertex that is a product of a reaction having a black substrate. If that vertex is a1 , there exists a path from a1 to w1 , which yields a white cycle with the edge (w1 , a1 ). That cycle is a potentially blocking cycle (because of the reaction r1 ) which contains no vertex in H, leading to a contradiction. In other words, T1 contains a vertex among (a2 , . . . , ak ), say a2 . This implies that every path ending in w2 can be extended to a path ending in w1 and thus T2 ⊆ T1 . Therefore, by minimality of T1 , T1 = T2 . This implies that w1 ∈ T2 : hence, there exists a white path from w1 to w2 . As a2 ∈ T1 , there also exists a white path from a2 to w1 . Thus, we can construct a white path from a2 to w2 . Considering the edge (w2 , a2 ), we again obtain a white cycle, which is potentially blocking (because of the reaction r2 ) and contains no vertex in H, leading to a contradiction. Thus, the set of white vertices is empty and A ⊆ ClC . Even in the case of the previous theorem, the bound is tight. Indeed, an example where the number of organisations is 2H is, once again, given in Figure 4, since all cycles presented in the example are potentially blocking.
5
Hitting Set Approach to Enumerate Organisations
Two exact algorithms were proposed in [2] to enumerate organisations. The ﬁrst one consisted in enumerating all closed sets and then checking for their selfmaintenance, while the second one consisted in enumerating all selfmaintaining
Enumerating Chemical Organisations in Consistent Metabolic Networks
235
sets and then checking linear combinations of them in order to obtain closed sets. A third approach was also proposed that was based on the second one but avoided enumerating all selfmaintaining sets. This algorithm however was a heuristic not guaranteed to ﬁnd all selfmaintaining sets (and thus organisations). Finally, a variation of the ﬁrst algorithm was proposed in order to enumerate only reactive connected organisations. This algorithm comes closer to the one we describe later and works as follows. First, the forward propagation of the empty set is computed. Once the procedure is blocked, all possible combinations of metabolites that are connected to the produced set X are considered for addition, in order to obtain further closed sets that include X. At this point, the algorithm recursively continues. Note that in the above procedures, no concept of blocking cycles has been formally identiﬁed and used. Now that we know that the hardness comes from such cycles, two diﬀerent approaches can be applied in ﬂuxconsistent networks. One is to ﬁnd a global hitting set for all cycles of the network and then, following Theorem 8, to apply the forward propagation procedure on each subset of the hitting set to produce closed sets which together form all candidate organisations and, ﬁnally, to check through LP if the candidates are selfmaintaining. However, the problem of ﬁnding a minimum hitting set for all cycles of a directed graph is NPhard as indeed it corresponds to the feedback vertex sex (FVS) problem [7]. Nevertheless approximation algorithms such as the one described in [13] can be used in order to perform this step. A second possibility is to ﬁnd a local hitting set. According to Theorem 10 only potentially blocking cycles need to be considered. This is a superset of the blocking cycles that can be identiﬁed when the forward propagation procedure stops because it is at this moment that we know we are dealing with actually blocking cycles. A more eﬃcient algorithm to enumerate reactive connected organisations is thus the following one: apply the forward propagation algorithm and once blocked, identify the set B of metabolites that are blocking the closure and ﬁnd a hitting set that unblocks only the cycles which directly or indirectly involve these blocking metabolites. In [5], the authors presented an approximation algorithm to a generalisation of the FVS problem, called SUBSETFVS, in which only a subset of the directed cycles in the graph is considered interesting, more speciﬁcally the ones that intersects a set of special vertices. In our case, the set of special vertices would be the blocking metabolites locally identiﬁed as described in the previous paragraph. The authors in [5] gave two approximation algorithms for the SUBSETFVS problem. The ﬁrst algorithm achieves an approxima tion factor of O log2 B . The second achieves an approximation factor of O (min{log T log log T, log n log log n}), where T is the value of the optimum fractional solution of the problem at hand, and n is the number of vertices in the graph. Before proving that this idea can be correctly used to exactly solve our problem, we need to deﬁne the concept of a blocking cycle in relation to a given set C of metabolites.
236
P.V. Milreu et al.
Definition 11. Let C be a set of metabolites. A Cblocking cycle is a cycle of vertices which are not in C such that there exists a reaction r in the cycle whose set of substrates contains at least one metabolite in C. Cblocking cycles correspond to those which actually stop the forward propagation procedure. Theorem 12. Let C be a closed set and H a hitting set of the Cblocking cycles of a metabolic network. Let A be a reactive connected organisation whose metabolites contain C. Then either C = A or there exists a non empty subset B of H such that the closure of C ∪ B is still a subset of A. Proof. Let A be a reactive connected organisation containing C as a subset of its metabolites and let B = A ∩ H. Let us suppose that C = A. To prove the theorem, it is then suﬃcient to prove that B = A ∩ H is not empty. We colour the vertices of A \ C in white and those of C in black. Since A is a reactive connected organisation, there exist edges between the white and the black metabolites and some of them go from a black to a white vertex, as otherwise, white vertices would be vanishing. Let (a1 , . . . , ak ) be the set of white vertices reached by at least one edge coming from a black vertex. The same argument of the proof of Theorem 10 can now be applied, showing that, as the set of white vertices is not empty, it contains a white Cblocking cycle. Therefore, B is not empty. Corollary 13. Every reactive connected organisation is included in the set CO returned by the procedure given in Algorithm CCO. Proof. Let A be a reactive connected organisation. It has to contain C0 as every organisation contains the closure of the empty set. Let C be maximum among the elements of CO which are subsets of A. Then Theorem 12 implies, by maximality of C, that A = C. Algorithm CCO(G) Require: a metabolic network represented as a hypergraph G = (M, R); Ensure: the set CO of all candidates for being organisations. CO ← {C0 } where C0 is the closure of the empty set (Cl{} ) for all elements C in CO which have not been treated before do Compute a hitting set H of the Cblocking cycles for every B ⊂ H do Compute ClC∪B and add it to CO if it was not present already return CO
Notice that the size of the hitting set computed by the algorithm is never greater than the number of blocking metabolites. Thus we can guarantee that our algorithm is theoretically better than existing algorithms which consider all blocking metabolites and then test all subsets.
Enumerating Chemical Organisations in Consistent Metabolic Networks
6
237
Conclusion
All the results presented in this paper correspond to enumerating closed sets as potential organisations. The problem of enumerating selfmaintaining sets is still open. Such an approach could enable us to design a method that enumerates stoichiometrically valid precursor sets, which would be an important followup of the work on minimal precursors sets presented in [3]. Finally, the algorithms introduced in this paper do not take any speciﬁc advantage of the fact that the network should be massconsistent and exploiting this might lead to better algorithms for enumerating selfmaintaining sets.
References 1. Acu˜ na, V., Chierichetti, F., Lacroix, V., MarchettiSpaccamela, A., Sagot, M.F., Stougie, L.: Modes and cuts in metabolic networks: Complexity and algorithms. Biosystems 95(1), 51–60 (2009) 2. Centler, F., Kaleta, C., di Fenizio, P.S., Dittrich, P.: Computing chemical organizations in biological networks. Bioinformatics 24(14), 1611–1618 (2008) 3. Cottret, L., Milreu, P.V., Acu˜ na, V., MarchettiSpaccamela, A., Martinez, F.V., Sagot, M.F., Stougie, L.: Enumerating Precursor Sets of Target Metabolites in a Metabolic Network. In: Crandall, K.A., Lagergren, J. (eds.) WABI 2008. LNCS (LNBI), vol. 5251, pp. 233–244. Springer, Heidelberg (2008) 4. Dittrich, P., di Fenizio, P.S.: Chemical organisation theory. Bull. Math. Biol. 69(4), 1199–1231 (2007) 5. Even, G., Naor, J., Schieber, B., Sudan, M.: Approximating minimum feedback sets and multicuts in directed graphs. Algorithmica 20, 151–174 (1998) 6. Fontana, W., Buss, L.: The Arrival of the ﬁttest: towards a theory of biological organization. Bull. Math. Biol. 56, 1–64 (1994) 7. Karp, R.M.: Reducibility among combinatorial problems. In: Complexity of Computer Computations, pp. 85–103 (1972) 8. Lacroix, V., Cottret, L., Thbault, P., Sagot, M.F.: An Introduction to Metabolic Networks and Their Structural Analysis. TCBB 5(4), 594–617 (2008) 9. Papin, J., Stelling, J., Price, N., Klamt, S., Schuster, S., Palsson, B.: Comparison of networkbased pathway analysis methods. Trends Biotechnol. 22, 400–405 (2004) 10. Romero, P., Karp, P.D.: Nutrientrelated analysis of pathway/genome databases. In: PSB 2001, pp. 470–482 (2001) 11. Schuster, S., Dandekar, T., Fell, D.A.: Detection of elementary ﬂux modes in biochemical networks: a promising tool for pathway analysis and metabolic engineering. Trends in Biotechnology 17(2), 53–60 (1999) 12. Schuster, S., Hilgetag, C.: On elementary ﬂux modes in biochemical reaction systems at steady state. J. Biol. Syst. (2), 165–182 (1994) 13. Seymour, P.D.: Packing directed circuits fractionally. Combinatorica 15(2), 281– 288 (1995)
Eﬃcient Subgraph Frequency Estimation with GTries Pedro Ribeiro and Fernando Silva CRACS & INESCPorto LA Faculdade de Ciˆencias, Universidade do Porto, Portugal {pribeiro,fds}@dcc.fc.up.pt
Abstract. Many biological networks contain recurring overrepresented elements, called network motifs. Finding these substructures is a computationally hard task related to graph isomorphism. GTries are an eﬃcient data structure, based on multiway trees, capable of eﬃciently identifying common substructures in a set of subgraphs. They are highly successful in constraining the search space when ﬁnding the occurrences of those subgraphs in a larger original graph. This leads to speedups up to 100 times faster than previous methods that aim for exact and complete results. In this paper we present a new eﬃcient sampling algorithm for subgraph frequency estimation based on gtries. It is able to uniformly traverse a fraction of the search space, providing an accurate unbiased estimation of subgraph frequencies. Our results show that in the same amount of time our algorithm achieves better precision than previous methods, as it is able to sustain higher sampling speeds. Keywords: complex networks, network motifs, subgraph frequency, sampling, gtries.
1
Introduction
A wide variety of reallife systems can be modeled and analyzed with complex networks [4]. It has been found that many of these networks contain recurring elements, called network motifs [15]. These are overrepresented subnetworks, i.e., subgraphs that appear in higher frequency than it would be expected in randomized networks with similar topological characteristics. Network motif analysis has a broad multidisciplinary applicability. Just to name a few domains, it has been applied on biological systems (like in brain networks [20], proteinprotein interactions [1] or gene regulation [5]), social networks [9]), engineering systems like electronic circuits [8] and even on software architecture [21]. Discovering these motifs is a computationally hard task closely related to the graph isomorphism problem. Currently, this is done by computing the frequency of subgraph classes of a determined size both in the original network and in a randomized ensemble of networks sharing similar topological features, namely the degree sequence. Discovering subgraph frequencies is the main bottleneck of the whole computation, with an explosive combinatorial eﬀect as the subgraph size increases. V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 238–249, 2010. c SpringerVerlag Berlin Heidelberg 2010
Eﬃcient Subgraph Frequency Estimation with GTries
239
This is typically tackled using one of two approaches: either we compute the frequency of each possible individual subgraph class, one at the time (subgraphcentric approach) [7], or we enumerate all subgraphs and then we compute which ones are isomorphic (networkcentric approach) [15,23]. Recently we have proposed a new specialized datastructure, gtries [17]. It takes advantage of common subgraph substructures in order to avoid redundant computations, matching an entire set of the subgraph classes at the same time in a given network. This leads to signiﬁcant performance gains when compared to previous methods, up to one hundred times faster for some networks. In the networkcentric approach, approximation techniques have been developed in order to improve execution time at the cost of reducing the accuracy [11,23,16]. This is done by sampling a fraction of the subgraph occurrences, instead of exhaustively enumerating all of them. Our main contribution is an eﬃcient heuristic sampling algorithm for discovering network motifs using gtries. We take the already existing gtrie exhaustive and complete algorithm and extend it in order to obtain an unbiased sample that can be used to estimate the desired subgraph frequencies. This leads to a new algorithm that, by taking advantage of gtries, achieves higher sampling rates and thus is able to reach more accurate predictions than previous algorithms for the same computing time. To substantiate this claim, we empirically evaluate the sampling speed, accuracy and total execution time of the algorithm in a set of representative networks. Our results show that in the same amount of time our algorithm can potentially reach higher subgraph and graph sizes. It can also only sample subgraphs from a predeﬁned set. The remainder of this paper is organized as follows. Section 2 establishes a network terminology and gives an overview of related work. Section 3 overviews the used gtrie data structure and details our sampling algorithm. Section 4 discusses the obtained results on a set of representative networks. Section 5 concludes the paper, with comments on the results and possible future work.
2
Preliminaries
To ensure a coherent network terminology, we brieﬂy review the main concepts and notation that will be used throughout the paper, and discuss related work. 2.1
Graph Terminology
A graph G is composed by the set of vertices V (G) and the set of edges E(G). The size of a graph is V (G), the number of vertices. A kgraph has size k. An edge is a pair (a, b) : a, b ∈ V (G). If the graph is directed the order of the pair expresses direction, while in undirected graphs there is no direction in edges. The neighborhood of a vertex u is deﬁned as N (u) = {v : (v, u) ∨ (u, v) ∈ E(G)}. All vertices are assigned consecutive integer numbers starting from 0, and the comparison v < u means that the index of v is lower than that of u. The adjacency matrix of a graph G is denoted as GAdj , and GAdj [a][b] represents a possible edge between vertices with index a and b.
240
P. Ribeiro and F. Silva
A ksubgraph Gk of a graph G is a kgraph such that V (Gk )⊆V (G) and E(Gk )⊆E(G). This subgraph is said to be induced if u, v ∈ V (Gk ) and (u, v) ∈ E(G) implies (u, v) ∈ E(Gk ). Two graphs G and H are said to be isomorphic (G∼H) if there is a onetoone mapping between the vertices of both graphs where two vertices of G share an edge if and only if their corresponding vertices in H also share an edge. 2.2
Network Motifs and Frequency Count
In network motif discovery, frequency count is the central subproblem being addressed, and thus, we deﬁne it more precisely: Definition 1 (Subgraph Counting Problem). Given a set of subgraphs SG and a graph G, count the number of all induced occurrences of subgraphs of SG in G. Two occurrences are considered diﬀerent if they have at least one node or edge that they do not share. Other nodes and edges can overlap. Note especially that we only count induced occurrences and how we distinguish occurrences. Although other frequency concepts exist [19], we resort to the standard deﬁnition for the network motif discovery problem [18]. It has direct implications on the number of occurrences and on the tractability of the problem, with no downward closure property [12] on the frequencies, i.e., a subgraph may appear more times than a subgraph contained in it. 2.3
Related Work
A general and informal survey on algorithms for network motifs discovery can be seen in [3], and [18] provides a more technical comparison of the algorithms. The overall most eﬃcient exhaustive networkcentric algorithms are ESU [23] and Kavosh [10]. MODA [16] and Grochow and Kellis [7] provide eﬃcient subgraphcentric algorithms and we provided the gtrie datastructure for an eﬃcient intermediate appproach [17]. Regarding heuristic approximate algorithms, there are three diﬀerent approaches that we are aware of. Kashtan et al [11] propose to sample one subgraph at a time, following a random graph walk, which results in a biased estimator. RANDESU [23] algorithm provides unbiased sampling by associating probabilities with each recursive search tree branch of the ESU algorithm. MODA [16] chooses nodes with a probability proportional to their degree. Our sampling algorithm diﬀers from all previous approaches since we use a diﬀerent underlying data structure and its associated methodology.
3 3.1
Sampling Algorithm GTries Data Structure
A gtrie is a data structure designed to store a set of graphs. It is conceptually inspired in preﬁx trees (trie) in the sense that it tries to identify common graph substructures in the same way a trie identiﬁes common preﬁxes of sequences.
Eﬃcient Subgraph Frequency Estimation with GTries
241
A gtrie is a tree where each tree node contains information about a single graph vertex and its correspondent connection to the vertices of ancestor tree nodes. Every node can have an arbitrary number of children and the path from the root to a node (possible a leaf) deﬁnes a single subgraph. Note that all descendants of a node share the same initial gtrie substructure and therefore have a common subtopology in graph terms. Figure 1 gives an example of a gtrie with 6 undirected subgraphs.
Fig. 1. A gtrie representing a set of 6 undirected subgraphs. Each gtrie node adds a new vertex (in black) to the already existing vertices in the ancestor nodes (in white). The connections to these nodes are represented by a sequence of boolean numbers indicating the corresponding adjacency matrix row.
As said, each gtrie node needs to specify the connections of is vertex to all ancestor ones (and to itself). This can be done in several ways, but in our current implementation we just store the correspondent part of the adjacency matrix. If the graphs are undirected, we store in each node the adjacency matrix row up to that vertex. If the graphs are directed we also store the adjacency matrix column up to that vertex, because we must specify ingoing and outgoing connections. In any case, given a path from the root to a node, we have a fully speciﬁed graph. The gtrie root node is empty since there are two possible direct child nodes: a vertex with or without a connection to itself. Considering that we want an unique and univocal representation of a set of graphs, we use a canonical adjacency matrix. This guarantees that any subgraph will always lead to the same path traversing the tree. There are many possible choices here, and we opted for the lexicographically bigger adjacency matrix. This favors the occurrence of more common substructures with higher degree nodes appearing in lower tree depth levels. This capability of identifying common subtopologies is the main strength of a gtrie. We are compressing information and avoiding redundant storage. But more than that, at a later stage, when using the gtrie to search for sugraphs and when matching a speciﬁc vertex in the gtrie, we are matching at the same time all possible descendant subgraphs stored in the gtrie. In order to avoid subgraph symmetries, gtries also store symmetry breaking conditions of the form a < b indicating that the vertex in position a should have
242
P. Ribeiro and F. Silva
a graph index smaller than vertex in position b. Similar to what was done in [7], these conditions establish an order for the vertices of the same symmetry group and guarantee that each subgraph can be found only once. More details on this can be seen in our previous work [17]. For the sake of clarity, from now on we will use the term node to refer to a gtrie tree node, and vertex to refer to a vertex of the stored graphs. Given a gtrie node T , we will use T.vertex to refer the new vertex of that node (represented in black in Figure 1), and T.in[i] and T.out[i] to refer to the boolean value of the new vertex having respectively an ingoing or outgoing connection to the vertex with index i, i.e., the new node represented in the ancestor of depth i. Note that if the gtrie stores undirected graphs, then T.in[i] = T.out[i] (and in fact T.out is not even stored in memory). We will also use T.cond to denote the set of conditions that break symmetries for the descendant nodes that correspond to a full graph. T.root denotes the gtrie root node and T.isGraph indicates if the node is the end vertex of a graph (in ﬁg. 1 this corresponds to all leaf nodes). 3.2
Exact Subgraph Frequency
Given a gtrie T and a graph G, the gtrie matching algorithm will ﬁnd the occurrences of all graphs of T as subgraphs of G, as shown in [17]. The basic idea is to ﬁnd a set of vertices of G that match completely with a path in T , and we heavily constraint our search by using the information stored about connections and symmetry breaking conditions. For the sake of clarity, we show the matching algorithm, in Algorithm 1, with a subtle modiﬁcation. It encapsulates some of the work in the matchingVertices() function, thus allowing for a logical separation of the recursion calls and the isomorphic matching. At any stage, Vused represents the currently partial match of graph vertices to a gtrie path. We start with the gtrie root children nodes and call the recursive procedure match() with an initial empty matched set (line 2). The later procedure starts by creating a set of vertices that completely match the current gtrie node (line 4). We then traverse that set (line 5) and recursively try to expand it through all possible tree paths (lines 7 and 8). If the node corresponds to a full subgraph, then we have found an occurrence of that subgraph (line 6). Note that at this time no isomorphic test is needed, since this was implicitly done as we were matching the vertices. Generating the set of matching vertices is done in the matchingVertices() procedure. The eﬃciency of the algorithm heavily depends on the above mentioned constraints as they help in reducing the search space. To generate the matching set, we start by creating a set of candidates (Vcand ). If we are at a root child, then all graph vertices are viable candidates (line 10). If not, we select from the already matched vertices that are connected to the new vertex (line 12), the one with the smallest neighborhood (line 13), reducing the possible candidates (line 14). Then, we traverse the set of candidates (line 16) and if one respects all connections to ancestors (lines 17 to 19), and respects at least one set of symmetry breaking conditions for a possible descendant subgraph (line 19), we add it to the set of matching vertices (line 20).
Eﬃcient Subgraph Frequency Estimation with GTries
243
Algorithm 1. Finding subgraphs of gtrie T in graph G. 1: procedure matchAll(T, G) 2: for all children c of T.root do match(c, ∅) 3: procedure match(T, Vused ) 4: V = matchingVertices(T, Vused ) 5: for all vertex v of V do 6: if T.isGraph then foundMatch() 7: for all children c of T do 8: match(c, Vused ∪ {v}) 9: function matchingVertices(T, Vused ) 10: if Vused = ∅ then Vcand := V (G) 11: else 12: Vconn = {v : v = Vused [i], T.in[i] ∨ T.out[i], i ∈ [1..Vused ]} 13: m := m ∈ Vconn : ∀v∈ Vconn , N (m) ≤ N (v) 14: Vcand := {v ∈ N (m) : v ∈ Vused } 15: V ertices = ∅ 16: for all v ∈ Vcand do 17: if ∀i∈[1..Vused ]: 18: T.in[i] = GAdj [Vused [i]][v] ∧ T.out[i] = GAdj [v][Vused [i]] then 19: if ∃C ∈ T.cond : Vused + v respects C then 20: V ertices = V ertices ∪ {v} 21: return V ertices
3.3
Uniform Sampling
Algorithm 1 creates an exhaustive and complete enumeration of all subgraph occurrences. Our contribution to the existing gtries methods is to sample only a fraction of all the occurrences. Similarly to what was done in [23], we will be trading accuracy for execution speed. The main idea is that each search branch is only chosen with a certain probability as depicted in Algorithm 2. Note that it is exactly the same as the previous algorithm with the exception of the indicated lines 3 and 9. Algorithm 2 . Sample subgraphs of gtrie T in graph G. Probability of each occurence is P , with P = Pd , where Pd is probability of depth d. 1: procedure sampleAll(T, G) 2: for all children c of T.root do 3: With probability P0 do sample(c, ∅)
changed line
4: procedure sample(T, Vused ) 5: V = matchingVertices(T, Vused ) 6: for all node v of V do 7: if T.isGraph then foundMatch() 8: for all children c of T do 9: With probability PT.depth do sample(c, Vused ∪ {v})
changed line
244
P. Ribeiro and F. Silva
In order to follow a probabilistic approach, the algorithm uses a set of probabilities associated to each gtrie depth:, {P0 , P1 , . . . , Pgtrie max depth } where 0 ≤ Pi ≤ 1. Any given node of depth d will therefore only be reached with probability P0 × . . . × Pd−1 . With this, we can produce an unbiased estimator of the frequency count of a single subgraph. Let Pi be the probability associated with depth i and Fsample (Gk ) be the number of occurrences of the ksubgraph Gk found in G by the sampleAll() procedure of Algorithm 2. Then, an unbiased estimator Fˆ (Gk , G) of the total number of occurrences of Gk in G is given by the following equation: Fˆ (Gk , G) =
Fsample (Gk , G) P0 × P1 × . . . × Pk−1
(1)
We say that the estimator is unbiased because any occurrence of Gk can be found with equal probability, and as we increase the probabilities, the estimator gets closer to the real value. In fact, if we choose Pi = 1 for all i, then the result is the same as the original complete algorithm. As seen, the parameters Pi control the search. Regarding the accuracy, we should avoid small values of probability for lower depths, closer to the root. Its eﬀect is to increase the variance of the result because any disregarded branch in lower depths may correspond to entire parts of the graph, and therefore may correspond to a higher number of subgraph occurrences not found. As to the execution time, the opposite happens. Very high probabilities in the lower depths will increase the execution time, since more parts of the search tree will have to be computed. For example, in the extreme case of having all probabilities equal to one except the last one, in the higher possible depth d, means that in practice we will explore all possible subgraphs of depth d − 1. Picking the parameters is therefore a delicate choice that will inﬂuence both the accuracy and speed of our method. Section 4 gives more details on actual useful real parameters. Note that if only ksubgraphs are being sought, than all complete subgraphs of the tree will correspond to leaf nodes and therefore the probability at depth k should always be 1 since when we are at that point, all computation needed to identify the occurrence is already made (no isomorphism test is needed after that), and choosing any value smaller than 1 would only decrease the number of samples without any gain in execution time. The main beneﬁt of our sampling algorithm regarding previous ones, is that it is able to sample only the desired set of subgraphs (mﬁnder and ESU can only sample the entire set of possible ksubgraphs and MODA can only sample the occurrences of a particular single subgraph). To our best knowledge, this is the ﬁrst algorithm doing that. The quality of the estimation depends on many factors. A fully ﬂedged analytical determination of tight bounds on error margins is very complicated since we do not know beforehand the distribution of the subgraphs that we are looking for. For example, if the subgraph is very well spread in the entire subgraph, we will have less variance than if all occurrences are clustered in a small number of nodes, where a search branch not followed can imply a signiﬁcant number of occurrences not found.
Eﬃcient Subgraph Frequency Estimation with GTries
3.4
245
Network Motif Discovery
With the algorithms previously deﬁned we can discover all network kmotifs in the following way: ﬁrst we ﬁnd all ksubgraphs that occur in the original graph using another algorithm (for example ESU). Then we build a gtrie with those ksubgraphs and only search that particular set in the similar ensemble of randomized networks. Eventually, if we have other conditions, like a minimum frequency in the original graph, we can already discard some subgraphs and take advantage of the fact that we can search only for the ones that interest us.
4
Results
In order to evaluate the performance of our proposed algorithm (which from now on we will call RANDGTRIE) we implemented it using C++. Isomorphisms and canonical labellings were computed using the nauty tool [14]. All tests were made on a computer with an Intel Core 2 6600 (2.4GHz) with 2GB of memory. We used four diﬀerent biological networks from diﬀerent domains, with varied topological features that are summarized in Table 1. Table 1. Networks used for experimental testing of RANDGTRIE Network Social Neural Metabolic Protein
Nodes 62 297 453 2361
Edges Directed Description Source 159 no Social network of a community of dolphins [13] 2345 yes Neural network of C. elegans [22] 2025 yes Metabolic network of C. elegans [6] 6646 no Proteinprotein inter. of S. cerevisiae [2]
In all tests the construction of the gtrie in itself was a very small fraction of the execution time, and we could even store and reuse canonical labellings on other program runs. On the network discovery problem, the gtrie can be computed once, at the beginning, and then reused for the ensemble random networks. Given this, we chose to leave the gtrie creation out of the picture when stating execution time. For the purposes of this section, we also limited the choice of probability parameters to three levels of quality. In order to sample a fraction f of all ksubgraph occurrences, we can opt for one of the following levels: – high: {P0 = 1, . . . , Pk−3 = 1, Pk−2 = f, P √k−1 = 1} √ – medium: {P0 =√1, . . . , Pk−4 = 1, P√ = f , Pk−2 = f , Pk−1 = 1} k−3 – low: {P0 = k−1 f , . . . , Pk−2 = k−1 f , Pk−1 = 1} Our ﬁrst test was to analyze the speed at which RANDGTRIE is able to generate samples. For that we counted how many ksubgraphs per second it was able to generate, both with a complete enumeration (all Pi = 1) and with only 10% of the ksubgraphs obtained by sampling with high quality level. We also compared the performance with RANDESU, the present most eﬃcient network centric method that also allows sampling in a way similar to ours. For that, the publicly
246
P. Ribeiro and F. Silva
available FanMod tool was used, with the same probabilities at the same depths. FanMod is also implemented in C++ and uses nauty for isomorphism. All sizes between 3 (the minimum acceptable for a subgraph to be taken in account) and 6 (the maximum that guarantees computation in a matter of a few hours) were used. We ﬁrst used ESU to discover all the ksubgraphs in the original graph, constructed a gtrie with those and then used it to estimate the frequency (as we would do with the randomized networks if we were discovering motifs). Figure 2 details the results obtained. Full Enumeration
7
♣ ♣
♣
♣
5
10
RANDGTRIE social RANDGTRIE neural RANDGTRIE metabolic RANDGTRIE protein
RANDESU social RANDESU neural RANDESU metabolic RANDESU protein
4
10
subgraphs/second
subgraphs/second
10
6
10
High Quality (10%)
7
10
6
10
♣ ♣
♣ ♣
5
10
RANDGTRIE social RANDGTRIE neural RANDGTRIE metabolic RANDGTRIE protein
RANDESU social RANDESU neural RANDESU metabolic RANDESU protein
4
3
4
5
subgraph size
6
10
3
4
5
6
subgraph size
Fig. 2. Sampling speed of RANDGTRIE and RANDESU
The main aspect to note is that RANDGTRIE is always faster, being an order of magnitude faster. This was also the case for all other networks tested, with the more extreme speedup bigger than 100×, for a power grid network [22]. RANDGTRIE also appears to scale well with an increasing subgraph size, as is the case with RANDESU, since the sampling rate is sustained. Mfinder, the other major alternative for sampling, was shown to be much slower than RANDESU and it does not scale well [23]. In order to test the accuracy of our algorithm, we applied all levels of sampling quality, while increasing the fraction of subgraphs being sampled, taking note of the percentage of subgraphs correctly identiﬁed. We considered an estimate to be accurate when it was within a 20% error margin of the correct perfect value. We took 100 samples for each fraction and level and only considered the estimate correct when at least 80 of those samples were accurate. The results for two of the networks are shown on ﬁg. 3. As expected, higher probabilities in lower depths correspond to better sampling quality (less variance). If we measure the execution time for the exact same tests, we can see that the opposite happens, with better quality sampling taking more execution time as detailed in ﬁg. 4. All quality levels have an execution growth proportional to the percentage of samples, but higher quality levels have a minimum time bigger than lower quality minimum time. For example, on the protein network, sampling just 0.1% of the subgraphs in high level of quality takes more then 6% of the time it takes to do a full enumeration. This is because we are traversing the entire tree up to depth k − 2. Judging by our empirical tests, 10% on high level exhibits a good balance between execution time and sampling quality, but depending on the situation, any other values can be used.
Protein Network
100 80
high medium low
60 40 20 0 0.1
0.2
0.5
1
2
5
10
20
50
100
% of subgraphs correctly estimated
% of subgraphs correctly estimated
Eﬃcient Subgraph Frequency Estimation with GTries
247
Metabolic Network
100
high medium low
80 60 40 20 0 0.1
0.2
0.5
% of subgraphs samples
1
2
5
10
20
50
100
% of subgraphs samples
Protein Network
100
high medium low
80 60 40 20 0 0.1
0.2
0.5
1
2
5
10
% of subgraphs samples
20
50
100
% of time relative to full enumeration
% of time relative to full enumeration
Fig. 3. Accuracy of RANDGTRIE for 5subgraphs, measured in percentage of correctly estimated subgraphs as the percentage of samples grows Metabolic Network
100
high medium low
80 60 40 20 0 0.1
0.2
0.5
1
2
5
10
20
50
100
% of subgraphs samples
Fig. 4. Execution time of RANDGTRIE for 5subgraphs, relative to the time a full enumeration with gtries takes (i.e., with Pi = 1 for every i)
If we take a closer look to what RANDGTRIE is computing, we can see that the more rare subgraphs are the ones with less estimating quality. This is because a smaller number of occurrences will obviously imply more variance in the estimated values (a “miss” has more weight). For example, with high level setting and 10% of samples on the metabolic network we have 84.27% subgraph classes estimated correctly. Almost all of the ones not identiﬁed appear less than 100 times in the sample, and therefore are estimated to appear less than 1000 times in the original network. On the other hand, with the same high level setting and only 0.1% of samples, the 7.49% that were estimated correctly correspond to subgraph classes that were sampled at least 1000 times, which means that they are estimated to occur more than one million times in the original graph. Finally, regarding motifs, we experimented to discover all motifs of sizes 3 to 6 in the four networks, using 10% sampling with high quality level, and we were able to ﬁnd more than 90% of the motifs that a full enumeration would ﬁnd. More than that, we spend on average less than 20% of the time it would take using gtries full enumeration. If we take into account that gtries are themselves a more eﬃcient data structure than previous methods, we can magnify even more the speedup and potentially reach previously unfeasible network and subgraph sizes. Note that since we can choose the subgraphs that we are looking for, we can even experiment with diﬀerent probability parameters for diﬀerent subgraphs, thus paving the way for a more adaptive algorithm.
248
5
P. Ribeiro and F. Silva
Conclusion
In this paper we presented a novel sampling algorithm for discovering network motifs. It employs as a basis the gtrie data structure, an eﬃcient specialized tree that uses common topologies in subgraphs in order to heavily constraint the search. By associating a probability with each tree depth, it is able to uniformly traverse a fraction of the whole search space. With this it provides an unbiased estimator for the real frequency of the associated subgraphs, and a way of eﬃciently discovering motifs. Our algorithm oﬀers many parametrization choices and it is also capable of sampling subgraphs solely from a predeﬁned set, in opposition to having to sample among all of the subgraphs of a determined size, or only sampling one individual subgraph. This has a direct beneﬁcial impact on the execution time and we are able to produce accurate results spending less execution time than previously existent methods. In the future we intend to exploit even more this property and create an adaptive version of our sampling algorithm that is able to make an initial estimation and then keep reﬁning it for the subgraphs that do not have enough estimation quality. For example, one could remove all frequent subgraphs from the gtrie and only repeat the search for the more rare ones, with an higher fraction of samples. We also intend to study the impact of the original graph labeling on the sampling quality, since our symmetry breaking conditions rely on this order. Finally, we will also apply our methodology in reallife problems, analyzing networks at scales that were not possible before, attempting to unveil new larger network motifs.
Acknowledgments Pedro Ribeiro is funded by an FCT Research Grant (SFRH/BD/19753/2004).
References 1. Albert, I., Albert, R.: Conserved network motifs allow proteinprotein interaction prediction. Bioinformatics 20(18), 3346–3352 (2004) 2. Bu, D., Zhao, Y., Cai, L., Xue, H., Zhu, X., Lu, H., Zhang, J., Sun, S., Ling, L., Zhang, N., Li, G., Chen, R.: Topological structure analysis of the proteinprotein interaction network in budding yeast. Nucl. Acids Res. 31(9), 2443–2450 (2003) 3. Ciriello, G., Guerra, C.: A review on models and algorithms for motif discovery in proteinprotein interaction networks. Brief Funct. Genomic Proteomic 7(2), 147– 156 (2008) 4. da Costa Luciano, F., Oliveira Jr., O.N., Travieso, G., Rodrigues, F.A., Villas Boas, P.R., Antiqueira, L., Viana, M.P., da Rocha, L.E.C.: Analyzing and modeling realworld phenomena with complex networks: A survey of applications. ArXiv eprints 0711(3199) (2007) 5. Dobrin, R., Beg, Q.K., Barabasi, A., Oltvai, Z.: Aggregation of topological motifs in the escherichia coli transcriptional regulatory network. BMC Bioinformatics 5, 10 (2004)
Eﬃcient Subgraph Frequency Estimation with GTries
249
6. Duch, J., Arenas, A.: Community identiﬁcation using extremal optimization. Phys. Rev. E. (Stat. Nonlin. Soft Matter Phys.) 72, 027104 (2005) 7. Grochow, J., Kellis, M.: Network motif discovery using subgraph enumeration and symmetrybreaking. Research in Computational Molecular Biology, 92–106 (2007) 8. Itzkovitz, S., Levitt, R., Kashtan, N., Milo, R., Itzkovitz, M., Alon, U.: Coarsegraining and selfdissimilarity of complex networks. Phys. Rev. E (Stat. Nonlin. Soft Matter Phys.) 71(1 Pt. 2) (January 2005) 9. Juszczyszyn, K., Kazienko, P., Musial, K.: Local topology of social network based on motif analysis. In: Lovrek, I., Howlett, R.J., Jain, L.C. (eds.) KES 2008, Part II. LNCS (LNAI), vol. 5178, pp. 97–105. Springer, Heidelberg (2008) 10. Kashani, Z., Ahrabian, H., Elahi, E., NowzariDalini, A., Ansari, E., Asadi, S., Mohammadi, S., Schreiber, F., MasoudiNejad, A.: Kavosh: a new algorithm for ﬁnding network motifs. BMC Bioinformatics 10(1), 318 (2009) 11. Kashtan, N., Itzkovitz, S., Milo, R., Alon, U.: Eﬃcient sampling algorithm for estimating subgraph concentrations and detecting network motifs. Bioinformatics 20(11), 1746–1758 (2004) 12. Kuramochi, M., Karypis, G.: Frequent subgraph discovery. In: IEEE International Conference on Data Mining, p. 313 (2001) 13. Lusseau, D., Schneider, K., Boisseau, O.J., Haase, P., Slooten, E., Dawson, S.M.: The bottlenose dolphin community of doubtful sound features a large proportion of longlasting associations. can geographic isolation explain this unique trait? Behavioral Ecology and Sociobiology 54(4), 396–405 (2003) 14. McKay, B.: Practical graph isomorphism. Cong. Numerantium 30, 45–87 (1981) 15. Milo, R., ShenOrr, S., Itzkovitz, S., Kashtan, N., Chklovskii, D., Alon, U.: Network motifs: simple building blocks of complex networks. Science 298(5594), 824–827 (2002) 16. Omidi, S., Schreiber, F., MasoudiNejad, A.: Moda: An eﬃcient algorithm for network motif discovery in biological networks. Genes & genetic systems 84(5), 385– 395 (2009) 17. Ribeiro, P., Silva, F.: Gtries: an eﬃcient data structure for discovering network motifs. In: ACM Symposium on Applied Computing (2010) 18. Ribeiro, P., Silva, F., Kaiser, M.: Strategies for network motifs discovery. In: 5th IEEE International Conference on eScience. IEEE CS Press, Oxford (2009) 19. Schreiber, F., Schwobbermeyer, H.: Towards motif detection in networks: Frequency concepts and ﬂexible search. In: Proc. of the Int. Workshop on Network Tools and Applications in Biology (NETTAB 2004), pp. 91–102 (2004) 20. Sporns, O., Kotter, R.: Motifs in brain networks. PLoS Biology 2 (2004) 21. Valverde, S., Sol´e, R.V.: Network motifs in computational graphs: A case study in software architecture. Phys. Rev. E (Stat. Nonlin. Soft Matter Phys.) 72(2) (2005) 22. Watts, D.J., Strogatz, S.H.: Collective dynamics of smallworld networks. Nature 393(6684), 440–442 (1998) 23. Wernicke, S.: Eﬃcient detection of network motifs. IEEE/ACM Trans. Comput. Biol. Bioinformatics 3(4), 347–359 (2006)
Accuracy Guarantees for Phylogeny Reconstruction Algorithms Based on Balanced Minimum Evolution Magnus Bordewich1, and Radu Mihaescu2 1
School of Engineering and Computing Sciences, Durham University, U. K. 2 Dept. of Computer Science, U. C. Berkeley, U. S. A.
Abstract. Distance based phylogenetic methods attempt to reconstruct an accurate phylogenetic tree relating a given set of taxa from an estimated matrix of pairwise distances between taxa. This paper examines two distance based algorithms (GreedyBME and FastME) which are based on the principle of trying to minimise the balanced minimum evolution (BME) score of the output tree in relation to the given estimated distance matrix. We show ﬁrstly that these algorithms will both reconstruct the correct tree if the input data is quartet consistent, and secondly that if the maximum error in any individual distance estimate is , then both algorithms will output trees containing all edges of the true tree that have length at least 3. That is to say the algorithms have edge safety radius 1/3. In contrast, quartet consistency of the data is not sufﬁcient to guarantee Neighbor Joining (NJ) reconstructs the correct tree, and moreover NJ has edge safety radius of 1/4, which is strictly worse.
1
Introduction
We analyse two algorithms for inferring phylogenetic trees from distance matrices, based on the balanced minimum evolution (BME) principle [4]. The optimality criterion (BME score) used is to minimize Pauplin’s treelength estimate [13] relative to the given distance matrix. The algorithms we consider are GreedyBME and FastME. GreedyBME is the greedy algorithm for reconstructing a tree taxonbytaxon. We start with three taxa arranged in a star tree topology and iteratively add each remaining taxon, inserting them at the location that minimises the BME score of the tree restricted to the taxa inserted so far. So GreedyBME builds a binary phylogenetic tree taxonbytaxon, starting from the star on three taxa, greedily minimising the BME score at each step. It is interesting to note that Gascuel and Steel, in an excellent review [8], have shown that NJ [14] also is a greedy algorithm which minimises the BME score at each step. The diﬀerence is that NJ starts at a star topology on all taxa and iteratively chooses two leaves and agglomerates them (eﬀectively regrafts them
The ﬁrst author was supported in part by EPSRC grant number EP/D063574/1. The work began while both authors were visiting the University of Canterbury, New Zealand.
V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 250–261, 2010. c SpringerVerlag Berlin Heidelberg 2010
Accuracy Guarantees for Phylogeny Reconstruction Algorithms
251
as a cherry attached to the root), where the leaves are chosen to minimise the BME score of the resulting tree on all taxa which still has a central vertex of high degree. FastME is a local topology search hillclimbing algorithm that takes the output of GreedyBME and iteratively searches through local topologies (those trees diﬀering from the current tree by one topological rearrangement operation) and moves to the topology that minimises the BME score. This approach is implemented in a software called FastME [4]. The two topological rearrangement operations available in the latest release of FastME are: the balanced subtree prune and regraft (BSPR) algorithm [9] and the balanced nearest neighbor interchange (BNNI) algorithm [4]. FastME has been shown experimentally [4,5] to be a fast and accurate method for tree inference, compared to other popular distancebased methods such as NJ, BIONJ [7], FITCH [6] or WEIGHBOR [3]. The results in this paper provide further theoretical support for using this approach. Atteson [1] studied the NJ algorithm and gave a condition, the safety radius of the algorithm, for accurate reconstruction of the true tree. Atteson showed that NJ has safety radius of 1/2, i.e. if the maximum error in the estimated distance matrix is at most 1/2 the minimum edge length in the true tree, then NJ will correctly reconstruct the entire tree. Moreover, no distance based method can have safety radius greater than 1/2. More recently Bordewich et al. [2] analysed FastME and showed that it has safety radius at least 1/3 (when using BSPR) and Shigezumi [16] has shown that GreedyBME has safety radius 1/2. Note that FastME and GreedyBME are heuristics for ﬁnding a tree that minimises BME score. Pardi et al. [12] have shown that the BME principle itself, or equivalently the algorithm that returns the tree that globally minimises BME score, has safety radius 1/2. The results described above relate the minimum edge length in the entire tree to the maximum allowed error, so a single short edge can massively aﬀect the permitted error across all estimated distances for the guarantee of correct reconstruction to hold. In contrast, in this paper we consider the edge safety radius, which guarantees that suﬃciently long edges will be correctly reconstructed even if other edges of the true tree are very short, relative to the error. An algorithm that is guaranteed to output a tree topology containing all those edges of the true tree that have length at least l, whenever the the maximum error in the estimated distance matrix is at most rl, is said to have edge safety radius r. Atteson conjectured that NJ has an edge safety radius of 1/4, which has recently been proved by Mihaescu et al. [11]. The main result of this paper is to show that GreedyBME and FastME each have edge safety radius 1/3. We also show that under a weaker condition than safety radius 1/2, namely quartet consistency (which we will deﬁne below), GreedyBME and FastME will correctly reconstruct the true tree. Note that having maximum error at most 1/2 the minimum edge length guarantees quartet consistency, but a distance matrix may be quartet consistent with the true tree while not satisfying the safety radius condition. In related work, Mihaescu [10] has shown that the
252
M. Bordewich and R. Mihaescu
BME principle also reconstructs the true tree on quartet consistent inputs, but is strictly weaker than its two heuristic versions (GreedyBME and NJ) in edge safety radius, having an asymptotic edge safety radius of 1/(2n) on n taxa. Our results show strict superiority of GreedyBME over NJ in two ways. It has been shown that quartet consistency is not a suﬃcient condition for NJ to correctly reconstruct the true tree [11]. Thus GreedyBME will correctly reconstruct the whole true tree under a weaker condition than NJ. Also, GreedyBME will correctly reconstruct all edges of the true tree having length at least 3 times the maximum error in the input matrix, whereas NJ sometimes fails to reconstruct edges up to 4 times the maximum error [1].
2
Basics, Definitions and Notation
The notation and terminology largely follows [15]. A phylogenetic tree is a tree whose leaves are bijectively labelled by the elements of some ﬁnite set X. A binary phylogenetic tree is a phylogenetic tree in which every internal vertex has degree exactly three. The set X usually denotes a set of species or taxa, and the tree T represents the evolutionary relationships between them. Unless stated otherwise, from now on X will denote a ﬁnite set and all trees considered will be phylogenetic trees. Throughout we consider phylogenetic trees as unweighted, i. e. they do not have intrinsic edge lengths, with the exception of the true tree T ∗ which does have edge lengths (or weights). Furthermore, capital letters will be used in all ﬁgures to represent subtrees. ∗ ] is a treemetric if there is a unique A matrix of pairwise distances δ ∗ = [δij ∗ phylogenetic tree T with positive edge lengths l(e) so that, for each x, y ∈ X, ∗ the distance δxy is the sum of the lengths of edges on the path between x and ∗ y in T . The input to our algorithms is an estimated pairwise distance matrix ∗ ). δ = [δij ], and the error of δ with respect to δ ∗ is maxx,y∈X (δxy − δxy We next deﬁne the BME score of a phylogenetic tree T . This is equivalent to the tree length formula of Pauplin [13]. Given two nodes i, j ∈ V (T ), we denote by P T (i, j) the set of all the internal nodes of T which lie on the (closed) path between i, j in T . In particular, if i or j are internal, then they also belong to P T (i, j). Similarly for two nodes i, j of T , internal or not, we let pTij = (deg(v) − 1)−1 . v∈P T (i,j)
The Balanced Minimum Evolution score of T relative to δ is the quantity pTij δij . BM E(δ, T ) = i,j∈X
A split S = {A, B} on a taxa set X is a bipartition of X into two nonempty disjoint subsets A, B ⊆ X whose union is X. For ease of notation, we will write AB or, equivalently BA for the split {A, B}. In general, a collection of splits of X is called a split system of X.
Accuracy Guarantees for Phylogeny Reconstruction Algorithms
253
Suppose that T is a phylogenetic tree on X. Each edge e of T corresponds to a split of AB of X, which may be obtained by deleting e and letting A be the leaflabel set of one of the resulting connected components and B be the leaflabel set of the other. The set of splits corresponding to edges of T are said to the be the splits of T . A clade of T is any subset C ⊂ X such that CX − C is a split of T . The clade is said to be rooted at the vertex c in T which is the end of the edge e which induces split CX − C closest to the leaves in C. A quartet of T is a partial split abcd, where a, b, c, d ∈ X and there is a split AD of T such that a, b ∈ A and c, d ∈ D. We say that a dissimilarity map δ is consistent with a quartet (abcd) if δab + δcd < δac + δbd , δad + δbc . We say that δ is consistent with an edge e = AD of T , if δ is consistent with all quartets abcd of T such that a, b ∈ A and b, c ∈ D. We say that δ is quartet consistent with a phylogenetic tree T if δ is consistent with all the quartets of T . Given a dissimilarity map δ and two disjoint clades A, B of tree T , rooted at a, b ∈ V (T ) respectively, we deﬁne the average clade distance, or clade distance for short, as δij pTij / pTij = δij pTia pTjb . δAB = i∈A,j∈B
i∈A,j∈B
i∈A,j∈B
Note that the clade distance thus only depends on the rooted topologies T A and T B and not on the entire topology T .
3
Results
We now formally state the main results of this paper. The ﬁrst concerns the algorithm GreedyBME, and gives suﬃcient conditions for accurate reconstruction of edges of the true tree. Theorem 1. Let T ∗ be a binary phylogenetic tree with induced distance matrix δ ∗ . Let input matrix δ have error with respect to δ ∗ . Then the algorithm GreedyBME will return a binary phylogenetic tree T such that 1. T contains an edge with split AB for all edges e = AB in T ∗ with l(e) > 3, i.e. GreedyBME has edgesafety radius 1/3. Furthermore, this bound is asymptotically tight. 2. if δ is quartet consistent with T ∗ then T = T ∗ . The second result concerns the local topology search phase of FastME. We show that if a local search is conducted from a tree T that already contains certain edges from the true tree T ∗ , then the end result is guaranteed to also contain these edges of T ∗ . The two forms of local topology search considered are those topologies within one NNI or one SPR operation of the current tree; for details of the deﬁnitions of NNI and SPR operations as used in FastME see for example [2]. Theorem 2. Let T ∗ be a binary phylogenetic tree with induced distance matrix δ ∗ . Let input matrix δ have error with respect to δ ∗ . Let T be a binary phylogenetic tree and let e = AB be an edge common to T and T ∗ . Then
254
M. Bordewich and R. Mihaescu
1. if l(e) > 2 then for any T that may be obtained in one NNI operation from T such that BM E(δ, T ) < BM E(δ, T ), e must be an edge of T ; 2. if l(e) > 3 and T is the tree at most one SPR operation from T which minimises BM E(δ, T ) then e must be an edge of T ; and 3. if δ is consistent with e then for any T that may be obtained in one NNI operation from T such that BM E(δ, T ) < BM E(δ, T ), e must be an edge of T . Combining the above two theorems we obtain the following immediate corollary. Corollary 1. FastME using an initial tree generated by GreedyBME and a local search based on NNI or SPR operations has edge safety radius 1/3. Note that in the local topology using NNI operations, it would not matter if the algorithm jumped immediately to the ﬁrst tree found with shorter length, or completed the search of all neighbouring trees and moved to the best one. However for an SPR based local topology search we have the restriction that all neighbouring trees are checked, and the best of those selected for the next iteration.
4
Proofs
4.1
GreedyBME
We shall make use of the following lemmas. The ﬁrst is Lemma 5.1 of [2], which gives a formula for the diﬀerence in BME score between two trees of certain structure. The second lemma gives a ﬁve point condition on the distance matrix δ, which is extended to clades. Lemma 1 (Lemma 5.1 of [2]). Let T A and T B be the trees given in Fig. 2. Then BM E(δ, T A ) − BM E(δ, T B ) =
1 1 − t 2 2
(δA xk − δxk Bt )+
t−1 i=1
1 2t−i+1
(δBi Bt − δBi xk ) −
1 2i+1
(δA Bi
− δBi xk ) .
Lemma 2. Let T ∗ be a phylogenetic tree on X and let T ∗ have a split e = AB of length l(e). Let δ be a matrix of pairwise distances that has error at most < l(e)/3. Then for A0 , A1 disjoint subsets of A, and Bi , Bj , Bk disjoint subsets of B, and for any tree T with clades A0 , A1 , Bi , Bj , Bk we have: (δA0 A1 + δA0 Bi − δA1 Bi ) − (δA0 Bj + δA0 Bk − δBj Bk ) < 0. Proof. Let a0 , a1 , bi , bj , bk be leaves in clades A0 , A1 , Bi , Bj , Bk respectively. The true topology T ∗ restricted to these ﬁve leaves must be one of the three topologies shown in Fig. 1, where the edge e depicted represents a path in T ∗ that contains edge e.
Accuracy Guarantees for Phylogeny Reconstruction Algorithms a0
bk x
a1
e bi Case (a)
bk
a0 x
y bj
e
a1
bj
a0
y
x
bj
bi
255
e
y
a1
bk
Case (b)
bi
Case (c)
Fig. 1. Possible true topologies relating the leaves a0 , a1 , bi , bj , bk
In each case the true distances satisfy ∗ (δa∗0 a1 + δa∗0 bi − δa∗1 bi ) − (δa∗0 bj + δa∗0 bk − δb∗j bk ) = 2δxy
< 2l(e), where x and y are the corresponding internal vertices of T ∗ . Since each entry in the estimated distance matrix has an error of at most , we have (δa0 a1 + δa0 bi − δa1 bi ) − (δa0 bj + δa0 bk − δbj bk ) < −2l(e) + 6 < 0. Note that for any clade C with root rc we have all terms over the leaves in all clades. Thus,
c∈C
pTcrc = 1. So we may sum
(δA0 A1 + δA0 Bi − δA1 Bi ) − (δA0 Bj + δA0 Bk − δBj Bk ) = pTa0 r0 pTa1 r1 pTbi ri pTbj rj pTbk rk [(δa0 a1 + δa0 bi − δa1 bi ) − (δa0 bj + δa0 bk − δbj bk )] < 0, where the summation is over all leaves a0 , a1 , bi , bj , bk in A0 , A1 , Bi , Bj and Bk respectively, and r0 , r1 , ri , rj , rk are the roots of the clades A0 , A1 , Bi , Bj and Bk in T respectively. We can now present the proof of Theorem 1. Proof (Theorem 1). First we prove that the edge safety radius of the algorithm GreedyBME is at least 1/3. Let T ∗ be the true tree, and let e = AB be a split in T ∗ of length l(e) > 3. Let δ be an estimated pairwise distance matrix with maximum error at most . The proof is by induction on the size of X. If X = 3, then trivially GreedyBME will return the true tree, since there is only one tree topology on three taxa. Suppose now that the theorem holds for all trees on taxa sets of size at most k − 1, and let X = k. Let xk be the last taxa added by GreedyBME, and consider the tree T ∗ obtained from T ∗ by removing xk and its pendent edge. Note that δ obtained from δ by removing the row and column corresponding to xk gives a pairwise distance matrix for T ∗ with maximum error at most . Without loss of generality we assume xk ∈ A. If A = {xk }, then trivially GreedyBME will construct a tree containing the split AB. Now we assume = ∅. Then T ∗ has split e = A B and the length of e is at least A = A − xk
256
M. Bordewich and R. Mihaescu
l(e). By the inductive hypothesis GreedyBME applied to δ will construct a tree containing the split e = A B. Thus GreedyBME applied to δ will also construct a tree T on X − xk containing the split e = A B after k − 1 steps. We must now show that after the addition of xk the split AB is present in the resulting tree T . GreedyBME will position xk at the point which minimises BM E(δ, T ). Suppose for contradiction that there is some position in clade B of T which minimises this, as depicted in Fig. 2(b), where B = B1 ∪ B2 ∪ . . . ∪ Bt , resulting in tree T B . We will show that tree T A obtained by attaching xk between the clades A and B, as depicted in Fig. 2(a), must obtain a smaller BME score, giving the required contradiction.
A
A
Bt
xk
B1
Bt−1
Bt
B1
(a) Tree T A
Bt−1 xk (b) Tree T B
Fig. 2. Possible positions for attaching the ﬁnal leaf xk
By Lemma 1, we can express the diﬀerence in BME score between T A and T as follows: BM E(δ, T A ) − BM E(δ, T B ) = B
1 1 − t 2 2 =
(δA xk − δxk Bt ) +
t−1 i=1
1
2
(δ − δBi xk ) − t−i+1 Bi Bt
B − δB x ) (δ A i i k i+1 1
2
t−1
1 (δA xk + δBi xk − δA Bi ) − (δxk Bt + δBt−i xk − δBt−i Bt ) . i+1 2 i=1
(1)
We may now apply Lemma 2 to each term in the summation (setting A0 = xk , A1 = A , Bi = Bi , Bj = Bt−i and Bk = Bt ) to see that each term is less than zero, and hence BM E(δ, T A) < BM E(δ, T B ). This contradicts the assumption that xk will be inserted in clade B, and completes the inductive step. We now show that the edge safety radius of GreedyBME is no more than 1/3. For contradiction assume the edge safety radius is r > 1/3. Consider a caterpillar tree T ∗ in which a , xk is a cherry separated from the rest of the tree by an edge of length l, as depicted in Fig. 2(a), taking the clades A , Bi , i = 1, . . . , t to be singleton leaves a , b1 , . . . , bt , and t to be odd. Let = rl. We will assume the sum of all other edge lengths in the tree is at most ν for some very small ν > 0. Deﬁne δ = [δxy ] as follows: δa xk = δa∗ xk + ; for i = 1 to t − 1 we deﬁne δa bi = δa∗ bi − and δbi bt = δb∗i bt + ; for i = 1 to (t − 1)/2 we deﬁne δxk bi = δx∗k bi + ; and for i = (t − 1)/2 + 1 to t − 1 we deﬁne δxk bi = δx∗k bi − . For brevity we omit the details, but it can be shown that, saving the insertion of xk until last, GreedyBME will build the correct tree on X − {xk }. For
Accuracy Guarantees for Phylogeny Reconstruction Algorithms
257
any r > 1/3 we can choose t large enough (and ν small enough) that xk can then be inserted in an incorrect position at lower BME score than T ∗ . Hence GreedyBME will fail to reconstruct the correct tree. This gives part 1 of the theorem. We now prove part 2. Let T be a binary phylogenetic tree and let δ be an estimated pairwise distance matrix which is quartet consistent with T . The proof is similar to part 1, and is again by induction on the size of X. If X = 4, then it is easy to check that GreedyBME will return the true tree. Suppose now that the theorem holds for all trees on taxa sets of size at most k − 1, and let X = k. Let xk be the last taxa added by GreedyBME, and consider the tree T obtained from T by removing xk and its pendent edge. Note that δ obtained from δ by removing the row and column corresponding to xk , gives a pairwise distance matrix which is quartet consistent with the topology T . Without loss of generality we assume the correct position for xk to be inserted is as a pendent leaf regrafted to some edge e = A B in T . By the inductive hypothesis GreedyBME applied to δ will construct T correctly. Thus GreedyBME applied to δ will also construct T on X − xk after k − 1 steps. GreedyBME will position xk at the point which minimises the BM E(δ, T ). Suppose for contradiction that there is some position other than as a pendent leaf grafted to e which minimises BME score. Without loss of generality we may assume that the position is in clade B of T , as depicted in Fig. 2(b), where B = B1 ∪ B2 ∪ . . . ∪ Bt , resulting in tree T B . We will show that tree T , as depicted in Fig. 2(a), must obtain a smaller BME score, giving the required contradiction. We will ﬁrst assume that t is odd: a small adjustment will be needed if t is even. Using Equation (1), we may express the diﬀerence in BME score between T A and T B as BM E(D, T A ) − BM E(D, T B ) =
(t−1)/2
i=1
1 (δA xk + δBi xk − δA Bi ) − (δxk Bt + δBt−i xk − δBt−i Bt ) 2i+1
+
1 2t−i+1
(δA xk + δBt−i xk − δA Bt−i ) − (δxk Bt + δBi xk − δBi Bt ) . (2)
Note that in contrast to the proof of Theorem 1 part 1, in this case we know that the internal topology of the clade B is the same in T as in T . For each set of leaves a ∈ A , bi ∈ Bi , bt−i ∈ Bt−i and bt ∈ Bt , we deﬁne f (a, bi , bt−i , bt ) =
1 2i+1 +
(δaxk + δbi xk − δabi ) − (δxk bt + δbt−i xk − δbt−i bt )
1 2t−i+1
(δaxk + δbt−i xk − δabt−i ) − (δxk bt + δbi xk − δbi bt ) .
By applying quartet consistency conditions one can show that the ﬁrst square bracketed term is less than zero. If the second term is also negative, then f (a, bi , bt−i , bt ) < 0. Otherwise f (a, bi , bt−i , bt ) <
1 (2δaxk + δbi bt + δbt−i bt − 2δxk bt − δabi − δabt−i ) . 2i+1
258
M. Bordewich and R. Mihaescu
In this case by applying quartet consistency conditions one can again show that f (a, bi , bt−i , bt ) < 0. In either case f (a, bi , bt−i , bt ) < 0, hence (by summing over the leaves in each clade) we see that each term of the main summation (2) above is less than zero. If t is even, then we need to take into account an extra term in Equation (2), corresponding to i = t − i = t/2. This term may similarly be shown to be less than zero. Thus BM E(δ, T A ) < BM E(δ, T B ) which contradicts the placement of xk in clade B. This completes the proof of Theorem 1. 4.2
Local Topology Search
We ﬁrst show that an NNI based search will never destroy an edge which has length at least twice the maximum error. Lemma 3. Let T, T ∗ be binary phylogenetic trees with some common edge e = AB. Let δ have maximum error < l(e)/2 relative to δ ∗ . Then any tree T one NNI operation from T which does not contain e must have larger BME score than T . Proof. Consider an NNI move that could destroy the split AB. Let A1 , A2 , B1 and B2 be the subclades of A and B obtained by dividing A and B at the point of attachment of e, as in Fig. 3. The only way e can be destroyed by an NNI is, without loss of generality, by swapping clades A2 and B2 , as shown by T in Fig. 3. By Lemma 1 1 [(δA1 A2 + δB1 B2 ) − (δA1 B2 + δB1 A2 )]. 4 For any leaves a1 , a2 , b1 , b2 in A1 , A2 , B1 , B2 we have BM E(δ, T ) − BM E(δ, T ) =
(δa1 a2 + δb1 b2 ) − (δa1 b2 + δb1 a2 ) ≤ (δa∗1 a2 + δb∗1 b2 ) − (δa∗1 b2 + δb∗1 a2 ) + 4 ≤ (δa∗1 b2 + δb∗1 a2 − 2l(e)) − (δa∗1 b2 + δb∗1 a2 ) + 4 = 4 − 2l(e) < 0. Summing over all leaves in A1 , A2 , B1 , B2 we see that BM E(δ, T )−BM E(δ, T ) < 0. Thus any NNI which removes e leads to an increase in BME score and will not be accepted. A1
B1
A1
B1
B2
B2
A2
e A2 T
T
Fig. 3. An NNI operation that breaks split e = A1 ∪ A2 B1 ∪ B2
Accuracy Guarantees for Phylogeny Reconstruction Algorithms
259
Next we show that as long as we check all trees within one SPR operation of the current tree, and choose the best of these, we will never destroy an edge e which has length at least 3 times the maximum error. Lemma 4. Let T, T ∗ be binary phylogenetic trees with some common edge e = AB. Let δ have maximum error < l(e)/3 relative to δ ∗ . Then any tree T one SPR operation from T which does not contain e must have larger BME score than a tree T A which preserves e and is also within one SPR operation of T . Proof. This proof follows the proof that GreedyBME has safety radius 1/3, and is omitted for reasons of brevity. We ﬁnally show that if δ is consistent with some edge e in T , then an NNI based local topology search will not remove e. Lemma 5. Let T, T ∗ be binary phylogenetic trees with some common edge e = AB. Let δ be a distance matrix consistent with e. Then NNI starting from T will never break the edge AB. Proof. As in the proof of Lemma 3, consider an NNI move that could destroy the split AB. Let A1 , A2 , B1 and B2 be the subclades of A and B obtained by dividing A and B at the point of attachment of e, as in Fig. 3. The only way e can be destroyed by an NNI is, without loss of generality, swapping clades A2 and B2 , as shown by T in Fig. 3. By Lemma 1 BM E(δ, T ) − BM E(δ, T ) =
1 [(δA1 A2 + δB1 B2 ) − (δA1 B2 + δB1 A2 )]. 4
For any leaves a1 , a2 , b1 , b2 in A1 , A2 , B1 , B2 we have (δa1 a2 + δb1 b2 ) − (δa1 b2 + δb1 a2 ) < 0. by the consistency of δ with any quartet spanning AB. Summing over all leaves in A1 , A2 , B1 , B2 we see that BM E(δ, T ) − BM E(δ, T ) < 0. Thus any NNI which removes e leads to an increase in BME score and will not be accepted. Theorem 2 follows from Lemmas 3, 4 and 5.
5
Conclusion
In this work we have shown that GreedyBME is a more robust method of inferring a phylogeny than Neighbor Joining in two rigorous senses. Firstly GreedyBME has an edge safety radius of 1/3 and secondly GreedyBME will correctly reconstruct the true tree given a distance matrix that is quartet consistent with the true tree. Both conditions are strict improvements over Neighbor Joining. The signiﬁcance of proving bounds on the edge safety radius is that any sufficiently long edge is correctly reconstructed from the distance matrix (edges longer than three times the maximum error), even in the presence of very short
260
M. Bordewich and R. Mihaescu
edges elsewhere in the tree. In contrast, with results on safety radius we can only guarantee that the whole tree is correctly reconstructed if all edges are suﬃciently long, otherwise we cannot guarantee anything. Minimum evolution, and in particular balanced minimum evolution, has been proposed by several authors as a basic principle for inferring phylogenies (for references and discussion see [4]). Moreover the underlying reason for the accuracy of certain phylogenetic algorithms, including Neighbor Joining, has been attributed to their relationship to the balanced minimum evolution principle [8,11]. It is therefore counterintuitive that a heuristic for minimising BME score, GreedyBME, has an edge safety radius of 1/3, when the underlying principle (i.e. an algorithm that selects the tree of globally minimum BME score) has a weaker edge safety radius, which even approaches zero for large trees [10]. Further work on understanding this issue, as well as extending the robustness guarantees to more reasonable models of error in distance matrices, will help improve distance based phylogenetic inference in the future.
References 1. Atteson, K.: The performance of the neighborjoining methods of phylogenetic reconstruction. Algorithmica 25, 251–278 (1999) 2. Bordewich, M., Gascuel, O., Huber, K., Moulton, V.: Consistency of Topological Moves Based on the Balanced Minimum Evolution Principle of Phylogenetic Inference. IEEE/ACM Transactions on Computational Biology and Bioinformatics 6(1), 110–117 (2009) 3. Bruno, W.J., Socci, N.D., Halpern, A.L.: Weighted Neighbor Joining: A likelihood based approach to distancebased phylogeny reconstruction. Mol. Biol. Evol. 17, 189–197 (2000) 4. Desper, R., Gascuel, O.: Fast and accurate phylogeny reconstruction algorithms based on the minimum evolution principle. J. Comp. Biol. 9, 587–598 (2002), Latest software available at, http://atgc.lirmm.fr/fastme/ 5. Desper, R., Gascuel, O.: Theoretical foundation of the balanced minimum evolution method of phylogenetic inference and its relationship to weighted leastsquares tree ﬁtting. Mol. Biol. Evol. 21, 587–598 (2004) 6. Felsenstein, J.: An alternating leastsquares approach to inferring phylogenies from pairwise distances. Syst. Biol. 46, 101–111 (1997) 7. Gascuel, O.: BIONJ: an improved version of the NJ algorithm based on a simple model of sequence data. Mol. Biol. Evol. 14, 685–695 (1997) 8. Gascuel, O., Steel, M.: Neighborjoining revealed. Mol. Biol. Evol. 23(11), 1997– 2000 (2006) 9. Hordijk, W., Gascuel, O.: Improving the eﬃciency of SPR moves in phylogenetic tree search methods based on maximum likelihood. Bioinformatics 21(24), 4338– 4347 (2005) 10. Mihaescu, R.: Reliability results for the general Balanced Minimum Evolution principle (in preparation) 11. Mihaescu, R., Levy, D., Pachter, L.: Why neighborjoining works. Algorithmica 54(1), 1–24 (2009) 12. Pardi, F., Guillemot, S., Gascuel, O.: Robustness of phylogenetic inference based on minimum evolution. Bulletin of Mathematical Biology (2010) (in press)
Accuracy Guarantees for Phylogeny Reconstruction Algorithms
261
13. Pauplin, Y.: Direct calculation of tree length using a distance matrix. J. Mol. Evol. 51, 66–85 (2000) 14. Saitou, N., Nei, M.: The neighborjoining method: A new method for reconstructing phylogenetic trees. Mol. Biol. Evol. 4, 406–424 (1987) 15. Semple, C., Steel, M.: Phylogenetics. Oxford University Press, Oxford (2003) 16. Shigezumi, T.: Robustness of greedy type minimum evolution algorithms. In: Computational Science –ICCS 2006, pp. 815–821 (2006)
The Complexity of Inferring a Minimally Resolved Phylogenetic Supertree Jesper Jansson1 , Richard S. Lemence1 , and Andrzej Lingas2 1
Ochanomizu University, 211 Otsuka, Bunkyoku, Tokyo 1128610, Japan
[email protected],
[email protected] Funded by the Special Coordination Funds for Promoting Science and Technology 2 Department of Computer Science, Lund University, 22100 Lund, Sweden
[email protected] Abstract. A recursive algorithm by Aho, Sagiv, Szymanski, and Ullman [1] forms the basis for many modern rooted supertree methods employed in Phylogenetics. However, as observed by Bryant [4], the tree output by the algorithm of Aho et al. is not always minimal; there may exist other trees which contain fewer nodes yet are still consistent with the input. In this paper, we prove strong polynomialtime inapproximability results for the problem of inferring a minimally resolved supertree from a given consistent set of rooted triplets (MinRS). We also present an exponentialtime algorithm for solving MinRS exactly which is based on tree separators. It runs in 2O(n log k) time when every node is required to have at most k children which are internal nodes and where n is the cardinality of the leaf label set of the input trees. Keywords: Phylogenetic tree; rooted triplet; minimally resolved supertree; NPhardness; tree separator.
1
Introduction
Phylogenetic trees are leaflabeled trees which are used to represent treelike evolutionary history. To infer a reliable phylogenetic tree containing a large number of leaves is often a diﬃcult task because of the computational complexity of the underlying optimization problems. One approach which has become increasingly popular in recent years is the divideandconquerbased supertree approach [2,6,9,12], which ﬁrst uses a computationally intense method to reconstruct highly accurate trees for small, partially overlapping subsets of the leaf label set, and then applies a combinatorial algorithm to merge the small trees into one large tree called a supertree. One of the common criticisms of supertrees is that they make statements about evolutionary relationships among leaves that are not always directly supported by any one of the input trees, which can create false groupings in the form of “spurious novel clades” [2]. Therefore, a natural idea is to try to avoid making more such statements than necessary to obtain a supertree, and thus to introduce as little unsupported branching information as possible. For this V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 262–273, 2010. c SpringerVerlag Berlin Heidelberg 2010
The Complexity of Inferring a Minimally Resolved Phylogenetic Supertree
263
reason, minimally resolved supertrees, i.e., trees that contain as few internal nodes as possible while still being consistent with the input, are important in Bioinformatics. Several alternative supertree methods whose formal deﬁnitions diﬀer have been developed; see, e.g., the survey paper by BinindaEmonds [2] for an extensive list of references. A classic algorithm by Aho, Sagiv, Szymanski, and Ullman [1] named BUILD (see Section 2.2 below for a short description) can be used to merge a given set of nonconflicting rooted phylogenetic trees. Due to its simplicity and eﬃciency, it is used as a starting point of many rooted supertree methods such as the ones presented in [8,14,15,16] for combining a set of conflicting trees. These methods imitate the behavior of BUILD until a conﬂict occurs, at which point the socalled auxiliary graph consists of a single connected component which is then split into smaller components by removing some edges (diﬀerent methods use diﬀerent rules to do this), and then the method is executed recursively on each newly created component. Typically, such methods will all yield the same output as BUILD in the ideal case where the input set of trees contains no conﬂicts; hence, to understand these methods, it is important to fully understand the properties of the trees which are output by BUILD. A surprising fact about BUILD is that it does not always produce a tree with the minimum possible number of internal nodes. This was ﬁrst observed by Bryant in [4]. We generalize Bryant’s example in Section 2.3 below to show that BUILD may in fact output a tree containing Ω(n) times more internal nodes than necessary, where n is the cardinality of the leaf label set of the input trees. A binary phylogenetic tree with exactly three leaves is called a rooted triplet. Rooted triplets are a special case of phylogenetic trees, so hardness results concerning the computational complexity of inferring supertrees from rooted triplets will directly carry over to the corresponding problems for general inputs. Moreover, as explained in [9], the branching information contained in any rooted, binary phylogenetic tree with m leaves can be represented by a set of O(m) rooted triplets (one rooted triplet per edge in the tree). From here on, we therefore focus on inputs which consist of rooted triplets. 1.1
Our Results and Organization of the Paper
We study the computational complexity of the problem of inferring a minimally resolved supertree from a given consistent set of rooted triplets over a leaf label set of cardinality n, called MinRS for short. The paper is organized as follows. Section 2 deﬁnes the MinRS problem formally and surveys previous work. Section 3 proves two strong negative results: (1) the decision version of MinRS is NPhard for any ﬁxed number of internal nodes larger than or equal to 4; and (2) MinRS cannot be approximated within n1− for any constant 0 < < 1 in polynomial time, unless P = NP. Then, Section 4.1 describes a simple algorithm for the decision version of MinRS which runs in O∗ (f (q) · q n ) time, where q is the allowed number of internal nodes and f (q) is the number of rooted, unlabeled trees with q nodes. Section 4.2 presents a more sophisticated exponentialtime exact algorithm based on tree separators
264
J. Jansson, R.S. Lemence, and A. Lingas
that runs in 2O(n log k) time, where every node is required to have at most k children which are internal nodes. Section 5 contains some ﬁnal remarks.
2 2.1
Preliminaries Basic Definitions
We will use the following deﬁnitions and notation. To simplify the presentation, any node in a tree is considered to be an ancestor as well as a descendant of itself. For any nodes u, v in a tree, in case u is a descendant of v and u = v then we write u ≺ v and call u a proper descendant of v. The lowest common ancestor of u and v, denoted by lca(u, v), is the node w such that both u and v are descendants of w and w ≺ x holds for every other node x which is an ancestor of both u and v. The set of leaves in a tree T is denoted by Λ(T ). A phylogenetic tree is a rooted, unordered tree whose leaves are distinctly labeled. Since the leaves in a phylogenetic tree are uniquely labeled, we will refer to them by referring to their labels. A rooted triplet is a phylogenetic tree with exactly three leaves in which every internal node has exactly two children, and we let xyz denote the rooted triplet having leaf label set {x, y, z} that satisﬁes lca(x, y) ≺ lca(x, z) = lca(y, z). Let T be a phylogenetic tree. For any {x, y, z} ⊆ Λ(T ), if the relation lca(x, y) ≺ lca(x, z) = lca(y, z) holds in T then the rooted triplet xyz is said to be consistent with T . A given set R of rooted triplets and a given phylogenetic tree T are consistent if every t ∈ R is consistent with T . Lastly, any given set R of rooted triplets is called consistent if there exists a tree which is consistent with R (otherwise, R is called inconsistent ). When R is given, we denote the set of all leaf labels which occur in R by L, i.e., we deﬁne L = t∈R Λ(t). Throughout the paper, we use the notation n = L and k = R. Given an input set R of rooted triplets, it is possible to eﬃciently check whether R is consistent and if so, to construct a phylogenetic tree consistent with R, by a classic algorithm of Aho, Sagiv, Szymanski, and Ullman [1] named BUILD. The algorithm is described in Section 2.2 below. Finally, for any consistent set R of rooted triplets, we say that a phylogenetic tree which is consistent with R and contains as few internal nodes as possible is a minimally resolved supertree for R. 2.2
The Algorithm of Aho et al. [1] (BUILD)
In this subsection, we brieﬂy review the algorithm of Aho, Sagiv, Szymanski, and Ullman [1]. The algorithm, referred to as BUILD, constructs a phylogenetic tree consistent with an input set R of rooted triplets over a leaf label set L, if such a tree exists. In case such a tree does not exist, the algorithm outputs null. BUILD is a topdown, recursive algorithm. The main idea of the algorithm is to ﬁrst partition the leaf set L into blocks according to the rooted triplets in R. Then, the algorithm outputs a tree consisting of a root node whose children are
The Complexity of Inferring a Minimally Resolved Phylogenetic Supertree
265
the roots of the trees obtained by recursing on each block. The base case of the recursion is when the leaf set consists of a single leaf. To perform the partitioning into blocks for any subset L ⊆ L with L  > 1, BUILD uses an auxiliary graph G(L ). The auxiliary graph for any L ⊆ L is deﬁned as G(L ) = (L , E), where E contains the edge {x, y} if and only if there is some rooted triplet of the form xyz in R with x, y, z ∈ L . After constructing G(L ), the algorithm computes the connected components in G(L ) and lets each such connected component deﬁne one block of L . If, at any point of its execution, L  > 1 yet L contains just one block, then BUILD terminates and outputs null. This approach is motivated by Proposition 1 below together with the key observation that for any rooted triplet xyz consistent with a phylogenetic tree T , the leaves labeled by x and y cannot descend from two diﬀerent children of the root of T , i.e., x and y must belong to the same block. (For a formal proof of correctness, see [1].) Proposition 1 (Aho, Sagiv, Szymanski, and Ullman [1]). If G(L) has only one connected component and L > 1 then R is not consistent with any phylogenetic tree. The running time of the original implementation of BUILD [1] was O(nk), where n = L and k = R. Henzinger et al. [9] later presented a faster implementation of this algorithm, and replacing the dynamic graph connectivity data structure used by [9] by a more recent one [10] further reduces the complexity of the algorithm to min{O(n + k log2 n), O(k + n2 log n)} time [11]. 2.3
Definition of MinRS
Bryant [4] noted that the BUILD algorithm of Aho et al. [1] does not always produce a minimally resolved supertree consistent with a given set of rooted triplets. In the example provided in Section 2.5.2 of [4], Bryant considered the set R = {bca, bda, ef a, ega}. As demonstrated in Figure 13 in [4], BUILD will construct a tree consistent with R which contains three internal nodes (a root node along with two internal nodes which are the parents of the leaves b, c, d and e, f, g, respectively), whereas the optimal solution is a tree containing two internal nodes (a root node and an internal node to which the leaves b, c, d, e, f, g are directly attached). We can simplify Bryant’s example to {bca, ef a}. Then, if we extend the example as follows: R = {x1 x2 x0 , x3 x4 x0 , . . . , x2i−1 x2i x0 )}, we obtain a consistent set of rooted triplets for which BUILD will construct a tree having i + 1 internal nodes. However, the tree consisting of a root node with two children c1 and c2 , where c1 is a leaf labeled by x0 and c2 is an internal node with 2i children which are leaves labeled by x1 , x2 , . . . , x2i , contains exactly two internal nodes and is also consistent with R. This shows that asymptotically, the BUILD algorithm of Aho et al. may produce a tree with Ω(n) times more
266
J. Jansson, R.S. Lemence, and A. Lingas
internal nodes than the minimally resolved supertree, where n is the cardinality of the leaf label set. From this observation, a natural question arises: When a consistent set of rooted triplets R is given, how eﬃciently can one construct a minimally resolved supertree consistent with R? Formally, we deﬁne: The Minimally Resolved Supertree Consistent with Rooted Triplets Problem (MinRS) Instance: A set R of rooted triplets with leaf set L. Output: A rooted, unordered tree whose leaves are distinctly labeled by L which has as few internal nodes as possible and which is consistent with every rooted triplet in R, if such a tree exists; otherwise, null. 2.4
Related Work
Besides Bryant [4], other authors such as Henzinger, King, and Warnow [9] have also previously considered the problem of inferring a minimally resolved supertree from a set of rooted triplets. Unfortunately, Henzinger et al. [9] incorrectly assumed that the BUILD algorithm of Aho et al. [1] always constructs a minimally resolved supertree. According to the proof of Theorem 4 in [9], the tree constructed by Algorithm A’ of Henzinger et al. [9] is identical to the tree constructed by the BUILD algorithm; therefore, our example from Section 2.3 above also implies that Algorithm A’ may output a tree with Ω(n) times more internal nodes than a minimally resolved supertree. This means that the minimality claim in Theorem 4 in [9] is not correct. A fan triplet is a a phylogenetic tree consisting of a root node to which three leaves are directly attached. For any phylogenetic tree T and any {x, y, z} ⊆ Λ(T ), if lca(x, y) = lca(x, z) = lca(y, z) holds in T then the fan triplet with leaves x, y, z is consistent with T . In Section 2.6.3 of [4], Bryant studied a kind of “dual” problem to MinRS called Most Resolved Compatible Tree, in which the input is a consistent set R of (rooted and fan) triplets on a leaf set L, and the objective is to construct a phylogenetic tree leaflabeled by L with the largest possible number of internal edges which is consistent with R. (Here, trees containing an internal node with a single child are not allowed.) Note that if R contains rooted triplets only then the problem is trivial since any binary tree which is consistent with R will give an optimal solution. However, in the general case, Most Resolved Compatible Tree is NPhard [4]. For a recent survey of other optimization problems related to rooted triplets consistency (for example, computing a maximum cardinality subset R of an inconsistent set R of rooted triplets such that R is consistent), see Section 2 in [5].
3
PolynomialTime Inapproximability of MinRS
In this section, we establish a strong polynomialtime inapproximability result for MinRS, namely that MinRS cannot be approximated within n1− for any
The Complexity of Inferring a Minimally Resolved Phylogenetic Supertree
267
constant 0 < < 1 in polynomial time, unless P = NP. We will obtain this result by reducing the Chromatic Number problem to MinRS. First, recall that for any undirected graph G = (V, E) and any positive integer K, a Kcoloring of G is a partition of V into (possibly empty) disjoint subsets V1 , V2 , . . . , VK called color classes such that for any {v, w} ∈ E, it holds that v and w belong to diﬀerent color classes. A graph G is called Kcolorable if there exists a Kcoloring of G. The Chromatic Number problem is deﬁned as: Chromatic Number Instance: An undirected graph G = (V, E). Output: The smallest integer K such that G is Kcolorable. Zuckerman [17] proved that Chromatic Number is NPhard to approximate within V 1− for every 0 < < 1. Moreover, the decision version of the problem, i.e., to determine if an undirected graph G is Kcolorable for a particular value of K, is easily solvable in polynomial time when K = 2 but known to be NPhard for any ﬁxed positive integer K ≥ 3; see, e.g., [7]. We now describe the reduction. Let G = (V, E) be any given instance of Chromatic Number. Without loss of generality, we assume that V contains at least two vertices and that G is connected. Construct an instance of MinRS as follows. Let L = {v1 , v2 : v ∈ V } be a set of 2V  new leaf labels and deﬁne R = {v1 v2 w1 , v1 v2 w2 , w1 w2 v1 , w1 w2 v2 : {v, w} ∈ E}. Clearly, the reduction can be carried out in polynomial time. Then we have: Lemma 1. If G is Kcolorable then there exists a tree which is consistent with R and contains K + 1 internal nodes. Proof. Since G = (V, E) is Kcolorable, we can partition the vertex set V of G into K disjoint color classes V1 , V2 , . . . , VK . Order the color classes so that V1 , V2 , . . . , Vj are nonempty and Vj+1 = · · · = VK = ∅, where j ≤ K. Deﬁne a tree T having exactly K + 1 internal nodes as follows. (See Fig. 1 for an illustration.) – Let the root of T be one end of a path of length K − j and let a0 be the other end of the path. Let a0 have j children a1 , a2 , . . . , aj . – For each i ∈ {1, 2, . . . , j} and each v ∈ Vi , attach two leaves labeled by v1 and v2 to the node ai . Consider any rooted triplet in R. It is of the form v1 v2 w1 , where {v, w} ∈ E; furthermore, since {v, w} ∈ E, both of the vertices v and w cannot belong to the same color class Vi . Thus, the parent of the leaves v1 and v2 in T is diﬀerent from the parent of the leaves w1 and w2 , and so v1 v2 w1 is consistent with T . Therefore, R is consistent with T .
Lemma 2. If there exists a tree which is consistent with R and contains K + 1 internal nodes then G is Kcolorable.
268
J. Jansson, R.S. Lemence, and A. Lingas
T:
a0
a1
ai
aj
v1 v2 Fig. 1. Illustrating the proof of Lemma 1. In this example, there is one empty color class (i.e., K − j = 1), so the path from the root of T to the internal node a0 has length 1. For each vertex v ∈ V , where v belongs to the color class Vi , the leaves v1 , v2 in T are directly attached to the internal node ai .
Proof. Let T be a tree with K + 1 internal nodes which is leaflabeled by L and consistent with R. Let c0 be the root of T and denote the other internal nodes of T by c1 , c2 , . . . , cK arbitrarily. For every i ∈ {0, 1, . . . , K}, associate a (possibly empty) subset Ci ⊆ V with the internal node ci , deﬁned as follows: for each v ∈ V , if lca(v1 , v2 ) = ci in T then let v ∈ Ci . It follows directly that for any i, j ∈ {0, 1, . . . , K} with i = j, the subsets Ci and Cj are disjoint. Observe that every v ∈ V belongs to at least one edge in E of the form {v, w} (otherwise, the graph G would not be connected), and thus, by the construction of R, the rooted triplets v1 v2 w1 , v1 v2 w2 , w1 w2 v1 , and w1 w2 v2 belong to R. Since v1 v2 w1 is consistent with T , it holds that lca(v1 , v2 ) is a proper descendant of lca(v1 , w1 ), i.e., lca(v1 , v2 ) cannot be the root of T . We have just shown that C0 = ∅. Next, we claim that for any two vertices v, w ∈ V , if {v, w} ∈ E then v and w cannot belong to the same subset Ci . For the purpose of obtaining a contradiction, suppose that v, w ∈ Ci . Then lca(v1 , v2 ) and lca(w1 , w2 ) are the same node in T according to the deﬁnition of Ci . By transitivity, at least one of lca(v1 , w1 ), lca(v1 , w2 ), lca(v2 , w1 ), and lca(v2 , w2 ) is also equal to this node. However, since T is consistent with the rooted triplets v1 v2 w1 , v1 v2 w2 , w1 w2 v1 , and w1 w2 v2 , it follows from the deﬁnition of “consistent with” that the node lca(v1 , v2 ) is a proper descendant of (and hence diﬀerent from) lca(v1 , w1 ) as well as of lca(v1 , w2 ), and in the same way that lca(w1 , w2 ) is a proper descendant of lca(v2 , w1 ) and of lca(v2 , w2 ). This yields a contradiction, so the claim must hold. Thus, the partition of V into disjoint subsets C1 , C2 , . . . , CK gives a Kcoloring of G, and so G is Kcolorable.
Theorem 1. MinRS cannot be approximated within n1− for any constant 0 < < 1 in polynomial time, unless P = NP.
The Complexity of Inferring a Minimally Resolved Phylogenetic Supertree
269
Proof. Follows from Lemmas 1 and 2 together with the fact that Chromatic Number is NPhard to approximate within V 1− for every 0 < < 1 [17].
Since the decision version of Chromatic Number is NPhard for any ﬁxed positive integer K ≥ 3 (see, e.g., [7]), using the above reduction and applying Lemmas 1 and 2 also yields: Corollary 1. The decision version of MinRS is NPhard for any fixed positive integer q ≥ 4, where q is the allowed number of internal nodes.
4
Exact Algorithms for MinRS
4.1
A BruteForce Algorithm
We can solve the decision version of MinRS with a simple bruteforce algorithm as follows. • Let q be the allowed number of internal nodes. • Generate all possible trees having q nodes and for each one try all q n ways of attaching the n leaves in L to the q diﬀerent nodes. For each obtained tree, check if it is consistent with R in polynomial time. If at least one such tree exists then output “yes”; otherwise, output “no”. This yields: Theorem 2. For any given positive integer q, the decision version of MinRS can be solved in O∗ (f (q) · q n ) time, where f (q) is the number of rooted, unlabeled trees with q nodes. It is known that f (q) ∼ c · dq · q −3/2 , where c = 0.439924 . . . and d = 2.955765 . . . [13]. Thus, the algorithm runs in exponential time for q = O(1). 4.2
An ExponentialTime Algorithm for a Restricted Case of MinRS
The derivation of our main result in this section relies on the following variant of the tree separator theorem. A nonleaf child of a node v in a tree is a child of v which is an internal node, and for any rooted tree T and node v in T , the notation Tv means the subtree of T rooted at v. Lemma 3. Let T be a rooted tree with n leaves. There is a node v such that the subtree Tv contains strictly greater than n2 leaves but for each nonleaf child w of v, the subtree Tw has at most n2 leaves. Proof. We start from the root of T and perform the following procedure. If the root satisﬁes the condition then we set v to it and stop. Otherwise, we set v to the child of the root with the largest number of leaves and iterate the procedure for Tv . Note that whenever a new iteration is applied to Tv then Tv has to have more than n2 leaves. It follows from the ﬁniteness of T that eventually a node v satisfying the condition will be found.
270
J. Jansson, R.S. Lemence, and A. Lingas
We now use Lemma 3 to design a 2O(n log k) time procedure for the variant of MinRS where every internal node is allowed to have at most k nonleaf children. The procedure is recursive. We enumerate all partitions of the leaf set L corresponding to the condition in Lemma 3. Then, we recursively apply the procedure on the resulting leaf subsets, possibly augmented by a dummy leaf, modifying the rooted triplets accordingly. A partition Q corresponding to the condition in Lemma 3 has two levels. See Fig. 2. Firstly, it splits the set L of leaves into a set L corresponding to Tv of size strictly greater than n2 and its complement L \ L corresponding to T \ Tv . Secondly, Q splits L into k ≤ k sets L1 , . . . , Lk corresponding to the nonleaf children of v in the condition, each of the sets of size at most n2 , and a number of singletons corresponding to the leaves pending on v.
T ’’  L \ L’  < n/2
a
T 1’
T k’’
L’1  < n/2
 L’k’  < n/2
Fig. 2. According to Lemma 3, T has a node whose removal would divide the leaf set L into a subset L containing strictly more than n2 leaves and its complement L \ L , and L would be further partitioned into subsets L1 , . . . , Lk of at most n2 leaves each as well as a number of singletons.
If there is a rooted triplet xyz where x, z ∈ L and y ∈ L \ L then we can disregard Q. On the other hand, if x, y ∈ L and z ∈ L \ L then xyz is satisﬁed by Q and the triplet can be disregarded. As for the sets L1 , . . . , Lk and the remaining leaf singletons, for each rooted triplet of the form xyz where x, y, z ∈ L , if x, y are not in the same set Ll then we can also disregard Q. Otherwise, we augment L \ L by a dummy leaf a and for each rooted triplet of the form xyz where x, z ∈ L \ L and y ∈ L , we form the rooted triplet xaz. Analogously, for each rooted triplet of the form xyz where x, y ∈ L \ L and z ∈ L , we form the rooted triplet xya. For each such remaining partition Q, we run our procedure recursively on L \ L ∪ {a} with the original set R of rooted triplets restricted to L \ L and the set of additional rooted triplets containing the dummy leaf a. Let T be the tree returned by the procedure.
The Complexity of Inferring a Minimally Resolved Phylogenetic Supertree
271
We run also our procedure on each of the sets L1 , . . . , Lk obtaining trees Then, we make the trees as well as the singleton leaves children of the leaf a in the tree T , and put the resulting tree on a candidate list. Finally, we return the tree on the candidate list which has the smallest number of internal nodes. The correctness of our procedure follows from Lemma 3 and the fact that we can join T with T1 , T2 , . . . , Tk in the described way at the dummy leaf a. The additional rooted triplets with a representing any leaf in L satisﬁed by T make the join possible. Let us estimate the time complexity T (n) of our procedure in terms of the number of leaves n. Note that the number of rooted triplets is O(n3 ). The number of partitions considered and the time needed to generate them are trivially O((k+ 2)n ) = 2O(n log k) . Each of the at most k + 1 recursive calls is applied to a set of leaves of size at most n2 . Thus, the total time complexity of processing the n partitions is 2O(n log k) ((k+1)T ( n2 )+nO(1) ). By the inequality 2αn log k 2c( 2 ) log k ≤ 2cn log k for c ≥ 2α, k ≥ 2, and n ≥ 3, we obtain T (n) = 2O(n log k) . T1 , T2 , . . . , Tk .
Theorem 3. The problem of constructing a minimally resolved tree consistent with a set R of rooted triplets on a leaf set L under the restriction that each node has at most k nonleaf children, where k ≥ 2, is solvable in 2O(n log k) time. Any tree with n leaves which is consistent with R can easily be converted into a tree consistent with R where each node has at most k nonleaf children by increasing the number of internal nodes by an O(logk n) multiplicative factor. (Simply connect each internal node v to its nonleaf children Cv via a kary tree of depth O(logk n) having Cv as leaves.) Hence, we obtain the following corollary. Corollary 2. MinRS can be approximated within a O(logk n) factor in time 2O(n log k) .
5
Concluding Remarks
Recall that at each recursion level, the BUILD algorithm of Aho et al. [1] partitions the leaf set into blocks by computing the connected components in the auxiliary graph, and then represents each block by one node in the tree. A simple idea to reduce the number of internal nodes in the tree produced by BUILD is to merge blocks while ensuring that no rooted triplets are violated as follows: Proceed as in BUILD, but after computing the blocks (i.e., the connected components in G(L )), construct an undirected graph H whose vertices are the blocks and where {A, B} is an edge in H if and only if R contains some rooted triplet of the form xyz where either x, y ∈ A and z ∈ B, or x, y ∈ B and z ∈ A. Compute a minimum coloring of H and merge all blocks whose vertices in H received the same color. Then, continue the execution of BUILD.
272
J. Jansson, R.S. Lemence, and A. Lingas
The above step can be implemented in O∗ (2j ) time by applying an exact algorithm for Chromatic Number [3], where j is the number of vertices in H. Summation over all recursive calls yields a total running time of O∗ (2n ). An interesting question is if this method minimizes the number of internal nodes, i.e., whether or not it always gives an optimal solution for MinRS.
Acknowledgments The authors would like to thank Sylvain Guillemot and WingKin Sung for some helpful comments.
References 1. Aho, A.V., Sagiv, Y., Szymanski, T.G., Ullman, J.D.: Inferring a tree from lowest common ancestors with an application to the optimization of relational expressions. SIAM Journal on Computing 10(3), 405–421 (1981) 2. BinindaEmonds, O.R.P.: The evolution of supertrees. TRENDS in Ecology and Evolution 19(6), 315–322 (2004) 3. Bj¨ orklund, A., Husfeldt, T.: Exact graph coloring using inclusionexclusion. In: Kao, M.Y. (ed.) Encyclopedia of Algorithms, p. 289. Springer Science+Business Media, LLC, Heidelberg (2008) 4. Bryant, D.: Building Trees, Hunting for Trees, and Comparing Trees: Theory and Methods in Phylogenetic Analysis. PhD thesis, University of Canterbury, Christchurch, New Zealand (1997) 5. Byrka, J., Guillemot, S., Jansson, J.: New results on optimizing rooted triplets consistency. Discrete Applied Mathematics 158(11), 1136–1147 (2010) 6. Chor, B., Hendy, M., Penny, D.: Analytic solutions for three taxon ML trees with variable rates across sites. Discrete Applied Mathematics 155(67), 750–758 (2007) 7. Garey, M., Johnson, D.: Computers and Intractability – A Guide to the Theory of NPCompleteness. W. H. Freeman and Company, New York (1979) ¨ L., Jansson, J., Lingas, A., Ostlin, A.: On the complexity of construct8. Gasieniec, ing evolutionary trees. Journal of Combinatorial Optimization 3(23), 183–197 (1999) 9. Henzinger, M.R., King, V., Warnow, T.: Constructing a tree from homeomorphic subtrees, with applications to computational evolutionary biology. Algorithmica 24(1), 1–13 (1999) 10. Holm, J., de Lichtenberg, K., Thorup, M.: Polylogarithmic deterministic fullydynamic algorithms for connectivity, minimum spanning tree, 2edge, and biconnectivity. Journal of the ACM 48(4), 723–760 (2001) 11. Jansson, J., Ng, J.H.K., Sadakane, K., Sung, W.K.: Rooted maximum agreement supertrees. Algorithmica 43(4), 293–307 (2005) 12. Kearney, P.: Phylogenetics and the quartet method. In: Jiang, T., Xu, Y., Zhang, M.Q. (eds.) Current Topics in Computational Molecular Biology, pp. 111–133. The MIT Press, Massachusetts (2002) 13. Otter, R.: The number of trees. Annals of Mathematics 49(3), 583–599 (1948)
The Complexity of Inferring a Minimally Resolved Phylogenetic Supertree
273
14. Page, R.D.M.: Modified mincut supertrees. In: Guig´ o, R., Gusfield, D. (eds.) WABI 2002. LNCS, vol. 2452, pp. 537–552. Springer, Heidelberg (2002) 15. Semple, C., Steel, M.: A supertree method for rooted trees. Discrete Applied Mathematics 105(13), 147–158 (2000) 16. Snir, S., Rao, S.: Using Max Cut to enhance rooted trees consistency. IEEE/ACM Transactions on Computational Biology and Bioinformatics 3(4), 323–333 (2006) 17. Zuckerman, D.: Linear degree extractors and the inapproximability of Max Clique and Chromatic Number. Theory of Computing 3(1), 103–128 (2007)
Reducing Multistate to Binary Perfect Phylogeny with Applications to Missing, Removable, Inserted, and Deleted Data Kristian Stevens and Dan Gusﬁeld Department of Computer Science University of California, Davis
Abstract. MultiState Perfect Phylogeny is an extension of Binary Perfect Phylogeny where characters are allowed more than two states. In this paper we consider four problems that extend its utility: In the Missing Data (MD) Problem some entries in the input are missing and the question is whether (bounded) values can be imputed so that the resulting data has a multistate Perfect Phylogeny; In the CharacterRemoval (CR) Problem we want to minimize the number of characters to remove from the data so that the resulting data has a multistate Perfect Phylogeny; In the MissingData CharacterRemoval (MDCR) Problem we want to impute values for the missing data to minimize the solution to the resulting CharacterRemoval Problem; In the Insertion and Deletion (ID) Problem insertion and deletion mutational events spanning multiple characters are also allowed. In this paper, we introduce a new general conceptual solution to these four problems. The method reduces kstate problems to binary problems with missing data. This gives a new conceptual solution to the multistate Perfect Phylogeny problem, and conceptual solutions to the MD, CR, MDCR and ID problems for any k signiﬁcantly improving previous work. Empirical evaluations of our implementations show that they are faster and eﬀective for larger input than previously established methods for general k.
1
Introduction and Background
A current and central problem in the study of evolution concerns the reconstruction of a sample’s evolutionary history in the form of a phylogenetic tree. Extant organisms (taxa) correspond to the tree leaves, while internal nodes correspond to hypothetical ancestral taxa. Each node is labeled with a series of features or traits in the form of characters. Each character takes on one of several possible states. Each edge in the tree describes a mutational event. Under a commonly used model of evolution, the infinitesites model of population genetics, characters are binary and only mutate once in the history of the sample. Phylogenetic reconstruction under this model is referred to as the Perfect Phylogeny problem (PP) and can be solved in linear time [5]. V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 274–287, 2010. c SpringerVerlag Berlin Heidelberg 2010
Reducing Multistate to Binary Perfect Phylogeny with Applications
1,2,1
Taxa
Characters 1 1 2 2 3
2 3 1 3 3
275
1,3,3
1,3,1
1 3 1 2 1
2,3,1
2,3,2
2,1,1
3,3,1
Fig. 1. A Perfect Phylogeny for a 3state matrix M with 3 characters from [4]. Extant taxa (square) are given in M and ancestral taxa (rounded) are inferred.
This paper concerns an important generalization of the binary Perfect Phylogeny problem that relaxes the constraint on the number of states and the number of mutational events per character. Under the infinitealleles model of population genetics a character may take on up to kstates but the mutation that originates a state diﬀerent from the root occurs only once in the sample’s evolutionary history. This mutational constraint is referred to as convexity, which we will more formally deﬁne. In the biological literature, violating convexity is referred to as homoplasy. We refer to the phylogeny under this model as a kstate Perfect Phylogeny. Historically this problem has been motivated by qualitative data mostly of morphological origin. However, today informative multistate data of molecular and genomic origin is widely available. We are given a matrix M of input data for m characters on n taxa. We will use c to denote a particular character, Ac to denote the set of observed states for c, and α to denote a particular state in Ac . We use t to denote the length m vector of states corresponding to a particular taxon, and c(t) denote the state of c for taxon t. Similarly, we use c(v) to denote the state of c for node v in a tree. We use the symbol ? to represent that the state is unknown. A character is said to be incomplete if it c(t) = ? for some extant taxon, otherwise it is complete. To denote the set of taxa labeled with state α of character c we use c(α). Definition 1 (kState Perfect Phylogeny). Assume Ac  ≤ k for every character c in M , a kstate Perfect Phylogeny for M is a tree T with n leaves, where each leaf is labeled by a distinct taxon t in M . Each internal node of T is labeled by a distinct taxon t, which might not appear in M , where c(t) ∈ Ac for each character c. Furthermore, all characters must satisfy the following convexity requirement on T . A character c is convex with respect to T , if for every state α in Ac , the subgraph induced by the nodes labeled with α is a connected subtree of T which we denote as Tc(α) . Figure 1 shows an example 3state Perfect Phylogeny. The kState Perfect Phylogeny problem is to ﬁnd and construct a kState Perfect Phylogeny for M or determine there is none. If neither k nor n nor m is ﬁxed, so k may grow with n, then the kstate Perfect Phylogeny problem is NPcomplete [18]. In contrast, if k is any ﬁxed integer, independent of n and m, then the kstate Perfect Phylogeny Problem can be solved in time that is polynomial in n and m [1,11,12].
276
K. Stevens and D. Gusﬁeld
In this paper we consider the following four variants that extend the biological utility of the basic kstate Perfect Phylogeny model. Missing Data Problem (MD). In this realistic variant, some of the characters are incomplete. For an m × n input matrix M with incomplete characters, a fill is a setting of the missing values that replaces each ? of every character c with a state in Ac . We are interested in determining if any ﬁll of the missing values of M gives data with a kstate Perfect Phylogeny. We will refer to such a ﬁll as a convex fill. The MD problem is motivated by the reality of missing entries in biological datasets. In many phylogenetic applications, missing data in the 30% range is not uncommon. While genotyping platforms usually produce missing data at a rate less than 10%, metagenomic and populationgenomic applications using whole genome shotgun for obtaining genotypes can have very high missing data rates. We will show the method presented here can handle missing entries at substantially higher rates than those considered in [6]. Even for binary data this problem is NPcomplete, although the directed version of it can be solved in polynomial time [14]. The problem we address here has the biologically meaningful and computationally challenging constraint that missing values be selected from the set of observed states. The MD problem has a simple formulation if O(n) additional states can be assigned [16]. Solutions to the binary MD problem were shown in [7] using integer linear programming (ILP) and in [15] using a more specialized algorithm. A general solution for the kstate MD problem using chordal graph theory was shown in [6] but is practical for much smaller problems. Character Removal Problem (CR). If M has no missing entries and does not have a kstate Perfect Phylogeny, what is the minimum number of characters to remove so that the resulting matrix does have a kstate Perfect Phylogeny? Even for binary data this problem is NPcomplete. Missing Data Character Removal Problem (MDCR). If M contains missing entries and does not have a kstate Perfect Phylogeny, how should the missing values be set in order to minimize the solution to the resulting CR problem? Another way of looking at the objective function is to minimize the number of characters removed such that the resulting MD problem has a Perfect Phylogeny. The aforementioned CR and MDCR problems are motivated by the common practice in phylogenetics of removing characters when the existing data does not ﬁt the Perfect Phylogeny model. This is most often done when the data is binary, but the problem and practice also arise for nonbinary data [4,6]. An ILP formulation to the CR problem for the speciﬁc cases of k=3, 4, 5 was presented in [6]. An ILP formulation to the binary MDCR problem was shown in [7] and for k=3 in [6]. Recently it was shown that the chordalgraph approach of [6] can be extended to the CR and MDCR problems for general k [8]. Here we present a new conceptually simple solution to the CR and MDCR problems for general k and a corresponding implementation that is eﬀective for large matrices.
Reducing Multistate to Binary Perfect Phylogeny with Applications
277
Insertions and Deletions (ID). Frequently in nature, molecular sequences will undergo insertion and deletion events, the eﬀect of which is to either insert a novel substring between two existing characters in a biological sequence or to delete an existing interval of characters from the sequence. We collectively refer to these intervals of spaces as indels, consistent with the fact that we do not know if one is caused by an insertion or a deletion, unless the known tree is rooted and the ancestral taxon is known. Indels can be used as phylogenetic characters. The importance of these characters to phylogenetic reconstruction arises from the fact that they occur frequently enough to be informative, and yet there is a wide acceptance that indels have a lower potential for homoplasy than do point mutations [13]. Both large and small indels are becoming a readily available source of mutational information from resequencing data. Indels are an example of the utility of our reduction for imposing restrictions on state transitions. Additional utility for restricted state transitions on multistate characters is shown in [2] for the gain and loss of characters in the evolution of gene structure.
2
Reducing kStates to Binary
In this section we formally present a central result of the paper on which the other results are based, that every instance of kstate Perfect Phylogeny can be reduced to an instance of binary Perfect Phylogeny with missing data. We now give an alternative deﬁnition of convexity for a character c with respect to a more general class of trees with labels only on the leaves. Given a leaflabeled tree T , a character c, and a state α of c, and let Ic(α) denote the minimal subtree of T that connects the set of leaves labeled by the taxa in set c(α). Then c is convex with respect to T if for any two states αi and αj in Ac , subtrees Ic(αi ) and Ic(αj ) are node disjoint. Any leaf labeled tree that satisﬁes this deﬁnition also has an internal labeling that satisﬁes our previous deﬁnition. The following lemmas directly follow from our two deﬁnitions of convexity and apply to the more general class of leaf labeled trees: Lemma 1 (Convexity). A character c is convex with respect to a leaflabeled tree T if for every unique pair of nodes in T labeled with the same state α of c, all labeled nodes on the unique path between them are labeled with state α or not = ?, labeled by a state. More formally, if vi , . . . vk . . . vj is a path on tree T , c(vi ) c(vj ) = ?, and c(vk ) = ? then c(vi ) = c(vj ) =⇒ c(vi ) = c(vj ) = c(vk ). Lemma 2 (Non Convexity). If vi , . . . vk . . . vj is a path on the leaflabeled tree T , c(vi ) = ?, c(vj ) = ?, c(vk ) = ?, and c(vi ) = c(vj ) but c(vk ) = c(vj ) then the character c is not convex with respect to T and T can not be Perfect Phylogeny for M . A state tree can be constructed for c from a completely labeled tree T by merging all nodes that have state α for each α ∈ Ac . A state tree can be constructed for c from a leaf labeled tree T by merging all nodes in the subtree with leaves labeled with state α for each α ∈ Ac .
278
K. Stevens and D. Gusﬁeld
Lemma 3 (State Tree). If a character c is convex with respect to a tree T , the state tree has exactly Ac  nodes, and each node corresponds to Tc(α) for any α in Ac . 2.1
Reducing kState Perfect Phylogeny to Binary Perfect Phylogeny with Missing Data
Given an instance of the kstate Perfect Phylogeny problem in matrix M we will derive a matrix M of binary characters such that a tree T can be labeled to be a Perfect Phylogeny for M if and only if it can also be labeled to be a Perfect Phylogeny for M . In Figure 2, we present our algorithm for reducing kstate problems which forms the basis of Theorem 1 and its subsequent proof. Theorem 1. Every instance of the kstate Perfect Phylogeny problem corresponds to an instance of the binary Perfect Phylogeny problem with missing data. M = ∅ FOREACH character c ∈ M FOREACH pair of states (αi , αj ) ∈ Ac such that αi < αj . FOREACH taxon t∈M ⎧ ⎪ ⎨ 0 if c(t) = αi c (t) = 1 if c(t) = αj ⎪ ⎩ ? otherwise Append c to M . ENDFOR ENDFOR ENDFOR Fig. 2. Algorithm: Convert kstate M to binary M
Proof. For the m × n kstate input matrix M and the binary matrix M , we denote the ﬁnite and countable space of all candidate trees with n leaves as T n . First we show that if a tree T ∈ T n can be a Perfect Phylogeny for M it can also be a Perfect Phylogeny for M . If T can be a Perfect Phylogeny for M then each character c in M is convex with respect to T and a state tree exists for c with respect to T . We now describe how to ﬁll each c in the expanded binary matrix M so that they will also satisfy the convexity condition with respect to T . For the state pair αi and αj corresponding to the binary character c , choose an arbitrary edge on the path between αi and αj in the state tree for c ∈ M and remove it. We then label all taxa t ∈ c where c (t) = ? as follows: If t appears in the component containing αi it is labeled with 0 otherwise if t appears in the component containing αj it is labeled with 1. Now we prove that the ﬁlled character c is convex by contradiction. If c was not convex then by Lemma 2 there must exist a path vi . . . vk . . . vj , where vi , vj , and vk are labeled with states, c (vi ) = c (vj ) = α, and c (vk ) = α. This would require that c(vk )
Reducing Multistate to Binary Perfect Phylogeny with Applications
279
be in the other component of the state tree, a violation of the convexity of c. This proves we can ﬁll in each c in such a way that is convex with respect to T . Next we show that if a tree T ∈ T n can not a Perfect Phylogeny for M it can also not be a Perfect Phylogeny for any ﬁll of M . If T can not be a Perfect Phylogeny for M then by Deﬁnition 1 there must exist a character c that is not convex. By Lemma 2 there must exist a path vi , . . . vk . . . vj , where vi , vj , and vk are labeled with states, such that c(vi ) = c(vj ) but c(vk ) = c(vj ). Without loss of generality, assume αi = c(vk ) and αj = c(vj ) and αi < αj . By the reduction algorithm there is a character c in M corresponding to the relabeling of αi as 0 and αj as 1. Because these states are ﬁxed, regardless of the ﬁll of c , the following will also hold c (vi ) = c (vj ) but c (vk ) = c (vj ) proving that c cannot be convex and T cannot be a Perfect Phylogeny for M . It remains to prove that if there is a Perfect Phylogeny for a ﬁll of M there always exists a Perfect Phylogeny for M . This also introduces the labeling algorithm for the missing taxa in M . Suppose there is a Perfect Phylogeny T for M . We will create a Perfect Phylogeny T for M where the unlabeled, undirected trees T and T are identical, and where the mapping from leaves of T to taxa of M is identical to the mapping from leaves of T to taxa of M. We start with the tree T , with each leaf only labeled by the taxon mapped to it. Next, for any character c of M and every state αi of c, label every leaf f of T with state αi of character c if and only if taxon f has state αi for character c, in M . Let Ic(αi ) be the induced subtree of T that spans the leaves with state αi for character c in M . We claim that for any character c and two states αi and αj of c, Ic(αi ) and Ic(αj ) do not intersect. If they do intersect at a node v in T , then consider character c in M corresponding to the state pair (αi , αj ) of c, and suppose αi < αj . Then all of the leaves with state αi for c in M will have state 1 for character c of M , and all of the leaves with state αj for c in M will have 0 for character c of M . But then the subtree of T that spans all of the leaves with state 1 for c will contain node v, as will the subtree of T that spans all of the leaves with state 0 for c , and so character c will not be convex in T . Hence Ic(αi ) and Ic(αj ) do not intersect in T . So, for each state α of each character c of M , label each of the nodes in Ic(α) with state α of c. To complete the labeling of T to create a convex ﬁll of M , let u be a node of T which is not labeled with a state for a character c. Do a breadth ﬁrst search in T from u until some node v is reached which is labeled by a state αk of character c, and label all of the nodes on the shortest path from u to v with state αk . Repeat until all of the nodes are labeled with a state of each character. The result is a Perfect Phylogeny T for M . The following corollary of Theorem 1 arises as a generalization for arbitrary k of the often practiced removal of redundant characters for binary data. Theorem 2 (kstate Character Redundancy). A character c contains redundant information and can be removed from M for the purposes of solving the Perfect Phylogeny problem if for every pair of states αi and αj in the set of allowed states Ac , the partitions c(αi ) and c(αj ) appear together in characters remaining in M .
280
K. Stevens and D. Gusﬁeld
Proof. When the reduction algorithm is applied to M , characters in M created by character c are created from remaining characters in M . 2.2
Extension to kState Perfect Phylogeny with Missing Data
Theorem 3. Theorem 1 can be extended to the case of incomplete characters. Proof. For an m × n input matrix M ◦ with incomplete characters, a ﬁll is a setting of the missing values, that independently replaces ?’s with states from Ac for every incomplete character c in M ◦ . The reduction algorithm from M to M applies without modiﬁcation to M ◦ . In Theorem 1 we established that if there is no Perfect Phylogeny for M there is no Perfect Phylogeny for M and this can be applied to all ﬁlls of M ◦ . In Theorem 1 we also established if there is a Perfect Phylogeny for M there is a Perfect Phylogeny for M and this can be applied toall ﬁlls of M ◦ . It remains to show that we cannot have a convex ﬁll for M and not M ◦ . By contradiction, suppose there is a convex ﬁll for M that results in a Perfect Phylogeny T . Because T is not a Perfect Phylogeny for M ◦ there must exist some character c ∈ M ◦ that is nonconvex with respect to T . We showed previously in Theorem 1 the existence of a nonconvex character in the ﬁll of M ◦ with respect to a tree T implies the existence of one or more non convex characters in M with respect to T violating Perfect Phylogeny. Hence if T is a Perfect Phylogeny for M it is also a Perfect Phylogeny for M ◦ and using the tree T and the labeling algorithm of Theorem 1, we can ﬁll the missing entries of M ◦ so that all characters are convex with respect to T .
3
Solving the MD Problem for Arbitrary k
In this section we will describe how to eﬀectively solve kstate MD and present our empirical results. To restate, our objective is to ﬁll the binary matrix M containing missing values in such a way that that it has a Perfect Phylogeny or note that it is not possible. This problem is NPhard, but it has previously been shown to be solvable in an eﬀective manner via ILP [7]. Before proceeding we ﬁrst note a wellknown necessary and suﬃcient condition for a Perfect Phylogeny on complete binary characters commonly referred to as the fourgamete condition. A gamete is an ordered state pair ci (tk ), cj (tk ) for characters ci and cj over taxon tk . Theorem 4 (SplitsEquivalence Theorem [3,16]). There is an tree for a collection of binary characters if and only if no pair of characters contain all four of the gametes {0, 0; 0, 1; 1, 0; 1, 1}. A pair of binary characters containing all four gametes is referred to as incompatible. Our objective is to ﬁll the matrix M in such a way that Theorem 4 is satisﬁed and no pair of characters is incompatible. We brieﬂy describe the program from the top level down.
Reducing Multistate to Binary Perfect Phylogeny with Applications
281
ILP Formulation. For each missing value in M , we create a variable Y (i, j) that indicates the imputed state in cell M (i, j). For each pair of characters (p, q) where, because of missing data, there is a potential for four gametes we have a variable C(p, q). For each of the missing gametes g in the character pair (p, q) we add a variable B(p, q, g) and an inequality that forces it to 1 for settings of the Y variables that create the missing gamete. We add an inequality for each C variable that forces it to 1 when all missing gametes are present as indicated by its corresponding B variables. The overall optimization objective is ﬁnd a setting of the Yvariables that minimizes the number of incompatible character pairs given by p,q∈M C(p, q). Early Termination and Problem Size Reduction Once the problem has been reduced to a binary matrix a number of eﬀective heuristics based on the four gamete condition can be applied to decrease the problem size or terminate if it is observed early that no Perfect Phylogeny exists. The heuristics below are repeatedly applied in succession until the binary matrix M can no longer be modiﬁed. Forbidden Gametes. We examine each pair of characters ci and cj in M where i < j. If a pair of columns contains the four gametes {0, 0; 0, 1; 1, 0; 1, 1} we may terminate early knowing no Perfect Phylogeny exists. Let ci (tk ), cj (tk ) be the gamete for taxon tk . If a pair of columns contains exactly three gametes then we can uniquely identify the remaining forbidden gamete fi , fj that must not appear if there is a Perfect Phylogeny for M . We apply the following two rules to impute missing values for each taxon tk : ci (tk ) equal to fi implies cj (tk ) must be 1 − fj cj (tk ) equal to fj implies ci (tk ) must be 1 − fi Logic similar to this has been previously used to impute missing values [9,15]. Character Nesting. For every unordered pair of characters ci and cj in M . If ci (αi ) ⊆ cj (αj ) and ci (1 − αi ) ⊆ cj (1 − αj ) for some αi ∈ 0, 1 and αj ∈ 0, 1 we can remove ci from M . To see this, consider a third character ck . After imputation, any setting of the missing values for cj and ck that results in fewer that four gametes can be used to compute a valid setting for ci with fewer that four gametes when paired with ck . In detail, the missing entries are set so that either ci is identical to cj or for every 1 in ci we have a 0 in cj and for every 0 in ci we have a 1 in cj . Taxon Nesting. For every unordered pair of taxa tk and tl in M . If ci (tk ) = ci (tl ) or ci (tl ) = ? for all 1 ≤ i ≤ m then tl can be removed from from M . To see this, for any pair of characters ci and cj the gamete for tl is either identical to the gamete for tk or it can be set to be identical to tk without increasing the total number of gametes in the character pair.
282
K. Stevens and D. Gusﬁeld
Table 1. Illustrative execution times for our implementation of kstate Perfect Phylogeny problems. We compare to the implementation alternative for general k using chordal graphs described in [6]. We report the median of 10 executions on a 2.8 GHz Intel Core 2 Duo with 8 Gb of memory. A dash “−” indicates an instance where the program did not terminate with a result. Problem Size Missing = 0% Missing = 25% Missing = 50% chars×taxa MD MD CR MD MD imput. MDCR MD MD imput. MDCR states [6] k → 2 k → 2 [6] k → 2 error k → 2 [6] k → 2 error k → 2 100 × 100 k=3 6.7s 0.0s 0.1s 6.9s 0.0s 1.6% 0.1s 13s 0.0s 2.7% 0.1s k=5 10s 0.1s 0.3s 9.8s 0.1s 1.9% 0.3s 75s 0.1s 4.0% 0.2s k = 10 25s 0.2s 2.1s 1m3s 0.6s 5.0% 1.9s − 0.8s 7.8% 1.3s 100 × 200 k=3 1m14s 0.1s 0.3s 1m21s 0.1s 1.3% 0.3s 2m09s 0.1s 2.1% 0.2s k=5 1m34s 0.5s 1.2s 2m12s 0.4s 2.2% 1.0s − 0.3s 3.4% 0.7s 200 × 400 k=3 − 0.6s 1.4s − 0.5s 0.5% 1.3s − 0.5s 0.9% 1.1s k=5 − 4.4s 9.1s − 3.7s 1.0% 9.6s − 2.6s 1.3% 5.6s 1000 × 1000 k=3 − 20s 45s − 18s 0.1% 42s − 17s 0.2% 34s k=5 − 2m22s 5m48s − 2m16s 0.2% 5m7s − 1m36s 0.3% 4m0s
Trivial Characters. Characters that do not contain more than one 0 or more than one 1 can be set in such a way that there is only one 0 or one 1. Such a character can never contain all four gametes when paired with any other character. These trivial characters are removed from M for later reinsertion if a Perfect Phylogeny is found. Empirical Results. Multistate data was simulated with R. Hudson’s ms program [10] using an application developed in [6] for converting instances of k = 2 to realistic instances where k > 2 both with and without Perfect Phylogenies. Table 1 presents our results and compares them to the alternative method for general k introduced in [6]. A few trends are noteworthy. In comparison to the method for solving kstate MD described in [6] based on chordal graphs, our implementation is faster and eﬀective for much larger problems. We increasingly outperform the alternative method as the size of the matrix and the amount of missing data increases. The space requirements of the alternative method rapidly increase with the number of states and the amount of missing data eventually exhausting available resources. Both methods slow down for a matrix of ﬁxed size as the number of states k increases. We also include the error rate for imputed states as an indication of how this method might perform when used to impute missing values when the data originates from a tree. The results indicate that the ability to recover the correct state is diminished as the number of states increases, the number of characters decreases, and the amount of missing data increases.
4
Solving the CR and MDCR Problems for Arbitrary k
Our reduction allows us to adapt, to the case of general k, the ILP formulation for the binary CR and MDCR problems introduced in [7].
Reducing Multistate to Binary Perfect Phylogeny with Applications
283
ILP Formulation. D(i) is a binary variable used to indicate whether or not character ci in M will be removed. For each pair of characters (p, q) that is already incompatible we add the inequality D(p) + D(q) ≥ 1 which requires at least one of them be removed. For each pair of characters (p, q) where, because of missing data, there is a potential for incompatibility we add the inequality D(p) + D(q) − C(p, q) > 0. This forces either D(p) or D(q) to 1 if missing values are imputed such that the pair is incompatible as indicated by a value of 1 for C(p, q). Next we formalize the concept of a character group G. In the reduction from M to M each kstate character ci in M creates a group Gi of up to k2 binary characters in M . Instead of minimizing the number of characters from M being removed, we are interested in minimizing the number of character groups associated with binary characters removed from M . For each character group Gi we create a variable G(i) that will be forced to 1 if any of its associated binary characters are removed from M . To do this we use an inequality that is essentially a logical OR: G i G(i) ≥ j∈Gi D(j). The overall objective function for the ILP is to minimize i∈M G(i). The setting of the G(i) variables tell us which characters to remove from M . The taxon nesting and trivial character heuristics for reducing the problem size can be applied as described in Section 3. The remaining two heuristics described in Section 3 are not applied because it is not known which characters will ultimately be present in the subsequent MD problem. Because not all the reduction tools are available, the resulting size of an MDCR ILP is much larger in practice than a comparable MD ILP. Most of the size of an MDCR ILP comes from B and C inequalities associated with potential pairwise incompatibilities. For instance, in our empirical results for 5 state 100x100 MDCR ILPs these inequalities always account for over 95% of its total size. This allows us to use an eﬀective approach for determining the optimal solution to large MDCR problems utilizing our ability to quickly solve problem MD. Recall that the MDCR problem is to ﬁnd the minimum number of characters to remove from M such that the resulting matrix has a Perfect Phylogeny as determined by problem MD. We also note that a solution to a relaxed MDCR minimization problem provides a lower bound on the number of characters that must be removed as well as a candidate list of characters to remove. Rather than solve the full MDCR ILP, we successively solve more constrained relaxations of the full MDCR ILP. To generate a relaxed MDCR ILP we impose a minimum cutoﬀ q on number of gametes observed in a pair of characters before the associated B and C inequalities for that pair are generated. We can test if a candidate list of removal characters is an optimal solution using our approach to problem MD. We decrease q from 4 to 0, applying successively greater constraint, until we verify a solution is optimal. Empirical Results. Illustrative total execution times are given in Table 1. Strikingly the times are of the same order of magnitude as the corresponding MD problems. The rate of homoplasy was set so that roughly 10% of the characters
284
K. Stevens and D. Gusﬁeld
were removed in the optimal solution. Asserting the validity of our approach, the program only went below the cutoﬀ q = 3 in the case of 10 states with 25% or more missing data.
5
Insertions and Deletions as Phylogenetic Characters
In the kstate Perfect Phylogeny problem with Insertions and Deletions (ID) we are given data with indels and want to construct a Perfect Phylogeny or determine that one does not exist, considering the indels as phylogenetic characters. The locations of insertions or deletions are ultimately revealed in a multiple alignment of the sequences. In this setting insertions and deletions are identically coded as a contiguous interval of spaces ’’ in the taxa that do not contain the inserted or deleted characters. Figure 3 shows a data matrix containing indels encoded by spaces derived from a hypothetical multiple alignment, where identical characters have been removed. Such a matrix is the input to problem ID. If each space in an indel is treated as an independent character, rather than considering the contiguous interval of spaces as a one single character, then common ancestry will be incorrectly inferred when two indels overlap. For an example of this see character 2 in Figure 3. To address this problem, Simmons and Ochoterena describe an encoding of indels using multistate characters (MCIC) that is maximally informative for phylogenetic construction by parsimony [17]. However, a multistate character alone is not enough to represent all the phylogenetic information, and MCIC provides additional information to the phylogenetic reconstruction algorithm in the form of a transition matrix. Six rules that implement the MCIC encoding for all situations with up to 3 overlapping indels are described in [17]. We present here a more rigorous multistate encoding of indels for the ID problem that captures all the phylogenetic information in the MCIC model. Our multistate encoding is simple to describe and implement. Moreover through reduction we will ultimately derive a binary encoding and demonstrate an equivalency between binary and multistate encodings under the Perfect Phylogeny model. We show that one additional binary character per indel is a suﬃciently informative encoding for the Perfect Phylogeny problem and that Perfect Phylogeny with indels is inherently a missing data problem. Finally, we provide a method for obtaining the optimal solution that explicitly handles the missing data. We are given a matrix M of nonredundant characters where some entries contain spaces ’’. We can assume, because of their low homoplasy, that the interval of spaces is unique to each indel event. To encode indels as multistate characters, we ﬁrst assign each unique contiguous interval of spaces to a state α that is not yet present in M , and denote its interval as the set span(α). We then assign state α to the associated spaces in all taxa containing that indel. This corrects the problem that overlapping spaces incorrectly suggest shared ancestry. We note that even though the state α associated with a unique indel event may span multiple characters, we do not need to explicitly require that the state arise at the same location in the tree for all characters in span(α). If a
Reducing Multistate to Binary Perfect Phylogeny with Applications
285
Perfect Phylogeny exists, this constraint arises naturally from the edgeinduced partitions of the taxa. The tree will have n − 1 edges each corresponding to a unique subset of the taxa. Convexity ensures one edge must correspond to the set of taxa c(α) which is the same for all characters c in span(α). At this point we have a multistate Perfect Phylogeny problem, but we have not yet restricted the possible state trees for characters with indel states. For the most part, an indel should be a leaf in the state tree, since under the model a character does not exist before it is inserted or after it is deleted. The exception to this is when one indel contains another, an example of which is when one sequence of characters is inserted within another inserted sequence of characters. To be speciﬁc, one indel is said contain another indel, denoted by αi ⊃ αj , if span(αi ) ⊃ span(αj ). An indel state must be a leaf in the state tree or adjacent to an indel state in which it can be contained. This imposes a partial ordering restriction on the state tree. We can use the reduction presented in Figure 2 and apply postprocessing to the binary matrix M to accomplish the desired restrictions. 1 3 1 2 2 
2 1 2 
1 1 1
1 1 2 1
1 3 1 2 2 5
2 4 4 1 2 5
6 4 4 1 1 1
1 4 4 1 2 1
There are only two possible state trees for character 3 where indel state 4 must either be a leaf or attached to indel state 6 which it contains. 1
6
4
6
1
4
Fig. 3. For problem ID, an example of the original data, a multistate encoded matrix, and the state tree restrictions on character 3
We now describe our algorithm for reducing the search space using M . Recall that for any character c in M we have a corresponding character c in M and a pair of states αi and αj in Ac corresponding to ﬁlled taxa. We visit each character c in M where either αi or αj corresponds to an indel state. Without loss of generality, assume that αi is an indel state and that αi in c corresponds to 0 in c for all taxa c(αi ). We ﬁrst assume the simple case where αi is a leaf on the state tree and that by convexity all taxa not in c(αi ) can be set to 1 in c . We then examine each taxon t of character c to ﬁnd any containing indel states. If c(t) is an indel state which can contain αi , we set c (t) = ?. Theorem 5. kstate ID reduces to kstate MD. Proof. Note that the aforementioned algorithm can be implemented by modifying the matrix M as follows: For each unique indel state α we add a binary character cα indicating it’s presence or absence. Then we set cα (t) = ? for all taxa t with an indel that contains α. Finally, all spaces ’’ in M are set to ?. Both the original and modiﬁed matrices will reduce to the same matrix M . Discussion of the ID Results. We see that Problem ID must be posed as a missing data problem. The missing data in this case corresponds to the actual sequence of states that were deleted or inserted which, by the convexity
286
K. Stevens and D. Gusﬁeld
requirement, can be ﬁlled into the missing entries. Perhaps not surprisingly the additional binary characters introduced by indels into the reduced matrix correspond to a simple indel encoding (SIC) proposed by Simmons and Ochoterena as a less phylogenetically informative alternative to MCIC. By showing an equivalency between the binary and multistate encoding schemes, we clarify that this assertion does not apply under the Perfect Phylogeny model. Using this conceptually simple extension of our implementation of problem MD we provide a rigorous method of determining the optimal solution to problem ID for general k. We leave open the complete characterization of the associated MD, CR, and MDCR problems in the presence of indels.
Acknowledgements This research is supported in part by NIH grant R01HG002942 (KS) and NSF grants SEIBIO 0513910 (DG) and IIS0803564 (DG).
References 1. Agarwala, R., FernandezBaca, D.: A polynomialtime algorithm for the perfect phylogeny problem when the number of character states is ﬁxed. SIAM Journal on Computing 23(6), 1216–1224 (1994) 2. Alekseyenko, A.V., Lee, C.J., Suchard, M.A.: Wagner and dollo: a stochastic duet by composing two parsimonious solos. Syst. Biol. 57(5), 772–784 (2008) 3. Buneman, P.: The recovery of trees from measures of dissimilarity. Mathematics in the archaeological and historical sciences, 387–395 (1971) 4. Fern´ andezBaca, D.: The perfect phylogeny problem. In: Du, D.Z., Cheng, X. (eds.) Steiner Trees in Industries. Kluwer Academic Publishers, Dordrecht (2001) 5. Gusﬁeld, D.: Eﬃcient algorithms for inferring evolutionary trees. Networks 21(1), 19–28 (1991) 6. Gusﬁeld, D.: The multistate perfect phylogeny problem with missing and removable data: Solutions via integerprogramming and chordal graph theory. In: Batzoglou, S. (ed.) RECOMB 2009. LNCS, vol. 5541, pp. 236–252. Springer, Heidelberg (2009) 7. Gusﬁeld, D., Frid, Y., Brown, D.: Integer Programming Formulations and Computations Solving Phylogenetic and Population Genetic Problems with Missing or Genotypic Data. In: Lin, G. (ed.) COCOON 2007. LNCS, vol. 4598, p. 51. Springer, Heidelberg (2007) 8. Gysel, R., Gusﬁeld, D.: Extensions and Improvements to the Chordal Graph Approach to the Multistate Perfect Phylogeny Problem. In: Borodovsky, M., Gogarten, J.P., Przytycka, T.M., Rajasekaran, S. (eds.) Bioinformatics Research and Applications. LNCS, vol. 6053, pp. 52–60. Springer, Heidelberg (2010) 9. Halperin, E., Karp, R.: Perfect phylogeny and haplotype assignment. In: Proceedings of the eighth annual international conference on Resaerch in computational molecular biology, pp. 10–19. ACM, New York (2004) 10. Hudson, R.: Generating samples under a WrightFisher neutral model of genetic variation. Bioinformatics 18(2), 337–338 (2002)
Reducing Multistate to Binary Perfect Phylogeny with Applications
287
11. Kannan, S., Warnow, T.: Inferring evolutionary history from DNA sequences. In: Proceedings of 31st Annual Symposium on Foundations of Computer Science, pp. 362–371 (1990) 12. Kannan, S., Warnow, T.: A fast algorithm for the computation and enumeration of perfect phylogenies when the number of character states is ﬁxed. In: Proceedings of the sixth annual ACMSIAM symposium on Discrete algorithms, pp. 595–603. Society for Industrial and Applied Mathematics, Philadelphia (1995) 13. Lloyd, D.: Multiresidue gaps, a class of molecular characters with exceptional reliability for phylogenetic analyses. Journal of Evolutionary Biology 4(1), 9–21 (2002) 14. Pe’er, I., Pupko, T., Shamir, R., Sharan, R.: Incomplete directed perfect phylogeny. SIAM Journal on Computing 33(3), 590–607 (2004) 15. Satya, R., Mukherjee, A.: The undirected incomplete perfect phylogeny problem. IEEE/ACM Transactions on Computational Biology and Bioinformatics 5(4), 618– 629 (2008) 16. Semple, C., Steel, M.: Phylogenetics. Oxford University Press, USA (2003) 17. Simmons, M., Ochoterena, H.: Gaps as characters in sequencebased phylogenetic analyses. Systematic Biology 49(2), 369–381 (2000) 18. Steel, M.: The complexity of reconstructing trees from qualitative characters and subtrees. Journal of Classiﬁcation 9(1), 91–116 (1992)
An Experimental Study of Quartets MaxCut and Other Supertree Methods M. Shel Swenson1,2 , Rahul Suri1 , C. Randal Linder3 , and Tandy Warnow1 1
Department of Computer Science, The University of Texas at Austin 2 Department of Mathematics, The University of Texas at Austin 3 Section of Integrative Biology, The University of Texas at Austin
Abstract. Although many supertree methods have been developed in the last few decades, none has been shown to produce more accurate trees than the popular Matrix Representation with Parsimony (MRP) method. In this paper, we evaluate the performance of several supertree methods based upon the Quartets MaxCut method of Snir and Rao. We show that two of these methods usually outperform MRP and all other supertree methods we studied under many realistic model conditions. In addition, we show that the popular criterion of minimizing the total topological distance to the source trees is only weakly correlated with topological accuracy, and therefore that evaluating supertree methods on biological datasets is problematic.
1 Introduction Supertree methods comprise one approach to reconstructing large molecular phylogenies given a set (called a profile) of estimated trees (called source trees) for overlapping subsets of the entire set of taxa. Source trees are combined into a single supertree on the full set of taxa using various algorithmic techniques. Because of the computational difficulties in estimating large phylogenies, many computational biologists think that the only feasible strategy to estimating the Tree of Life will involve a divideandconquer approach where trees are estimated on subsets of taxa and a supertree method is used to assemble a tree on the entire taxon set from the source trees. While there are many supertree methods, only MRP is used regularly in supertree constructions on biological datasets (4); furthermore, no other supertree method has been shown to produce trees that are comparable in accuracy to MRP under the standard bipartition metric (5). One version of the supertree estimation problem uses quartet amalgamation methods. Each estimated source tree is encoded by an appropriately chosen subset of its induced quartet trees, and the set of quartets (the union of the chosen subsets for each source tree) is used to estimate a supertree. Quartet amalgamation methods can thus be used to assemble supertrees from source trees of arbitrary size. The Maximum Quartet Consistency (MQC) problem is a natural optimization problem, in which the input is a set of quartet trees and a supertree is sought that displays the maximum number of quartet trees. MQC is NPhard, and generally hard to approximate except in special cases (3; 15; 6; 11). Theoretical results and heuristics for the special case where the input set contains a tree on every quartet appear in (24; 20; 14; 16; 22). In a recent paper (21), Snir and Rao presented Quartets MaxCut (QMC), a heuristic for V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 288–299, 2010. c SpringerVerlag Berlin Heidelberg 2010
An Experimental Study of Quartets MaxCut and Other Supertree Methods
289
MQC that can be applied to arbitrary sets of quartet trees (i.e., ones that may not contain a tree on every quartet). Snir and Rao showed that by encoding the source trees as quartet trees, QMC could be used as a generic supertree method. They then constructed supertrees using this QMCbased supertree method for a number of biological supertree profiles. Since the true supertree was not known, they could not evaluate the topological accuracy of the supertrees they constructed; instead, they compared the QMC supertree to the source trees to produce two different average similarity measures for each supertree. A comparison between QMCbased supertrees and MRP supertrees showed that QMC had higher average similarity to the source trees under one criterion, and lower average similarity with respect to another. QMC’s failure to outperform MRP as a supertree method with respect to the average similarity to the source trees should not be considered a serious limitation for two reasons. First, average similarity to the source trees is not the same as accuracy with respect to the true tree (a phenomenon we investigate directly in this paper). Second, QMC depends critically upon the specific technique used to encode each source tree as a set of quartet trees. In other words, QMC might be producing highly accurate trees even though the average similarity is lower than MRP, and it might produce more accurate trees if other encodings of the source trees were used. In this paper, we report results from a study in which we employ several encodings of the source trees by quartet trees and apply QMC to the resultant sets of quartet trees. We compare the accuracy of QMC using different encodings to MRP and five other supertree methods: RobinsonFoulds Supertrees (1), QImputation (13), MinFlip (8; 7; 9), SFIT (10), and PhySIC (19). We find that the topological accuracy of QMC supertrees computed on different encodings varies substantially. Two QMCbased supertree methods, QMC(All) and QMC(Exp+TSQ) (differing only in how the source trees are encoded), perform similarly and outperform all the other supertree methods under many realistic model conditions, and have comparable accuracy under most others. However, MRP outperforms all QMC methods on the largest (1000taxon) datasets. Finally, we find that using topological similarity to source trees as a proxy for topological accuracy with respect to the true tree is of limited use, and can be misleading. Thus, evaluating supertree methods on biological datasets is problematic, and supertree methods that seek to minimize topological distance to source trees may not have the best accuracy.
2 Basics Supertree Datasets. Because of the taxon sampling strategies used by biologists, source trees tend to be focused either on intensively sampled, smaller subgroups, like big cats, or on larger, sparsely sampled groups, like all vertebrates. The first type is called a clade source tree, and the second type is called a scaffold. Supertree profiles include scaffolds to ensure sufficient overlap among the clade trees. The input to the supertree problem is a set of source trees, {t1 , t2 , . . . , tk }, on subsets of a set S of taxa. Source trees are often estimated using biomolecular sequence datasets. Each source tree is estimated on its aligned sequence dataset using computationally intensive methods–e.g., maximum parsimony or maximum likelihood heuristics like RAxML (23). A supertree method combines the source trees into a tree on the full dataset.
290
M.S. Swenson et al.
Matrix Representation with Parsimony. Matrix representation with parsimony (MRP) (2; 18) is currently the most widely used supertree method. It encodes source trees as a matrix of partial binary characters: all entries in the matrix are 0, 1, or ?, with each column in the matrix defined by a single edge in a source tree. The matrix is then analyzed using a heuristic for the NPhard maximum parsimony problem (12). Quartets MaxCut (QMC). QMC is a quartet amalgamation method, operating in polynomial time and providing no guarantees with respect to its optimization problem, MQC. The source trees are encoded by sets of quartet trees, and QMC is applied to the union of these sets. Quartet Encodings of Source Trees. Here, we explore several techniques for representing source trees by sets of quartet trees. Two of these techniques use random sampling strategies (21), which are based upon computation of the topological distance between leaves in the source tree. The topological diameter of a quartet tree q with respect to a source tree t is the maximum of its leaftoleaf topological distances within the source tree and is denoted diamt (q). The quartet encoding strategies used in (21) also include calculation of the TopologicallyShort Quartet (TSQ) trees, defined as follows: For each edge in a source tree, pick the topologically nearest leaves in each of the subtrees around the edge. If two or more leaves within a subtree have the same topological distance to the edge, pick all such leaves. The set of quartet trees formed by picking one such leaf from each subtree forms the TSQs around that edge. The union of all these is the set of TSQ trees. We tested five strategies for encoding a source tree t by a set of quartet trees: All quartets: include all induced fourtaxon trees. kshort: a generalization of the TSQs: for each edge in a source tree, pick the k topologically nearest leaves in each of the subtrees around that edge. The (approximately) k 4 quartets of leaves are the kshort quartet trees around that edge, and the set of all such kshort quartet trees (unioning over all the internal edges) forms the set kshort. In this study, we let k = 5 and k = 25. Geo+TSQ: include a quartet q with probability d−3 where d = diamt (q), and add the TSQ trees (this was studied in (21)). Exp+TSQ: compute the topological distance between every pair of leaves, include a quartet with probability 1.5−d where d = diamt (q), and add the TSQ trees (this was also studied in (21)).
3 Performance Study We performed a study using simulated datasets to evaluate QMCbased supertree methods in comparison to MRP and other supertree methods. Simulations are used to evaluate phylogeny estimation methods, because the true tree is known exactly. For our simulations, we used the SMIDGen (25) methodology, and used datasets with 100, 500 and 1000 taxa. We used SMIDGen to produce supertree datasets of mixed source trees, consisting of one scaffold dataset (produced by a random selection of taxa from the entire dataset) and many cladebased datasets (focused, dense taxon sampling within a rooted subtree).
An Experimental Study of Quartets MaxCut and Other Supertree Methods
291
Simulation Study Design: For this study, we used simulated datasets generated for another study (25), and, therefore, describe the methodology only in brief. The simulated datasets are produced by simulating evolution under a GTR+Gamma+I process, down purebirth model trees, deviated from a clock, and containing up to 1000 leaves. We generated 30 replicates for each 100 and 500taxon model condition, and 10 replicates for each 1000taxon model condition. Each model condition is indicated by the density of the scaffold dataset, which is the percentage of the entire taxon set in the scaffold dataset, with scaffold densities ranging from 20% to 100%. We used RAxML (23) to estimate phylogenetic trees. We performed the MP search in the MRP analyses, using a very effective heuristic search technique called the Ratchet (17), and computed a greedy consensus (gMRP) tree for the set of most parsimonious trees found during this search. We also computed supertrees based upon five ways of encoding the source trees as sets of quartet trees and then applying QMC, as described above. Finally, we computed supertrees using several other methods, including Qimputation (QImp), RobinsonFoulds Supertrees (RFS), MinFlip, SFIT, and PhySIC, all in their default settings. For RFS, MinFlip, and PhySIC, methods that require rooted trees, we used midpoint rooting to root the source trees, a method commonly used to root unrooted trees and particularly appropriate because our source trees were not strongly deviated from ultrametricity. We computed three types of topological error rates for each estimated supertree when compared with the model tree: false positive rates, false negative rates, and RobinsonFoulds rates. We also computed the total topological distance of each supertree to the estimated source trees, using FN (false negative), FP (false positive) and RF (bipartition distance) errors modified so that we could handle trees on different taxon datasets. We restricted the supertree to the subset of taxa for the source tree, and then compute the topological distances between the two trees. We note that the bipartition distance, also known as the “RobinsonFoulds” (RF) distance, is the standard metric used in most studies. In our study, we show both FN and FP as well, thus providing a more nuanced description of error. Because QMC failed to return trees on some inputs, we restricted our results to datasets for which all the reported methods returned trees. This reduced the number of replicates for some model conditions. We also recorded the running time of each method on each dataset. Because the analyses were run under Condor (a distributed software environment (26)), running times (for the larger datasets, especially) are inexact and are larger than if they had been run on a dedicated processor. Running times are, therefore, an approximation of the time needed to perform these analyses.
4 Results 4.1 Exploring QMC under Different Source Tree Encodings We compared the performance of the QMC variants and gMRP (Fig. 1). For a given model condition, we include only those methods that successfully completed on at least one third of the replicates, and display results for only those replicates on which every selected method successfully completed. We report performance with respect to FN rates, but the performance with respect to FP and RF rates is almost identical.
292
M.S. Swenson et al.
number of taxa: 100
0.5
number of taxa: 500
number of taxa: 1000
0.4
method
0.3 FN rate
QMC(5short) QMC(Geo+TSQ) QMC(25short) gMRP QMC(Exp+TSQ) QMC(All)
0.2
0.1
20
50
75
100 20
50 75 scaffold factor
100 20
50
75
100
Fig. 1. Average topological error (False Negative (FN) rates) with standard error regions on mixed sourcetree datasets. We use shaded regions in place of standard error bars as it better demonstrates overlap; however, the shading between data points for a method is not intended as an interpolation of error for scaffold factors not tested. Results are reported for the QMC variants and gMRP, as a function of the scaffold factor and by number of taxa. Points are graphed for a method if it had at least six datasets that completed in common with all other methods.
On the mixed 100taxon datasets, QMC(All) and QMC(Exp+TSQ) were essentially tied as the best methods, followed by gMRP. Furthermore, QMC(All) and QMC(Exp+ TSQ) had the greatest advantage over gMRP for the sparse scaffold cases. The other QMC variants had worse accuracy. On a large number of the 500 and 1000taxon datasets, many of the QMC variants failed to complete, indicating that computational requirements can limit QMC’s utility. On the 500taxon datasets for which QMC(Exp+ TSQ) could be run, it produced topologically more accurate trees than gMRP, giving the biggest advantage on the sparse scaffold datasets. For the 1000taxon datasets, gMRP outperformed all the QMC variants that completed. However, most QMC variants failed to return trees on most inputs. 4.2 Comparing QMC(Exp+TSQ) to Other Supertree Methods We compared QMC(Exp+TSQ) to six other supertree methods: gMRP, QImp, SFIT, MinFlip, PhySIC, and RobinsonFoulds Supertrees (RFS). All of these methods could be run on the 100taxon datasets, but some failed to run on the larger datasets. For this reason, we obtained results for all seven methods on the 100taxon datasets, but only five methods on the 500taxon datasets (where SFIT and QImp failed to run, due to computational limitations), and only four methods on the
An Experimental Study of Quartets MaxCut and Other Supertree Methods
number of taxa: 100
number of taxa: 500
293
number of taxa: 1000
0.4
0.3 method
FN rate
SFIT MinFlip RFS gMRP QImp QMC(Exp+TSQ)
0.2
0.1
20
50
75
100 20
50 75 scaffold factor
100 20
50
75
100
Fig. 2. We report False Negative (FN) rates (means with standard error regions) for QMC (Exp+TSQ), gMRP, SFIT, MinFlip, RFS, and QImp, as a function of the scaffold factor, for 100, 500 and 1000taxon model conditions
1000taxon datasets (where we did not try to run PhySIC, since it was computationally intensive for the 500taxon datasets). In addition, QMC(Exp+TSQ) failed to run on some datasets; we therefore only report results for those datasets on which all reported methods were able to run. PhySIC gives by far the worst results, producing completely unresolved trees except when the scaffold density is 100%, at which point it produces results that are still worse than the other methods. Because of it is not competitive with other methods, we omit PhySIC from our graphs. The experiments show that three methods–QMC(Exp+TSQ), QImp, and gMRP– generally outperform the remaining methods with respect to topological accuracy (Fig. 2). As with Fig. 1, in Fig. 2 we only include results for replicates for which all displayed methods were able to complete. Since Fig. 2 includes a different collection of methods, the results for a different collection of replicates are used. On the 100taxon datasets, QMC(Exp+TSQ) and QImp both gave higher accuracy than gMRP and all other methods (except on the 100% scaffold datasets, where they were equal to gMRP). On the 500taxon datasets with sparse scaffolds, QMC(Exp+TSQ) performed better than all methods, with only a slight advantage over gMRP. On the 500taxon datasets with dense (75% and 100%) scaffolds, QMC(Exp+TSQ) and gMRP were the most accurate, and had essentially the same accuracy. On the 1000taxon datasets, gMRP had an advantage over QMC(Exp+TSQ) and other methods, and QMC(Exp+TSQ) failed to run on the dense scaffold datasets (QMC fails to run on profiles with large source trees, due to computational reasons). The remaining methods–PhySIC, SFIT, MinFlip,
294
M.S. Swenson et al.
and RFS–are generally less accurate than QMC(Exp+TSQ), QImp, and gMRP, and some (i.e., PhySIC and SFIT) cannot be run on large datasets. Interestingly, RFS outperforms QMC(Exp+TSQ) on the 1000 taxon datasets, where it matches the accuracy on the sparse scaffold datasets and (unlike QMC(Exp+TSQ)) is able to run on the dense scaffold datasets. 4.3 Evaluating Supertree Methods on Biological Datasets For biological datasets, the true tree is not available, so evaluations of accuracy have tended to use average or total topological distance to the source trees (for example, (1; 21)). To test whether this is a good proxy for the quality of the supertree, we computed three distances for each supertree T to the profile T of source trees:
(FN(T,t))
, where – SumFN is defined as follows: SumFN(T, T ) = t∈T M FN(T, t) is the number of edges in t that do not appear in T , and M = t∈T mt , where mt is the number of internal edges in t. – SumFP and SumRF are defined similarly, with FP(T, t) and RF(T, t) replacing FN(T, t), respectively. Here, FP denotes the false positive distance and RF denotes the RobinsonFoulds (“bipartition”) distance. Each distance is normalized to produce a value between 0 and 1. The false positive distance between a supertree T and a source tree t in the profile T is the number of edges in T that do not appear in t, and the RobinsonFoulds distance is the total number of missing and false positive edges. Note that if the supertree and all source trees are binary, then for each source tree t, RF(T, t) = 2FN(T, t) = 2FP(T, t), and after normalization all three distances are equal. We examined how closely measurements of this sort are correlated to actual topological accuracy, that is, how closely SumFN, SumFP, or SumRF are correlated to the FN, FP or RF distance to the true tree. We found the correlations to be largely independent of the choice of topological distance to source trees (SumFN, SumFP, or SumRF) or topological error (FN, FP or RF). The reason for this was that the true supertree was fully resolved or nearly so, and all the computed supertrees were either fully resolved or nearly so. We therefore present results focusing on the correlation between SumFN (topological distance to the source trees) and FN (topological distance to the true tree). To assess whether SumFN, SumFP or SumRF is a good optimality criterion, we calculated Spearman rankcorrelations for each of the 100taxon simulated datasets for the six supertree methods that consistently perform reasonably well (MinFlip, gMRP, QImp, QMC(All), QMC(Exp+TSQ), and RFS). Correlations were calculated for each of these measures of distance to source trees and each of FN, FP and RF (calculated by comparing the supertree estimated by each of the methods with the true tree). The statistics were calculated this way to test whether the rankorder of the topological distances to source trees correlated strongly with the true rankorder of the supertrees, in terms of topological accuracy with respect to the true tree.
An Experimental Study of Quartets MaxCut and Other Supertree Methods
295
Table 1. Results of Spearman rankorder correlations of SumFN, SumFP, and SumRF with the true FN, FP, and RF measures of supertrees estimated using six supertree methods FN scaffold optimality factor criterion SumFN 25 SumFP SumFN SumFN 50 SumFP SumRF SumFN 75 SumFP SumRF SumFN 100 SumFP SumRF
mean 0.401 0.421 0.406 0.544 0.546 0.546 0.593 0.593 0.593 0.447 0.447 0.447
range 0.890, 0.939 0.890, 0.939 0.890, 0.939 0.203, 1.000 0.143, 1.000 0.143, 1.000 1.000, 0.986 1.000, 0.986 1.000, 0.986 0.789, 1.000 0.789, 1.000 0.789, 1.000
FP mean 0.376 0.421 0.395 0.536 0.539 0.539 0.589 0.589 0.589 0.447 0.447 0.447
range 0.890, 0.926 0.890, 0.926 0.890, 0.926 0.348, 0.971 0.257, 0.971 0.257, 0.971 1.000, 0.986 1.000, 0.986 1.000, 0.986 0.789, 1.000 0.789, 1.000 0.789, 1.000
RF mean 0.391 0.426 0.406 0.541 0.543 0.543 0.591 0.591 0.591 0.447 0.447 0.447
range 0.890, 0.926 0.890, 0.926 0.890, 0.926 0.203, 0.971 0.143, 0.971 0.143, 0.971 1.000, 0.986 1.000, 0.986 1.000, 0.986 0.789, 1.000 0.789, 1.000 0.789, 1.000
The results (Table 1) show clearly that attempting to optimize the total distance to the source trees is of limited use in producing accurate supertrees. None of the optimality criteria averaged better than 60% correlation with measures of true accuracy for a given scaffold factor, and for some datasets, the criteria were negatively correlated with the true quality of the supertrees that were estimated. Thus, the correlation between topological distance to source trees and topological error (i.e., distance to the true tree) tends to be only weakly positive, so that while, in general, supertrees with smaller topological distance to the source trees are more accurate, there can be more accurate supertrees with higher topological distance to the source trees. These results suggest that the highest accuracy supertrees may not optimize SumFN (or any other topological distance to source trees). This observation has two consequences for supertree analyses. First, directly trying to optimize the topological distance is not likely to produce the most accurate trees, since better trees are being produced through other means. Secondly, because the true tree is not known for biological supertree datasets, it is difficult to evaluate supertree methods using biological datasets. These conclusions are clearly based upon the conditions of this experiment, in which the source trees were reasonably, but not extremely, accurate. However, when source trees have no error at all, the true tree is guaranteed to minimize the distance to the source trees. Under this condition, MRP will also be guaranteed to return the true tree as one of the solutions. Thus, for very highly accurate source trees, both MRP and minimizing the total topological distance may be very good optimality criteria; the issue is how well supertree methods perform under more realistic conditions, where source trees have error.
296
M.S. Swenson et al.
number of taxa: 100
number of taxa: 500
number of taxa: 1000
104
103 Time, seconds
method
QMC(All) QMC(Geo+TSQ) QMC(Exp+TSQ) gMRP QMC(25short) QMC(5short)
102
101
20
50
75
100 20
50 75 scaffold factor
100 20
50
75
100
Fig. 3. Running times in seconds (means with standard error regions) of QMC supertree methods on mixed datasets; the yaxis is given with a logarithmic scale
number of taxa: 100
number of taxa: 500
number of taxa: 1000
104
Time, seconds
method
103
SFIT QImp MinFlip RFS QMC(Exp+TSQ) gMRP PhySIC
102
101
20
50
75
100 20
50 75 scaffold factor
100 20
50
75
100
Fig. 4. Running times in seconds (means with standard error regions) of supertree methods on mixed datasets; the yaxis is given with a logarithmic scale
An Experimental Study of Quartets MaxCut and Other Supertree Methods
297
4.4 Scalability We now discuss running time issues on simulated data. Fig. 3 gives the results for the QMC variants and gMRP, and Fig. 4 gives results for QMC(Exp+TSQ), gMRP, and the other (not QMCbased) supertree methods. Supertree methods on the simulated datasets showed some differences in running times. First, gMRP was faster than the accurate QMC variants for most of the model conditions, and the degree of improvement ranged from very small (a few seconds) to several hours. In general, we saw that profiles with large source trees were particularly difficult for QMC(Exp+TSQ) and QMC(All), and that for such datasets, gMRP had a running time advantage. We note that the running times of QMC(Geo+TSQ), QMC(Exp+TSQ), and QMC(All) are directly impacted by the size of the source trees, since each fourtuple of taxa must be examined to produce the quartet trees. Thus, for large source trees, we expect these three methods to suffer computational limitations.
5 Conclusions This study makes several important contributions. First, we show that while MRP is still the most accurate supertree method for the largest datasets, both QMC(Exp+TSQ) and QImp produce more accurate supertrees than MRP and other supertree methods for the smaller (100 and 500taxon) datasets. Therefore, an effort should be made to produce scalable and robust implementations of the quartet methods, QMC(Exp+TSQ) and QImp. Each of these methods produces, at some point, a quartet encoding of the source trees. Scalable implementations of these methods will require not using all the quartets in these encodings, as such approaches simply will fail on large datasets. The second important contribution of this study is that the total topological distance to the source trees only provides limited information about topological accuracy, and that reliable comparisons can only be made between supertrees that have very different total topological distances. Consequently, previous studies that have explored performance of supertree methods using total topological distance to the source trees need to be revisited.
Acknowledgments We thank Sagi Snir for assistance with using the QMC code and for providing the software for generating the quartet encodings Exp+TSQ, Geo+TSQ, and AllQuartets. This work was supported by the US National Science Foundation ITR0331453, for the CIPRES project.
References [1] Bansal, M., Burleigh, J.G., Eulenstein, O., Fern´andezBaca, D.: Robinsonfoulds supertrees (2009) [2] Baum, B.R.: Combining trees as a way of combining data sets for phylogenetic inference, and the desirability of combining gene trees. Taxon 41, 3–10 (1992)
298
M.S. Swenson et al.
[3] Bendor, A., Chor, B., Graur, D., Ophir, R., Pelleg, D.: Constructing phylogenies from quartets: Elucidation of eutherian superordinal relationships. Journal of Computational Biology 5(3), 377–390 (1998), Earlier version appeared in RECOMB 1998 (1998) [4] BinindaEmonds, O.R.P.: The evolution of supertrees. Trends in Ecology and Evolution 19, 315–322 (2004) [5] BinindaEmonds, O.R.P.: Phylogenetic Supertrees: Combining Information To Reveal The Tree Of Life. Computational Biology. Kluwer Academic, Dordrecht (2004) [6] Bolaender, H., Fellows, M., Warnow, T.: Two strikes against perfect phylogeny. In: Kuich, W. (ed.) ICALP 1992. LNCS, vol. 623, pp. 273–283. Springer, Heidelberg (1992) [7] Burleigh, J.G., Eulenstein, O., Fern´andezBaca, D., Sanderson, M.J.: MRF supertrees. In: BinindaEmonds, O.R.P. (ed.) Phylogenetic Supertrees: Combining Information To Reveal The Tree Of Life, pp. 65–86. Kluwer Academic, Dordrecht (2004) [8] Chen, D., Diao, L., Eulenstein, O., Fern´andezBaca, D., Sanderson, M.J.: Flipping: a supertree construction method. In: Bioconsensus. DIMACS: Series in Discrete Mathematics and Theoretical Computer Science, vol. 61, pp. 135–160. American Mathematical SocietyDIMACS, Providence (2003) [9] Chen, D., Eulenstein, O., Fern´andezBaca, D., Burleigh, J.G.: Improved heuristics for minimumflip supertree construction. Evol. Bioinform. 2, 401–410 (2006) [10] Creevey, C.J., McInerney, J.O.: Clann: investigating phylogenetic information through supertree analyses. Bioinformatics 21(3), 390–392 (2005) [11] Dress, A., Steel, M.: Convex tree realizations of partitions. Applied Mathematics Letters 5(3), 3–6 (1992) [12] Foulds, L.R., Graham, R.L.: The steiner problem in phylogeny is NPcomplete. Adv. in Appl. Math. 3(4349), 299 (1982) [13] Holland, B., Conner, G., Huber, K., Moulton, V.: Imputing supertrees and supernetworks from quartets. Syst. Biol. 57(1), 299–308 (2007) [14] Jiang, T., Kearney, P., Li, M.: Orchestrating quartets: approximation and data correction. In: Motwani, R. (ed.) Proceedings of the 39th IEEE Annual Symposium on Foundations of Computer Science, Los Alamitos, CA., pp. 416–425 (1998) [15] Jiang, T., Kearney, P., Li, M.: A polynomialtime approximation scheme for inferring evolutionary trees from quartet topologies and its applications. SIAM J. Comput. 30(6), 1924– 1961 (2001) [16] John, K.S., Warnow, T., Moret, B.M.E., Vawter, L.: Performance study of phylogenetic methods: (unweighted) quartet methods and neighborjoining. Journal of Algorithms 48, 173–193 (2003) [17] Nixon, K.C.: The parsimony ratchet, a new method for rapid parsimony analysis. Cladistics 15, 407–414 (1999) [18] Ragan, M.A.: Phylogenetic inference based on matrix representation of trees. Mol. Phylo. Evol. 1, 53–58 (1992) [19] Ranwez, V., Berry, V., Criscuolo, A., Fabre, P.H., Guillemot, S., Scornavacca, C., Douzery, E.J.P.: PhySIC: a veto supertree method with desirable properties. Syst. Biol. 56(5), 798– 817 (2007) [20] Ranwez, V., Gascuel, O.: QuartetBased phylogenetic inference: Improvements and limits. Mol. Biol. Evol. 18(6), 1103–1116 (2001) [21] Snir, S., Rao, S.: Quartets MaxCut: a divide and conquer quartets algorithm. IEEE/ACM Trans. Comput. Biol. Bioinform. (2008) [22] Snir, S., Warnow, T., Rao, S.: Short quartet puzzling: A new QuartetBased phylogeny reconstruction algorithm. J. Comput. Biol. 15(1), 91–103 (2008) [23] Stamatakis, A.: RAxMLNIHPC: Maximum likelihoodbased phylogenetic analyses with thousands of taxa and mixed models. Bioinformatics 22, 2688–2690 (2006)
An Experimental Study of Quartets MaxCut and Other Supertree Methods
299
[24] Strimmer, K., von Haeseler, A.: Quartet puzzling: A quartet maximimlikelihood method for reconstructing tree topologies. Molecular Biology and Evolution 13(7), 964–969 (1996) [25] Swenson, M.S., Barbanc¸on, F., Warnow, T., Linder, C.R.: A simulation study comparing supertree and combined analysis methods using SMIDGen. Algorithms for Molecular Biology 5, 8 (2010) [26] Thain, D., Tannenbaum, T., Livny, M.: Distributed computing in practice: the Condor experience. Concurrency and Computation: Practice and Experience 17, 323–356 (2005)
An Eﬃcient Method for DNABased Species Assignment via Gene Tree and Species Tree Reconciliation Louxin Zhang and Yun Cui Department of Mathematics, National University of Singapore 10 Lower Kent Ridge Road, Singapore 119076 {matzlx,matcy}@nus.edu.sg
Abstract. DNAbased species assignment and delimitation are two important problems in systematic biology. In a recent work of O’Meara, species delimitation is investigated through coupling it with species tree inference in the framework of gene tree and species tree reconciliation. We present a polynomial time algorithm for splitting individuals into species to minimize the deep coalescence cost of the gene tree and species tree reconciliation, a species assignment problem arises from species delimitation via gene tree and species tree reconciliation. How to incorporate this proposed algorithm into the heuristic search strategy of O’Meara for species delimitation is also discussed. The proposed algorithm is implemented in C++. Keywords: DNA barcoding, species delimitation, gene tree and species tree reconciliation, deep coalescence, dene duplication and loss.
1
Introduction
DNA sequencing of living organisms holds great promise in species identiﬁcation and delimitation, two important but diﬃcult tasks in taxonomy. Based on the premise that genetic diﬀerence between species exceeds that within species, DNA information is currently being used for species assignment (“DNA barcoding”, [12,13]). To identify which species an individual belongs in, one retrieves a short DNA sequence  the barcode  from some gene region from the individual and compares it with reference barcoding sequences for known species under the current Linnean system. The species membership of the individual is determined based on the degree of sequence similarity using pairwise similarity [29] or a statistical method [12,21,22]. DNA information also provides a way for discovering new species (equivalent to species delimitation) from poorly studied individuals [5,27,16,30]. However, establishing the association of DNA sequence information with a species (which is a group of individuals) is extremely challenging due to intraspecies DNA
To whom correspondence may be addressed. The work was ﬁnancially supported by AcRF R146000109112.
V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 300–311, 2010. c SpringerVerlag Berlin Heidelberg 2010
An Eﬃcient Method for DNABased Species Assignment
301
variation [20,31], the possible discord of gene and species histories [8,9,10,25], and inconsistency of species concepts [1,3,6]. For DNA species delimitation, one needs to adopt a species concept and choose a criterion to apply this concept to DNA sequence information. A set of methods have been developed for deciding whether new individuals belong in existing species [12,21,22,29]. These methods typically use DNA information at a single locus or multiple loci where the assignment of individuals to species is only partially known, but the species history is of little interest. In this paper, inspired by a work [23] of O’Meara, we suggest a new combinatorial method for DNA barcoding via gene tree and species tree reconciliation. One main cause for the gene tree and species tree discord is lack of coalescence of intraspeciﬁc sequences between speciation event. Hence, the total number of “extra” gene lineages that fails to coalesce on a species tree is proposed to measure gene tree and species tree diﬀerence [19]. If gene tree is considered as a neutral coalescent tree, the most probable gene tree matches the species tree except for extreme cases involving short internal branches [7,14]. Hence, we propose to assign species to individuals by minimizing deep coalescence events in the reconciliation of the gene tree, estimated from sampled sequences, and the species tree. Such a method takes advantage of the species history and is also eﬃcient. Gene trees are often used to discover new species from poorly studied organisms [3,14,23,26,27]. However, unlike other works, O’Meara proposed to infer species boundaries by coupling species delimitation with species tree inference [23]. In the approach, gene trees are estimated from sampled sequences and then the considered individuals are split into putative species by minimizing the structure cost of the gene and species tree reconciliation. As joint species delimitation and species tree inference is more general than species tree inference, the complexity study in [18] and [33] suggests that this problem is unlikely solvable in polynomial time. In this work, we shall also discuss how to improve the heuristic strategy presented in [23] using our species assignment algorithm.
2
Species Assignment Problems
Assume that there are a set of species whose phylogenetic tree is known and a set of individuals whose taxonomic classiﬁcation is unknown. To identify which species each individual belongs in, one obtains a gene sequence from these individuals as well as from some other individuals that belong to the species under consideration and builds a gene tree over these sampled sequences. The gene tree is partially leaf labeled in the sense that a leaf representing a sequence sampled from an individual whose species is known is labeled by the species whereas a leaf representing a sequence from an individual whose species needs to be identiﬁed is unlabeled. Applying the parsimony principle, we split the individuals into species to minimize the cost of the reconciliation of the resulting fully leaf labeled gene tree and the species tree. Formally, the species identiﬁcation problem is modeled as the following algorithmic problem.
302
L. Zhang and Y. Cui
geneloss duplication Failure to coalesce
Fig. 1. Illustration of gene tree and species tree reconciliation
Species Assignment Problem Input: A species tree S for a set of species and a partially leaflabeled gene tree G, and a reconciliation cost function c(, ). Solution: A labeling L of unknown leaves of G that minimizes the reconciliation cost c(GL , S). The discord of gene tree and the containing species tree is caused by lineage sorting, gene duplication and loss, or horizontal gene transfer shown in Figure 1. The importance of these causes depends on the considered genes and species. The gene duplication/loss [10,24] and deep coalescence costs [19] (to be deﬁned later) are proposed to study the gene tree and species tree relationship. In species identiﬁcation content, the deep coalescence cost is probably more suitable as multiple genes’ persistence without coalescence before the divergence of the containing species is a key mutational process to be considered. However, the duplicationplusloss cost is closely related to the deep coalescence cost [33]. Therefore, we shall study the species assignment problem for each of them. When multilocus sequence data are used for species assignment, the multilocus species assignment problem arises, in which there are a set of partially leaflabeled gene trees and a species tree S and the goal is to ﬁnd a labeling that minimizes the total reconciliation cost. In the study of environmental samples of fungi or other group of unknown individuals for which there are no taxonomic hypotheses [27], the species tree assumed in the Species Assignment problem simply does not exist and so species delimitation is formulated as the joint species delimitation and species tree inference problem in [23], which we call: Species Assignment With Unknown Species Input: A set of partially leaflabeled gene tree G(1) , G(2) , · · · , G(t) , and a reconciliation cost function c(, ). (i) Solution: A species tree S and a labeling L minimizing i c(GL , S).
3
Basic Concepts and Notation
Both gene tree and species tree are rooted fully binary trees. In a species tree, the leaves represent extant species and are labeled with the corresponding species.
An Eﬃcient Method for DNABased Species Assignment
303
In a gene tree, each leaf may or may not be labeled; if a leaf is labeled, its label represents the species of the individual from which the corresponding gene sequence is sampled; if a leaf is unlabeled, the corresponding gene sequence is sampled from an individual whose species is to be identiﬁed. Let T be a gene or species tree, • Leaf(T ) denotes the set of leaves of T ; • L(T ) denotes the set of leaf labels. If no leaf of T is labeled, we simply write L(T ) = φ; • T  denotes the number of the nodes of T ; • T denotes the number of the leaves of T ; • the notation t ∈ T denotes that t is a node of T ; • the notation A ⊆ L(T ) denotes that A is a subset of the label set L(T ); and • ﬁnally, ta and tb denote the two children of an internal node t ∈ T . For a node t ∈ T , any node in the unique path from the root of T to t is called an ancestor of t; and any node below t is called a descendant of t. For any two nodes t , t ∈ T , their least common ancestor, denoted by lca(t , t ), is the ancestor of t and t whose children are not an ancestor of either t or t . For a node x ∈ T , we use Tx to denote the subtree consisting of x and its descendants. For a subset A ⊆ Leaf(T ), the restriction of T on A is the smallest subtree of T containing A as its leaf set, denoted by T A . In general, T A may not be a full binary tree as it may contain nonroot degree2 nodes and its root is the least common ancestor of the nodes of A. Let L ⊆ L(T ) be a leaf label subset. For simplicity, we use T L to denote the restriction of T on the leaves having a label in L.
4
Measuring Gene Tree and Species Tree Reconciliation
Let G be a fully leaf labeled gene tree and S a species tree such that L(G) ⊆ L(S). To reconcile G and S, each node g ∈ G is mapped to a unique node M (g) ∈ S as the corresponding leaf with the same label, if g ∈ Leaf(G), M (g) = if g ∈ Leaf(G). lca (M (ga ), M (gb )) , The node M (g) with which g is associated is called the image of g (with respect to M ). The mapping M was ﬁrst considered in [10] and then formulated in [24]. We call M the reconciliation (map) of G within S. 4.1
Gene Duplication and Loss
Let G be a gene tree and g ∈ G. For any descendant g of g, M (g ) is equal to either M (g) or a descendant of M (g) in the reconciliation M of G within a species tree S such that L(G) ⊆ L(S). If M (ga ) = M (g) or M (gb ) = M (g),
304
L. Zhang and Y. Cui
then we say that a duplication occurs at M (g) (or more exactly in the lineage entering M (g)) in S and also say that it is associated with g. The total number of duplications is deﬁned as the duplication cost of the reconciliation of G within S, which is denoted by cdup (G, S). Note that the duplication cost is an asymmetric measure for tree comparison. For any two nodes s and s such that s is an ancestor of s , we use P (s , s ) to denote the unique path from s to s and deﬁne d(s , s ) = (No. of nodes s ( = s , s ) on the path P (s , s )) .
(1)
Then, the number of losses lg associated to g is deﬁned as ⎧ if M (g) = M (ga ) = M (gb ), ⎨ 0, (M (g ), M (g)) + 1, if M (ga ) ⊂ M (g) = M (gb ), lg = d a ⎩ h=ga ,gb d (M (h), M (g)) , if M (ga ), M (gb ) ⊂ M (g). The gene loss cost of the reconciliation of G within S, denoted by closs (G, S), is deﬁned as the total number of losses g∈G lg (see [11,24]). The gene duplication plus loss cost is equal to the sum of the gene duplication and gene loss costs, is denoted by cdl (G, S). The gene duplication plus loss cost is also called the mutation cost in [11]. 4.2
Deep Coalescence
Let G be a gene tree and S a species tree such that L(G) ⊆ L(S). In the reconciliation M of G within S, if a branch e of S is in the k(≥ 2) paths from M (gi ) to M (gi ), where gi ∈ G (1 ≤ i ≤ k) and gi is a child of gi , then we say that there are k − 1 ‘extra’ lineages on e failing to coalesce on e. The deep coalescence cost is deﬁned as the total number of the ‘extra’ lineages on all the branches of S in the reconciliation M of G within S (see [19]), which is denoted as cdc (G, S). The deep coalescence cost is closely related to the gene duplication and loss costs. It is not hard to see that, in the reconciliation of G within S such that L(G) ⊂ L(S), G is mapped onto SL(G) . We have the following equation. Theorem 1. ([33]) Let G be a fully leaflabeled gene tree and S a species tree such that L(G) ⊆ L(S). Then, for the reconciliation of G within S, cdc (G, S) = closs (G, S) − 2cdup (G, S) + G −  SL(G)  , (2) where T  is the number of the nodes of T for T = G, SL(G) .
5
Solving the Species Assignment Problem in Poly. Time
In this section, we shall present a polynomialtime algorithm for the species assignment problem for both the deep coalescence and duplication plus loss costs.
An Eﬃcient Method for DNABased Species Assignment
305
Here, we use the latter only as a reconciliation cost function as inferred duplication or loss events have no biological meaning when gene tree and species tree are reconciled for the purpose of species assignment and delimitation. Additionally, the algorithm for the duplication plus loss cost could ﬁnd applications in other ﬁelds where gene tree and species tree are compared. 5.1
Algorithm for the Duplication Plus Loss Cost
Let S be a species tree and G a partially leaflabeled gene tree such that L(G) ⊆ L(S). We use UL(G) to denote the set of unlabeled leaves of G. Hence, Leaf(G)− UL(G) is the set of labeled leaves in G, denoted as LF (G). Let x ∈ G and y ∈ S. Obviously, each labeling L: UL(Gx ) → L(S) induces a reconciliation ML of Gx within Sy if and only if x is mapped to y under ML . For such a labeling L: UL(Gx ) → L(S), we use cdl,L (Gx , Sy ) to denote the duplicationplusloss cost of the resulting reconciliation of Gx within Sy , and further deﬁne Cdl (x, y) =
min
L:ML (x)=y
cdl,L (Gx , Sy ).
(3)
If it is impossible to reconcile Gx within Sy with the condition that x is mapped to y, we simply write Cdl (x, y) = ∞. If each labeled leaf in Gx has the same label as y, then labeling all unlabeled leaves in Gx by the label l(y) results in a reconciliation with the gene duplication cost Gx −1 but no gene loss. Hence, for any leaf y ∈ S, Gx −1, if any f ∈ LF (Gx ) has the label l(y), Cdl (x, y) = (4) ∞, otherwise where LF (Gx ) is the set of the labeled leaves of Gx . In particular, if x is an unlabeled leaf of G and y a leaf of S, we have that Cdl (x, y) = 0. Let y be an arbitrary internal node of S and x ∈ G. Recall that ta and tb denote the children of t for t = x, y. In a reconciliation ML of Gx within Sy such that x is mapped to y, one of the following cases holds: Both xa and xb are mapped to y; The node xa is mapped to y, but xb is mapped to a descendant of y; The node xb is mapped to y, but xa is mapped to a descendant of y; The node xa is mapped to a descendant of y in Sya , and xb is mapped to a descendant of y in Syb ; C5. The node xa is mapped to a descendant of y in Syb , and xb is mapped to a descendant of y in Sya . C1. C2. C3. C4.
Assume that ML has the minimum duplication plus loss cost over all the reconciliations of Gx within Sy . If the case C1 holds, one duplication and 0 loss are
306
L. Zhang and Y. Cui
associated with x in ML . Deﬁne dg = 1 if a duplication is associated with g ∈ G and 0 otherwise. Then, Cdl (x, y) = closs,L (Gx , Sy ) + cdup,L (Gx , Sy ) = (lg + dg ) + (lg + dg ) + (lx + dx ) g∈Gxa
g∈Gxb
= Cdl (xa , y) + Cdl (xb , y) + 1. If the case C2 holds, we may assume that xb is mapped to z, a descendant of y. Then, a duplication is associated with x and the gene loss lx associated with x is 1 + d(z, y), where d(, ) is deﬁned by Eqn. (1) in Section 4.1, and so Cdl (x, y) = (lg + dg ) + (lg + dg ) + (lx + dx ) g∈Gxa
g∈Gxb
= Cdl (xa , y) + Cdl (xb , z) + l(z, y) + 1, in this case. If the C3 holds, we similarly have Cdl (x, y) = Cdl (xa , z) + Cdl (xb , y) + d(z, y) + 2, where z is the image of xa . If the case C4 or C5 hold, no duplication occurs at y and we have Cdl (x, y) = Cdl (xa , z1 ) + Cdl (xb , z2 ) + d(z1 , y) + d(z2 , y), where z1 and z2 are the images of xa and xb , respectively. In summary, we obtain that ⎧ ⎪ ⎪ Cdl (xa , y) + Cdl (xb , y) + 1, ⎪ ⎪ ⎨ Cdl (xa , y) + miny =z∈Sy (Cdl (xb , z) + d(z, y)) + 2, Cdl (x, y) = min miny =z∈Sy (Cdl (xa , z) + d(z, y) + 2) + Cdl (xb , y) , ⎪ ⎪ ⎪ ⎪ minz1 ∈Sya f (xa , z1 ) + minz2 ∈Syb f (xb , z2 ), ⎩ minz1 ∈Syb f (xa , z1 ) + minz2 ∈Sya f (xb , z2 ),
(5)
where f (x , z) = Cdl (x , z) + d(z, y) for an internal node z below y and a child x of x. Eqn. (4)(5) lead to a dynamic programming algorithm of time complexity O( G · S 2 ). It is not hard to see that the above idea can be used to obtain an eﬃcient algorithm for the species assignment problem with the duplication cost. Actually, a quadratictime algorithm for this problem is known for the duplication cost [2] due to the fact that duplication events can be counted eﬀectively. 5.2
Algorithm for the Deep Coalescence Cost
The dynamic programming algorithm presented in Section 5.1 is based on the following two facts:
An Eﬃcient Method for DNABased Species Assignment
307
(a) For a node g ∈ G, labeling the leaves below a child of g is independent of labeling the leaves below the other child of g. (b) For the duplicationplusloss cost, ﬁnding the best labeling for the leaves below g is equivalent to ﬁnding the best labeling for the leaves below each child of g given that the images of the children are ﬁxed. Unfortunately, the fact (b) does not hold for the deep coalescence cost since diﬀerent labelings for the leaves below the two children of g may induce diﬀerent number of extra lineages on each branch in the subtree below the image of g. However, Eqn. (2) can be used to develop a dynamic programming algorithm which takes polynomial time for the gene tree G and species tree S such that L(G) = L(S), that is, if a reference sequence is present in the gene tree for each species under consideration. Let S be a species tree and G a partially leaflabeled gene tree such that L(G) = L(S). Assume that x ∈ G and y ∈ S. Similar to the duplication plus loss cost case, we deﬁne Cdc (x, y) =
min
L:ML (x)=y
cdc,L (Gx , Sy ).
(6)
Again, we write Cdc (x, y) = ∞ if it is impossible to reconcile Gx within Sy with the condition that x is mapped to y. Let rG and rS be the root of G and S respectively. By assumption that L(G) = L(S), we have that SL(G) = S, G −  SL(G)  = 2( G − S ). Thus, Eqn. (2) becomes Cdc (rG , rS ) =
min
L:ML (rG )=rS
[closs (G, S) − 2cdup (G, S) + 2( G − S )] . (7)
Hence, we only need to compute minL:ML (rG )=rS closs (G, S) − 2cdup (G, S) since G − S is ﬁxed and independent of labelings. For each x ∈ G and y ∈ S, we deﬁne F (x, y) =
min
L:ML (x)=y
[closs (Gx , Sy ) − 2cdup (Gx , Sy )] .
(8)
Recall that we use l(y) to denote the label of y ∈ Leaf(S). If y is a leaf of S and each labeled leaf in Gx has the same label as y, then labeling all unlabeled leaves in Gx by l(y) results in a reconciliation having 0 gene loss and Gx −1 gene duplications. Hence, for any x ∈ G and y ∈ Leaf(S) 2(1− Gx ), if any f ∈ LF (Gx ) has the label l(y), F (x, y) = (9) ∞, otherwise.
308
L. Zhang and Y. Cui
Furthermore, we can obtain the following recurrence formula for computing F (x, y) in the same way as for the duplication plus loss cost: ⎧ F (xa , y) + F (xb , y) − 2, ⎪ ⎪ ⎪ ⎪ ⎨ F (xa , y) + miny =z∈Sy (F (xb , z) + d(z, y) − 1) , F (x, y) = min miny (10) =z∈Sy (F (xa , z) + d(z, y) − 1) + F (xb , y) , ⎪ ⎪ V (x , z ) + min V (x , z ), min ⎪ z ∈S a 1 z ∈S b 2 1 ya 2 yb ⎪ ⎩ minz1 ∈Syb V (xa , z1 ) + minz2 ∈Sya V (xb , z2 ), where V (x , z) = F (x , z) + d(z, y) for an internal node z below y and a child x of x. Eqn. (7)(10) give us a desired dynamic programming algorithm that takes O( G · S 2 ) basic operations for a gene tree G and a species trees S such that L(G) = L(S). Finally, we remark that it is not clear whether there is a polynomial time algorithm for the species assignment problem for an arbitrary partially leaf labeled gene tree G and a species tree S such that L(G) ⊆ L(G) or not. 5.3
Implementation Issues of the Dynamic Algorithms
We employ a twodimensional matrix to implement each of the dynamic programming algorithms presented in this section. The detail description of this part can be found in the journal version of this paper. 5.4
Generalization to the Species Phylogenetic Networks
Genomes evolved vertically and horizontally [4,32]. Acyclic directed network is sought as a model of the evolution of genomes or species, called a phylogenetic network, to capture not only speciation events but also recombination and horizontal gene transfer events. In a phylogenetic network, nonleaf tree nodes correspond to speciation events whereas reticulation nodes correspond to recombination or horizontal gene transfer events. In this study, we will not distinguish these two events. Note that a tree is a network not containing reticulation nodes. By analogy to trees, we say that a node u is an ancestor of a node v or equivalently v is a descendant of u if u is on a path from the root to v in the network; we also say that u is a common ancestor of a set of nodes if it is an ancestor of each node in the set. In a tree, there is the least common ancestor for any set of nodes. However, there may be two or more common ancestors that do not contain one another in a network. We say a common ancestor u of a set of nodes is minimal if any descendant of u is not a common ancestor of the nodes. Given a gene tree G and a phylogenetic network N such that L(G) ⊆ L(N ), where L(N ) denotes the set of leave labels in N . We can reconcile G within N by mapping a leaf of G to the corresponding leave of N and an internal node v to a minimal common ancestor of the images of the leaves in Gv . It is possible
An Eﬃcient Method for DNABased Species Assignment
309
that more than one reconciliation exist for G and N . For a reconciliation M of G within N , its duplication, duplicationplusloss and deep coalescence costs can be deﬁned in the same way as for gene tree and species tree except for not counting reticulation nodes when the gene loss associated with an internal node is computed [33], which are denoted by cdup (M ), cdl (M ) and cdc (M ) respectively. Let R(G, N ) denote all of the possible reconciliations of G within N . For each cost function c(, ), we deﬁne the cost of the reconciliation of G within N as c(G, N ) =
min
c(M ).
(11)
M∈R(G,N )
Since recurrence equations similar to (4)–(5) can be established for the duplication and duplicationplusloss costs in the case of gene tree vs species phylogenetic network reconciliation, the dynamic programming technique leads to a polynomial time algorithm for (a) Computing cdup (G, N ) or cdl (G, N ) for a gene tree G and a species network N , and (b) Solving the species assignment problem for a partially leaflabeled gene tree and a species network with the duplication or duplicationplusloss cost. These algorithms are described in detail in the journal version of this work. However, it is not clear whether the same result hold for the deep coalescence cost or not.
6
Species Assignment with Unknown Species Is Hard
The species tree inference problem is, given a set of fully labeled gene trees Gi (1 ≤ i ≤ n), to ﬁnd a species tree S minimizing the total cost 1≤i≤n c(Gi , S) for a reconciliation cost function c(, ). In [18] and [33], the species tree inference problem is proved to be NPhard for each of the duplication, duplicationplusloss, and deep coalescence costs. As a matter of fact, the species tree inference problem is a special case of the species assignment with unknown species problem in which an instance contains just fully leaflabeled gene trees. By proof by restriction, the problem of species delimitation with unknown species is NPhard for each of the reconciliation costs mentioned above.
7
Conclusion
We have presented an eﬃcient systematic approach for species identiﬁcation. In this approach, identifying species membership for a set of individuals is modeled as the species assignment problem in the framework of gene tree and species tree reconciliation, in the spirit of the work [23]. The dynamic programming technique has been applied to diﬀerent problems in tree comparison [2,17,28]. Using this powerful technique, we develop a cubictime algorithm for solving the species assignment problem for the duplicationplusloss and deep coalescence costs. These algorithms have been implemented in C++ and the program package is
310
L. Zhang and Y. Cui
available upon request. Hence, our proposed method takes advantage of species history and is eﬃcient. As our ongoing work, we shall evaluate the performance of this bioinformatic approach on some benchmark DNA barcoding data. We remark that the species assignment with unknown species is NPhard. This means that there is unlikely a polynomial time algorithm for it. We have discussed how to incorporate our solution to the species assignment problem into the heuristic search method proposed in [23] for the problem. Without doubt, this problem deserves more investigation. The species assignment problem also arises from tree comparison in ligand and receptor pairing [2]. Exploring its application in it and other research ﬁelds is deﬁnitely worthy further study. Finally, several algorithmic problems arise from this work. First, we have presented a polynomial time algorithm for the species assignment problem when the deep coalescence cost is used if the input gene tree contains at least one reference sequence for each considered species. This is probably good enough for the species identiﬁcation purpose. However, it is of theoretical interest whether the species assignment problem is polynomial time solvable or not for arbitrary gene trees and species trees for the deep coalescence cost. Secondly, we have generalized the polynomial time algorithm for the species assignment problem from species tree to species network. The study of various cost functions for gene network and species network reconciliation and algorithms for the species assignment problem in the network case are open for investigation.
References 1. Agapow, P.M.: The impact of species concept on biodiversity studies. Q. Rev. Biol. 79, 161–179 (2004) 2. Bafna, V., Hannenhalli, S., Rice, K., Vawter, L.: LigandReceptor pairing via tree comparison. J. Comput. Biol. 7, 59–70 (2000) 3. Baum, D.A., Shaw, K.L.: Genealogical perspectives on the species problem. In: Hoch, P.C., Stephenson, A.C. (eds.) Experimental and molecular approaches to plant biosystematics, pp. 289–303. Missouri Botanical Garden, Saint Louis (1995) 4. Brockelman, W.Y., Gittins, S.P.: Natural hybridization in the Hylobates lar species group: implications for speciation in gibbons. In: Preushcoft, H., Chivers, D.J., Brockelman, W.Y., et al. (eds.) The Lesser Apes. Evolutionary and Behavioral Biology. Edinburgh University Press, Edinburgh (1984) 5. Burns, J.M., Janzen, D.H., Hajibabaei, M., Hallwachs, W., Hebert, P.D.: DNA barcodes and cryptic species of skipper butterﬂies in the genus Perichares in Area de Conservacion Guanacaste, Costa Rica. Proc. Nat’l. Acad. Sci. USA 105, 6350– 6355 (2008) 6. De Queiroz, K.: Species concepts and species delimitation. Syst. Biol. 56, 879–886 (2007) 7. Degnan, J.H., Rosenberg, N.A.: Discordance of species trees with their most likely gene trees. PLoS Genet. 2, e68 (2006) 8. Doyle, J.J.: Gene trees and species trees: molecular systematics as onecharacter taxonomy. Syst. Bot. 17, 144–163 (1992) 9. Fitch, W.: Distinguishing homologous from analogous proteins. Syst. Zool. 19, 99– 113 (1970)
An Eﬃcient Method for DNABased Species Assignment
311
10. Goodman, M., et al.: Fitting the gene lineage into its species lineage, a parsimony strategy illustrated by cladograms constructed from globin sequences. Syst. Zool. 28, 132–163 (1979) 11. Guig´ o, R., Muchnik, I., Smith, T.: Reconstruction of ancient molecular phylogeny. Mol. Phylogenet Evol. 6, 189–213 (1996) 12. Hebert, P.D.N., Cywinska, A., Ball, S.L., DeWaard, J.R.: Biological identiﬁcation through DNA barcodes. Proc. R. Soc. B 270, 313–321 (2003) 13. Hebert, P.D.N., Gregory, T.R.: The promise of DNA barcoding for taxonomy. Syst. Biol. 54, 852–859 (2005) 14. Knowles, L.L., Carstens, B.C.: Delimiting species without monophyletic gene trees. Syst. Biol. 56, 887–895 (2007) 15. Leach´e, A.D., et al.: Quantifying ecological, morphological, and genetic variation to delimit speceis in the coast horned lizard speceis complex (Phrynosoma). Proc. Nat’l Acad. Sci. USA 106, 12418–12423 (2009) 16. Leliaert, F., Verbruggen, H., Wysor, B., De Clerck, O.: DNA taxonomy in morphologically plastic taxa: algorithmic species delimitation in the Boodlea complex (Chlorophyta: Cladophorales). Mol. Phylogenet. Evol. 53, 122–133 (2009) 17. LibeskindHadas, R., Charleston, M.A.: On the computational complexity of the reticulate cophylogeny reconstruction problem. J. Comput. Biol. 16, 105–117 (2009) 18. Ma, B., Li, M., Zhang, L.X.: From gene trees to species trees. SIAM J. Comput. 30, 729–752 (2000) 19. Maddison, W.P.: Gene trees in species trees. Syst. Biol. 46, 523–536 (1997) 20. Mallet, J., Willmott, K.: Taxonomy: Renaissance or tower of babel? Trends Ecol. Evol. 18, 57–59 (2003) 21. Matz, M.V., Nielsen, R.: A likelihood ratio test for species membership based on DNA sequence data. Phil. Trans. R. Soc. B 360, 1969–1974 (2005) 22. Nielsen, R., Matz, M.: Statistical approaches for DNA barcoding. Syst. Biol. 55, 162–169 (2006) 23. O’Meara, B.C.: New heuristic methods for joint species delimitation and species tree inference. Syst. Biol. 59, 59–73 (2010) 24. Page, R.: Maps between trees and cladistic analysis of historical associations among genes, organisms, and areas. Syst. Biol. 43, 58–77 (1994) 25. Pamilo, P., Nei, M.: Relationship between gene trees and species trees. Mol. Biol. Evol. 5, 568–583 (1988) 26. Petit, J.R., Excoﬃer, L.: Gene ﬂow and species delimitation. Trends Ecol. Evol. 24, 386–393 (2009) 27. Pons, J., et al.: Sequencebased species delimitation for the DNA taxonomy of undescribed insects. Syst. Biol. 55, 595–609 (2006) 28. Ronquist, F.: Threedimensional cost matrix optimisation and maximum cospeciation. Cladistics 14, 167–172 (1998) 29. Steinke, D., Vences, N., Salzburger, W., Meyer, A.: TaxI: a software tool for DNA barcoding using distance methods. Phil. Trans. R. Soc. B 360, 1975–1980 (2005) 30. Tautz, D., et al.: DNA points the way ahead in taxonomy. Nature 418, 479 (2002) 31. Will, K.W., Rubinoﬀ, D.: Myth of the molecule: DNA barcodes for species cannot replace morphology for identiﬁcation and classigication. Cladistics. 20, 47–55 (2004) 32. Xu, S.: Phylogenetic analysis under reticulate evolution. Mol. Biol. Evol. 17, 897– 907 (2000) 33. Zhang, L.X.: From gene trees to species trees II: Species tree inference in the deep coalescence model. Manuscript (2010)
Eﬀective Algorithms for Fusion Gene Detection Dan He and Eleazar Eskin Dept. of Comp. Sci., Univ. of California Los Angeles, Los Angeles, CA 90095, USA {danhe,eeskin}@cs.ucla.edu
Abstract. Chromosomal rearrangements which shape the genomes of cancer cells often result in fusion genes. Several recent studies have proposed using oligo microarrays targeting fusion junctions to detect fusion genes present in a sample. These approaches design a microarray targeted to discover known fusion genes by using a probe for each possible fusion junction. The hybridization of a sample to one of these probes suggests the presence of a fusion gene. Application of this approach is impractical to detect denovo gene fusions due to the tremendous number of possible fusion junctions. In this paper we develop a novel approach related to string barcoding which reduces the number of probes necessary for denovo gene fusion detection by a factor of 3000. The key idea behind our approach is that we utilize probes which match multiple fusion genes where each fusion gene is represented by a unique combination of probes. Keywords: Fusion Gene, Suﬃx Tree, Minimum Set Cover, Integer Linear Programming.
1
Introduction
Chromosomal rearrangements which shape the genomes of cancer cells often result in fusion genes. These genes arise when a rearrangement occurs within genomic regions of two distinct genes creating a novel gene which contains a mixture of the exons of the two genes. The cancer cell transcribes the “fused” genomic regions of the two genes and then the splicing mechanism of the cell removes the introns resulting in a mRNA transcript consisting of several exons from one gene followed by exons from the other gene. Since as long as the rearrangement happens within the same introns which are often considerably sized genomic regions, the same fusion gene will be created. Characteristic fusion genes are found in a variety of cancers including hematological cancers, sarcomas and prostate cancer [10], [17]. Discovery of fusion genes in cancer cells is a diﬃcult process traditionally involving karyotyping analysis to identify regions where a fusion gene may occur and then following up these regions using FISH and RTPCR[16]. This process is both time consuming and diﬃcult and can often fail for many cancer samples. Recently, several groups have proposed using high throughput sequencing technologies to identify fusion genes[9]. Unfortunately, despite tremendous advances in sequencing technologies, the cost of sequencing a tumor sample is still expensive and time consuming. V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 312–324, 2010. c SpringerVerlag Berlin Heidelberg 2010
Eﬀective Algorithms for Fusion Gene Detection
313
Several recent studies have proposed using oligo microarrays targeting fusion junctions to detect fusion genes present in a sample[16,15,4,8,11,12]. The basic idea behind these studies is that they attempt to identify a presence of a junction between two exons which are originally in diﬀerent genes. Extracted mRNA from a cancer sample is hybridized to an array which contains probes spanning the boundaries of each possible pair of fused exons. Most of these studies focus on a small set of candidate fusions[15,4,8,11,12]. In their study, Skotheim et al[16], generate a microarray which can identify all currently known fusion genes (371 at the time of their publication) using 59,381 probes spanning the junctions. Each potential fusion gene corresponds to one of these probes. Unfortunately, direct application of this technique to discover new fusion genes is impractical because it requires too many probes. A direct application of this approach to cover all possible fusion genes requires approximately 25 billion probes, each covering a speciﬁc pair of fused exons. We want to design a smaller set of probes to identify all these possible junctions of fusion exons. The fusion junction detection problem is very challenging in the following aspects: – The probes need to detect all possible fusion junctions, which is a very large number. Given n exons, the number of possible fusion junctions is O(n2 ). This number is very large if the number of exons n > 100, 000. Even just iterating through the 25 billion possible fusion junctions is not feasible. – The probes can only detect the potential fusion junctions but due to possible contamination of the sample, must not match the normal genes, including normal junctions between exons of the same gene. This is because if the probe also detects the normal gene, the prediction of the probe will always hybridize in the experiments and thus won’t provide any useful information. – The probes must detect each fusion junctions uniquely. The fusion junction detection problem is similar to the wellknown String Barcoding problem, introduced by Rash and Gusﬁeld [13]. In their problem settings, they have a large amount of genomic sequences and they want to identify certain unidentiﬁed sequences using a minimum set of probes. Given a set of probes and an unidentiﬁed genomic sequence, a probe reports the presence of the substring if it matches exactly the substring of the sequence and reports absence if not. If we consider “presence” and “absence” as bits 1, 0, respectively, the unidentiﬁed sequence can be detected by a binary string, or barcode, as outputs from the set of probes. The barcode for each unidentiﬁed sequence needs to be unique such that each sequence can be detected uniquely, namely for each pair of genomic sequences si , sj , there exists at least one probe which is a substring of either si or sj but not of both. Many algorithms have been proposed for this problem. Rash and Gusﬁeld [13] proposed an integer programming algorithm to try to minimize the number of probes. They also use suﬃx tree to conduct eﬃcient probe construction. Borneman et al. [1] used Lagrangian relaxation and simulated annealing to achieve similar results. DasGupta et al. [6] described a greedy algorithm which has high scalability to the wholegenome sequence. Their algorithm selects the probe in each iteration which distinguishes the largest number of not yet distinguished
314
D. He and E. Eskin
pairs of genomic sequences. Lancia and Rizzi [7] showed the string barcoding problem is NPcomplete for even binary alphabets and the problem is as hard to approximate as the Set Cover problem. There are three key diﬀerences between the string barcoding problem and our fusion gene detection problem: (1) The transcriptome (the set of possible mRNA sequences) is relatively small and with the requirement of probes of a minimum length due to technological constraints, most probes will match the transcriptome uniquely. (2) All probes are potentially valid in the string barcoding problem, while in the fusion gene detection problem, probes matching normal junctions or sequences within exons can not be used. (3) Probes with gap or mismatch positions are allowed. This leads to much more ﬂexibility for our problem. In this paper we present a novel approach to this problem which requires signiﬁcantly fewer probes to cover all possible fusion genes. Our approach reduces the number of required probes to discover all putative fusion genes in the genome to only 9 million probes, a reduction by a factor close to 3,000. The key idea behind our approach is that we make use of “unbalanced” probes which unevenly span the junction of two exons, uniquely matching the exon on one side of the junction and extending only a few bases onto the exon on the other side.
2 2.1
Methods Problem Statement
Assume gene i contains 5 exons (ei1 , ei2 , ei3 , ei4 , ei5 ). For illustration purpose, here we assume each gene contains only 5 exons, each typically is of length less than a few hundred bases. There are 4 junctions between adjacent exons (ei1 ei2 , ei2 ei3 , ei3  ei4 , ei4 ei5 ). We call these junctions normal junctions. Here we exclude the probability of alternative splicing which can be easily addressed by adding additional normal junctions. Given any pair of genes i and j with exons (ei1 , ei2 , ei3 , ei4 , ei5 ), (ej1 , ej2 , ej3 , ej4 , ej5 ), where eik denotes the kth exon of gene i, one exon of a gene may be fused, or concatenated with an exon of the other gene, for example, ei2 is concatenated with ej3 , we call the resulting gene (ei1 , ei2 , ej3 , ej4 , ej5 ) fusion gene, call the junction “ei2 ej3 ” fusion junction, call “ei2 ” the left exon of the fusion junction (left exon for simplicity), call “ej3 ” the right exon of the fusion junction (right exon). The same two exons can be fused in two diﬀerent ways to form two diﬀerent fusion junctions, namely “eik ejl ” and “ejl eik ”. Any exon of a gene can be fused to any exon of another gene, with the exception that the ﬁrst exon of a gene can not be fused as the right exon and the last exon of a gene can not be fused as the left exon. A length h probe is a string of length h. We say a probe identifies a junction if the probe spans the junction and the left half of the probe (we call it left probe) matches exactly the suﬃx of the left exon, the right half of the probe (we call it right probe) matches exactly the preﬁx of the right exon. A probe identiﬁes a normal string if the probe matches the string exactly. The left probe and the right probe don’t need to be of the same length, but the sum of their length needs to be h. Given all this notation, the fusion gene probe selection problem can be formally stated as following:
Eﬀective Algorithms for Fusion Gene Detection
315
Given f genes, each having various number of exons, a solution to the fusion gene probe selection problem is a set of probes which may contain gaps such that each fusion junction can be identiﬁed by the set of probes uniquely, under the constraint that all the nonjunction regions as well as normal junctions of the genes (we call these regions normal regions) will not match any probe sequences. We deﬁne an optimal solution as the solution using the smallest number of probes. We note that in practice the constraint of a minimum length h has a large eﬀect on the problem. For microarrays probes to perform eﬀectively, often h has to be in the range of 30 − 40. Such a long probe will most likely be unique in the transcriptome making it diﬃcult to construct probes which match in multiple locations. 2.2
Naive Algorithm
Assuming there are totally n exons, the number of fusion junctions is O(n2 ) since any exon of a gene can be fused with any exon of another gene. A naive way of designing probes is to design one probe to uniquely identify one fusion junction for each fusion junction. The probe simply spans the fusion junction and matches both the left and right exons. This algorithm requires O(n2 ) probes. We shown an example in Figure 1 where we have two genes (ACT CAGT CAGAGT AGAAACT ) and (GCT CGCGT GAT AGCACCT AT ). For illustration purpose, each gene contains only 4 exons, each of length 5. There are 8 possible fusion junctions as shown in Figure 1 (remember that the ﬁrst exon of a gene can not be the right exon and the last exon of a gene can not be the left exon). Assuming the probe length is 6, according to the naive algorithm, we design one probe for each fusion junction and these probes are shown in Figure 1 as the “Naive Probe Selection” column. As we can see, in this example, these probes identify one fusion junction uniquely and they don’t match the normal regions of the genes. Fusion Junction Set Naive Probe Selection Unbalanced Probe Selection (Greedy) ACT CACGT GA T CACGT T CAC − −; − − ACGT ACT CAT AGCA T CAT AG T CAT − −; −CAT AG ACT CACCT AT T CACCT T CAC − −; T CACCT GT CAGCGT GA CAGCGT CAGC − −; −AGCGT GT CAGT AGCA CAGT AG CAGT − −; − − GT AG GT CAGCCT AT CAGCCT CAGC − −; − − GCCT AGT AGCGT GA T AGCGT T AGC − −; −AGCGT AGT AGT AGCA T AGT AG T AGT − −; − − GT AG AGT AGCCT AT T AGCCT T AGC − −; − − GCCT GCT CGGT CAG T CGGT C T CGG − −; − − GGT C GCT CGAGT AG T CGAGT T CGA − −; −CGAGT GCT CGAAACT T CGAAA T CGA − −; −CGAAA CGT GAGT CAG T GAGT C T GAG − −; −GAGT C CGT GAAGT AG T GAAGT T GAA − −; − − AAGT CGT GAAAACT T GAAAA T GAA − −; − − AAAA T AGCAGT CAG GCAGT C GCAG − −; GCAGT C T AGCAAGT AG GCAAGT GCAA − −; − − AAGT T AGCAAAACT GCAAAA GCAA − −; − − AAAA
Fig. 1. An example of probe selection for two genes (ACT CAGT CAGAGT AGAAACT ) and (GCT CGCGT GAT AGCACCT AT ), where “−” denotes a gap
316
D. He and E. Eskin
2.3
Unbalanced Probe Selection Algorithm
The naive algorithm is very simple, however, the number of probes by the naive algorithm is O(n2 ) which is obviously very large for large n greater than 100,000. Therefore the naive algorithm is too expensive for practical use. However, since each probe must be length h, usually larger than 30 − 40 for current microarray technologies, even most sequences of length h/2 will occur only at most once within the set of exons. This greatly constrains our ability to select probes that match multiple fusion junctions. Our key idea is to take advantage of “unbalanced” junction probes which span a junction in a way that the majority of the probe is on one exon and a small portion of the probe is on the second exon. The probe will uniquely match one of the exons, but will match many possible fusion genes that include the ﬁrst exon and any exons that match the small portion of the probe. We note that if we use balanced probes with h/2 length sequences on each side of the junction, it is likely that both the right and left probes match the sequence uniquely and these probes are equivalent to the probes used in the naive solution. For simplicity, we ﬁrst consider the case where the probes are contiguous, meaning that we disallow gaps or mismatch positions within the probes. Thus the left probe must exactly match the suﬃx of the left exon and the right probe must exactly match the preﬁx of the right exon. In our unbalanced solution, each true fusion will match two probes. The ﬁrst probe will match the suﬃx of the left exon uniquely and matches a set of possible right exons. The second probe will match the preﬁx of the right exon uniquely and a set of possible left exons. Observing the combination of these two probes uniquely deﬁnes a fusion junction. For example, consider the probe T CAC for the example above. The preﬁx of the probe, T CA, matches the exon ACT CA uniquely. The suﬃx of the probe C matches both the exons CGT GA and CCT AT . The probe T CAG would not be valid because it matches the normal junction between exons ACT CA and GT CAG. Similarly, consider the probe ACGT , where the suﬃx CGT matches the preﬁx of exon CGT GA and the preﬁx A matches both exons ACT CA and CGT GA. A pair of unbalanced probes uniquely identiﬁes a single fusion junction. If we observe hybridization at both probes T CAC and ACGT , then that uniquely identiﬁes the presence of the fusion between exons ACT CA and CGT GA. We refer to the diﬀerent type of probes as f orward and backward unbalanced probes. Now consider the fusion between exons ACT CA and CCT AT . The same probe from above T CAC will match the suﬃx of ACT CA and the preﬁx of CCT AT . However, care must be taken to construct the probe that matches the suﬃx of CCT AT and the preﬁx of ACT CA. The probe ACCT unfortunately is not valid since it matches the normal junction between exons T AGCA and CCT AT . Similarly CACCT is also invalid for the same reason. Instead, we use the probe T CACCT to represent this fusion junction. Any shorter probe would match the normal exon. Speciﬁcally, the length of the shorter portion of the fusion junction probe is the shortest length that does not match the normal junction.
Eﬀective Algorithms for Fusion Gene Detection
317
Greedy Algorithm for Contiguous Probes. Instead of directly examining each of the 25 billion fusion junctions and create probes to identify these junctions, we leverage these insights to directly eﬃciently construct the optimal probeset for contiguous unbalanced probes of the type described above using a greedy algorithm. It is obvious that for contiguous probes, we must construct a set of forward probes for each left exon that can be part of a fusion and backward probes for each right exon that can be part of a fusion. This set of probes must contain a portion that uniquely matches the exon and contains preﬁxes (or suﬃxes) that match each possible fusion exon but none of the normal exons. The algorithm below constructs such a minimal set. For each exon, without loss of generality, assume it is the left exon in the normal junction. We construct the unbalanced probes where the long portion matches the exon uniquely. In the meanwhile, the short portions of the probes match all the exons which can be potentially fused to the current exon and do not match the corresponding right exon in the same normal junction. To construct the short portions of the unbalanced probes, we build a suﬃx tree for the preﬁx of all potential fusion exons as well as the right exon in the same normal junction. In the suﬃx tree, the leaf nodes are the exons and a path from the root to the leaf corresponds to the sequence of the preﬁxes of the corresponding exon sequences. The depth of the suﬃx tree is bounded by the length of the right probe. We then search along the suﬃx tree for the normal junction. Whenever we see a new branch diﬀer from the current search path, we create a right probe (n1 , n2 , . . . , nk , fk+1 , −, −, ...), where n1 , n2 , . . . , nk are the symbols on the current search path and fk+1 is the ﬁrst symbol in the new branch. This probe covers all the fusion exons in the subtree of the branch since all these vertices have the same preﬁx (n1 , n2 , . . . , nk , fk+1 ). We keep on searching along the suﬃx tree until the normal destination vertex is reached, which corresponds to the last symbol of the normal junction exon in the suﬃx tree. All fusion junction exons will thus be covered. Therefore, for each normal junction, we need to construct a set of right probes to match all potential fusion exons but not the right exon in the normal junction. We show an example in the left graph of Figure 2. The right exon of the normal junction has preﬁx as AT T GAA. The symbol besides the triangle denotes the ﬁrst symbol of a branch. Each triangle denotes a subtree of the corresponding branch. According to our algorithm, we design 5 right probes (G− − − −−), (AT C − −−), (AT T GC − −), (AT T GAT −), (AT T GAG−). As we can see, these right probes cover all the fusion junction exons in the subtrees of their corresponding branches but not the normal destination vertices. We need to repeat the same process for each exon to generate both forward and backward unbalanced probes for the case the exon is left exon and the case the exon is right exon, respectively. For each internal node in the suﬃx tree along the path from root to the normal destination vertex, there can be at most 3 new branches, which leads to at most 3 new right probes. Therefore, the number of right probes is bounded by 3 × length(right probe) in our algorithm. As we need to repeat the process for every
318
G A
D. He and E. Eskin
TC T
G CAT G A normal destination vertex
Fig. 2. (left) Example of probe selection with a suﬃx tree. (right) The initial set of probes starting at position 0, 1, . . ., s − t + 1 in the short portion of the probe, which is the right probe in this example. The minimum nongap symbols threshold is t. The boxes are the t contiguous nongap symbols. The dot lines are gaps.
exon as a forward and backward unbalanced probe, the total number of probes is bounded by O(3×2× h2 ×n), where n is the number of exons, h is the length of the probe and we assume the left probe and the right probe are of equal length. Since only two suﬃx trees are needed for the whole selection process, one for all left exons and one for all right exons, the probe selection process for each exon is linear with the size of the probe. Therefore, our algorithm takes O(n × h) time complexity, where n is the number of exons, h is the length of the probe. When a forward and a backward unbalanced probe are used to identify uniquely a fusion junction, the greedy algorithm can produce the optimal solution for contiguous sequences. This is because any longer probes will require adding additional probes without covering any additional fusion junctions since they would already be covered by these shorter probes. Shorter probes other than the ones we already picked will be invalid since they match normal junctions. We summarize the probes required by our unbalanced probe algorithm for each fusion junction in the above example in Figure 1. As we can see, the number of probes required is 25, which actually exceeds the number of probes required by the naive algorithm as 18. This is because as we showed before, the number of probes of the naive algorithm is O(n2 ), while the the number of probes of the greedy algorithm is O(3 × 2 × h2 × n), where n is the number of exons and h is the length of the probes. In the example of Figure 1, the length of probes h is 6, while number of exons n is 8. Therefore, the number of probes of the greedy algorithm is greater than the corresponding number of the naive algorithm. Thus when the total number of exons is too small, the probe sets from the “unbalanced” probe design may not be optimal. However, for much longer exons, as shown later in our experiments, the unbalanced probe algorithm requires many fewer probes than the naive algorithm does. One problem of this design is crosshybridization, namely if the short portion of a probe is too short, it may bind to other exon junctions. To address this problem, we may need to set a minimum length threshold for the short portion.
Eﬀective Algorithms for Fusion Gene Detection
319
The greedy algorithm can be easily adapted to integrate this threshold t such that the left or right probe need to contain no fewer than t symbols. Minimum Set Cover Conversion. While the greedy algorithm can produce the optimal solution for contiguous sequences, although not necessarily when we allow for gaps in the probe sequences. To allow for gaps in the sequence, we reformulate the problem. We construct a graph where each exon is a vertex, each probe is then a set covering certain vertices, corresponding to the exons the probe matches, the problem of seeking minimum number of probes matching all exons can be converted to the problem of minimum set cover on the graph. Minimum Set Cover problem is known to be NPcomplete. We thus format the problem into the following ILP (integer linear programming) problem and solve it optimally with an ILP solver CPLEX [5]. Minimize :
N
Si
i
Subject to :
Sj ≥ 1 f or each Vk
j∈Covk
Sj ∈ {0, 1}
Where Si is the ith set, corresponding to the ith probe, Vk is the kth vertex, corresponding to the kth exon, Covk is the set of sets covering vertex Vk , and all Sj ’s are binary. Therefore we require each vertex to be covered by at least one set. The Minimum Set Cover problem, however, requires knowing the initial set of probes which must ﬁrst be determined. Since we allow gaps, assuming the short portion of the probe is of length s and the minimum number of nongap symbols in the short portion is l2 . There are a total of s choose l2 ways of choosing nongap symbols for the probes, where the nongap symbols are intervened with gaps such that the total length of the short portion is s. However, to avoid crosshybridization, we require the nongap symbols in the short portion to be contiguous. Gaps are only allowed between the nongap symbols of the long portion and the nongap symbols of the short portion. Therefore, given the short portion of the probe with length s, the minimum number of nongap symbols in the short portion as l2 , the possible ways of choosing nongap symbols is s − l2 + 1 instead of s choose l2 . Again, we can set a minimum nongap symbols threshold t. Then the initial set of probes are the probes having t contiguous nongap symbols which start at position 0, 1, . . ., s − l2 + 1 in the short portion of the probe, respectively. We show an example in the right graph of Figure 2, where the nongap symbols need to be contiguous. We do not use probes with more than t nongap symbols because a probe always covers more vertices than another probe which contains all the nongap symbols contained by the ﬁrst probe as well as some extra nongap symbols. For example, the probe ACT T always matches more exons than the probe ACT T C or T ACT T . The t contiguous nongap symbols of a probe must have at least one diﬀerent symbol from the length t substring of the normal junction exon starting at the same position. This is to guarantee that the probes matches to
320
D. He and E. Eskin
all fusion junction exons but not the normal junction exon. For example, for normal junction exon ACT ACCCT T , assuming t=2, then at position 0, we can have all possible length two probes AA, AT, AG, . . ., etc., but not AC. Similarly, at position 1, we can have all possible length two probes but not CT . Therefore, for each normal junction, we need to initialize a set of probes whose size is (s − t + 1) × (4t − 1), where 4t − 1 means the probe can be any combination of the four characters but not the one from the normal junction exon. Then CPLEX can be applied to ﬁnd the optimal set of probes.
3 3.1
Experimental Results Synthetic Gene Sequences
●
2500000
●
● ● ●
0
●● ●
0
●
1000000
●
#Probe by Greedy Algorithm
4e+09 2e+09
●
0e+00
#Probe by Naive Algorithm
We ﬁrst evaluate the performance of our algorithm on synthetic gene sequences. We randomly generate a set of gene sequences, each with 5 exons. The exon length is 100. We vary the number of genes as 500, 1000, 2000, 4000, 8000, 16000. and for each set of parameters we conduct our experiments 10 times and show the average performance. We set the probe length as 30 and we set left probe and right probe both as length 15 such that the probes are long enough to uniquely identify any exon. We set the minimum nongap symbols threshold as 1. We compare the number of probes generated by our greedy algorithm and by the naive algorithm. We also show the run time of our algorithm. The results are shown in Figure 3. As we can see in Figure 3, as gene number increases, the exon number increases and the probe number required by both algorithms increases. However,
5000
10000
15000
●
0
5000
150 100
Run Time(sec.)
●
●
● ●
●●
0
●
15000
●
50
1400 1000 600
●
●
0
10000
Gene Number
●
200
#Probe by Naive / #Probe by Greedy
Gene Number
5000
10000
Gene Number
15000
0
●
5000
10000
15000
Gene Number
Fig. 3. Comparison between the naive algorithm and the unbalanced probe algorithm for randomly generated gene sequences. The gene numbers vary as 500, 1000, 2000, 4000, 8000, 16000. Each gene contains 5 exons of length 100 each.
Eﬀective Algorithms for Fusion Gene Detection
321
the probe number by the naive algorithm increases quadratically, while the probe number by our unbalanced probe algorithm increases linearly. The probe number by naive algorithm far exceeds that by our unbalanced probe algorithm. The ratio of the probe number by naive algorithm versus the probe number by unbalanced probe algorithm increases linearly as gene number increase, indicating unbalanced probe algorithm is more eﬃcient when the number of exons is large. For example, for 16000 genes, namely 80000 exons, the number of probes using the naive algorithm is 1400 times larger than the number of probes using the unbalanced probe algorithm. The run time increases almost linearly as the number of genes increases, indicating the unbalanced probe algorithm is time eﬃcient and is scalable to large data set. 3.2
Complete Human Gene Sequences
We next download the complete human gene sequences from the UCSC genome browser [2]. The gene number is 23,754 and the total exon number is 183,249. Each gene roughly contains 7.7 exons. Again, we set probe length to 30 and left and right probe length to 15. We set the minimum nongap symbols threshold as 1. Our greedy algorithm runs on these gene sequences for 30 minutes and generates approximately 9 million probes. The naive algorithm, however, generates approximately 26 billion probes, which is approximately 3000 times larger than the number of probes generated by our algorithm. This again indicates our method generates a lot fewer probes and is time eﬃcient. To address crosshybridization, in the following experiment, we vary the minimum nongap symbols threshold for the short portion of the probe from 1 to 5 and the number of probes required for each threshold are 8,944,202, 11,836,694, 26,299,154, 87,041,486, 330,814,516, respectively. As we can see, the numbers of required probes for nongap symbols thresholds 1,2, and 3 are close to each other, all very low, but the number increases dramatically for thresholds 4 and 5, indicating the feasible nongap symbols threshold needs to be under 5. This again conﬁrms our previous claim that we need to design unbalanced probe where the short portion needs to be short enough, otherwise the number of required probes is too large. Given a nongap symbols threshold of 5, our method still requires only 1/60 of the probes required by the naive method. We can convert the problem into ILP problem and solve it with the solver CPLEX. However, in our experiments, the number of exons is too large. CPLEX can not ﬁnd the optimal solution in a reasonable amount of time, especially when the minimum nongap symbols threshold is greater than one. Therefore, we set a time limit for CPLEX as 20 minutes for each ILP problem. With a longer time limit, the results may be better. Again, we vary the minimum nongap symbols threshold for the short portion of the probe from 1 to 5. Since for each normal junction, we need to design a set of probes, to illustrate the eﬀects of error correction on the number of required probes, we randomly select 15 normal junctions. For each junction, we compare the number of required probes for the greedy algorithm and for CPLEX. Again, due to crosshybridization, we require
●
●
● ● ●
● ●
●
●
●
●
● ●
●
● ●
●
●
●
●
●
●
●
●
●
●
●
● ●
● ●
●
● ●
● ● ● ●
●
● ● ● ● ●
●
●
●
●
●
●
●
● ●
●
●
●
●
20
●
0
●
CPLEX Greedy
250
number of probes 270 290
2 4 6 8 10 12 14 randomly selected normal junction (t = 1)
2 4 6 8 10 12 14 randomly selected normal junction (t = 2)
CPLEX Greedy
●
● ● ● ●
●
● ● ●
● ●
●
● ●
●
●
●
●
●
●
●
● ●
●
● ●
● ● ●
2 4 6 8 10 12 14 randomly selected normal junction (t = 4)
number of probes 1000 1020 1040
●
CPLEX Greedy ●
●
●
●
●
●
● ●
●
●
●
●
● ● ● ●
●
●
●
● ●
●
● ●
● ●
●
● ● ●
60
CPLEX Greedy
number of probes 70 80 90 100
number of probes 30 40 50
D. He and E. Eskin
number of probes 10 30 50
322
2 4 6 8 10 12 14 randomly selected normal junction (t = 3)
CPLEX Greedy
●
● ●
●
●
●
●
● ●
● ● ●
● ●
●
●
● ●
● ●
●
●
●
● ●
●
●
●
2 4 6 8 10 12 14 randomly selected normal junction (t = 5)
Fig. 4. Comparison of the number of required probes for t (minimum nongap symbols threshold) for the short portion of the probe as 1, 2, 3, 4, 5, on randomly selected normal junctions in human gene sequences for the greedy algorithm and CPLEX
all contiguous portions of the probe to be of length no less than the minimum nongap symbols threshold t. We show the results in Figure 4. As we can see, CPLEX successfully reduced the number of required probes to around half of what would be needed compared to the greedy algorithm. However, as t increases, the diﬀerences between the number of required probes by CPLEX and by the greedy algorithm decrease, especially when t = 5, CPLEX performs almost the same as the greedy algorithm does. This behavior is reasonable for the following two reasons: (1) We set time limit for CPLEX as only 20 minutes. As t gets bigger, almost all the solutions from CPLEX are not optimal. Using a longer time limit should lead to better performance of CPLEX. (2) As t increases, the number of vertices, or exons, covered by each probe, decreases sharply. Therefore, there is not much ﬂexibility with introducing gaps. The gaped probes perform almost the same well as the nonegaped probes.
4
Discussion
In this paper, we study the fusion gene probe selection problem where each possible fusion junctions needs to be uniquely identiﬁed by a set of probes and none of the normal regions including normal junctions of the genes can be identiﬁed by these probes. We ﬁrst propose an eﬃcient greedy algorithm which is linear time in the number of exons. We show our algorithm requires many fewer probes than the naive algorithm does. The number of probes generated by our algorithm is small enough for practical use. We next convert the problem of seeking minimum number of probes into the Minimum Set Cover problem and we show the problem can be solved optimally with an ILP (Integer Linear Programming) solver such as CPLEX.
Eﬀective Algorithms for Fusion Gene Detection
323
There are several technological limitations related to the use of microarrays for detection of fusion genes. First, the technology is limited to identify fusion genes which are expressed in the cancer sample. Fusion genes which have very low expression will not be detected with any probe in the array. Second, due to differing hybridization properties of the probes, diﬀerent probes will have diﬀerent baseline levels of intensity. One possible approach to mitigate this problem is to hybridize both a tumor sample as well as a normal sample to the array and compare the diﬀerential expression. Finally, single nucleotide polymorphisms will aﬀect our approach if they are present within the probe sequences. However, databases such as dbSNP now contain the majority of these polymorphisms and it is straightforward to exclude these positions from our probe design. We also tried introducing errorcorrection mechanism in the probe selection process to address the problem of possible failures of the probes due to crosshybridyzation. Given at most k failures are allowed, the ILP formula can be easily revised to incorporate errorcorrections, where each vertex (probe) needs to be covered at least k times, and each set can be selected multiple times. Due to space limit, we do not show the experimental results for errorcorrection in the paper. An alternate strategy for detecting fusion genes is to take advantage of highthroughput sequencing technologies[14] to directly sequencing the transcriptome of a cancer sample and then look for fusion junctions among the sequence reads[3]. Although these technologies have great promise, they are still being developed and it is not clear how soon they will be ready for wide scale clinical use due to several logistical issues. The sequencing machines are extremely expensive and require large computational and bioinformatics infrastructure for analysis. In addition, to reduce the cost, many samples must be combined in the same sequencing run at the same time which creates logistical challenges.
Acknowledgements D.H. and E.E. are supported by National Science Foundation grants 0513612, 0731455, 0729049 and 0916676, and NIH grants K25HL080079 and U01DA024417. This research was supported in part by the University of California, Los Angeles subcontract of contract N01ES45530 from the National Toxicology Program and National Institute of Environmental Health Sciences to Perlegen Sciences.
References 1. Borneman, J., Chrobak, M., Della Vedova, G., Figueroa, A., Jiang, T.: Probe selection algorithms with applications in the analysis of microbial communities. Bioinformatics 17(suppl. 1), S39–S48 (2001) 2. UCSC Genome Browser, http://genome.ucsc.edu/ 3. Chen, W., et al.: Mapping translocation breakpoints by nextgeneration sequencing. Genome Res. 18(7), 1143–1149 (2008) 4. Chun, S.M.M., et al.: Identiﬁcation of leukemiaspeciﬁc fusion gene transcripts with a novel oligonucleotide array. Mol. Diagn. Ther. 11(1), 21–28 (2007)
324
D. He and E. Eskin
5. CPLEX, http://www.ilog.com/products/cplex/ 6. Dasgupta, B., Konwar, K.M., Mandoiu, I.I., Shvartsman, A.A.: Highly scalable algorithms for robust string barcoding. Int. J. Bioinform. Res. Appl. 1(2), 145–161 (2005) 7. Lancia, G., Rizzi, R.: The approximability of the string barcoding problem. Algorithms Mol. Biol. 1, 12 (2006) 8. Lu, Q., et al.: A sensitive arraybased assay for identifying multiple tmprss2:erg fusion gene variants. Nucleic Acids Res. 36(20), e130 (2008) 9. Maher, C.A., et al.: Transcriptome sequencing to detect gene fusions in cancer. Nature 458(7234), 97–101 (2009) 10. Mitelman, F., Johansson, B., Mertens, F.: The impact of translocations and gene fusions on cancer causation. Nat. Rev. Cancer 7(4), 233–245 (2007) 11. Nasedkina, T.V., et al.: Identiﬁcation of chromosomal translocations in leukemias by hybridization with oligonucleotide microarrays. Haematologica 87(4), 363–372 (2002) 12. Nasedkina, T.V., et al.: Clinical screening of gene rearrangements in childhood leukemia by using a multiplex polymerase chain reactionmicroarray approach. Clin. Cancer Res. 9(15), 5620–5629 (2003) 13. Rash, S., Gusﬁeld, D.: String barcoding: uncovering optimal virus signatures. In: RECOMB 2002: Proceedings of the sixth annual international conference on Computational biology, pp. 254–261. ACM, New York (2002) 14. ReisFilho, J.S.: Nextgeneration sequencing. Breast Cancer Res 11(suppl. 3), S12 (2009) 15. Shi, R.Z., Morrissey, J.M., Rowley, J.D.: Screening and quantiﬁcation of multiple chromosome translocations in human leukemia. Clin. Chem. 49(7), 1066–1073 (2003) 16. Skotheim, R.I., et al.: A universal assay for detection of oncogenic fusion transcripts by oligo microarray analysis. Mol. Cancer 8, 5 (2009) 17. Teixeira, M.R.: Recurrent fusion oncogenes in carcinomas. Crit. Rev. Oncog. 12(34), 257–271 (2006)
Swiftly Computing Center Strings Franziska Hufsky1,3 , L´eon Kuchenbecker2 , Katharina Jahn2 , Jens Stoye2 , and Sebastian B¨ ocker1 1
Lehrstuhl f¨ ur Bioinformatik, FriedrichSchillerUniversit¨ at Jena, ErnstAbbePlatz 2, Jena, Germany {franziska.hufsky,sebastian.boecker}@unijena.de 2 AG Genominformatik, Technische Fakult¨ at, Universit¨ at Bielefeld, Germany
[email protected], {lkuchenb,stoye}@techfak.unibielefeld.de 3 International Max Planck Research School, Jena, Germany
Abstract. The center string (or closest string) problem is a classical computer science problem with important applications in computational biology. Given k input strings and a distance threshold d, we search for a string within Hamming distance d to each input string. This problem is NPcomplete. In this paper, we focus on exact methods for the problem that are also fast in application. First, we introduce data reduction techniques that allow us to infer that certain instances have no solution, or that a center string must satisfy certain conditions. Then, we describe a novel search tree strategy that is very eﬃcient in practice. Finally, we present results of an evaluation study for instances from a biological application. We ﬁnd that data reduction is mandatory for the notoriously diﬃcult case d = dopt − 1.
1
Introduction
The Center String problem (also called Closest String problem) is deﬁned as follows: Given k strings of length L over an alphabet Σ and a distance threshold d, ﬁnd a string of length L that has Hamming distances at most d to each of the given strings. The Center String problem has been studied extensively in theoretical computer science and particularly in computational biology [5,9], and has various applications such as degenerate PCR primer design [10] or motif ﬁnding [2,5]. We are particularly interested in its application as part of ﬁnding approximate gene clusters: The increasing speed of genome sequencing and the resulting number of available data oﬀers the possibility of comparing gene order of whole genomes. During the course of evolution, speciation results in the divergence of genomes that initially have the same gene order and content. Conserved gene order is evidence for some biological signal [11]. Approximate gene cluster models account for reordering inside the gene cluster, as well as additional and missing genes in the compared genomes [8, 1]. The center gene cluster model limits the distance between the gene cluster and each of the approximate occurrences. For given approximate occurrences, ﬁnding the center gene cluster is equivalent to ﬁnding a center string for binary input strings. V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 325–336, 2010. c SpringerVerlag Berlin Heidelberg 2010
326
F. Hufsky et al.
Previous Work. The Center String problem is NPcomplete even for three strings [3, 5], hence no polynomial time algorithm can exist unless P = NP. Different approaches have been studied for the problem: Ma and Sun [7] presented a −2 polynomial time approximation scheme with time complexity O(nO( ) ) for an approximation ratio of 1 + for any > 0. Also, heuristics and parallel implementations with good practical running times have been developed [6]. The drawback of these approaches is that they cannot guarantee to ﬁnd an exact solution. Parameterized algorithms use a parameter to describe the complexity of a problem instance and restrict the running time using this parameter, while at the same time guarantee to ﬁnd optimal solutions. Parameters that have been studied in the literature for the Center String problem are the distance threshold d and the number of input strings k. For the latter parameter, Gramm et al. [4] showed that the problem is ﬁxedparameter tractable using an Integer Linear Program. Evaluations indicate that this approach is of theoretical interest only and impractical for k ≥ 5. Regarding the distance threshold d, in the same paper d+1 an algorithm was given with running time O(kL + kd ).dLater, Madand Sun [7] presented an algorithm with running time O kL +kd · 16 (Σ − 1) . Recently, Wang and Zhu [9] improved the running time to O kL + kd·9.53d (Σ− 1)d . All of these algorithms are based on the search tree paradigm. Note that for binary strings the term (Σ − 1)d vanishes. Our Contribution. In this paper, we focus on exact methods that are also swift in application. We have developed an advanced preprocessing to quickly ﬁlter out unsolvable instances. Additionally, we compute rules that can be used within search tree algorithms to bound the search space, excluding unsolvable instances. We show how to integrate this information into the algorithms from [4, 7]. We then present a new search tree strategy called MismatchCount that, despite its bad worst case running time, works extremely well in practice. We implemented all three algorithms to evaluate their performance in combination with our preprocessing. We then present results of our experimental evaluation, showing that preprocessing and the novel algorithm improve running times by several orders of magnitude. We ﬁnd that particularly the case d = dopt − 1 is notoriously diﬃcult for all approaches, where dopt is the smallest distance value for which a solution exists.
2
Preliminaries
Given a string s over a ﬁnite alphabet Σ, let s[i] indicate the ith character of s and s[i, j] the substring of s starting at position i and ending at position j. The length of s is denoted by s. The Hamming distance dH (s, t) of two strings s and t of the same length L is the number of positions p with s[p] = t[p]. Let R = {p1 , . . . , pm } ⊆ {1, . . . , L} be a set of positions such that pi < pi+1 for all 1 ≤ i < m. Then sR := s[p1 ] . . . s[pm ] denotes the subsequence of s restricted to the positions in R. We deﬁne the Hamming distance of two strings s and t restricted to R as dR H (s, t) :=
Swiftly Computing Center Strings
327
dH (sR , tR ). For two strings s and t, let Ds,t := p : s[p] = t[p] ⊆ {1, . . . , L} denote the set of positions where s and t diﬀer, and let E s,t := p : s[p] = t[p] = {1, . . . , L} \ Ds,t be the set of positions where s and t are identical. Note D that dH s,t (s, t) = dH (s, t). For k input strings s1 , . . . , sk , we write Di,j := Dsi ,sj and Ei,j := Esi ,sj . For strings over the binary alphabet Σ = {0, 1}, which is our default, we deﬁne s[p] = 1 − s[p]. The Center String problem is deﬁned as follows: Given strings s1 , . . . , sk of length L over an alphabet Σ, and a distance threshold d, ﬁnd a string sˆ of length L, called center string, that has Hamming distances at most d to each of the given strings. For k strings s1 , . . . , sk and distance threshold d, we can construct a na¨ıve kernel as follows [4]: A position p is called clean if all sequences coincide at this position, i.e. si [p] = sj [p] for all 1 ≤ i < j ≤ k, otherwise it is called dirty. One can easily see that there can be at most kd dirty positions if an instance allows for a center string of distance d. If a position is not dirty, then all strings share the same character at this position, and the center string will also share this character. So, we can remove all positions but the dirty ones, and get an instance of length L ≤ kd. In our algorithms, we assume a distance threshold d to be given. In applications, we might not know the distance threshold d in advance, but instead search for a center string minimizing d. We can do so by calling our algorithms repeatedly, increasing d = 0, 1, 2, . . . until a solution is found for d = dopt . Both in theory and in our experimental evaluation, we ﬁnd that the running time of this iteration is governed by the last subroutine calls with d = dopt − 1 and d = dopt . That is why in our evaluations we will put special focus on these two cases. In the following, we present a data reduction that will often allow us to conclude that no solution can exist for a particular distance threshold d. But in case we cannot rule out the existence of a center string by data reduction (what is obviously the case when d = dopt ) we still have to decide whether a valid center strings exists. All algorithms for doing so, such as [4,7,9] and the MismatchCount algorithm presented below, are based on the search tree paradigm: In principle, we scan through all 2L possible binary strings and test whether any such string is a center string of the input. The algorithms diﬀer in the order in which they process the 2L strings and, in particular, how they constrain the search space to speed up computations.
3
Data Reduction
Our data reduction is based on the pairwise comparison of the input strings. Given an instance s1 , . . . , sk and d of the Center String problem, we can divide all pairs of strings {si , sj } into three groups: pairs with distance less than 2d − 1, greater than 2d, or equal to 2d or 2d − 1. If there exist two strings si , sj with Hamming distance dH (si , sj ) > 2d, then the instance has no solution. This follows from the fact that a center string sˆ can have at most distance d
328
F. Hufsky et al.
to each of si and sj and, hence, dH (si , sj ) ≤ dH (si , sˆ) + dH (ˆ s, sj ) ≤ 2d. So, d ≥ 12 maxi,j dH (si , sj ) must hold for the instance to have a solution. Solving Trivial Positions. Some positions of the solution string can be trivially solved. This is based on the following observation: Lemma 1. Given strings s1 , . . . , sk and a center string sˆ with distance d. For two strings si , sj such that dH (si , sj ) = 2d or dH (si , sj ) = 2d − 1, we have sˆ[p] = si [p] = sj [p] for all p ∈ Ei,j . Proof. A center string with distance at most d to all strings is located central between the two strings si and sj with distance 2d and hence has distance d to both of them. Thus, all positions ﬁxed between si and sj must also be ﬁxed in sˆ. Our reasoning can be extended to string pairs with distance 2d − 1: We need to change, in at least one of the strings, d positions and Ei,j is the set of equal positions between both strings, hence we are still not allowed to change any position p ∈ Ei,j . As a reduction rule, if we ﬁnd two strings si , sj with dH (si , sj ) ≥ 2d − 1, then we can set sˆ[p] := si [p] for all p ∈ Ei,j and mark these positions as “permanent”. Let P denote this set of permanent positions. By doing this for all si , sj with dH (si , sj ) = 2d or dH (si , sj ) = 2d − 1, we may run into conﬂicting situations where we have to permanently set a certain position to ‘0’ and ‘1’ simultaneously. We call such a situation a conflict and infer that the instance has no solution for the current choice of d. If we do not have a conﬂict, then applying this data reduction results in a partially solved solution string sˆ with sˆ[p] = c ∈ Σ ﬁxed for all p ∈ P, whereas all positions not in P still have to be decided. Computation of Position Subsets. We next focus on pairs of strings si , sj with dH (si , sj ) = δ < 2d − 1. For a given center string sˆ we deﬁne Xi,j (ˆ s) := p ∈ Ei,j : si [p] = sj [p] = sˆ[p] as the set of positions where si and sj agree, but disagree with the center string sˆ. We extend the reasoning behind Lemma 1 as follows: Lemma 2. Given strings s1 , . . . , sk and a center string sˆ with distance d. For two strings si , sj such that dH (si , sj ) < 2d − 1, we have Xi,j (ˆ s) ≤ d − 12 dH (si , sj ) . Proof. Let D := Di,j . Regarding the distances between sˆD and si D as well as sj D , we can state that sˆD has to at least one of the strings si D or sj D a distance at least 12 dH (si , sj ): max {dH (si D , sˆD ), dH (sj D , sˆD )} ≥ 12 dH (si , sj ) . This is true since dH is a metric and the triangle inequality holds, dH (si D ) ≤ dH (si D , sˆD ) + dH (sj D , sˆD ). Since we need a distance of at least 12 dH (si , sj ) to solve the positions from D, a distance of at most d − 12 dH (si , sj ) remains to solve the positions from E.
Swiftly Computing Center Strings
329
Lemma 2 implies that the maximum number of positions p ∈ Ei,j we are allowed to choose in the center string with sˆ[p] = si [p] is bounded by d − 12 dH (si , sj ). We can transform this observation into a reduction rule as follows: When, during search tree traversal or by other reduction rules, we have a partially solved solution string sˆ such that Xi,j (ˆ s) > d − 12 dH (si , sj ) for any pair si , sj , then we can infer that sˆ cannot be extended to a solution for the current choice of d. For each pair si , sj , we therefore set xi,j := d− 12 dH (si , sj ) and store all tuples (Ei,j , xi,j ) in an array T . Removing redundant information from T may lead to further trivially solved positions. This is done by removing, for all 1 ≤ i < j ≤ k, all positions p ∈ = si [p] then we decrease xi,j by one. P ∩ Ei,j from Ei,j . Moreover, if sˆ[p] For xi,j = 0 we set all positions p from Ei,j to “permanent” and include them in P. Since P has changed, we continue our data reduction again until there is no tuple (Ei,j , xi,j ) with xi,j = 0 in T . For xi,j < 0 we can easily infer that there must exist a conﬂict and, hence, the instance has no valid solution for this distance threshold d. Cascading. To further enlarge the number of solved positions we consider all pairs of strings si , sj with xi,j = 1 and use cascading. A valid center string sˆ has to agree with si in at least Ei,j  − 1 positions from Ei,j , hence for binary strings at most one position p ∈ Ei,j can be set to sˆ[p] = si [p]. To this end, we test for all positions p ∈ Ei,j what we can infer from setting sˆ[p] = si [p]. This implies xi,j = 0, hence the remaining positions q ∈ Ei,j , q = p, are added to P and the tuple set T is reduced. If we run into a conﬂict during this reduction, we know that setting sˆ[p] = si [p] cannot result in a valid solution. In this case, we infer sˆ[p] = si [p] and permanently set position p. Unfortunately, if not running into a conﬂict, setting sˆ[p] = si [p] is not mandatory. However, we get a partially solved solution string sˆp,v and a set of “potentially permanent” positions Pp,v depending on the position p and the value v = si [p]. We store this information in a set of rules R. We can use the set of rules R when solving the remaining instance by, say, a search tree algorithm. If, during the search tree traversal, we decide to set sˆ[p] = v for the solution string sˆ, then we can immediately start the above data reduction: For all positions q ∈ Pp,v \ P, we set the solution string sˆ[q] = sˆp,v [q]. For the remaining positions q ∈ Pp,v ∩ P, the condition sˆ[q] = sˆp,v [q] must be met, otherwise we run into a conﬂict and, thus, this branch of the search tree does not lead to a valid solution.
4
Integration into Search Tree Algorithms
We can use the information derived during preprocessing, stored in the sets P, T , R, to speed up the algorithms of Ma and Sun [7] and Gramm et al. [4].
330
F. Hufsky et al.
Integrating the set of solved positions P into the algorithm of Ma and Sun is straightforward, as this algorithm tackles the more general Neighbor String problem. In all other cases, it is necessary to interweave the use of P, T , R with the actual search tree algorithms. Here, we use the information from P, T , R to shrink the search tree, by excluding search tree branches which cannot lead to a valid solution. To do so, we simply test if the (partial) string candidate of the search tree is already conﬂicting with this information. The integration of P, T , R is somewhat diﬀerent for the algorithms of Ma and Sun and Gramm et al., we defer the technical details to the full version of this paper. Unfortunately, the use of P, T , R does not change the worstcase running times of both algorithms. But our preprocessing, as an algorithm engineering technique, allows us to speed up the algorithms in practice, as demonstrated in Sect. 6.
5
Algorithm MismatchCount
After we have applied our data reduction rules, we have to solve the remaining instance using a search tree algorithm, like those from [7, 4]. In this section we present another such procedure, MismatchCount, that is very eﬃcient in practice, as we will show below. Given binary strings s1 , . . . , sk of length L and a distance threshold d, the MismatchCount algorithm solves the Closest String problem as follows: We iterate through all strings s with distance at most d to a chosen string si — without loss of generality, we that string to be s1 . This dmay choose L leaves us with a search space of size . We present an enumeration d =0 d scheme for those s that allows eﬃcient testing for the center condition on each candidate, and that makes it possible to skip large areas of the search space based on information gained while checking those candidates. The mismatch positions for d mismatches in s1 (and therefore the center string candidates s) are enumerated, equivalently to generating all binary numbers of length m with d bits set to 1, in reverse order. An example for the placement of at most three mismatches is shown in Fig. 1. For every s, its Hamming distance to the remaining strings s2 , s3 , . . . , sk has to be checked. Rather than recomputing these distances entirely new for each candidate, the Hamming distances from the previous candidate s are updated by increasing (resp. decreasing) the distances according to the changed positions. The running time for verifying a center candidate s is therefore bounded by O(g · k), where g is the number of positions changed from s to s. The overall number of changes performed during the enumeration of all center candidates can be determined like this: using the presented enumeration scheme, each position p in s is changed once to ‘1’ and once to ‘0’ for every conﬁguration such of s[1, p − 1] with at most d mismatches to s1 [1, p − 1]. There are p−1 d conﬁgurations for each d = 1, 2, . . . , d. Summing over all possible combinations of p and d , the number of bit changes performed can be bounded by O(2L ). Since for each character change in s, k Hamming distances need to be updated, the overall worstcase running time of the algorithm is bounded by O(k · 2L ).
Swiftly Computing Center Strings
331
dH (s, s1 ) = 0 dH (s, s1 ) = 1 dH (s, s1 ) = 2 dH (s, s1 ) = 3 00000
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
1 1 1 1 0 0 0 0 0 0
1 0 0 0 1 1 1 0 0 0
0 1 0 0 1 0 0 1 1 0
0 0 1 0 0 1 0 1 0 1
0 0 0 1 0 0 1 0 1 1
1 1 1 1 1 1 0 0 0 0
1 1 1 0 0 0 1 1 1 0
1 0 0 1 1 0 1 1 0 1
0 1 0 1 0 1 1 0 1 1
0 0 1 0 1 1 0 1 1 1
Fig. 1. Enumeration scheme for all strings s with Hamming distance at most 3 to a bit string s1 of length 5. The ‘0’s denote matches between s and s1 at the respective positions, while ‘1’s denote mismatches.
However, this worstcase analysis refers to the exploration of all legal mismatch conﬁgurations of s. As already mentioned above, the enumeration scheme enables us to skip large areas of that search space. Using the maximum Hamming distance dmax = maxi=2,...,k (dH (s, si )) computed in each iteration, we can derive a lower bound for the number of positions that have to be changed in s in order to fulﬁll the center condition. Therefore, for each candidate s taken into consideration, we compute cmin = dmax2 −d , where 2 · cmin is the minimum number of positions in s that have to be changed when its successor is generated. This bound can be used in two ways: We cannot change 2 · cmin positions in s by changing the positions of less than cmin mismatches. Therefore, if currently all candidates s with dH (s1 , s) = d are enumerated and we encounter a candidate that reveals a cmin > d, we can proceed to the generation of candidates with dH (s1 , s) = cmin , omitting the enumeration for all s with dH (s1 , s) ∈ {d, d + 1, . . . , c − 1}. Furthermore, even if cmin does not exceed d for a currently observed candidate, we can use that bound to skip the enumeration of certain candidates. Since we know that we have to change at least 2 · cmin positions in s, we can omit all enumeration steps that involve less than cmin mismatch positions. Applying the data reduction to this algorithm is straightforward. Let Q := {1, . . . , L} \ P be the set of positions that are not permanent. Then, the reduced instance is s1 Q , . . . , sk Q . When estimating for every candidate s its Hamming distance to each remaining string si , the additional amount dH (ˆ sP , si P ) has to be added to the distances of the reduced strings. This is done only once at the beginning, since the Hamming distances are updated during the algorithm.
6
Computational Results
We performed our tests on a data set obtained by applying the approximate gene cluster algorithm described in [1] to ﬁve γproteobacteria genomes from
332
F. Hufsky et al.
Table 1. Five γproteobacteria from the NCBI Genome database, used for detection of approximate gene clusters to generate biological instances of the center string problem. ‘Refseq’ denotes reference sequence from NCBI Genome database, ‘PC’ number of proteincoding genes. Species name Buchnera aphidicola str. APS Escherichia coli str. K12 substr. MG1655 Haemophilus influenzae Rd KW20 Pasteurella multocida subsp. multocida str. Pm70 Xylella fastidiosa 9a5c
Refseq NC 002528 NC 000913 NC 000907 NC 002663 NC 002488
Genes 607 4493 1789 2092 2838
PC 564 4149 1657 2015 2766
the NCBI Genome database1 , see Tab. 1. The gene classiﬁcation is based on COG2 functional categories. The generation of center string instances from gene cluster predictions works as follows: Each gene cluster consists of ﬁve approximate occurrences, one on each genome, that are transformed into binary strings based on their gene composition. Since the instances generated from a single cluster are too short to evaluate the performance of our algorithms, larger instances are created by concatenation until the length L is reached. Additional strings are constructed in the same fashion, incorporating further cluster occurrences. We created 50 instances for each combination of k and L with k = 20, 30, 40, 50 and L = 250, 300, . . . , 500. The origin of our data, based on ﬁnding approximate gene clusters, results in many clean columns that are trivially solved. We keep only the dirty columns, representing the “hard part” of the instances. In our dataset, there were between 36.2% and 57.7% dirty columns. We stress that results in the following sections are reported for this na¨ıve kernel. In the further evaluation we examine only the 567 instances with dopt ≤ 40 and we concentrate on the computation of center strings for d = dopt and d = dopt − 1, since these are the computationally hard instances, see Fig. 3 below. For the search tree algorithms evaluated below, the search tree size grows (super) exponentially with increasing d, hence the algorithms’ running times are usually dominated by these cases. Excluding Unsolvable Instances by Preprocessing. Our preprocessing allows us to exclude unsolvable instances more eﬃciently than the na¨ıve kernel, when d is too small for a center string to exist. This is of particular interest as here search tree algorithms have to scan the complete search tree to ensure that no solution exists. Recall that the na¨ıve kernel tests if there exist more than kd dirty columns, in which case the instance cannot have a solution for this choice of d. Table 2 shows the number of excluded instances via preprocessing, for d = dopt − 1. Our improved preprocessing always ﬁlters out more instances than the na¨ıve kernel does. For diﬀerent k, we can exclude between 15.9 % and 44.4 % of instances that have not been ﬁltered by the na¨ıve kernel. We note that for 1 2
http://www.ncbi.nlm.nih.gov/sites/entrez?db=genome http://www.ncbi.nlm.nih.gov/COG/
Swiftly Computing Center Strings
333
Table 2. Percentage of instances excluded by preprocessing, for d = dopt − 1 number of sequences k na¨ıve kernel (%) our preprocessing, from remaining (%) total excluded instances (%)
20 56.5 24.3 67.1
30 59.1 15.9 65.6
40 67.4 36.4 79.3
50 68.4 44.4 82.4
d = dopt − 2, more than 99 % of the instances are rejected by the na¨ıve kernel or since d < 12 maxi,j dH (si , sj ). Clearly, no instances are rejected for d = dopt .
Number of trivially solved positions in %
Solving Trivial Positions by Preprocessing. The second advantage of our method is the computation of positions that can be trivially solved during preprocessing, see Fig. 2. The percentage of ﬁxed positions is especially high for the important case d = dopt . In fact, an average of 41.0 % of the positions was ﬁxed for these instances during preprocessing. We also observe that there is no “twilight zone” of ﬁxed positions: In 57.8 % of the instances, more than 40 % of positions were ﬁxed; in 38.5 % the data reduction did not ﬁx any positions; and in less than 3.7 % of the instances we observed a ﬁxation of 0–40 % of positions.
100 80 60 40 20 0
60
80
100
120
140
160
180
200
length
Fig. 2. Percentage of trivially solved positions in P for d = dopt , plotted against the length L of the instance. Crosses represent individual instances, solid line is average percentage for intervals of width 20.
Running Times. We have implemented the algorithms of Gramm et al. [4], Ma and Sun [7], and the MismatchCount algorithm from Sect. 5, referred to as “Gramm”, “MaSun” and “MismatchCount ”, respectively. These algorithms do not include any preprocessing beyond the na¨ıve kernel. Name suﬃx “RT ” indicates that preprocessing, algorithm engineering, and the use of R and T are enabled. For the MismatchCount algorithm, only the information from P is used, denoted as name suﬃx “P ”. All algorithms have been implemented in Java and compiled with the Sun Java Standard Edition compiler version 1.6. All computations were done on a quadcore 2.2 GHz AMD Opteron processor with 5 GB of main memory under the Solaris 10 operating system. The presented running times are the core running
334
F. Hufsky et al.
running time in sec
600 500 400 300 200
MismatchCountP MismatchCount MaSunRT MaSun GrammRT Gramm
100 0 dopt4
dopt2
dopt d
dopt+2
dopt+4
Fig. 3. Average running times for the 395 instances with dopt ≤ 35. Running times are depicted in dependency on varying d around dopt .
times of the algorithms and do not include I/O or removal of clean columns. We set a time limit of ten minutes per instance. We ﬁrst show that running times of all algorithms are truly dominated by the cases d = dopt − 1 and d = dopt . To this end, we consider the 395 instances with dopt ≤ 35 of length 57 ≤ L ≤ 243 after removing clean columns. Results are shown in Fig. 3. It is clearly visible that it is suﬃcient to concentrate on the two cases d = dopt − 1 and d = dopt . Algorithms MaSun and Gramm show large running times for both of these cases, whereas MismatchCount reaches its maximum running times for d = dopt − 1 while it is faster for d = dopt . Note that we cannot circumvent calling the algorithm with d = dopt − 1 to ensure that dopt is truly optimal. We now show the dependency of running times on the parameter dopt . Therefore, we pooled the instances with respect to the optimum center distance dopt . For d = dopt − 1 we excluded all instances where d < L/k after removing clean columns, or d < 12 maxi,j dH (si , sj ), as these obviously have no solution, leaving us with 241 instances. In Tab. 3, we show the percentage of instances that were rejected in less than 600 s, all other instances remain undecided by the algorithm. Running times for both d = dopt − 1 and d = dopt are depicted in Fig. 4. Note that the unmodiﬁed algorithms of Gramm et al. and Ma and Sun usually run into the time limit at 600 s, true running times are expected to be much higher. We also see that the MismatchCount algorithm is much faster for the case d = dopt than for d = dopt − 1. Table 3. Percentage of instances rejected within diﬀerent time limits, for d = dopt − 1. ‘MC ’ denotes MismatchCount algorithm. MCP MC MaSunRT MaSun GrammRT Gramm time limit 600 s (%) 49.4 14.9 51.9 5.4 48.1 0 time limit 1 s (%) 45.6 12.4 44.0 4.1 43.6 0
Swiftly Computing Center Strings 1000 running time in sec
running time in sec
1000 100 10 1 MismatchCount MaSun Gramm
0.1 0.01
24
26
28
30 32 d=dopt1
34
36
10 1 MismatchCountP MaSunRT GrammRT
0.1 24
26
28
30 32 d=dopt1
34
36
38
1000 running times in sec
running time in sec
100
0.01
38
1000 100 10 1 MismatchCount MaSun Gramm
0.1 0.01
335
26
28
30
32 34 d=dopt
36
38
40
100 10 1 MismatchCountP MaSunRT GrammRT
0.1 0.01
26
28
30
32 34 d=dopt
36
38
40
Fig. 4. Average running times for varying dopt . Running times for the original (left) and improved implementations (right) for d = dopt − 1 (top) and d = dopt (bottom). Logarithmic scale for running times.
7
Conclusion
We have presented an improved preprocessing for the Center String problem. This is based on the observation that for strings with an optimal center at distance d, there usually exist many pairs of strings with distance close or equal to 2d. Our data reduction allows us to reject more instances that do not have a valid center string, and to draw conclusions about certain positions of a center string. We show how this information can be used in the search tree algorithms of Gramm et al. and Ma and Sun. We have also presented the MismatchCount algorithm for binary alphabets. In our experimental evaluation, we could show that our data reduction is very eﬃcient and that the MismatchCount algorithm outperforms the other two in practice. Our data reduction is particularly helpful for tackling the case d = dopt − 1, where the MismatchCount algorithm has maximum running times, as we can exclude more instances. Currently, the MismatchCount algorithm does not use information encoded in R and T . We are working on a modiﬁed version of the algorithm that will allow us to approach even larger instances in reasonable running time, as it will speed up computations for the “neuralgic” case d = dopt − 1.
Acknowledgments This research was partially funded by DFG grant STO 431/5.
336
F. Hufsky et al.
References 1. B¨ ocker, S., Jahn, K., Mixtacki, J., Stoye, J.: Computation of median gene clusters. J. Comput. Biol. 16(8), 1085–1099 (2009) 2. Davila, J., Balla, S., Rajasekaran, S.: Fast and practical algorithms for planted (l, d) motif search. IEEE/ACM Trans. Comput. Biol. Bioinformatics 4(4), 544–552 (2007) 3. Frances, M., Litman, A.: On covering problems of codes. Theory Comput. Systems 30(2), 113–119 (1997) 4. Gramm, J., Niedermeier, R., Rossmanith, P.: Fixedparameter algorithms for closest string and related problems. Algorithmica 37(1), 25–42 (2003) 5. Lanctot, J.K., Li, M., Ma, B., Wang, S., Zhang, L.: Distinguishing string selection problems. Information and Computation 185(1), 41–55 (2003) 6. Liu, X., He, H., Sykora, O.: Parallel genetic algorithm and parallel simulated annealing algorithm for the closest string problem. In: Li, X., Wang, S., Dong, Z.Y. (eds.) ADMA 2005. LNCS (LNAI), vol. 3584, pp. 591–597. Springer, Heidelberg (2005) 7. Ma, B., Sun, X.: More eﬃcient algorithms for closest string and substring problems. SIAM J. Comput. 39(4), 1432–1443 (2009) 8. Rahmann, S., Klau, G.W.: Integer linear programming techniques for discovering approximate gene clusters. In: Mandoiu, I., Zelikovsky, A. (eds.) Bioinformatics Algorithms: Techniques and Applications. Wiley Series on Bioinformatics: Computational Techniques and Engineering, ch. 9, pp. 203–222. Wiley, Chichester (2008) 9. Wang, L., Zhu, B.: Eﬃcient algorithms for the closest string and distinguishing string selection problems. In: Deng, X., Hopcroft, J.E., Xue, J. (eds.) FAW 2009. LNCS, vol. 5598, pp. 261–270. Springer, Heidelberg (2009) 10. Wang, Y., Chen, W., Li, X., Cheng, B.: Degenerated primer design to amplify the heavy chain variable region from immunoglobulin cdna. BMC Bioinformatics 7(suppl. 4), S9 (2006) 11. Yanai, I., DeLisi, C.: The society of genes: networks of functional links between genes from comparative genomics. Genome Biol. 3(11), research0064 (2002)
Speeding Up Exact Motif Discovery by Bounding the Expected Clump Size Tobias Marschall and Sven Rahmann Bioinformatics for HighThroughput Technologies at the Chair of Algorithm Engineering, Computer Science Department, TU Dortmund, 44221 Dortmund, Germany {tobias.marschall,sven.rahmann}@tudortmund.de
Abstract. The overlapping structure of complex patterns, such as IUPAC motifs, signiﬁcantly aﬀects their statistical properties and should be taken into account in motif discovery algorithms. The contribution of this paper is twofold. On the one hand, we give surprisingly simple formulas for the expected size and weight of motif clumps (maximal overlapping sets of motif matches in a text). In contrast to previous results, we show that these expected values can be computed without matrix inversions. On the other hand, we show how these results can be algorithmically exploited to improve an exact motif discovery algorithm. First, the algorithm can be eﬃciently generalized to arbitrary ﬁnitememory text models, whereas it was previously limited to i.i.d. texts. Second, we achieve a speedup of up to a factor of 135. Our opensource (GPL) implementation is available at http://www.rahmannlab.de/software.
1
Introduction
The motif discovery problem consists of ﬁnding extraordinary patterns (motifs) in a given set of strings (texts). A common application in computational biology is the discovery of transcription factor binding sites. Much attention has been given to this problem, resulting in hundreds of published (mostly heuristic) algorithms. For an overview, refer to the review articles [1,2,3,4]. Most algorithms can be classiﬁed as being either alignment driven or pattern driven. The former algorithms align a (ﬁxed or variable) number of motif occurrences from which a position weight matrix (PWM) is constructed [5,6,7]; that means, the search space is the space of all alignments of motif occurrences. In contrast, patterndriven algorithms search the space of all patterns [8,9,10,11]. To allow approximate matches, either a generalized alphabet (including wildcards) like the IUPAC alphabet is used or a Hamming neighborhood is added to the patterns. Patterndriven algorithms theoretically allow computing a globally optimal motif by enumerating all patterns. The beneﬁt of knowing the global optimum, however, varies with the used objective function. In a recent article (ISMB’09, [11]), we veriﬁed that the compound Poisson approximation to the pattern’s pvalue is accurate, and we developed a patterndriven motif discovery algorithm that V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 337–349, 2010. c SpringerVerlag Berlin Heidelberg 2010
338
T. Marschall and S. Rahmann
returns the optimal motif with respect to this objective. We demonstrated the algorithm’s performance on a benchmark set [12] and on the noncoding regions of Mycobacterium tuberculosis’ genome. Here, we substantially speed up this algorithm and generalize it to higherorder text models. Notation. For concreteness, we deﬁne Σ := {A, C, G, T} as the nucleotide alphabet. All indexing starts at 0, that means w = w0 . . . w−1 for w ∈ Σ . Deﬁne Λ := 2Σ \ {∅}, where 2Σ is the power set of Σ, and note that each g ∈ Λ uniquely maps to a IUPAC oneletter code; e.g. {A, G} corresponds to the IUPAC code R. Each m ∈ Λ∗ is called generalized string. We deﬁne a motif of length to be an element of Λ . We say w ∈ Σ matches m ∈ Λ , written w m, if wi ∈ mi for 0 ≤ i < . The distribution of a random variable X is denoted by L(X). Row and column vectors are written x and y, respectively. All elements of the column vector 1 are 1. The identity matrix is denoted n by 1. For a matrix A, the rowsum norm is denoted by A∞ := maxi=1,...,n j=1 Aij . Random Texts. Let a word w ∈ Σ ∗ be given. Assume that w occurs k times in a given text (or genome). Then, its pvalue is the probability that it occurs k or more times in a random text of the same length. To compute this pvalue, a text model has to be given. The simplest possibility is an i.i.d. model, that is, a distribution over the alphabet Σ. For genomic sequences, more elaborate models are necessary. In Markovian text models, the character distribution depends on a ﬁnite history. Characteremitting hidden Markov models (HMMs) are even more sophisticated. These three types of text models are all special cases of ﬁnitememory text models. Formally, a random text is a stochastic process (St )t∈N0 , where St is a random variable giving the tth character. Definition 1 (Finitememory text model). A finitememory text model is a tuple (C, c0 , Σ, ϕ), where C is a finite state space (called context space), c0 ∈ C a start context, Σ an alphabet, and ϕ : C ×Σ ×C → [0, 1] with σ∈Σ, c ∈C ϕ(c, σ, c ) = 1 for all c ∈ C. The random variable giving the context after t steps is denoted Ct with C0 :≡ c0 . A probability measure is now induced by stipulating P(S0 . . . Sn−1 = s, C1 = c1 , . . . , Cn = cn ) :=
n−1
ϕ(ci , si , ci+1 )
(1)
i=0
for all n ∈ N0 , s ∈ Σ n , and (c1 , . . . , cn ) ∈ C n . We require the context process (Ct )t∈N0 to converge to an equilibrium distribution. The intuition behind this deﬁnition is that when in context c, we make a random choice to emit the next text character σ and transit to the next context c , the corresponding probability being ϕ(c, σ, c ). It follows that the probability for a n−1 text of length n is given by P(S0 . . . Sn−1 = s) := c1 ,...,cn i=0 ϕ(ci , si , ci+1 ), where c0 is the ﬁxed start context. This sum can be eﬃciently computed by dynamic programming. Similar models are used in [13] where they are called probability transducers. In this article, all analyses and algorithms are valid for arbitrary ﬁnitememory text models.
Speeding Up Exact Motif Discovery by Bounding the Expected Clump Size
339
Compound Poisson Distribution. The diﬃculty in computing the distribution of the number of word occurrences lies in possible selfoverlaps. Although exact algorithms, for example using ﬁnite automata [14,15,16], are known, it remains infeasible to compute the exact pvalues for a large set of motifs. This problem can be overcome by using a compound Poisson approximation. The idea is to decompose the set of motif occurrences into clumps of overlapping occurrences. Formally, a clump is a maximal set of overlapping motif occurrences. For example, the string AAACACACTGACAT contains two clumps of the word ACA (underlined). The random variable Zi gives the size, i.e. the number of contained occurrences, of the ith clump in the random text (St )t∈N0 . If no ith clump exists, we set Zi := 0; this happens with zero probability for inﬁnite texts. n −1 Zi (ignoring border eﬀects), The number of occurrences is now given by N i=0 where Nn is the number of clumps in a text of length n. The compound Poisson approximation assumes that Nn is Poisson distributed. This approximation is accurate for rare words [17]. Example 1 (Influence of clumping). Consider a random text of length 10,000 over Σ = {A, C, G, T} where each character is distributed independently and uniformly. The expected number of occurrences for the two patterns AAAAAAAAAA and AAAAAAAAAC equals 0.0095 in both cases, but the probabilities of observing 10 or more occurrences diﬀer greatly and amount to 2.982·10−8 and 1.546·10−27, respectively. The diﬀerent behavior is reﬂected in the expected clump sizes that equal 4/3 and 1, respectively. When computing the compound Poisson approximations of these pvalues, we obtain 2.986 · 10−8 and 1.685 · 10−27 , respectively. Definition 2 (Expected Clump Size). The expected clump size ψ is ψ := lim E(Zi ) . i→∞
(2)
Note that ψ is welldeﬁned as the existence of limit (2) follows from the assumed convergence of the text model to an equilibrium distribution. Results. Clumps and compound Poisson approximations to the occurrence count distribution of words have been studied extensively [18,19,20,21]. For the ﬁrst time, however, we give a simple and general formula for the expected clump size that holds for sets of patterns and arbitrary ﬁnitememory text models that are equivalent to characteremitting HMMs (Theorem 1). The formula is short and involves no laborious operations like matrix inversions. Furthermore, it can readily be generalized to the case where each pattern is given a weight (Theorem 2), which is useful to handle reverse complements in DNA motifs. In [11], we introduced a motif discovery algorithm that ﬁnds (within a given motif space) the optimal motif with respect to its pvalue (in compound Poisson approximation). Based on the new formula for the expected clump size, we derive bounds for the expected clump size for partially known patterns. These bounds allow us to improve our motif discovery algorithm in two respects. First, ﬁnding the globally optimal motif with respect to arbitrary ﬁnitememory text models is now possible; before, the search was restricted to i.i.d. models. Second, the algorithm is substantially faster than before.
340
T. Marschall and S. Rahmann
Before we compute and bound the expected clump size, Section 2 explains how motif discovery can beneﬁt from such a procedure. In Section 3, formulas for expected clump size and expected clump weight are given and proved. Subsequently, in Section 4, bounds for partially known motifs are derived. Experiments showing the practical beneﬁt are presented in Section 5.
2
Eﬃcient Motif Discovery with Clump Size Bounds
The idea of performing a patterndriven search by walking a suﬃx tree has long been known [8]. We took up this idea in [11] and furthered it to optimize pvalues of degenerate motifs rather than their number of occurrences. The basic idea is to enumerate all candidate motifs from a given motif space in lexicographic order and skip parts of the search space that cannot contain motifs of interest. This is done by examining the suﬃx tree nodes that correspond to the preﬁxes of the current motif. If a preﬁx does not occur frequently enough to be interesting, all motifs sharing this preﬁx can be skipped. When optimizing pvalues, we need to answer the following question: Given a motif space M to be searched, a motif preﬁx and the number of occurrences of this preﬁx, compute a lower bound for the pvalue of all m ∈ M with this preﬁx. If this lower bound is too large, we can discard the preﬁx along with all its continuations. Obviously, the number of occurrences is greater than or equal to the number of clumps. By compound Poisson approximation, the number of clumps has a Poisson distribution with motifspeciﬁc mean λm . Write Pλ (i) := e−λ λi /i!. Assume that the motif m is observed n times, then pvalue(m) ≥
∞ i=n
Pλm (i) ≥
∞
Pλ (i) for λm ≥ λ ,
i=n
where the right inequality follows from the monotonicity of the cumulative Poisson distribution function in its parameter. Therefore, the problem is reduced to computing a lower bound λ ≤ λm for the expected number of clumps λm =
expected number of occurrences of m . expected clump size of m
To ﬁnd a λ ≤ λm , we require a lower bound for the expected number of occurrences and an upper bound for the expected clump size. In [11], the ﬁrst problem was approached by partitioning the motif space into subsets containing motifs with equal expectation and computing the expectation exactly, which is easy for i.i.d. text models, but not practical for more complex text models. For the expected clump size, a global upper bound of 3 was used, which lead to long runtimes. Here, we present a more eﬃcient strategy based on motif preﬁxes instead of whole motifs. Better individual bounds on the clump size will allow to prune larger parts of the search space. A lower bound for the expected number of occurrences for all continuations of a partially known motif from M can be obtained by computing the equilibrium
Speeding Up Exact Motif Discovery by Bounding the Expected Clump Size
341
probability of the preﬁx and using the lowest possible continuation probability for each unknown character. This probability can be eﬃciently precomputed by examining, for all combinations of characters σ and text model contexts c, the probability that, starting from context c, character σ is generated. We now derive a formula for the exact expected clump size and use it in Section 4 to derive the desired bound.
3
Computing the Expected Clump Size
In the following, we assume a length ≥ 2 and a pattern set W ⊂ Σ to be given. Each IUPAC motif can be represented as such a set W. A length substring of the random text (St )t∈N0 is written St := St . . . St+−1 . In ﬁnitememory text models, it is not suﬃcient to look at strings St only, but we simultaneously need to keep track of the context. To shorten notation, we deﬁne Xt := (St , Ct ); so Xt = (w, c) means that word w ∈ Σ starts at position t in S, and before generating its ﬁrst letter, we are in context c, i.e., St = w and Ct = c. We say that t”. c at position “word w occurs in context Furthermore, we deﬁne X := (w, c) ∈ W × C : limt→∞ P Xt = (w, c) > 0 . Restricting attention to X is suﬃcient as pairs (w, c) with zero occurrence probability do not contribute to the expected clump size ψ (cf. Deﬁnition 2). To derive a formula for ψ, we need several deﬁnitions. Definition 3 (Overlap probability function). The overlap probability function κ : X × X → [0, 1] is defined by κ (w1 , c1 ), (w2 , c2 ) := −1 P Xt+i = (w2 , c2 ), St+i−1 , . . . , St+1 ∈ / W  Xt = (w1 , c1 ) . i=1
By definition of finitememory text models, the involved conditional probabilities do not depend on t. Intuitively, κ (w1 , c1 ), (w2 , c2 ) is the probability that, having seen w1 in context c1 , there follows another word from W in the same clump and that the next such word is w2 in context c2 . Example 2 (Overlap probability function). Let Σ = {A, B} and consider an i.i.d. text model, that means a ﬁnitememory text model with only one context c0 . Let the character probabilities be given by pA =0.1, pB =0.9. Let further W:= {AAA, AAB, ABA}. We obtain κ (AAA, c0 ), (AAA, c0 ) = 0.1, κ (AAA, c0 ), (AAB, c0 ) = 0.9, and κ (AAA, c0 ), (ABA, c0 ) = 0. The last probability is zero as ABA cannot rightoverlap AAA without ﬁrst creating an occurrence of AAB. It is useful to view κ as a matrix. Thus, we deﬁne a bijective mapping ι : K = as overlap matrix  − 1} and denote the resulting matrix X → {0, . . . , X kι(w,c),ι(w,c ) ∈ RX ×X , where kι(w,c),ι(w,c ) := κ (w, c), (w , c ) . As all results hold independent of the choice of ι, we use pairs (w, c) ∈ X as indices.
342
T. Marschall and S. Rahmann
Definition 4 (Word and clump start distributions). The word distribution vector, denoted p = p(w,c) ∈ RX  , is given by p(w,c) := lim P Xt = (w, c)  St ∈ W . t→∞
It is the equilibrium probability to see word w in context c, given that a word
start start
= p(w,c) ∈ RX  from W is seen. The clump start distribution vector p is given by pstart /W . (3) (w,c) := lim P Xt = (w, c)  St ∈ W, St−1 , . . . , St−+1 ∈ t→∞
It is the equilibrium probability to see word w in context c, given that a word from W is seen and starts a clump of such words. Theorem 1 (Expected clump size). Let a pattern set W ⊂ Σ be given such that K∞ < 1. Then, its expected clump size is finite and given by ψ =
start
(1 − K)−1 1 = p
1 . 1 − pK1
The ﬁrst equality is not surprising, and similar formulas have been known. The second equality, to our knowledge, is new and our ﬁrst main result. To prove the theorem, we need additional deﬁnitions and an auxiliary lemma. Definition 5 (Clump end vector). The clump end vector, denoted f = f(w,c) ∈ Rm , is given by f(w,c) := P St+1 , . . . , St+−1 ∈ / W  Xt = (w, c) , which is the conditional probability that, when seeing word w in context c, no further word from W follows in the same clump. Here f(w,c) does not depend on t due to conditioning on Ct = c. We express f in terms of the overlap probability matrix: f(w,c) = 1 − k(w,c),(w ,c ) or f = (1 − K)1.
(4)
(w ,c )∈X
Definition 6 (Backward overlap function and matrix). The backward − : X × X → [0, 1] is defined by overlap function ← κ ← − κ (w , c ), (w , c ) := 1
lim
t→∞
−1 i=1
1
2
2
P Xt−i = (w2 , c2 ), St−i+1 , . . . , St−1 ∈ / W  Xt = (w1 , c1 ) .
− Intuitively, ← κ (w1 , c1 ), (w2 , c2 ) is the equilibrium probability that, observing w1 in context c1 , there exists a preceding word from W in the same clump and that the immediately preceding such word is w2 in context c2 . Note the symmetry to Deﬁnition 3; however, the conditional probability may depend on t, so we take ← − the equilibrium limit. The backward overlap matrix K is deﬁned accordingly.
Speeding Up Exact Motif Discovery by Bounding the Expected Clump Size
343
Lemma 1. For all (w1 , c1 ), (w2 , c2 ) ∈ X , ← − p(w1 ,c1 ) k(w1 ,c1 ),(w2 ,c2 ) = p(w2 ,c2 ) k (w2 ,c2 ),(w1 ,c1 ) . ← − This is a “detailed balance” between p, K and K : The equilibrium probability of seeing a wordcontext pair (w1 , c1 ) followed by (w2 , c2 ) in the same clump equals the equilibrium probability of (w2 , c2 ) preceded by (w1 , c1 ). It can be veriﬁed directly from the deﬁnitions. Proof (Theorem 1, first part). Every clump can be uniquely decomposed into a sequence of overlapping occurrences of words from W: A clump of size z starts with a wordcontext pair x1 = (w1 , c1 ) ∈ X , and makes z − 1 transitions to following wordcontext pairs xj = (wj , cj ). The transition probabilities are given by the corresponding entries of K. The clump ends with a wordcontext pair xz = (wz , cz ). In equilibrium, lim P(Zi = z) =
i→∞
x1
ψ = lim E(Zi ) = i→∞
··· pstart kx1 ,x2 · · · kxz−1 ,xz fxz = pstart K z−1 f ; x1 xz
∞
z · p
z=1
start
K
z−1
f = p
start
∞
 zK z−1 f
∞
2 = pstart  K z f = pstart  (1 − K)−2 f
(5)
z=1
(6)
z=0 −1
= pstart  (1 − K)
1,
(7)
where the rearrangement from (5) to (6) is allowed as both series converge absolutely because K∞ < 1. Equation (6) uses the value of a geometric series of matrices (see [22], Proposition 9.4.13) and (6)=(7) follows from (4).
Proof (Theorem 1, second part). We now rewrite pstart :
pstart lim P Xt = (w, c) St ∈ W, St−1 , . . . , St−+1 ∈ /W (w,c) = t→∞ P Xt = (w, c), St−1 , . . . , St−+1 ∈ /W = lim t→∞ P S ∈ W, S , . . . , S /W t t−1 t−+1 ∈
P St−1 , . . . , St−+1 ∈ / W Xt = (w, c) P Xt = (w, c)
= lim t→∞ / W Xt = (w1 , c1 ) P Xt = (w1 , c1 ) (w1 ,c1 ) P St−1 , . . . , St−+1 ∈
← − 1 − (w ,c ) k (w,c),(w ,c ) · p(w,c)
= (8) ← − (w1 ,c1 ) 1 − (w2 ,c2 ) k (w1 ,c1 ),(w2 ,c2 ) · p(w1 ,c1 ) p(w,c) − (w ,c ) p(w ,c ) k(w ,c ),(w,c)
, = (w1 ,c1 ) p(w1 ,c1 ) − (w2 ,c2 ) p(w2 ,c2 ) k(w2 ,c2 ),(w1 ,c1 )
(9)
344
T. Marschall and S. Rahmann
where (8)=(9) follows from Lemma 1. Thus pstart  =
p(1 − K) p(1 − K) = . p(1 − K)1 1 − pK1
The proof is completed by combining the above expression with (7) and noting that p1 = 1, since p is a probability distribution.
Weighted Patterns. We deﬁned the clump size as the number of occurrences of words from W in a clump. That means, we assigned a weight of 1 to each occurrence. In this section, we permit individual weights for each w ∈ W by deﬁning a weight function ν : W → R. This weighted case is important when patterns over the DNA alphabet are considered and the reverse complement is taken into account. Example 3. Consider the DNA alphabet Σ = {A, C, G, T} and the pattern set W = {AAT, ACT, ATT}. Adding all reverse complements, we obtain the multiset W = {{AAT, ACT, ATT, ATT, AGT, AAT}} and thus weights ν(AAT) = 2, ν(ATT) = 2, ν(ACT) = 1, and ν(AGT) = 1. Definition 7 (Weight vector and expected clump weight). We define the weight vector v ∈ RX  by v(w,c) := ν(w) for (w, c) ∈ X . For a given weight vector v, the random variable Wi denotes the weight of the ith clump, i.e. the sum of the weights of the words forming the clump. The expected clump weight is defined as ψv := limi→∞ E(Wi ). Theorem 2 (Expected clump weight). Given a pattern set W ⊂ Σ such that K∞ < 1 and a weight vector v, then the expected clump weight is ψv = pv · ψ =
pv < ∞. 1 − pK1
Proof (Sketch). The idea is to combine a scaling and a homogeneity argument: The (asymptotic) expected number of occurrences of W per text character, say μ = p1·μ, changes to pv·μ when weights are assigned, as p is the equilibrium distribution restricted to W. In equilibrium, all clumps have the same stochastic properties, and the distribution of words from W in clumps is p as well, because by deﬁnition words only occur in clumps. Hence the expected clump weight is pv · ψ, and the result follows from Theorem 1.
4
Bounding the Expected Clump Size of Motifs
We assume a motif space M ⊆ Λ to be deﬁned by giving constraints on the number of allowed wildcard characters. For example, we might use the motif space given in [11], deﬁned by = 10 and allowing at most six g ∈ Λ with g = 2 (IUPAC codes R, Y, W, S, K, M), zero characters with g = 3 (IUPAC codes B, D, H, V), and at most two characters with g = 4 (IUPAC code N). This space covers many biologically relevant motifs (see [11]).
Speeding Up Exact Motif Discovery by Bounding the Expected Clump Size
345
The following theorem translates the results from the last section into bounds for the expected clump size of IUPAC motifs. We assume that text model and all motifs are such that the overlap probability matrix K for each motif satisﬁes K∞ < 1, which means that there is zero probability for inﬁnitely large clumps. Theorem 3. Consider a text model that converges to an equilibrium context distribution. Let a motif m ∈ Λ and a bound P < 1 be given such that Bm := max c∈C
−1
P St+i m  St m, Ct = c ≤ P,
(10)
i=1
where Bm is independent of t due to conditioning on Ct . Then, the expected clump size ψm satisfies ψm ≤ 1/(1 − Bm ) ≤ 1/(1 − P ). Here Bm , and thus also P , are upper bounds for the conditional probability that a given occurrence of m is rightoverlapped by another occurrence. Proof. Let W := {w ∈ Σ : w m}. Applying the deﬁnitions of p and K, p(w,c) k(w,c),(w ,c ) pK1 = (w,c)∈X (w ,c )∈X
= lim
t→∞
≤ lim
t→∞
= lim
t→∞
= lim
t→∞
= lim
t→∞
−1
P Xt+i = (w , c ), St+i−1 , . . . , St+1 ∈ / W Xt = (w, c)
(w,c) (w ,c ) i=1 · P Xt = (w, c) St m −1
P Xt+i = (w , c ) Xt = (w, c) P Xt = (w, c) St m (w,c) (w ,c ) i=1 −1 P Xt+i = (w , c ), Xt = (w, c)  St m (w,c) (w ,c ) i=1 −1 P St+i m  St m i=1
−1 P St+i m  St m, Ct = c · P Ct = c  St m
c∈C
i=1
≤ Bm · lim P Ct = c  St m = Bm · 1 ≤ P < 1 . t→∞
c∈C
Applying Theorem 1 yields the claimed result, as x → 1/(1−x) is increasing. Given only a length motif preﬁx m0 . . . m −1 , we derive a bound P for Theorem 3 that is valid for all possible continuations of this preﬁx within M. To be useful in motif discovery as sketched in Section 2, fast calculation of the bound must be possible. We approach the problem by computing bounds P1 , . . . , P−1 for each possible shift separately such that
346
T. Marschall and S. Rahmann
Fig. 1. Diﬀerent overlap situations of partially known motifs are illustrated. The ﬁrst part of the motif (gray) is known, while the second part (white) is unknown. Left: Shift of 1, the aligned known IUPAC characters must be compatible. Middle: Shift of 4, no known characters align, but the diagonal lines emphasize that, although unknown, the characters in the top motif are the same as the ones in the bottom motif. Right: Shift of 6, the known characters right of the previous occurrence must be present.
max
max P St+i m  St m, Ct = c ≤ Pi .
m ,...,m−1 ∈Λ: m∈M c∈C
Then, P := P1 + . . . + P−1 is a valid bound, i.e., P ≥ Bm for all continuations m . . . m−1 of m0 . . . m −1 . Computing the bound Pi for shift i. There are diﬀerent strategies for obtaining good bounds for diﬀerent shifts. For short shifts, where many known IUPAC characters overlap (Figure 1, left), we can bound the conditional probability that text character St matches the intersection of the overlapping IUPAC characters. For this, we use a precomputed table Pmax of worstcase conditional probabilities (with respect to all possible contexts), and deﬁne for g, g ∈ Λ Pmax (g  g ) := max P(St g  St g , Ct = c) , c∈C
a quantity that does not depend on t by Deﬁnition 1. Note that for incompatible IUPAC characters, i.e. g ∩ g = ∅, an overlap is impossible and Pmax (g  g ) = 0. The strategy of considering every position separately does not work eﬀectively for longer shifts, as shown in Figure 1 (middle). For each position, the unknown character can be chosen unfavorably, such that a probability bound equals 1. To obtain a meaningful bound, we have to take into account that the top and bottom motifs are the same, and therefore unknown positions cannot be chosen independently. The idea is to partition the columns into groups such that each top character is the bottom character in the next column in that group, as illustrated in Figure 2. The groups deﬁned in that way can then be bounded jointly. To this end, we precompute socalled telescope bounds for each (initial) IUPAC character: For all g ∈ Λ, deﬁne ⎛ ⎞ M−2 ⎝ max Pmax (Mi Mi+1 )⎠ Pmax (MM−1 Σ) . Ptel (g) := ∗ M∈Λ : M0 =g
i=0
In the example in Figure 2, we bound the telescope product for M = m2 m4 m6 by Ptel (m2 ) and the product for M = m3 m5 m7 by Ptel (m3 ). To compute these bounds, we need not check all M ∈ Λ∗ , but can restrict our attention to those M with Mi Mi+1 for 0 ≤ i < M  − 1. It can be shown that the maximum over all
Speeding Up Exact Motif Discovery by Bounding the Expected Clump Size A
B
A
B
A
347
B
m0 m1 m2 m3 m4 m5 m6 m7 m0 m1 m2 m3 m4 m5 m6 m7
Fig. 2. For each set of columns labeled with the same letter (A or B), a bound can be obtained. For group A, a bound is given by Pmax (m2  m4 )Pmax (m4  m6 )Pmax (m6  Σ). For group B, it is given by Pmax (m3  m5 )Pmax (m5  m7 )Pmax (m7  Σ). Assuming that the characters m4 , . . . , m7 are unknown (white background), the maximum over all possible values of m4 , . . . , m7 must be used.
M ∈ Λ∗ is attained for an M with this property (proof omitted). Thus, Ptel (g) can be precomputed for all g ∈ Λ. In the i.i.d. model, the telescope bound takes a particularly simple form because of cancellations: Ptel (g) = limt→∞ P(St g), the equilibrium probability of g. In the right part of Figure 1, some of the known characters do not overlap the previous motif occurrence. For such a character g, the bound Pmax (gΣ) can be used. Based on the motif space and its constraints on the multiplicity of wildcard characters, the approach may also apply to columns where unknown characters do not overlap the previous occurrence. When, for example, the known characters are ANNT and at most two wildcards are allowed, the unknown characters must be from Σ = {A, C, G, T} and the bound maxσ∈Σ Pmax (σΣ) can be used. Depending on the motif preﬁx and the shift i, the above three ideas can be combined in diﬀerent ways to produce a bound Pi . There are several case distinctions, which we omit in this extended abstract. Instead, we exemplarily consider the situation in Figure 2 (i.e. = 8 and shift 2) for the motif preﬁx ARRA and calculate bound P2 . Recall that R = {A, G}. In two columns, known characters overlap and we use bounds from Pmax for them. For the groups A and B, as shown in Figure 2, we employ the telescope bounds. Assuming an i.i.d. text model with uniform character distribution, we get P2 = Pmax (AR) · Pmax (RA) · Ptel (R) · Ptel (A) =
1 1 1 1 ·1· · = . 2 2 4 16
Calculations for the other shifts yield P1 = 1/8, P3 = 1/16, and P4 = P5 = P6 = P7 = 1/64. We obtain P = P1 + . . . + P7 = 5/16 and a bound for the expected clump size of 1/(1 − P ) = 16/11 ≈ 1.45. For all possible continuations, the largest exact expected clump size is 1.3144 (for the motif ARRANNNN). So far, we discussed only bounds for single IUPAC motifs. By virtue of Theorem 2, jointly handling a motif and its reverse complement poses no principal diﬃculties but involves several more case distinctions. Again, we omit the details in this extended abstract.
348
5
T. Marschall and S. Rahmann
Experiments and Conclusions
Using the new bounds, we improve the IUPAC motif discovery algorithm presented in [11], where we assessed the quality of results and compared it to other algorithms. We only discuss runtimes here. Because of new compute cluster hardware (quadcore CPUs at 2.66 GHz), we reran the old experiment (twice as fast) to report comparable results in Table 1. Table 1. Running times of M. tuberculosis motif discovery in noncoding regions using diﬀerent algorithms, text models and restrictions. Times are singlecore hours, i.e. running the algorithm on a single core would have taken this time. The pvalue bound was given as 10−50 . In some cases, the search was restricted to motifs with 100 expected occurrences to avoid highly degenerate motifs and to reduce runtime. The motif space was chosen as in [11], deﬁned by a motif length of 10, allowing at most six g ∈ Λ with g = 2, zero with g = 3, and at most two with g = 4. (Runtime with * is estimated based on searching 2% of the motif space.) Text model i.i.d. i.i.d. Markov order 1 Markov order 2 Markov order 3
Expectation restriction ≤ 100 none ≤ 100 ≤ 100 ≤ 100
Runtime of original alg. 127.2 h *56,000.0 h not possible not possible not possible
Runtime of improved alg. 21.2 412.5 118.3 800.3 6,364.4
h h h h h
Speedup factor 6x 135x — — —
Formerly, one key to feasibility was bounding the expected number of motif occurrences by 100 in addition to setting a strict pvalue bound of 10−50 . This restriction is no longer necessary. Even with the restriction, a speedup factor of 6 is observed. Without the restriction, time is reduced by a factor of 135 with the new bounds. This shows that the new bounds are especially eﬀective for more degenerate motifs. Additionally, direct optimization under a Markov text model was not feasible before. As far as we are aware, our method is the only practically eﬃcient algorithm that ﬁnds provably optimal IUPAC motifs in general ﬁnitememory text models. Runtimes of several hundred singlecore hours pose no practical problem on a medium sized cluster. Topics for future work are further engineering and ﬁnetuning the implementation, e.g. on massivelyparallel hardware like GPUs.
References 1. Tompa, M., Li, N., Bailey, T.L., et al.: Assessing computational tools for the discovery of transcription factor binding sites. Nature Biotechnology 23(1), 137–144 (2005) 2. Sandve, G.K., Drabløs, F.: A survey of motif discovery methods in an integrated framework. Biology Direct 1(1), 11 (2006) 3. Das, M., Dai, H.K.: A survey of DNA motif ﬁnding algorithms. BMC Bioinformatics 8(suppl. 7), S21 (2007)
Speeding Up Exact Motif Discovery by Bounding the Expected Clump Size
349
4. Narlikar, L., Ovcharenko, I.: Identifying regulatory elements in eukaryotic genomes. Brieﬁngs in Functional Genomics and Proteomics 8(4), 215–230 (2009) 5. Bailey, T.L., Williams, N., Misleh, C., Li, W.W.: MEME: discovering and analyzing DNA and protein sequence motifs. Nucleic Acids Research 34(suppl.2), W369– W373 (2006) 6. Hertz, G.Z., Stormo, G.D.: Identifying DNA and protein patterns with statistically signiﬁcant alignments of multiple sequences. Bioinformatics 15(78), 563–577 (1999) 7. Rahmann, S., Marschall, T., Behler, F., Kramer, O.: Modeling evolutionary ﬁtness for DNA motif discovery. In: Rothlauf, F. (ed.) Genetic and Evolutionary Computation Conference (GECCO), Montreal, Qu´ebec, Canada, pp. 225–232. ACM, New York (2009) 8. Sagot, M.F.: Spelling approximate repeated or common motifs using a suﬃx tree. In: Lucchesi, C.L., Moura, A.V. (eds.) LATIN 1998. LNCS, vol. 1380, pp. 374–390. Springer, Heidelberg (1998) 9. Pavesi, G., Mauri, G., Pesole, G.: An algorithm for ﬁnding signals of unknown length in DNA sequences. Bioinformatics 17(suppl. 1), S207–S214 (2001) 10. Sinha, S., Tompa, M.: A statistical method for ﬁnding transcription factor binding sites. In: Proceedings of the 8th International Conference on Intelligent Systems for Molecular Biology (ISMB), pp. 344–354 (2000) 11. Marschall, T., Rahmann, S.: Eﬃcient exact motif discovery. Bioinformatics 25(12), i356–i364 (2009) 12. Sandve, G.K., Abul, O., Walseng, V., Drabløs, F.: Improved benchmarks for computational motif discovery. BMC Bioinformatics 8, 193 (2007) 13. Kucherov, G., No´e, L., Roytberg, M.: A unifying framework for seed sensitivity and its application to subset seeds. Journal of Bioinformatics and Computational Biology 4(2), 553–569 (2006) 14. Nicod`eme, P., Salvy, B., Flajolet, P.: Motif statistics. Theoretical Computer Science 287, 593–617 (2002) 15. Marschall, T., Rahmann, S.: Probabilistic arithmetic automata and their application to pattern matching statistics. In: Ferragina, P., Landau, G.M. (eds.) CPM 2008. LNCS, vol. 5029, pp. 95–106. Springer, Heidelberg (2008) 16. Nuel, G.: Pattern Markov chains: optimal Markov chain embedding through deterministic ﬁnite automata. Journal of Applied Probability 45, 226–243 (2008) 17. Stefanov, V., Robin, S., Schbath, S.: Waiting times for clumps of patterns and for structured motifs in random sequences. Discrete Appl. Math. 155(67), 868–880 (2007) 18. Schbath, S.: Compound Poisson approximation of word counts in DNA sequences. ESAIM: Probability and Statistics 1, 1–16 (1995) 19. Reinert, G., Schbath, S.: Compound Poisson and Poisson process approximations for occurrences of multiple words in Markov chains. Journal of Computational Biology 5(2), 223–253 (1998) 20. Pape, U.J., Rahmann, S., Sun, F., Vingron, M.: Compound Poisson approximation of the number of occurrences of a position frequency matrix (PFM) on both strands. Journal of Computational Biology 15(6), 547–564 (2008) 21. Bassino, F., Cl´ement, J., Fayolle, J., Nicod`eme, P.: Constructions for clumps statistics. In: Proceedings of the Fifth Colloquium on Mathematics and Computer Science. Discrete Mathematics and Theoretical Computer Science, pp. 179–194 (2008) 22. Bernstein, D.S.: Matrix mathematics, 2nd edn. Princeton University Press, Princeton (2009)
Pair HMM Based Gap Statistics for Reevaluation of Indels in Alignments with Affine Gap Penalties Alexander Sch¨onhuth1, , Raheleh Salari2, , and S. Cenk Sahinalp2 1 2
Department of Mathematics, University of California at Berkeley
[email protected] School of Computing Science, Simon Fraser University, Burnaby
Abstract. Although computationally aligning sequence is a crucial step in the vast majority of comparative genomics studies our understanding of alignment biases still needs to be improved. To infer true structural or homologous regions computational alignments need further evaluation. It has been shown that the accuracy of aligned positions can drop substantially in particular around gaps. Here we focus on reevaluation of scorebased alignments with affine gap penalty costs. We exploit their relationships with pair hidden Markov models and develop efficient algorithms by which to identify gaps which are significant in terms of length and multiplicity. We evaluate our statistics with respect to the wellestablished structural alignments from SABmark and find that indel reliability substantially increases with their significance in particular in worstcase twilight zone alignments. This points out that our statistics can reliably complement other methods which mostly focus on the reliability of match positions.
1 Introduction Having been introduced over three decades ago [20] the sequencealignment problem has remained one of the most actively studied topics in computational biology. While the vast majority of comparative genomics studies crucially depend on alignment quality inaccuracies abundantly occur. This can have detrimental effects in all kinds of downstream analyses [16]. Still, our understanding of the involved biases remains rather rudimentary [14, 17]. That different methods often yield contradictory statements [8] further establishes the need for further investigations into the essence of alignment biases and their consequences [14]. While the sequencealignment problem virtually is that of inferring the correct placement of gaps, insertions and deletions (indels) have remained the most unreliable parts of the alignments. For example, Lunter et al. [17], in a wholegenome alignment study, observe 96% alignment accuracy for alignment positions which are far away from gaps while accuracy drops down to 56% when considering positions closely surrounding gaps. They also observe a downward bias in the number of inferred indels which is due to effects termed gap attraction and gap annihilation. Decreased numbers of inferred indels were equally observed in other recent studies [15, 23]. This points out that numbers and size of computationally inferred indels can make statements about alignment quality.
Joint first authorship.
V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 350–361, 2010. c SpringerVerlag Berlin Heidelberg 2010
Pair HMM Based Gap Statistics for Reevaluation of Indels in Alignments
351
The purpose of this paper is to systematically address such questions. We develop a statistical framework by which to efficiently compute probabilities of the type P(Id,A (x, y) ≥ k  LA (x, y) = n, SimA (x, y) ∈ [σ1 , σ2 ])
(1)
where (x, y) has been randomly sampled from an appropriate pool of protein pairs. In the following pools contain protein pairs which have a (either false or true positive) structural SABMark [27] (see below) alignment. In case of, for example, all pairs of human proteins, (1) would act as null distribution for human. A is a local or global optimal, scorebased alignment procedure with affine gap penalties such as the affine gap cost version of the NeedlemanWunsch (NW) algorithm [20,12] or the SmithWaterman (SW) algorithm [29, 31], LA (x, y) is the length of the alignment, SimA (x, y) denotes alignment similarity that is the fraction of perfectly matching and “wellbehaved” mismatches vs. ”bad” mismatches (as measured in terms of biochemical affinity [21]) and gap positions. Id,A (x, y) finally denotes the length of the dth longest gap in the alignment. In summary, (1) can be read as the probability that a NW resp. SW alignment of length n and similarity between σ1 and σ2 contains at least d gaps of length k and the reasoning is that gaps which make part of significant such gap combinations are more likely to reflect true indels. Significance is determined conditioned on the length L(x, y) of the alignment as well as alignment similarity Sim(x, y). The reasoning behind this is that longer alignments are more likely to accumulate spurious indels such that only increased gap length and multiplicity are significant signs of true indels. Increased similarity Sim(x, y), however, indicates that already shorter and less gaps are more likely to reflect true indels simply because an alignment of high similarity is an overall more trustworthy statement. In summary, we provide a statistically sound, systematic approach to answering questions such as “Am I to believe that 4 gaps of size at least 6 in an alignment of length 200 and similarity 50 are likely to reflect true indels” as motivated by the recent studies [15, 17, 23]. We opted to address these questions for scorebased alignments with affine gap costs for two reasons: 1. To employ scorebased such alignments still is a most popular option among most bioinformatics practitioners. 2. Such alignments can be alternatively viewed as Viterbi paths in pair HMMs. While exact statistics on Viterbi paths are hard to obtain and beyond the scope of this study we obtain reasonable approximations by “Viterbi training” sensibly modified versions of the hidden Markov chains which underlie the pair HMMs. We evaluate our statistics on the wellestablished SABmark [27] alignments. SABmark is a database of structurally related proteins which cover the entire known fold space. The “Twilight Zone set” was particularly designed to represent the worst case scenario for sequence alignment. While we obtain good results also in the more benign “Superfamilies set” of alignments it is that worst case scenario of twilight zone alignments where our statistics prove their particular usefulness. Here significance of gap multiplicity is crucial while significance of indel length alone does not necessarily indicate enhanced indel quality. Related Work: [18] reevaluate match (but not indel) positions in global scorebased alignments by obtaining reliability scores from suboptimal alignments. Similarly, [28]
352
A. Sch¨onhuth, R. Salari, and S. Cenk Sahinalp
derive reliability scores also for indel positions in global scorebased alignments. However, the method presented in [28] reportedly only works in the case of more than 30% sequence identity. Related work where structural profile information is used is [30] whereas [6] realign rather than reevaluate. Posterior decoding algorithms (see e.g. [9, 17, 3] for most recent approaches) are related to reevaluation of alignments insofar as posterior probabilities can be interpreted as reliability scores. However, how to score indels as a whole by way of posterior decoding does not have a straightforward answer. We are aware of the potential advantages inherent to posterior decoding algorithms—it is work in progress of ours to combine the ideas of pair HMM based posterior decoding aligners with the ideas from this study1 . To assess statistical significance of alignment phenomena is certainly related to the vastly used AltschulDemboKarlin statistics [13, 7, 1] where score significance serves as an indicator of protein homology. To devise computational indel models still remains an area of active research (e.g. [24, 5, 4, 17, 19]). However, the community has not yet come to a final conclusion. Last but not least, the algorithms presented here are related to the algorithms developed in [25] where the special case of d = 1 for only global alignments in (2) was treated to explore the relationship of indel length and functional divergence. The advances achieved here are to provide null models also for the more complex case of local alignments and to devise a dynamic programming approach also for the case d > 1 which required to develop generalized inclusionexclusion arguments. Just like in [25] note that empirical statistics approaches fail for the same reasons that have justified the development of the AltschulDemboKarlin statistics: sizes of samples are usually much too small. Here samples (indels in alignments) are subdivided into bins of equal alignment similarity and then further into bins of equal length n and dth longest indel size k. 1.1 Summary of Contributions As abovementioned, our work is centered around computation of probabilities P(Id (x, y) ≥ k  L(x, y) = n, Sim(x, y) ∈ [σ1 , σ2 ]).
(2)
We refer to this problem as Multiple Indel Length Problem (MILP) in the following. Our contributions then are as follows: 1. We are the first ones to address this problem and derive appropriate Markov chain based null models from the pair HMMs which underlie the NW resp. SW algorithms to yield approximations for the probabilities (2). 2. Despite having a natural formulation, the inherent Markov chain problem had no known efficient solution. We present the first efficient algorithm to solve it. 3. We demonstrate the usefulness of such statistics by showing that significant gaps in both global and local alignments indicate increased reliability in terms of identifying true structural indel positions. This became particularly obvious for worstcase twilight zone alignments of at most 25% sequence identity. 1
Note that although we derive statistical scores for indels as a whole our evaluation in the Results section will refer to counting individual indel positions.
Pair HMM Based Gap Statistics for Reevaluation of Indels in Alignments
353
(a) Standard pair HMM
(b) Markov Chain Fig. 1. Standard pair HMM corresponding to local SmithWaterman alignments and the Markov Chain whose generative statistics, after Viterbi training, approximate the Viterbi statistics of the pair HMM for local alignments
4. Thereby we deliver statistical evidence of that computational alignments are biased in terms of numbers and sizes of gaps as described in [17, 23]. In particular too little numbers of gaps can reflect alignment artifacts. 5. Reevaluation of indels in scorebased both local and global alignments had not been explicitly addressed before, in particular, reliable solutions for worstcase twilight zone alignments were missing. Our work adds to (rather than competes with) the abovementioned related work. In summary, we have complemented extant methods for scorebased alignment reevaluation. Note that none of the existing methods explicitly addresses indel reliability but rather focus on the reliability of substitutions.
2 Methods 2.1 Pair HMMs and Viterbi Path Statistics In the following we only treat the more complex case of local SmithWaterman alignments. See [25] for the case of global NeedlemanWunsch like alignments where in the following the statistical models derived in [25] have to be, mutatis mutandis, plugged into the computations of the subsequent subsections. A local SmithWaterman alignment with affine gap penalties of two sequences x = x1 ...xw , y = y1 ...yz is associated with the most likely sequence of hidden states (i.e. the
354
A. Sch¨onhuth, R. Salari, and S. Cenk Sahinalp
Viterbi path) in the pair HMM of Fig. 1(a) [10]. The path of hidden states translates to an alignment of the two sequences by emitting the necessary symbols along the run. Statistics on Viterbi paths in HMMs pose hard mathematical problems and have not been fully understood. In analogy to [25], we construct a Markov chain whose common, generative statistics mimick the Viterbi statistics of interest here. Hence probabilities derived from this Markov chain serve as approximations of (2). We do this by the following steps: 1. 2. 3. 4.
We take the Markov chain of the pair HMM in Fig. 1(a) as a template. We add two match states M 1, M 3. The original match state is M 2. We merge the initial resp. terminal regions into one start resp. end state. We collapse states X and Y into one indel state I.
The Markov chain approach is justified by the fact that consecutive runs in Viterbi paths are approximately governed by the geometric distribution which is precisely what a Markov chain reflects. The second point is to take into account the nonstationary character of the original Markov chain. Note that in local alignments, initial and final consecutive stretches of (mis)matches are longer than intermediate (mis)match stretches which translates to q1 , q6 > q5 in Fig. 1(a). See an extended version of this paper [26] for more detailed discussions and tables. Point 3 merely reflects that we are only interested in statistics on alignment regions. Point 4 finally accounts for that we do not make a difference between insertions and deletions due to the involved symmetry (relative to exchanging sequences). 2.2 Algorithmic Solution of the MILP We define Cn,k,d to be the set of sequences over the alphabet B, M1, I, M2, M3, E (for Begin, Match1, Indel, Match2, Match3 and End) of length n that contain at least d consecutive I stretches of length at least k. Let An := {Xn = M3, Xn+1 = E} be the set of sequences with an alignment region of length n. We then suggest the following procedure to compute approximations of the probabilities (2) where T (σ1 , σ2 ) is supposed to be a pool of protein pairs (x, y) whose alignments exhibit alignment similarity Sim(x, y) ∈ [σ1 , σ2 ]. 1: Compute alignments for all sequence pairs in T (σ1 , σ2 ). 2: Infer parameters q1 , q2 , q3 , q4 , q5 , q6 of the Markov chain by Viterbi training it with the alignments. 3: n ← length of the alignment of x and y 4: Compute P(Cn,k,d ∩An ) as well as P(An ), the probabilities that the Markov chain of Fig. 1(b) generates sequences from Cn,k,d ∩ An and An 5: Output P(Cn,k,d ∩ An ) (3) P(Cn,k,d  An ) = P(An ) as an approximation for (2). The idea of step 1 and 2 is to specifically train the Markov chain to generate alignments from the pool T (σ2 , σ2 ). In our setting, Viterbi training translates to counting M1 toM1 , M1 toI, ItoI, ItoM2 , M2 toM2 and M3 toM3 transitions
Pair HMM Based Gap Statistics for Reevaluation of Indels in Alignments
355
in the alignments under consideration to provide maximum likelihood estimates for q1 , q2 , q3 , q4 , q5 and q6 . 2.3 Efficient Computation of P(Cn,k,d ∩ An ) The problem of computing probabilities of the type (2) has been made the problem of computing the probability that the Markov chain generates sequences from Cn,k,d ∩ An and An . While computing P(An ) = P(Xn = M3 ) · P(Xn+1 = E  Xn = M3 ) is an elementary computation, the question of efficient computation and/or closed formulas for probabilities of the type P(Cn,k,d ∩ An ) had not been addressed in the mathematical literature and poses a last, involved problem. The approach taken here is related to the one taken in [25], which treated the special case of single consecutive runs (i.e. d = 1) in the context of the twostate Markov chains which reflect null models for global alignments. We generalize this in two aspects. First, we provide a solution for more than two states (our approach applies for arbitrary numbers of states). Second, we show how to deal with multiple runs. The probability event design trick inherent to our solution was adopted from that of [22]. The solution provided in [22] can be used for the (rather irrelevant) case of global alignments with linear gap penalties, i.e. gap opening and extension are identically scored. See also [11, 2] for related mathematical treatments of the i.i.d. case. In the following, let i, j ∈ {B, M1 , I, M2 , M3 , E} be indices ranging over the alphabet of Markov chain states. Let ei ∈ R6 be the standard basis vector of R6 having a 1 in the ith component and zero elsewhere. For example, eI = (0, 0, 1, 0, 0, 0), eM3 = (0, 0, 0, 0, 1, 0). We furthermore denote the standard scalar product on R6 by . , .. Efficient computation of the probabilities P(Cn,k,d ∩ An ) is obtained by a dynamic programming approach. As usual, we collect the Markov chain parameters (in accordance with Fig. 1(b)) into a state transition probability matrix P = (pij := P(Xt = i  Xt−1 = j))i,j∈{B,M1,I,M2,M3,E}
(4)
such that, for example pI,M3 = 1 − q3 − q4 and an initial probability distribution vector π = eB = (1, 0, 0, 0, 0, 0)T . The initial distribution reflects that we start an alignment from the ’Begin’ state. More formally, P(X0 = B) = 1. For example, according to the laws that govern a Markov chain, the probability of being in the indel state I at position t in a sequence generated by the Markov chain is P(Xt = I) = eI , P t π = eI , P t eB .
(5)
It can be seen that naive approaches to computing P(Cn,k,d ∩ An ) result in runtimes that are exponential in n, the length of the alignments, which is infeasible. Efficient computation of these probabilities is helped by adopting the event design trick of [22]. In detail, we define Dt,k := {Xt = I, ..., Xt+k−1 = I, Xt+k = I}
(6)
to be the set of sequences that have a run of state I of length k that stretches from positions t to t + k − 1 and ends at position t + k − 1, that is, the run is followed by a visit of state different from I at position t + k.
356
A. Sch¨onhuth, R. Salari, and S. Cenk Sahinalp
We further define πI :=
1 · (pBI , pM1 I , 0, pM2 I , pM3 I , pEI )T (1 − pI I )
(7)
which can be interpreted as the state the Markov chain is in if we know that the Markov chain has left state I at the time step before. Consider P(Xt+s = I  Xt−1 = I, Xt = I) as the probability that the Markov chain is in state I at period t + s after having been in the state πI at period t (note that this probability is independent of t as we deal with a homogeneous Markov chain). Similarly P(At+k+s  Dt,k ) is the probability that the Markov chain transits from state M3 to state E at position t + k + s + 1 while it has a run of state I of length k that stretches from positions t to t + k − 1 and ends at position t + k − 1. Lastly, we introduce the variables
Ql,m :=
P(Xs1 = I)
1≤s1 ,...,sm ≤l s1 +...+sm =l
RL,m :=
L
m
P(Xt+si = I  Xt−1 = I, Xt = I)
(8)
i=2
Ql,m P(At+k+L−l  Dt,k ),
1≤m≤L≤n
(9)
l=m
for 1 ≤ m ≤ l ≤ n where the sum reflects summing over partitions of the integer l into m positive, not necessarily different, integers si . We then obtain the following lemma a proof of which needs a generalized inclusionexlusion argument. See an extended version of this paper [26] for the proof. Lemma 1. n k+1
P(Cn,k,d ∩ An ) =
m=1
(−1)m+d
m−1 m · (pk−1 II (1 − pII )) · Rn−mk,m . d−1
(10)
The consequences of the above considerations can be summarized in the following theorem. Theorem 1. A full table of values P(Cn,k,d ∩ An ), k ≤ n ≤ N can be computed in O(N 3 ) runtime. Proof. Observing the recursive relationship Ql,m =
l−m+1
P(Xt+s = I  Xt−1 = I, Xt = I)Ql−s,m−1 ,
m>1
(11)
s=1
yields a standard dynamic programming procedure by which the ensemble of the Ql,m and the RL,m (1 ≤ m ≤ l, L ≤ N ) can be computed in O(N 3 ) runtime. This also requires that the values P(Xs = I), P(Xt+s = I  Xt−1 = I, Xt = I) have been precomputed which can be done in time linear in N . After computation of the Ql,m and the RL,m , computation of the P(Cn,k,d ∩ An ), 1 ≤ k ≤ n ≤ N then equally requires O(N 3 ) time which follows from lemma 1.
Pair HMM Based Gap Statistics for Reevaluation of Indels in Alignments SmithWaterman Twi
SmithWaterman Sup
0.85
0.82 "Sig7" "Sig4" "Sig1" "Const"
0.8
"Sig7" "Sig4" "Sig1" "Const"
0.8 0.78
0.75
Precision
Precision
357
0.7 0.65
0.76 0.74 0.72 0.7 0.68 0.66
0.6
0.64 0.55
0.62 1
0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1
1
0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1
Recall
Recall NeedlemanWunsch Sup 0.78
"Sig7" "Sig4" "Sig1" "Const"
"Sig7" "Sig4" "Sig1" "Const"
0.76 0.74
Precision
Precision
NeedlemanWunsch Twi 0.73 0.72 0.71 0.7 0.69 0.68 0.67 0.66 0.65 0.64 0.63 0.62
0.72 0.7 0.68 0.66 0.64 0.62
1
0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1
Recall
1
0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1
Recall
Fig. 2. PrecisionRecall curves for the different sets of computational alignments. Recall is lowered through lowering the significance threshold θ for the strategies SigD (θ) (θ = 1.0 for maximal recall of 1.0) and for raising indel length in the baseline strategy Const (length = 1 for maximal recall of 1.0).
3 Results Data. We downloaded both the “Superfamilies” (Sup) and “Twilight Zone” (Twi) datasets together with their structural alignment information from SABmark 1.65 [27], including the suggested false positive pairs (that is structurally unrelated, but apparently similar sequences, see [27] for a detailed description). While Sup is a more benign set of structural alignments where protein pairs can be assumed to be homologous and which contains alignments of up to 50% identity, Twi is a worst case scenario of alignments between only 025 % sequence identity where the presence of a common evolutionary ancestor remains unclear. To calculate pairwise global resp. local alignments we used the “GGSEARCH” resp. ”LALIGN” tool from the FASTA sequence comparison package [21]. As a substitution matrix, BLOSUM50 (default) was used. GGSEARCH resp. LALIGN implement the classical NeedlemanWunsch (NW) resp. SmithWaterman (SW) alignment algorithm both with affine gap penalties. We subsequently discarded global resp. local alignments of an evalue larger than 10.0 resp. 1.0, as suggested as a default threshold setting [21], in order to ensure to only treat alignments which can be assumed not to be entirely random. We then subdivided the resulting 4 groups (NW Twi, NW Sup, SW Twi and SW Sup) of computational alignments into pools of alignments of similarity in [σ, σ + 10]
358
A. Sch¨onhuth, R. Salari, and S. Cenk Sahinalp
where σ ranged from 20 to 90. We then trained parameters (using also the false positive SABmark alignments in order to obtain unbiased null models) for the 36 = 4 × 9 different Markov chains (2state as in [25] resp. 6state as described here for global resp. local) and computed probability tables as described in the Methods section. After computation of probability tables, false positive alignments were discarded. See [26] for Markov chain parameters and plots. The remaining (non falsepositive) NW Twi, NW Sup, SW Twi and SW Sup alignments contained 179018, 407629, 20853 and 86233 gap positions contained in 122701, 276082, 17776 and 68513 gaps. In the global alignments this includes also initial and end gaps. 3.1 Evaluation Strategies Based on efficient computation of probabilities of the type (2) we devise strategies SigD (θ) for predicting indel reliability in NW and SW alignments where D = 1, 4, 7. Let K be the length of the Lth longest indel in the NW resp. SW alignment of proteins x, y. In strategy SigD (θ), this indel is classified as reliable if SigD (θ) :
P(Imin(D,L) (x, y) ≥ K  L(x, y), Sim(x, y)) ≤ θ.
(12)
In other words, we look up whether it is significant that an alignment of length L(x, y) and similarity Sim(x, y) contains at least L resp. D, in case of D > L resp. D ≤ L, indels of size K. Note that in strategy Sig1 (θ) that is for D = 1, since L ≥ 1 hence min(D, L) = 1, an indel of length K is evaluated as reliable if and only if the indel is significantly long without considering its relationship with the other gaps in the alignment. This is different for strategy Sig7 (θ) where, for example, the 6th longest indel is evaluated as reliable if it is significant to have at least 6 indels of that length (min(D, L) = 6) whereas the 8th longest indel is supposed to be reliable if there are at least 7 indels of that length (min(D, L) = 7). Note that in strategy Sig7 (θ) already shorter indels are classified as reliable in case that there are many indels of that length in the alignment which is not the case in strategy Sig1 (θ). Clearly, raising D beyond 7 might make sense. For sake of simplicity only, we restricted our attention to D = 1, 4, 7. As a simple baseline method we suggest Const which considers an indel as reliable if its length exceeds a constant threshold. Both raising the constant length threshold in Const and lowering θ in SigD (θ) lead to reduced amounts of indels classified as reliable. Evaluation Measures. We found that for both global and local alignments further evaluation of gaps of length at most 4 and length greater than 30 (global) resp. 20 (local) did not make much sense. See the extended version [26] for some basic statistics on such gaps. However, for gaps of length ranging from 5 to 20 resp. 30 in local resp. global alignments a significance analysis made sense. We evaluated the indel positions in gaps of length 5 − 20 resp. 5 − 30 in local resp. global alignments by defining a true positive (TP) to be a computational gap position which is classified as reliable (meaning that it is found to be significant by SigD (θ), D = 1, 4, 7 or long enough by Const) and coincides with a true structural
Pair HMM Based Gap Statistics for Reevaluation of Indels in Alignments
359
Table 1. Relationship between Recall and θ (displayed as − log(θ)) for strategies SigD and indel length (= IL) for strategy Const (= Con) Recall 1.0 0.75 0.5 0.25
− log(θ) 0.0 0.0 0.0 2.0 2.0 1.0 2.5 2.5 1.5 3.5 3.5 2.5 Sig7 Sig4 Sig1 SW Twi
IL 5 5 6 8 Con
−log(θ) 0.0 0.0 0.0 2.0 2.0 1.0 3.0 3.0 1.5 4.5 4.5 3.0 Sig7 Sig4 Sig1 SW Sup
IL 5 6 7 10 Con
− log(θ) 0.0 0.0 0.0 19.0 18.5 6.5 28.0 24.0 10.5 38.5 33.0 16.0 Sig7 Sig4 Sig1 NW Twi
IL 5 6 8 11 Con
−log(θ) 0.0 0.0 0.0 21.0 19.5 7.0 30.0 27.0 11.5 41.5 36.0 18.0 Sig7 Sig4 Sig1 NW Sup
IL 5 6 8 11 Con
indel position in the reference structural alignment as provided by SABmark. Correspondingly, a false positive (FP) is a gap position classified as reliable which cannot be found in the reference alignment. A true negative (TN) is a gap position not classified as reliable and not a structural indel position and a false negative (FN) is not classified as reliable but refers to a true structural indel position. Recall, as usual, is calculated as T P/(T P + F N ) whereas Precision (also called PPV=Positive Predictive Value) is calculated as T P/(T P + F P ). 3.2 Discussion of Results Results are displayed in Figure 2 where we have plotted Precision vs. Recall while lowering θ for the strategies SigD (θ) and increasing indel length for the baseline method Const. While Recall = 1.0 relates to θ = 1.0 in the strategies SigD maximal recall relates to indel length 5 in the strategy Const. Table 1 displays further supporting statistics on the relationship between choices of θ resp. indel length and Recall. A first look reveals that indel reliability clearly increases for increasing indel length— longer indels are more likely to contain true indel positions. However, further improvements can be achieved by classifying indels as reliable according to significance. For the Sup alignments improvements over the baseline method are only slight. For both local and global alignments strategy Sig1 is an option in particular when it comes to achieving utmost precision which can be raised up to 0.8. For the Twi alignments differences are obvious. More importantly, just considering indel length without evaluating multiplicity does not serve to achieve substantially increased Precision. Here, multiplicity is decisive which in particular confirms the findings on twilight zone alignments reported in [23]. In the Twi alignments Precision can be raised up to about 0.7. Note that [28] achieve 0.7 Precision on both match and gap positions for structural alignments (not from SABmark) of 25 − 30% identity while reporting that their evaluation does not work for alignments of less than 25% identity which renders it not applicable for the Twi alignments. The posterior decoding aligner FSA which outperformed all other multiple aligners in terms of Precision on both (mis)match and gaps in the entire SABmark dataset, comprising both Sup and Twi [3] report Precision of 0.52 (all other aligners fall below 0.5) without further reevaluation of their alignments. This lets us conclude that our statistical reevaluation makes an interesting complementary contribution to alignment reevaluation.
360
A. Sch¨onhuth, R. Salari, and S. Cenk Sahinalp
4 Conclusion Most recent studies have again pointed out that computational alignments of all kinds need further reevaluation in order to avoid detrimental effects in downstream analyses of comparative genomics studies. While exact gap placement is at the core of aligning sequence positive prediction rates are worst within or closely around inferred indels. Here we have systematically addressed that indel size and multiplicity can serve as indicators of alignment artifacts. We have developed a pair HMM based statistical evaluation pipeline which can soundly distinguish between spurious and reliable indels in alignments with affine gap penalties by measuring indel significance in terms of indel size and multiplicity. As a result we are able to reliably identify indels which are more likely to enclose true structural indel positions as provided by SABmark, raising positive prediction rates up to 0.7 even for worstcase twilight zone alignments of maximal 25% sequence identity. Since previous approaches predominantly addressed reevaluation of match/mismatch positions we think that we have made a valuable, complementary contribution to the issue of alignment reevaluation. Future work of ours is concerned with reevaluation of pair HMM based posterior decoding aligners which have proven to be superior over scorebased aligners in a variety of aspects. Acknowledgments. AS is funded by donation from David DesJardins, Google Inc. We would like to thank Lior Pachter for helpful discussions on Viterbi path statistics.
References 1. Altschul, S.F., Gish, W.: Local alignment statistics. Methods in Enzymology 266, 460–480 (1996) 2. Bassino, F., Clement, J., Fayolle, J., Nicodeme, P.: Constructions for Clumps Statistics. In: MathInfo 2008 (2008), www.arxiv.org/abs/0804.3671 3. Bradley, R.K., Roberts, A., Smoot, M., Juvekar, S., Do, J., Dewey, C., Holmes, I., Pachter, L.: Fast statistical alignment. PLoS Computational Biology 5(5), e1000392 (2009) 4. Cartwright, R.A.: Logarithmic gap costs decrease alignment accuracy. BMC Bioinformatics 7, 527 (2006) 5. Chang, M.S.S., Benner, S.A.: Empirical analysis of protein insertions and deletions determining parameters for the correct placement of gaps in protein sequence alignments. Journal of Molecular Biology 341, 617–631 (2004) 6. Cline, M., Hughey, R., Karplus, K.: Predicting reliable regions in protein sequence alignments. Bioinformatics 18 (2), 306–314 (2002) 7. Dembo, A., Karlin, S.: Strong limit theorem of empirical functions for large exceedances of partial sums of i.i.d. variables. Annals of Probability 19, 1737–1755 (1991) 8. Dewey, C.N., Huggins, P.M., Woods, K., Sturmfels, B., Pachter, L.: Parametric alignment of Drosophila genomes. PLoS Computational Biology 2, e73 (2006) 9. Do, C.B., Mahabhashyam, M.S., Brudno, M., Batzoglou, S.: ProbCons: Probabilistic consistencybased multiple sequence alignment. Genome Research 15, 330–340 (2005) 10. Durbin, R., Eddy, S., Krogh, A., Mitchison, G.: Biological sequence analysis. Cambridge University Press, Cambridge (1998) 11. Fu, J.C., Koutras, M.V.: Distribution theory of runs: a Markov chain approach. Journal of the American Statistical Association 89(427), 1050–1058 (1994)
Pair HMM Based Gap Statistics for Reevaluation of Indels in Alignments
361
12. Gotoh, O.: An improved algorithm for matching biological sequences. Journal of Molecular Biology 162, 705–708 (1982) 13. Karlin, S., Altschul, S.F.: Methods for assessing the statistic significance of molecular sequence features by using general scoring schemes. Proceedings of the National Academy of Sciences of the USA 87, 2264–2268 (1990) 14. Kumar, S., Filipski, A.: Multiple sequence alignment: In pursuit of homologous DNA positions. Genome Research 17, 127–135 (2007) 15. Loeytynoja, A., Goldman, N.: An algorithm for progressive multiple alignment of sequences with insertions. Proceedings of the National Academy of Sciences of the USA 102 (30), 10557–10562 (2005) 16. Loeytynoja, A., Goldman, N.: Phylogenyaware gap placement prevents errors in sequence alignment and evolutionary analysis. Science 320, 1632–1635 (2008) 17. Lunter, G., Rocco, A., Mimouni, N., Heger, A., Caldeira, A., Hein, J.: Uncertainty in homology inferences: Assessing and improving genomic sequence alignment. Genome Research 18 (2007), doi:10.1101/gr.6725608 18. Mevissen, H., Vingron, M.: Quantifying the local reliability of a sequence alignment. Stochastic Models of Sequence Evolution including InsertionDeletion Events. Protein Engineering 9(2), 127–132 (1996) 19. Miklos, I., Novak, A., Satija, R., Lyngso, R., Hein, J.: Stochastic Models of Sequence Evolution including InsertionDeletion Events. In: Statistical Methods in Medical Research 2009 (2008), doi:10.1177/096228020809950 20. Needleman, S.B., Wunsch, C.D.: A general method applicable to the search for similarities in the amino acid sequence of two proteins. Journal of Molecular Biology 48, 443–453 (1970) 21. Pearson, W.R., Lipman, D.J.: Improved tools for biological sequence comparison. Proc. Natl. Acad. Sci. USA 85, 2444–2448 (1988) 22. Pek¨oz, E.A., Ross, S.M.: A simple derivation of exact reliability formulas for linear and circular consecutivekofn F systems. Journal of Applied Probability 32, 554–557 (1995) 23. Polyanovsky, V.O., Roytberg, M.A., Tumanyan, V.G.: A new approach to assessing the validity of indels in algorithmic pair alignments. Biophysics 53(4), 253–255 (2008) 24. Qian, B., Goldstein, R.A.: Distribution of indel lengths. Proteins: Structure, Function and Bioinformatics 45, 102–104 (2001) 25. Sch¨onhuth, A., Salari, R., Hormozdiari, F., Cherkasov, A., Sahinalp, S.C.: Towards improved assessment of functional similarity in largescale screens: an indel study. Journal of Computational Biology 17(1), 1–20 (2010) 26. Sch¨onhuth, A., Salari, R., Sahinalp, S.C.: Pair HMM based gap statistics for reevaluation of indels in alignments with affine gap penalties—Extended Version (2010), http://arxiv.org/abs/1006.2420 27. Van Walle, I., Lasters, I., Wyns, L.: SABmark  a benchmark for sequence alignment that covers the entire known fold space. Bioinformatics 21, 1267–1268 (2005) 28. Schlosshauer, M., Ohlsson, M.: A novel approach to local reliability of sequence alignments. Bioinformatics 18 (6), 847–854 (2002) 29. Smith, T.M., Waterman, M.: Identification of common molecular subsequences. Journal of Molecular Biology 147, 195–197 (1981) 30. Tress, M.L., Jones, D., Valencia, A.: Predicting reliable regions in protein alignments from sequence profiles. Journal of Molecular Biology 330 (4), 705–718 (2003) 31. Waterman, M.S., Eggert, M.: A new algorithm for best subsequences alignment with application to tRNArRNA comparisons. J. MoL. BioL. 197, 723–728 (1987)
Quantifying the Strength of Natural Selection of a Motif Sequence ChenHsiang Yeang Institute of Statistical Science, Academia Sinica, Taipei, Taiwan
[email protected] Abstract. Quantiﬁcation of selective pressures on regulatory sequences is a central question in studying the evolution of gene regulatory networks. Previous methods focus primarily on single sites rather than motif sequences. We propose a method of evaluating the strength of natural selection of a motif from a family of aligned sequences. The method is based on a Poisson process model of neutral sequence substitutions and derives a birthdeath process of the motif occurrence frequencies. The selection coeﬃcient is treated as a penalty for the motif death rate. We demonstrate that the birthdeath model closely approximates statistics generated from simulated data and the Poisson process assumption holds in mammalian promoter sequences. Furthermore, we show that a considerably higher portion of known transcription factor binding motifs possess high selection coeﬃcients compared to negative controls with high occurrence frequencies on promoters. Preliminary analysis supports the potential applications of the model to identify regulatory sequences under selection.
Summary Motivation Many sequence motifs –such as transcription factor binding sites – are present in multiple locations of the genomes. Due to their functional constraints, selective pressures are often exerted on the evolution of sequence motifs. Quantiﬁcation of selective pressures on motifs is a powerful tool to study the evolution of biological systems and to identify functionally important motifs from sequence data. However, most existing methods either target speciﬁc sites (rather than motif sequences) or apply only to two species. Consequently, a quantitative model and algorithm to evaluate the selective strength of motif sequences from multiple species need to be developed. Main results We propose a simple model of neutral (i.e., selectionfree) evolution of motif sequences. The model hypothesizes that each position undergoes an independent random sequence substitution. The occurrence of a motif results from stochastic additions (birth) and removals (death) based on sequence substitutions. We derive the neutral and selective models of motif evolution and propose an algorithm to quantify the selective strength of a motif based on the two models. V. Moulton and M. Singh (Eds.): WABI 2010, LNBI 6293, pp. 362–373, 2010. c SpringerVerlag Berlin Heidelberg 2010
Quantifying the Strength of Natural Selection of a Motif Sequence
363
To validate its utility we demonstrate a considerably higher portion of known transcription factor binding motifs possess strong selective strengths compared to random controls. In contrast, a conservation score fails to separate functional motifs and the short random motifs that occur frequently on promoters. Signiﬁcance Initial analysis indicates that the birthdeath model is adequate for the neutral evolution of motifs. Furthermore, selective coeﬃcients outperform conservation scores in separating functional motifs from random sequences. The results justify the use of our model and algorithm in studying the evolution of functional motifs and identifying de novo functional motifs.
1
Introduction
High sequence similarity of proteincoding genes between distant species has led to the shift of focus in studying the evolution of non proteincoding regions. One central issue in this area is to gauge the selective pressure of a sequence motif. Cisregulatory elements or regulatory RNAs may possess strong sequence speciﬁcity and resist random drifts. It is therefore possible to identify these elements from the sequences of multiple genes and organisms. One can align the promoter sequences of orthologous genes and apply motifﬁnding algorithms to identify the conserved motifs [1]. Conservation alone, however, may not confer natural selection since it also depends on the rate of neutral evolution, sequence length and complexity, population structure, and other factors. A variety of methods have been proposed to detect/quantify natural selection from sequences, including a the ratios of nonsynonymous to synonymous substitution rates K Ks , [2], likelihood scores from a background sequence substitution model [3], comparison of intraspeciﬁc variation versus interspeciﬁc divergence [4], deviation between heterozygosity and number of segregation sites [5], and comparison of SNP frequencies in distinct haplotype groups [6]. Despite the rich literature in detecting natural selection from sequences, the majority of the studies consider the evolution of single sites instead of motifs. Furthermore, most of these models require a intraspeciﬁc polymorphism data which may not be available, and the K Ks test applies only to proteincoding regions. To overcome these drawbacks, we propose a method of evaluating the strength of natural selection of a motif from aligned sequences. The method is based on a simple neutral model of sequence substitution: what is the distribution of motif occurrences in a sequence of ﬁxed length if each position undergoes an independent sequence substitution? The rate of sequence substitution, the entire sequence length, evolutionary distances of sampled species and sequence complexity of the motif determine the rates of addition (birth) and deletion (death) of motifs in neutral evolution. In contrast, a motif under purifying selection such as a transcription factor binding site often populates on promoters and resists deletions. We quantify natural selection by a coeﬃcient penalizing the rate of motif deletions, and develop an algorithm to estimate the maximumlikelihood selection coeﬃcient.
364
C.H. Yeang
Our model resembles the probabilistic model of promoter evolution in [7] as both models deﬁne a motif as a collection of ﬁxedlength sequences and employ continuoustime Markov processes on sequence substitutions. However, our model diﬀers from [7] by discarding sequencespeciﬁc substitution rates, considering the evolution of the motif occurrence frequencies, and being applied to the aligned sequences of more than two species. The birthdeath model approximates the empirical distributions derived from simulated data. Analysis on the 5kb upstream promoters of 34 mammalian genomes also validates the underlying hypothesis of the model – Poisson process of sequence substitution. We then calculate the selection coeﬃcients of 388 known transcription factor binding motifs and random sequences. The selection coeﬃcient distribution of known motifs is signiﬁcantly tilted to high values compared to random controls, suggesting the tendency of positive selection of many transcription factor binding motifs. In contrast, the magnitudes of conservation (fraction of species containing the motif) on transcription factor binding motifs are not higher than random controls.
2 2.1
Methods Overview
Our method is based on a neutral model of independent sequence substitution in each position. The distribution of motif counts depends on (1)the rate of sequence substitution, (2)the time interval of interest, (3)the promoter sequence length, (4)the degeneracy and complexity of the motif in the sequence space. In the neutral model a Poisson process is employed to the sequence substitution of each position. The instantaneous rates of additions (birth) and deletions (death) of the motif can be derived from the sequence substitution model. In contrast, if purifying selection occurs to the motif then the death rate is penalized by a constant. The evolution of motif occurrence frequency distributions is thus expressed as a system of diﬀerentialdiﬀerence equations parameterized by the penalty constant and the four factors described above. We can calculate the motif count distributions by simulating the diﬀerentialdiﬀerence equations. Furthermore, according to the simulated distributions we apply binary search to ﬁnd the penalty constant that maximizes the likelihood score of aligned sequences. The penalty constant characterizes the strength of natural selection. 2.2
A Poisson Process Model of Sequence Substitution
A Poisson process is probably the simplest model of sequence substitution [8]. In an inﬁnitesimal time interval dt the nucleotide sequence of a position transitions to another base with probability λdt. Denote nP (t) the cumulative number of sequence changes at time t. The transitions from t to t + dt follow P (nP (t + dt) = N + 1nP (t) = N ) = λdt. = 1 − λdt. P (nP (t + dt) = N nP (t) = N )
(1)
Quantifying the Strength of Natural Selection of a Motif Sequence
365
and the conditional probability at a ﬁnite time interval t is P (nP (t) = N nP (0) = 0) =
(λt)N N!
e−λt .
(2)
Poisson processes are Markovian as conditional probabilities are invariant with time shifts. Suppose nP (t) is observed at time points ti s with interval Ti s: ti+1 = ti + Ti .
(3)
Denote mi ≡ nP (ti+1 ) − nP (ti ) as the number of sequence changes in time interval (ti , ti+1 ]. The log likelihood of the data is L(λ) = i log P (nP (ti+1 ) − nP (ti ) = mi ) (4) = i mi log(λTi ) − λTi + C. By taking the derivative of L(λ) with respect to λ the maximum likelihood rate is ˆ = N. (5) λ T where N is the total number of changes along each time interval and T is the sum of all time intervals. In this work we assume the Poisson process rate λ is identical in all positions and across all lineages and estimate λ from a family of aligned sequences and their phylogenetic tree. The parsimonious sequences of the internal nodes of the tree are inferred by a dynamic programming algorithm [9]. In brief, for the aligned sequences at each position we construct a cost function of assigning a sequence conﬁguration to the internal nodes of the tree as the total number of sequence substitutions along each branch of the tree. The cost function along a tree can be recursively computed. Denote v as an internal node and u ∈ B ≡ {A, C, G, T } as a nucleotide. The cost function of v = u becomes C(v = u) = i maxui ∈B [C(vi = ui ) + d(u, ui )]. (6) where each vi is a child of v and d(u, ui ) denotes the distance between bases u and ui . The reconstructed ancestral sequences maximize equation 6 and can be recursively computed using dynamic programming. 2.3
A BirthDeath Model for the Neutral Evolution of Motif Occurrences
The major contribution of this study is a neutral model of motif evolution. Motif occurrences can be modeled as a birthdeath process [10]. The birth and death rates are determined by the sequence substitution rate and the degeneracy of the motif sequences. A motif M ⊂ B l is deﬁned as a collection of nucleotide sequences of length l. Degenerate symbols in IUPAC format are allowed in M. For instance, R denotes purines (A or G) and Y denotes pyrimidines (C or T). Given a promoter sequence S of length ls and the sequence substitution rate λ at each position, we want to
366
C.H. Yeang
model the distributions of n(t), the frequency of motif occurrences in sequence S at time t. We ﬁrst consider the sequence evolution in a window of length l. There are 4l possible sequences, and each sequence s ∈ B l can be labeled as either a member of the motif (s ∈ M) or not (s ∈ M). These sequences comprise an undirected graph G = (V, E), where a node v ∈ V denotes a sequence and an edge e = (v1 , v2 ) denotes the two sequences v1 and v2 diﬀering at one position. M constitutes a subset of nodes in G, and the evolution of the sequences in an lmer window can be viewed as a Markov random walk on G. In an inﬁnitesimal time interval a sequence is allowed only to transition to neighboring nodes in G. The overall rate of transitions is the sequence substitution rate of the entire window λl. With an independent and identically distributed (iid) assumption this rate is equally divided among all the neighboring nodes. We are interested in the transition rate from a nonmotif sequence to a motif sequence or vice versa. In principle this rate depends on the initial and ﬁnal states of each transition and is quite complicated. To simplify the model we use two numbers to characterize the average fraction of motif → nonmotif transitions and vice versa. r01 = r10 =
{(v1 ,v2 )∈E:v1 ∈M,v2 ∈M} . {(v1 ,v2 )∈E:v1 ∈M} {(v1 ,v2 )∈E:v1 ∈M,v2 ∈M} . {(v1 ,v2 )∈E:v1 ∈M}
(7)
r01 is the fraction of all nonmotif → motif transitions among all transitions from nonmotifs. For simplicity we expect the nonmotif → motif transitions and r01 nonmotif → nonmotif transitions are distributed by a ratio 1−r . A reciprocal 01 argument applies to the motif → nonmotif transitions for r10 . An equal transition rate to each sequence may not be an adequate assumption as the distribution of vertebrate genes has a strong bias in the CpG islands [11]. Consequently, we calibrate the ratios r01 and r10 by the background frequencies of nucleotides (PA , PC , PG , PT ):
r01 = r10 =
w(v1 ,v2 )δ(v2 ∈M) . w(v1 ,v2 ) w(v ,v )δ(v ∈ M) 1 2 2 {(v1 ,v2 )∈E:v1 ∈M} . {(v ,v )∈E:v ∈M} w(v1 ,v2 ) {(v1 ,v2 )∈E:v1 ∈M}
{(v1 ,v2 )∈E:v1 ∈M}
1
2
(8)
1
where w(v1 , v2 ) is the nucleotide background probability of v2 at the position where v1 and v2 diﬀer. For instance, w(AGGC, AGT C) = PT . δ(.) is an indicator function. r01 and r10 are weighted by the background nucleotide frequencies such that more transitions are allocated to GCrich sequences. Summarizing the discussions above the transitions of motif occurrence of an lmer window conform with the following equations: P (n(t + dt) = 1n(t) = 0) = λlr01 dt. P (n(t + dt) = 0n(t) = 1) = λlr10 dt.
(9)
We then extend the analysis to the entire promoter sequence of length ls . In an inﬁnitesimal time interval dt, n(t) = n can only increase/decrease by 1 or
Quantifying the Strength of Natural Selection of a Motif Sequence
367
remain intact. Assuming the motif instances on the promoter do not overlap, there are ln positions occupied by existing motifs and ls − ln free positions. The ln occupied positions are divided into n independent windows, and the motif → nonmotif transitions of each window follow equation (9.2). Thus the “death rate” of motif occurrence on the entire sequence is multiplied by n: P (n(t + dt) = n − 1n(t) = n) = λlr10 ndt.
(10)
The “birth rate” of motif occurrence is more diﬃcult to analyze because the number of windows depends on the actual positions of existing motifs and these windows are not independent. For simplicity we approximate the number of independent lmer windows among free positions by ls − ln + l + 1, the number of lmer windows in ls − ln consecutive positions. Thus the “birth rate” of motif occurrence on the entire sequence is multiplied by ls − ln + l + 1: P (n(t + dt) = n + 1n(t) = n) = λlr01 (ls − ln + l + 1)dt.
(11)
Equations (11) and (10) specify the birth and death rates of motif occurrences in an inﬁnitesimal time interval. The distribution Pn (t) ≡ P (n(t) = n) of motif occurrences over time can be expressed as the diﬀerentialdiﬀerence equations: dP0 (t) dt dPn (t) dt
= μ(1)P1 (t) − λ(0)P0 (t). = λ(n − 1)Pn−1 (t) + μ(n + 1)Pn+1 (t) − (λ(n) + μ(n))Pn (t). λ(n) = λlr01 (ls − ln + l + 1). μ(n) = λlr10 n. 2.4
(12)
A BirthDeath Model of the Selective Evolution of Motif Occurrences
The purpose of constructing a neutral model of motif evolution is to identify the motif sequences that undergo purifying selection. Intuitively, purifying selection penalizes decrements of a functional motif on the promoter. Thus we divide the death rates by a selection coeﬃcient: μ (n) =
μ(n) s .
(13)
When s > 1, the process of motif deletion slows down and more motifs are accumulated. This phenomenon is consistent with purifying selection. s is diﬀerent from the conventional deﬁnition of selection coeﬃcients in population genetics, which denotes the deviation of genotype frequencies from the neutral model. 2.5
Evaluating the Selection Coeﬃcient of the BirthDeath Model
To evaluate the strength of purifying selection we apply both neutral and selective models to aligned sequences. Figure 1 outlines the algorithm of evaluating the selection coeﬃcient.
368
C.H. Yeang
Inputs: Motif M, phylogenetic tree T = (VT , ET ) of k species, n orthologous families of aligned promoter sequences, sij denotes the aligned sequence of gene i in species j. Outputs: Selection coeﬃcient of M on the aligned sequences. 1. 2. 3. 4. 5. 6.
Reconstruct the ancestral sequences of the internal nodes using equation (6). Infer the Poisson rate λ using equation (5). Split a promoter sequence into multiple segments of ﬁxed length ls = 30l. Count the motif occurrence in each segment of both terminal and internal species. Count the empirical conditional frequency along each branch. Apply binary search to ﬁnd the selection coeﬃcient that maximizes the log likelihood score. Fig. 1. Evaluating the selection coeﬃcient of a motif
The inputs of the algorithm are the phylogenetic tree T = (VT , ET ) of k species, n orthologous families of aligned sequences, and a sequence motif M. We ﬁrst apply dynamic programming to reconstruct sequences of internal nodes of T and infer the Poisson rate λ using equation (5). For simplicity we assume the sequence substitution rates of all families are identical. The birthdeath models in equations (11) and (10) apply to sequences of any lengths as long as ls l. In practice, longer sequences are computationally challenging for the following reasons. First, due to frequent recombinations, insertions and deletions, more gaps will appear in a long stretch of aligned sequences. Gaps add complexities in evaluating likelihood scores hence are undesirable. Second, longer sequences accommodate more motif instances by random sequence substitution. Hence more terms in equation (12) need to be considered. We divide the promoter sequence into segments of length ls = 30l. A segment with more than 10% gaps in a species is treated as a missing data and discarded. Motif occurrences in a segment are counted by sliding a window of length l along the segment. Denote sijk the aligned sequence of the kth segment of gene i in species j, and nijk the motif count of the corresponding segment. The motif occurrences of internal nodes can be inferred from their reconstructed sequences. The joint log likelihood of the observed and reconstructed motif counts is L = i k (v,w)∈ET log P (n(t(v,w) ) = niwk n(0) = nivk ) + C. (14) where summation is over indices of gene i, segment k and edge (v, w) in T . t(v,w) denotes the branch length of edge (v, w). Resembling EM, our method ﬁlls the missing data of internal nodes with reconstructed motif counts and avoids the cumbersome evaluation of the marginal likelihood. The log likelihood can also be expressed as L = t n0 n1 f (t, n0 , n1 ) log P (n(t) = n1 n(0) = n0 ) + C. (15) where f (t, n0 , n1 ) denotes the frequency of the instances where the motif counts in the parent and child nodes are n0 and n1 and the branch length is t. These
Quantifying the Strength of Natural Selection of a Motif Sequence
369
empirical frequencies can be directly obtained from the observed and reconstructed data. P (n(t) = n1 n(0) = n0 ) is the conditional probability derived from the birthdeath model of the neutral or selective evolution (equations (12) and (13)). In this work we solve the transient responses Pn (t) numerically by simulating the diﬀerentialdiﬀerence equations. Given the relatively short segments (30l) only the ﬁrst few equations in equation (12) are needed. The only free parameter of the log likelihood is the selection coeﬃcient s. We want to ﬁnd the s that maximizes equation (15). Because s is integrated in equation (15) in a complex form and P (n(t) = n1 n(0) = n0 ) has no analytic solutions, we apply a binary search to ﬁnd the optimum value of s over the interval [0, 20].
3 3.1
Results The BirthDeath Model Agrees with Simulation Data
We ﬁrst veriﬁed that the birthdeath model approximated the motif count distribution derived from a Poisson sequence substitution process with simulation data. A random 100base initial sequence and 20 random 4base motifs were constructed. 1000 instances with the identical initial sequence underwent independent Poisson sequence substitutions with λ = 0.2 and T = 4.0. The empirical data were compared to the conditional probabilities predicted by equations (12) and (13). The birthdeath model strongly agreed with the simulated data. Figure 2 shows the time evolution of motif count distributions of 3 motifs with 0, 1 and 2 instances in the initial sequence respectively. The predicted models (dashed lines) closely follow the empirical distributions (solid lines) in each case. The results indicate the birthdeath model accurately describes motif count distributions in a Poisson process of sequence substitution. 3.2
Sequence Substitutions on Mammalian Promoters Follow a Poisson Process
Aligned 5kb upstream sequences of 27667 orthologous gene families from 34 mammalian species were extracted from the UCSC Genome Browser [12]. The maximum likelihood rate of the Poisson process was obtained from the procedures described in the Method Section. Figure 3 compares the distributions of sequence substitutions from the data and the Poisson process with the maximumlikelihood rate λ = 0.8937. For each position, the empirical number of sequence substitutions between two species is the number of sequence changes along the path connecting the two species in the phylogenetic tree. The predicted Poisson distributions closely resembled the empirical distributions at various time intervals, suggesting that promoter sequence substitutions in mammals follow a Poisson process.
C.H. Yeang
t=0.000000
t=0.400000
n=0 simulation n=0 model n=1 simulation n=1 model n=2 simulation n=2 model
0.6
0.4
0.2
0
2 # motifs
3
4
0
1
2 # motifs
3
Pr(# motifs)
0.2
0
3
4
3
4
n=0 simulation n=0 model n=1 simulation n=1 model n=2 simulation n=2 model
0.8
0.4
0
2 # motifs t=2.000000
n=0 simulation n=0 model n=1 simulation n=1 model n=2 simulation n=2 model
0.6
0.2
2 # motifs
1
1
0.8
0.4
1
0
t=1.600000
n=0 simulation n=0 model n=1 simulation n=1 model n=2 simulation n=2 model
0
0.4
0
4
1
0.6
0.6
0.2
t=1.200000 1
0.8
n=0 simulation n=0 model n=1 simulation n=1 model n=2 simulation n=2 model
0.8
0.4
0
1
n=0 simulation n=0 model n=1 simulation n=1 model n=2 simulation n=2 model
0.6
0.2
0
1
0.8 Pr(# motifs)
Pr(# motifs)
0.8
Pr(# motifs)
t=0.800000
1
Pr(# motifs)
1
Pr(# motifs)
370
0.6
0.4
0.2
0
1
2 # motifs
3
4
0
0
1
2 # motifs
3
4
Fig. 2. Comparison of empirical and predicted distributions of motif counts in simulated data. Conditional probabilities of motif counts at 6 time points are shown. Solid lines indicate empirical distributions of 3 motifs with 0 (left bump), 1 (middle bump) and 2 (right bump) instances in the initial sequence respectively. Dashed lines are the distributions derived from equation (12).
3.3
Known Transcription Factor Binding Motifs Have Higher Selection Coeﬃcients Than Random Sequences with High Occurrence Frequencies
388 transcription factor binding motifs were extracted from the TRANSFAC database [13]. Motif lengths ranged from 5 to 15 nucleotides and the mean length was 10.66 nucleotides. We applied the algorithm in Figure 1 to evaluate the selection coeﬃcient of each motif on the 5kb promoters of 27667 orthologous families in 34 mammals. In addition to selection coeﬃcients, we also evaluated the magnitudes of conservation by counting the fractions of species containing the motifs among 34 mammals and averaging the scores over all segments in all the gene families. As a negative control we generated 10000 random motif sequences (in IUPAC format) of 5 and 10 nucleotides and selected the top 500 sequences according to their occurrence frequencies on mammalian promoters. The left diagram of Figure 4 shows the distributions of selection coeﬃcients in TRANSFAC motifs and two negative control sets. Intriguingly, there are many more highscoring TRANSFAC motifs than the negative controls. About one quarter (96 of 388) of known motifs have selection coeﬃcients ≥ 4.0. In contrast, only 11 and 24 of 500 5mer and 10mer control motifs pass the same threshold. The fraction of highscoring motifs may be overestimated as some transcription factors possess multiple similar motifs. By grouping motifs by their transcription factors, the same conclusion was reached (results not shown).
Quantifying the Strength of Natural Selection of a Motif Sequence
t=0.013230
t=0.345260
0.6 0.4
0.6 0.4 0.2
0
0
2 4 # substitutions
6
empirical predicted
0.8
0.2
0
1
Pr(# substitutions)
empirical predicted
0.8
0
2 4 # substitutions
0.4
0
t=0.724660
Pr(# substitutions)
0.6 0.4
0.6 0.4 0.2
0
0
2 4 # substitutions
6
6
t=1.155600
empirical predicted
0.8
0.2
2 4 # substitutions
1
Pr(# substitutions)
empirical predicted
0
0.6
0
6
1
0.8
empirical predicted
0.8
0.2
t=0.526420 1
Pr(# substitutions)
t=0.440630
1
Pr(# substitutions)
Pr(# substitutions)
1
371
empirical predicted
0.8 0.6 0.4 0.2
0
2 4 # substitutions
6
0
0
2 4 # substitutions
6
Fig. 3. Sequence substitutions on 5kb promoters of mammalian genes. Empirical distributions of sequence substitutions (solid lines) are obtained by the numbers of sequence changes along the paths connecting each pair of species in each position. Predicted distributions (dashed lines) are calculated by a Poisson process with λ = 0.8937. The distributions at 6 time intervals are shown.
The right diagram of Figure 4 shows the distributions of conservation magnitudes in TRANSFAC motifs and two negative control sets. The conservation mangitude of a motif on a promoter is the fraction of the species containing the motif. We report the average of the conservation magnitudes over the genes where the motif appears at least in one species. Clearly, natural selection is not revealed by conservation alone, as the conservation magnitudes of most TRANSFAC motifs are smaller than those of the control motifs. Moreover, unlike selection coeﬃcients conservation magnitudes of control motifs are sensitive to their lengths. The results are sensible in two aspects. First, the “random motifs” in Figure 4 are the sequences with high occurrence frequencies. They often contain multiple degenerate sequences and are thus expected to appear in more species by chance. The birthdeath model can eliminate these spurious motifs as the volumes of motif sequences are taken into account. Second, conservation of motifs is sensitive to sequence length as short sequences are likely to appear in more species by chance. The birthdeath model also takes sequence length into account. Therefore, the selection coeﬃcient distributions of 5mer and 10mer control motifs are similar. These sequences in the negative control set occur more frequently on mammalian promoters thus are more likely to be conserved by chance. Alternatively, we also selected random sequences without ranking them by occurrence frequencies as the negative controls. The distributions of selection coeﬃcients and conservation scores are similar to Figure 4. Thus the superiority of the selection coeﬃcients in detecting TRANSFAC motifs sustains.
372
C.H. Yeang
1
1 transfac motifs random 5−base motifs random 10−base motifs
0.8
0.8
0.7
0.7
0.6 0.5 0.4 0.3
0.6 0.5 0.4 0.3
0.2
0.2
0.1
0.1
0
0
5
10 15 selection coeffcients
20
transfac motifs random 5−base motifs random 10−base motifs
0.9
frequency of occurrences
frequency of occurrences
0.9
0
0
0.2
0.4 0.6 0.8 conservation magnitudes
1
Fig. 4. Left: Distributions of selection coeﬃcients of 388 TRANSFAC motifs (solid), 500 frequent 5mer random motifs (dashed), and 500 frequent 10mer random motifs (broken). Right: Distributions of conservation magnitudes of 388 TRANSFAC motifs (solid), 500 frequent 5mer random motifs (dashed), and 500 frequent 10mer random motifs (broken).
4
Discussions
In this work we propose a model and an algorithm to evaluate the strength of natural selection of a sequence motif from aligned sequences across gene families and species. The neutral model of motif occurrence distributions is based on a simple assumption that each position undergoes an independent Poisson process of sequence substitution. We consequently derive a birthdeath model of motif occurrences according to the sequence substitution rate, motif sequence degeneracy and total sequence length. The selection coeﬃcient is the penalty on the rate of motif deletion in the birthdeath model. Predictions derived from the neutral model ﬁt both simulated data and the statistics of random motifs on the aligned promoters of 34 mammals. In addition, many more known transcription factor binding motifs have high selection coeﬃcients relative to negative controls, suggesting many of them are under purifying selection. Despite the success in the preliminary study the current model and algorithm have several limitations. First, the model (and many other models of natural selection) focuses on sequence substitution and does not take other types of mutations – insertions/deletions, recombinations – into account. This simpliﬁcation yields false negatives when there are gaps in the motifs. Second, the model considers a ubiquitous selection along each branch of phylogeny and discards lineage speciﬁc selection. Third, the model also discards the genespeciﬁc selection on promoters and only considers the overall eﬀects on all gene families. Fourth, numerical simulations and binary search of the algorithm are timeconsuming. Analytic approximations to the transient responses of the birthdeath model should be developed. Fifth, the inverse problem of this work – identify the motif
Quantifying the Strength of Natural Selection of a Motif Sequence
373
sequences with high selection coeﬃcients – is yet to be tackled. In spite of these limitations our model serves as a reasonable tool to validate the computationally or experimentally discovered candidate motifs.
References 1. Kellis, M., Patterson, N., Endrizzi, M., Birren, B., Lander, E.S.: Sequencing and comparison of yeast species to identify genes and regulatory motifs. Nature 423, 241–254 (2003) 2. Yang, Z., Bielawski, J.P.: Statistical methods for detecting molecular adaptation. Trends of Ecology and Evolution 15, 496–503 (2000) 3. Siepel, A., Haussler, D.: Combining phylogenetic and hidden Markov models in biosequence analysis. Journal of Computational Biology 11(23), 413–428 (2004) 4. McDonald, J.H., Kreitman, M.: Adaptive evolution at the Adh locus in Drosophila. Nature 351, 652–654 (1991) 5. Tajima, F.: Statistical method for testing the neutral mutation hypothesis by DNA polymorphism. Genetics 123, 585–595 (1989) 6. Atwal, G.S., Bond, G.L., Metsuyanim, S., et al.: Haplotype structure and selection of the MDM2 oncogene in humans. Proceedings of National Academy of Science USA 104, 4525–4529 (2007) 7. Raijman, D., Shamir, R., Tanay, A.: Evolution and selection in yeast promoters: analyzing the combined eﬀect of diverse transcription factor binding sites. PLoS Computational Biology 4, 77–87 (2008) 8. Zuckerandl, E., Pauling, L.: Evolutionary divergence and convergence in proteins. In: Bryson, V., Vogel, H.J. (eds.) Evolving genes and proteins, pp. 97–166. Academic Press, New York (1965) 9. Felsenstein, J.: Evolutionary trees from DNA sequences: a maximum likelihood approach. Journal of Molecular Evoution 17, 368–376 (1981) 10. Kendall, D.G.: On the generalized birthdeath process. The Annals of Mathematical Statistics 19(1), 1–15 (1948) 11. Bird, A.P.: CpG islands as gene markers in the vertebrate nucleus. Trends in Genetics 3, 342–347 (1987) 12. Kuhn, R.M., Karolchik, D., Zweig, A.S., et al.: The UCSC Genome Browser Database: update 2009. Nucleic Acids Research, D755–D761 (2009) 13. Matys, V., Fricke, E., Geﬀers, R., Gossling, E., Haubrock, M., et al.: TRANSFAC: transcriptional regulation, from patterns to proﬁles. Nucleic Acids Research 31(1), 374–378 (2003)
Author Index
Acu˜ na, Vicente 226 Allison, Lloyd 189 Azad, Ariful 162 Backofen, Rolf 40 Badr, Ghada 102 B´erces, Attila 176 BeresfordSmith, Bryan 189 Berger, Bonnie 13 BergerWolf, Tanya 111 Bertrand, Denis 78 Birmel´e, Etienne 226 Blanchette, Mathieu 78 B¨ ocker, Sebastian 325 Bonizzoni, Paola 148 Bordewich, Magnus 250 Braga, Mar´ılia D.V. 90 Brown, Daniel G. 111 Conway, Thomas 189 Crescenzi, Pierluigi 226 Cs˝ ur¨ os, Mikl´ os 176 Cui, Yun 300 Doan, Duong D.
124
Jiang, Tao 148 Juhos, Szilveszter
176
Kirkpatrick, Bonnie 136 Konagurthu, Arun S. 189 Kristensen, Thomas G. 28 Kuchenbecker, L´eon 325 Lacroix, Vincent 226 Langguth, Johannes 162 Lemence, Richard S. 262 Linder, C. Randal 288 Lingas, Andrzej 262 Mangul, Serghei 202 MarchettiSpaccamela, Alberto Marschall, Tobias 337 Mihaescu, Radu 250 Milreu, Paulo Vieira 226 M¨ ohl, Mathias 40 M˘ andoiu, Ion 202 Nicolae, Marius
202
ElMabrouk, Nadia 78 Eskin, Eleazar 312 Evans, Patricia A. 124
Pedersen, Christian N.S. Pirola, Yuri 148 Pothen, Alex 162
Fang, Youhan 162 Frid, Yelena 1
Qi, Alan
Gagnon, Yves 78 Gamzu, Iftah 215 Giegerich, Robert 52 Gusﬁeld, Dan 1, 274 He, Dan 312 Hosur, Raghavendra 13 Hufsky, Franziska 325 Jahn, Katharina 325 Janssen, Stefan 52 Jansson, Jesper 262
28
162
Rahmann, Sven 337 Ribeiro, Pedro 238 Sagot, MarieFrance 226 Sahinalp, S. Cenk 40, 350 Salari, Raheleh 40, 350 Sankoﬀ, David 102 Sch¨ onhuth, Alexander 350 Segev, Danny 215 Sharan, Roded 215 Silva, Fernando 238 Singh, Rohit 13
226
376
Author Index
Stevens, Kristian 274 Stougie, Leen 226 Stoye, Jens 90, 325 Suri, Rahul 288 Swenson, Krister M. 102 Swenson, M. Shel 288
Theis, Corinna 52 Tsur, Dekel 65
Warnow, Tandy 288 Willing, Eyla 90 Will, Sebastian 40 Yeang, ChenHsiang
362
Zakov, Shay 65 Zelikovsky, Alex 202 Zhang, Louxin 300 ZivUkelson, Michal 65 Zobel, Justin 189