83
Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Combinatorial Optimization in Computational Biology

Dan Gusfield

Computer Science, UC Davis

Page 2: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Some Applications of optimization methods

• Dynamic Programming in sequence alignment• TSP and Euler paths in DNA sequencing• Integer Programming in Haplotype inference • Graphic Matroid Recognition in Haplotype

inference• Integer Programming for Virus Identification• Weighted matching in genetic partition analysis

Page 3: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Apology

This talk focuses (mostly) on my own work, for simplicity ofpreparation. But, many other wonderful examples existin the literature.

At present, there is no coherent story about the ways thatcombinatorial optimization arises in ComputationalBiology. Must be alert for meaningful applications.

Page 4: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Topic 1: Sequence Alignment

Intended to show the similarity of two sequences (strings).

Definition: An alignment of two strings S and S’ is obtainedby inserting spaces into, or at the ends of, the two strings, sothat the resulting strings (including the spaces) have the samelengths.

A -- T C -- A

-- C T C A A

Page 5: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Matches, Mismatches and Indels

Two aligned, identical characters in an alignment are a match.

Two aligned, unequal characters are a mismatch.

A character aligned with a space, represents an indel (insertion/deletion).

A A C T A C T -- C C T A A C A C T -- ---- -- C T C C T A C C T -- -- T A C T T T

10 matches, 2 mismatches, 7 indels

the bars show mismatches

Page 6: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Basic Algorithmic Problem

Biologically, under the point mutation model, a mismatch represents a mutation, while an indel represents a historicalinsertion or deletion of a single character.

Find an alignment of the two strings thatMaximizes the # matches - # mismatches - # spacesin the alignment of strings S and S’.

That maximum number defines the similarity of the twostrings.

Also called Optimal Global Alignment

Page 7: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Solution By Dynamic Programming

Def: Let V(I, J) be the Maximimum Value obtainable inany alignment of the first I characters of S and the firstJ characters of S’.

If S has N characters and S’ has M characters, thenwe want to compute V(N, M), and the associatedalignment.

Let M(I, J) = -1 if S(I) mismatches S’(J) and M(I, J) = 1 if S(I) matches S’(J)

Page 8: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

DP Solution

V (I,0) = −I,

V (0,J) = −J,

V (I,J) = Max

V (I −1,J −1) + M(I,J)

V (I −1,J) −1

V (I,J −1) −1

⎢ ⎢ ⎢

⎥ ⎥ ⎥

The DP recurrences are:

They can be evaluated in O(NM) operations.

I and J aligned

I opposite a space

J opposite a space

General Cases

Base Cases

Page 9: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Many Variations on the Theme

The most important alignment variant is Optimal Local Alignment:

Given S and S’ find a substring A of S, and a substring B of S’such that the value of the Global Alignment of A and B is maximized over all pairs of substrings of S and S’.

The point is to find a pair of substrings of S and S’ which arehighly similar to each other, even if S and S’ are not. Manybiological reasons for this: DNA problems, Protein Domains etc.

Naively, we would need to do O((NM)**2) global alignments,for a time bound of O((NM)**3) operations overall.

Page 10: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

DP solution to Local Alignment

V (I,0) =V (0,J) = 0

V (I,J) = MAX

V (I −1,J −1) + M(I,J)

V (I −1,J) −1

V (I,J −1) −1

0

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

But the optimal value is no longer V(N, M) as in global alignment.Instead the optimal Local Alignment Value is the largest Vvalue computed over all the NM values. The time isagain O(NM). This is the Smith-Waterman Local AlignmentAlgorithm.

Page 11: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Adding Operation WeightsFind an alignment of the two strings thatMaximizes

Vm x (# matches) - Cm x (# mismatches) - Cs x (# spaces)in the alignment of strings S and S’.

The modification to the DP is immediate, but now themodeling question is what Vm, Cm and Cs should be.Those values greatly determine the biological utility ofthe alignment.

This leads to Parametric Alignment: Find the optimal alignmentas a function of unknown values of Vm, Cm, and Cs

Page 12: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Parametric Sequence Alignment

As a function of two selected weight parameters Vm, Cm, Cs, Cg,decompose the two dimensional parameter space into convexpolygons, so that in each polygon, an alignment inside the polygonis optimal for any point in the polygon, and nowhere else.

The time for this decomposition is O(NM) per polygon.

In the case of global alignment, the number of polygons is boundedby 0.88(N^(2/3)), where N < M.

package XPARAL to find the polygons is available on the web.

Gusfield, Naor, Stelling in several papers (see the web)

Page 13: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis
Page 14: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Adding Gaps to the Model

A Gap in an alignment is a contiguous run of spaces in one sequence.

Example: A T T -- -- -- C C -- -- -- T C T G C C C

has six spaces in three gaps

Now the objective function for alignment is Maximize

Vm x (#matches) - Cm x (#mis) - Cs x (#spaces) - Cg x (#gaps)

This is the affine gap model, the dominant model for studyingprotein sequence similarity. The choice of Cs and Cg are critical for thebiological utility. The DP in this case can also be solved in O(NM) time.

Page 15: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Topic 2: Sequencing By Hybridization

The technology allows you to determine all the K-tuples,for a fixed K, that are contained in a DNA string S.

The goal is to try to determine the string S from the givenK-tuples.

One can cast this problem as a Hamilton Path problem ona graph, but it is more productive to view it as an EulerPath Problem.This approach was introduced by Pavel Pavzner.

A proposed approach to sequencing DNA

Page 16: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

I will focus on the results inGraph Traversals, Genes and Matroids: An Efficient Special Case of the Traveling Salesman ProblemD. Gusfield, R. Karp, L. Wang, P. Stelling

Discrete Applied Math 88 special issue onComputational Molecular Biology, 1998, p. 167-180.

Page 17: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Sequencing by Hybridization

Example: S =

ACTTAAACGCGCACAA

K = 3

So we learn that ACT, CTT etc. are in S, but we learn thesein no predictable order.

Page 18: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Hamilton Path View

Each node represents a K-tuple, and a directed edge from onenode to another if the second K-tuple can be obtained from thefirst by deleting the left character, and adding a right character:i.e, a shift and add.

ACG CGCadd a C on theleft

Then a Hamilton Path in this graph generates a sequence S’that has the same K-tuples as S

Page 19: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Euler Path View

The Euler Path view is more productive, leading to moreefficient algorithms both for the base problem, and forvariants of the problem.

Due to P. Pevzner

Page 20: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

AA AC CA

TA

TT CT CG

GC

A

A

AT

T

C

A

A

C

A

G

C

Observed triples from S: AAA, AAC, ACA, CAA, CAC, ACG, CGC, GCA, GCC, ACT, CTT, TTA, TAA

Graph G: One node for every k-1 tuple, and oneedge for every observed k-tuple

Page 21: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Any Euler path in G produces a string which has the sameK-tuples as the original string S. So if there is only oneEuler path in G, then you have reconstructed S.

The problem is that typically there is more than one Eulerpath. So how to choose one Euler path as a most promisingone? That is, one that is most likely to correspond to S?

Frequently there is additional information about the K-tuples,for example the rough distances between K-tuples in S. So,we can give a value to each pair of successive edges in G,which roughly reflects the probability that the two edgeswould appear successively in the Euler Path for S. Anotherway to state this is that we evaluate the goodness of S’according to the (k+1)-tuples that it contains.

Page 22: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Back to the Hamilton View

Now we are back to the Hamilton Path view, where eachnode is a K-tuple of S, but now eachedge has a distance reflecting the goodness of any (K+1)-tuplethat would be generated by a Hamilton path, and we want the Maximum distance Hamilton Path in the graph.

This sounds hard, but there is structure in this problem: thegraphs are not arbitrary.

Page 23: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The structure of the Hamilton Graph

The Hamilton Graph for the data, where nodes representK-tuples in S, and edges represent (K+1)-tuples in a solution string S’, is the line di-graph of the Euler Graph for the data, where nodes represent (K-1) tuples, andedges represent K-tuples.

Page 24: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

How Euler Relates to Hamilton

The Hamilton graph is the line di-graph L(G) of the Euler Graph G.

Each red edge has the value of the successive pair of black edges.

Each edge of G becomes a node in L(G), and each edge in L(G)represents a successive pair of edges in G.

So the problem now is to find a Maximum Value TSPath.

Page 25: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

In the case that each node has only two in and two out edges(which happens when using a simplified DNA alphabet),this TSP problem has a polynomial time solution.

In fact, if L(G) is any line digraph where every node hasin and out degrees at most 2, then even for arbitrary edgedistances, the TSP problem can be solved in O(n log n) time.

Moreover, if every edge value is distinct, then the TSP solutionis unique.

The Hamilton paths for such 2-in, 2-out-degree graphs havea matroid structure that reveals many features of the TSP solutions.

When degrees are greater than 2, we branch-and-bound down tocases of degree 2, which we then can solve optimally.

Page 26: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Approximations

When the in and out-degrees are bounded by X, a greedyalgorithm is guaranteed to find a Hamilton path whosevalue is within 1/X that of the optimal. So 1/3 or 1/4for the case of DNA.

Use of this approximation can speed up the branch-and-bound until the in and out-degree bound of 2 is reached.

Page 27: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Topic 3: Combinatorial Algorithms for Haplotype

InferenceTrue Parsimony and Perfect

Phylogeny

Dan Gusfield

Page 28: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Genotypes and HaplotypesEach individual has two “copies” of each

chromosome.

At each site, each chromosome has one of two alleles (states) denoted by 0 and 1 (motivated by

SNPs)0 1 1 1 0 0 1 1 0

1 1 0 1 0 0 1 0 0

2 1 2 1 0 0 1 2 0

Two haplotypes per individual

Genotype for the individual

Merge the haplotypes

Page 29: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Haplotyping Problem

• Biological Problem: For disease association studies, haplotype data is more valuable than genotype data, but haplotype data is hard to collect. Genotype data is easy to collect.

• Computational Problem: Given a set of n genotypes, determine the original set of n haplotype pairs that generated the n genotypes. This is hopeless without a genetic model.

Page 30: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

We consider two models in this talk

• Pure (True) Parsimony Model, Gusfield unpublished (Note added 3/18/03 technical report is available on the web, and will appear in the 2003 CPM conference)

• Perfect Phylogeny Model, Gusfield RECOMB Proceedings April 2002

Page 31: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Topic 3a: The Pure Parsimony Objective

For a set of genotypes, find a Smallest set H of

haplotypes, such that each genotype can be

explained by a pair of haplotypes in H.

Page 32: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Example of Parsimony

02120 0010001110

22110 01110 10110

20120 0010010110

3 distinct haplotypesset S has size 3

Page 33: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Pure Parsimony is NP-hard

Earl Hubbel (Affymetrix) showed that Pure Parsimonyis NP-hard.

However, for a range of parameters of current interest(number of sites and genotypes) a Pure Parsimony solution can be computed efficiently, using IntegerLinear Programming, and one speed-up trick.

For larger parameters (100 sites and 50 genotypes)A near-parsimony solution can be found efficiently.

Page 34: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Conceptual Integer Programming Formulation

For each genotype (individual) j, create one integerprogramming variable Yij for each pair of haplotypeswhose merge creates genotype j. If j has k 2’s, thenThis creates 2^(k-1) Y variables.

Create one integer programming variable Xq forEach distinct haplotype q that appears in one of thepairs for a Y variable.

Page 35: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Conceptual IP

For each genotype, create an equality that says thatexactly one of its Y variables must be set to 1.

For each variable Yij, whose two haplotypes aregiven variables Xq and Xq’, include an inequalitythat says that if variable Yij is set to 1, then bothvariables Xq and Xq’ must be set to 1.

Then the objective function is to Minimize thesum of the X variables.

Page 36: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Example02120 Creates a Y variable Y1 for pair 00100 X1 01110 X2

and a Y variable Y2 for pair 01100 X3 00110 X4

Y1 + Y2 = 1Y1 - X1 <= 0Y1 - X2 <= 0Y2 - X3 <= 0Y2 - X4 <= 0

Include the following (in)equalities into the IP

The objective function willinclude the subexpressionX1 + X2 + X3 + X4But any X variable is includedexactly once no matter how manyY variables it is associated with.

Page 37: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Efficiency Trick

Ignore any Y variable and its two X variables if those Xvariables are associated with no other Y variable. TheResulting IP is much smaller, and can be used to findthe optimal to the conceptual IP.

Also, we need not first enumerate all X pairs for a given genotype, but can efficiently recognize the pairs weneed. Another simple trick.

Page 38: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

How Fast? How Good?

Depends on the level of recombination in the underlyingdata. Pure Parsimony can be computed in seconds tominutes for most cases with 50 genotypes and up to 60sites, faster as the level of recombination increases.

As the level of recombination increases, the accuracyof the Pure Parsimony Solution falls, but remains within10% of the quality of PHASE (for comparison).

Page 39: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Topic 3b: Haplotyping via Perfect Phylogeny

Conceptual Framework and Efficient (almost linear-time) Solutions

Dan Gusfield

U.C. Davis

Page 40: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Perfect Phylogeny Model

We assume that the evolution of extant haplotypes can be displayed on a rooted, directed tree, with the all-0 haplotype at the root, where each site

changes from 0 to 1 on exactly one edge, and each extant haplotype is created by accumulating the changes on a path from the root to a leaf, where that haplotype is displayed.

In other words, the extant haplotypes evolved along a perfect phylogeny with all-0 root.

Page 41: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Perfect Phylogeny Model

00000

1

2

4

3

510100

1000001011

00010

01010

12345sitesAncestral haplotype

Extant haplotypes at the leaves

Site mutations on edges

Page 42: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Justification for Perfect Phylogeny Model

• In the absence of recombination each haplotype of any individual has a single parent, so tracing back the history of the haplotypes in a population gives a tree.

• Recent strong evidence for long regions of DNA with no recombination. Key to the NIH haplotype mapping project. (See NYT October 30, 2002)

• Mutations are rare at selected sites, so are assumed non-recurrent.

• Connection with coalescent models.

Page 43: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Haplotype Phylogeny Problem

Given a set of genotypes S, find an explaining set of haplotypes that fits a perfect phylogeny.

1 2

a 2 2

b 0 2

c 1 0

sitesA haplotype pair explains agenotype if the merge of thehaplotypes creates thegenotype. Example: Themerge of 0 1 and 1 0 explains 2 2.

Genotype matrix

S

Page 44: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Haplotype Phylogeny Problem

Given a set of genotypes, find an explaining set of haplotypes that fits a perfect phylogeny

1 2

a 2 2

b 0 2

c 1 0

1 2

a 1 0

a 0 1

b 0 0

b 0 1

c 1 0

c 1 0

Page 45: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Haplotype Phylogeny Problem

Given a set of genotypes, find an explaining set of haplotypes that fits a perfect phylogeny

1 2

a 2 2

b 0 2

c 1 0

1 2

a 1 0

a 0 1

b 0 0

b 0 1

c 1 0

c 1 0

1

c c a a

b

b

2

10 10 10 01 01

00

00

Page 46: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Alternative Explanation

1 2

a 2 2

b 0 2

c 1 0

1 2

a 1 1

a 0 0

b 0 0

b 0 1

c 1 0

c 1 0

No treepossiblefor thisexplanation

Page 47: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

When does a set of haplotypes to fit a perfect phylogeny?

Classic NASC: Arrange the haplotypes in a matrix, two haplotypes for each individual. Then (with no duplicate columns), the haplotypes fit a unique perfect phylogeny if and only if no two columns contain all three pairs:

0,1 and 1,0 and 1,1

This is the 3-Gamete Test

Page 48: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Alternative Explanation

1 2

a 2 2

b 0 2

c 1 0

1 2

a 1 1

a 0 0

b 0 0

b 0 1

c 1 0

c 1 0

No treepossiblefor thisexplanation

Page 49: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

1 2

a 2 2

b 0 2

c 1 0

1 2

a 1 0

a 0 1

b 0 0

b 0 1

c 1 0

c 1 0

1

c c a a

b

b

2

0 0

0 1 0 1

0 0

The Tree Explanation Again

Page 50: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Solving the Haplotype Phylogeny Problem (PPH)

• Simple Tools based on classical Perfect Phylogeny Problem.

• Complex Tools based on Graph Realization

Problem (graphic matroid realization).

Page 51: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Simple Tools – treeing the 1’s1) For any row i in S, the set of 1 entries in row

i specify the exact set of mutations on the path from the root to the least common ancestor of the two leaves labeled i, in every perfect phylogeny for S.

2) The order of those 1 entries on the path is also the same in every perfect phylogeny for S, and is easy to determine by “leaf counting”.

Page 52: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Leaf Counting

1 2 3 4 5 6 7

a 1 0 1 0 0 0 0

b 0 1 0 1 0 0 0

c 2 2 0 0 2 0 2

d 2 2 0 0 0 2 0

In any column c, count two for each 1, andcount one for each 2. The total is the number of leaves below mutation c, in every perfect phylogeny for S. So if we know the set ofmutations on a path from the root, we knowtheir order as well.

S

Count 4 4 2 2 1 1 1

Page 53: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Subtree of 1’s is Forced

The columns of S with at least one 1 entry specify a unique upper subtree that must be in every perfect phylogeny for S.

1 2 3 4 5 6 7

a 1 0 1 0 0 0 0

b 0 1 0 1 0 0 0

c 2 2 0 0 2 0 2

d 2 2 0 0 0 2 0

S

143

2

a a b b

4 4 2 2 1 1 1

Page 54: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Corollary: A Useful Sufficient Condition

If every column of S has at least one 1, then there is a unique perfect phylogeny for S, if there is any.

Build the forced tree based on the 1-entries, then every mutation (site) is in the tree, and any 2-entries dictate where the remaining leaves must be attached to the tree.

Page 55: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

What to do when the Corollary does not apply?

• Build the forced tree of 1-entries.

• 2-entries in columns with 1-entries are done.

• Remaining problem: 2-entries in columns without any 1-entries

Page 56: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Uniqueness without 1’s

A 0 2 2

B 2 2 0

C 2 0 2

There are 8 haplotype solutionsthat can explain the data, butonly one that fits a perfect phylogeny, i.e. only one solutionto the PPH problem.

Page 57: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

More Simple Tools

3) For any row i in S, and any column c, if S(i,c) is 2, then in every perfect phylogeny for S, the path between the two leaves labeled i, must contain the edge with mutation c.

Further, every mutation c on the path between the two i leaves must be from such a column c.

Page 58: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

From Row Data to Tree Constraints

RootThe order is known for the red mutations

1 2 3 4 5 6 7

i:0 1 0 2 2 1 2

i i

Subtree for row i data

4,5,7orderunknown

26

sites

Page 59: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The Graph Theoretic Problem

Given a genotype matrix S with n sites, and a red-blue fork for each row i,

create a directed tree T where each integer from 1 to n labels exactly one edge, so that each fork is contained in T.i i

Page 60: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Complex Tool: Graph Realization

• Let Rn be the integers 1 to n, and let P be an unordered subset of Rn. P is called a path set.

• A tree T with n edges, where each is labeled with a unique integer of Rn, realizes P if there is a contiguous path in T labeled with the integers of P and no others.

• Given a family P1, P2, P3…Pk of path sets, tree T realizes the family if it realizes each Pi.

• The graph realization problem generalizes the consecutive ones problem, where T is a path.

Page 61: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Graph Realization Example

1

24

5

6

3

8

7

P1: 1, 5, 8P2: 2, 4P3: 1, 2, 5, 6 P4: 3, 6, 8P5: 1, 5, 6, 7

Realizing Tree T

Page 62: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Graph Realization

Polynomial time (almost linear-time) algorithms exist for the graph realization problem – Whitney, Tutte, Cunningham, Edmonds, Bixby, Wagner, Gavril, Tamari, Fushishige.

The algorithms are not simple; no known

implementations of the near linear-time methods. But an implementation from UCD CS of a slightly slower method is available on the web.

Page 63: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Recognizing graphic Matroids

• The graph realization problem is the same problem as determining if a binary matroid is graphic, and the algorithms come from that literature.

• The fastest algorithm is due to Bixby and Wagner. For n rows and m columns the time is O(nm x alpha(nm).

• Representation methods due to Cunningham et al.

Page 64: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Reducing PPH to graph realization

We solve any instance of the PPH problem by creating appropriate path sets, so that a solution to the resulting graph realization problem leads to a solution to the PPH problem instance.

The key issue: How to encode a fork by path sets.

Page 65: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

From Row Data to Tree Constraints

RootThe order is known for the red mutations

1 2 3 4 5 6 7

i:0 1 0 2 2 1 2

i i

Subtree for row i data

4,5,7orderunknown

26

sites

Page 66: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Encoding a Red path, named g

2

57

P1: U, 2P2: U, 2, 5P3: 2, 5P4: 2, 5, 7P5: 5, 7P6: 5, 7, gP7: 7, g

25

7

g

U

U is a universal glue edge, used for all red paths.g is used for all red paths identical to this one – i.e.different forks with the identical red path.

forcedIn T

Page 67: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Encoding and gluing a blue path

For a specific blue path, simply specify a singlepath set containingthe integers in the blue path. However, we need toforce that path to be glued to the end of a specificred path g, or to the root of T.

In the first case, just add g to the path set. In the second case, add U to the path set.

Page 68: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Encoding and gluing a blue path to the end of red path g

2

57

4, 9, 18, 20

g

P: g, 4, 9, 18, 20

Page 69: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

After the Reduction

After all the paths are given to the graph realization algorithm, and a realizing tree T is obtained (assuming one is), contract all the glue edges to obtain a perfect phylogeny for the original haplotyping problem (PPH) instance.

Conversely, any solution can be obtained in

this way. The reduction takes time O(nm) for n rows and m columns.

Page 70: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Uniqueness In 1932, Whitney established the NASC for the uniqueness

of a solution to a graph realization problem:

Let T be the tree realizing the family of required path sets. For each path set Pi in the family, add an edge in T between the ends of the path realizing Pi. Call the result graph G(T).

T is the unique realizing tree, if and only if

G(T) is 3-vertex connected. e.g., G(T) remains connected after the removal of any two vertices.

Page 71: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Uniqueness of PPH Solution

• Apply Whitney’s theorem, using all the paths implied by the reduction of the PPH problem to graph realization.

• (Minor point) Do not allow the removal of the endpoints of the universal glue edge U.

Page 72: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Multiple Solutions

• In 1933, Whitney showed how multiple solutions to the graph realization problem are related.

• Partition the edges of G into two, connected graphs, each with at least two edges, such that the two graphs have exactly two nodes in common. Then twist one graph around those nodes.

• Any solution can be transformed to another via a series of such twists.

Page 73: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Twisting Example

x y x y

12

3

4

56

78

12

3

4

5 67

8

All the cycle sets are preserved by twisting

Page 74: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Representing all the solutions

All the solutions to the PPH problem can be implicitly represented in a data structure whichcan be built in linear time, once one solution isknown. Then each solution can be generated inlinear time per solution. Method is a smallmodification of ones developed by Cunninghamand Edwards, and by Hopcroft and Tarjan.

See Gusfield’s web site for errata.

Page 75: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The biological meaning

Each subgraph in the representation identifies a set ofmutations (columns) whose 0/1 settings are invariantover all PPH solutions. However, by switching all0/1 values that had been 2, in all of those mutations,the relative 0/1settings between columns in different subgraphs canbe set arbitrarilly, and all PPH solutions can begenerated in this way.

Page 76: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

1 2 2 2 0 0 0

1 2 2 2 0 0 0

2

0 2 0 0 0 2

2 0 2 0 0 0 2

1 2 2 2 0 2 0

1 2 2 2 0 2 0

1 2 2 0 2 0 0

1 2 2 0 2 0 0

2 2 0 0 0 2 0

2 2 0 0 0 2 0

a

a

b

b

cc

d

ed

e

1 2 3 4 5 6 7

An example.Each row startsduplicated forsimplicity.

Page 77: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

1 1 0 0 0 0 0

1 0 1 1 0 0 0

1

0 1 0 0 0 0

0 0 0 0 0 0 1

1 1 0 0 1 0 0

1 0 1 1 0 0 0

1 1 0 0 0 1 0

1 0 1 0 0 0 0

1 1 0 0 1 0 0

0 0 0 0 0 0 0

a

a

b

b

cc

d

ed

e

1 2 3 4 6 5 7Starting from a PPHSolution, if all shaded cells in ablock switch value,then the result isalso a PPH solution,and any PPHsolution can be obtained in this way, i.e. by choosing in eachblock whether toswitch or not.

Page 78: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Secondary information and optimization

• The partition shows explicitly what added information is useful and what is redundant. Information about the relationship of a pair of columns is redundant if and only if they are in the same block of the column partition. Apply this successively as additional information is obtained.

• Problem: Minimize the number of haplotype pairs (individuals) that need be laboratory determined in order to find the correct tree.

• Minimize the number of (individual, site1, site2) triples whose phase relationship needs to be determined, in order to find the correct tree.

Page 79: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

The implicit representation of all solutions providesa framework for solving these secondary problems,as well as other problems involving the use ofadditional information, and specific tree-selectioncriteria.

Page 80: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

A Phase-Transition

Problem, as the ratio of sites to genotypes changes,how does the probability that the PPH solution isunique change?

For greatest utility, we want genotype data where thePPH solution is unique.

Intuitively, as the ratio of genotypes to sites increases,the probability of uniqueness increases.

Page 81: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Frequency of a unique solution with 50 and 100 sites, 5% rule and 2500 datasets

per entry

10 0.0018

20 0.0032

22 0.7646

40 0.7488

42 0.9611

70 0.994

130 0.999

140 1

# geno. Frequency of unique solution

10 0

20 0

22 0.78

40 0.725

42 0.971

60 0.983

100 0.999

110 1

Page 82: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

An alternative solution

Recently, we developed an algorithm that is not basedon graph realization, and which is much easier to understand.However, it runs in O(nm^2) time. See Gusfield’s website.

Page 83: Combinatorial Optimization in Computational Biology Dan Gusfield Computer Science, UC Davis

Implementations

See wwwcsif.cs.ucdavis.edu/~gusfield/

for papers and software.