Haplotyping via Perfect Phylogeny: A Direct Approach

57
Haplotyping via Perfect Phylogeny: A Direct Approach Dan Gusfield CS, UC Davis int work with V. Bafna, G. Lancia and S. Yoo

description

Haplotyping via Perfect Phylogeny: A Direct Approach. Dan Gusfield CS, UC Davis. Joint work with V. Bafna, G. Lancia and S. Yooseph. Genotypes and Haplotypes. Each individual has two “copies” of each chromosome. - PowerPoint PPT Presentation

Transcript of Haplotyping via Perfect Phylogeny: A Direct Approach

Page 1: Haplotyping via Perfect Phylogeny: A Direct Approach

Haplotyping via Perfect Phylogeny: A Direct Approach

Dan Gusfield

CS, UC Davis

Joint work with V. Bafna, G. Lancia and S. Yooseph

Page 2: Haplotyping via Perfect Phylogeny: A Direct Approach

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 3: Haplotyping via Perfect Phylogeny: A Direct Approach

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 4: Haplotyping via Perfect Phylogeny: A Direct Approach

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 5: Haplotyping via Perfect Phylogeny: A Direct Approach

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 6: Haplotyping via Perfect Phylogeny: A Direct Approach

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 NY Times October 30, 2002)

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

• Connection with coalescent models.

Page 7: Haplotyping via Perfect Phylogeny: A Direct Approach

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 8: Haplotyping via Perfect Phylogeny: A Direct Approach

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 9: Haplotyping via Perfect Phylogeny: A Direct Approach

The Haplotype Phylogeny Problem(PPH 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 10: Haplotyping via Perfect Phylogeny: A Direct Approach

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 11: Haplotyping via Perfect Phylogeny: A Direct Approach

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 12: Haplotyping via Perfect Phylogeny: A Direct Approach

We can remove the red words to obtain anothertrue statement.

Also, we can consider an unrooted version of theproblem, where the 4-gamete test is used, butin this talk we consider the simpler, rooted version.See the full paper for the unrooted version.

Page 13: Haplotyping via Perfect Phylogeny: A Direct Approach

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 14: Haplotyping via Perfect Phylogeny: A Direct Approach

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 15: Haplotyping via Perfect Phylogeny: A Direct Approach

The case of the unknown root

The 3-Gamete Testis for the case when the root is assumed to bethe all-0 vector. When the root is not knownthen the NASC is that the submatrix

00 10 must not appear in the matrix. This is 10 called the 4-Gamete Test. 11

Page 16: Haplotyping via Perfect Phylogeny: A Direct Approach

Solving the Haplotype Phylogeny Problem (PPH) in nearly linear

O(nm alpha(nm)) time

• Simple Tools based on classical Perfect Phylogeny Problem.

• Complex Tools based on Graph Realization

Problem (graphic matroid realization).

But in this talk, we develop a simpler, but

somewhat slower version.

Gusfield, RECOMB, April 2002

Page 17: Haplotyping via Perfect Phylogeny: A Direct Approach

Program PPH

• Program PPH solves the perfect phylogeny haplotyping problem using the graph realization approach. It solves problems with 50 sites and 100 individuals in about 1 second.

• Program PPH can be obtained at

www.cs.ucdavis.edu/~gusfield

Page 18: Haplotyping via Perfect Phylogeny: A Direct Approach

The Combinatorial Problem

Input: A ternary matrix (0,1,2) M with 2N rowspartitioned into N pairs of rows, where thetwo rows in each pair are identical.

Def: If a pair of rows (r,r’) in the partition have entry values of 2 in a column j then positions (r,j) and (r’,j) are called Mates.

Page 19: Haplotyping via Perfect Phylogeny: A Direct Approach

Output: A binary matrix M’ created from Mby replacing each 2 in M with either 0 or 1,such that

a) A position is assigned 0 if and only if its Mate is assigned 1.

b) M’ passes the 3-Gamete Test, i.e., does not contain a 3x2 submatrix (after row and column permutations) with all three combinations 0,1; 1,0; and 1,1

Page 20: Haplotyping via Perfect Phylogeny: A Direct Approach

Initial Observations

If two columns of M contain the following rows 2 0 2 0 mates 0 2 0 2 mates

then M’ will contain a row with 1 0 and a row with 0 1 in those columns.

This is a forced expansion.

Page 21: Haplotyping via Perfect Phylogeny: A Direct Approach

Initial Observations

Similarly, if two columns of M contain the mates 2 1 2 1 then M’ will contain a row with 1 1 in those

columns.

This is a forced expansion.

Page 22: Haplotyping via Perfect Phylogeny: A Direct Approach

If a forced expansion of two columns creates 0 1 in those columns, then any 2 2 1 0 2 2 in those columns must be set to be0 11 0 We say that two columns are forced out-of-phase.

If a forced expansion of two columns creates 1 1 in those columns, then any 2 2 2 2 in those columns must be set to be1 10 0 We say that two columns are forced in-phase.

Page 23: Haplotyping via Perfect Phylogeny: A Direct Approach

1 2 2

1 2 2

2

0 2

2 0 2

1 2 2

1 2 2

1 2 2

1 2 2

2 2 0

2 2 0

a

a

b

b

cc

d

ed

e

1 2 3

Columns 1 and 2, and 1 and3 are forced in-phase.Columns 2 and 3 are forced out-of-phase.

Example:

Page 24: Haplotyping via Perfect Phylogeny: A Direct Approach

Immediate Failure

It can happen that the forced expansion of cellscreates a 3x2 submatrix that fails the 3-GameteTest. In that case, there is no PPH solution forM.

Example: 20 2011110202

Will fail the 3-Gamete Test

Page 25: Haplotyping via Perfect Phylogeny: A Direct Approach

An O(nm^2)-time Algorithm

• Find all the forced phase relationships by considering columns in pairs.

• Find all the inferred, invariant, phase relationships.

• Find a set of column pairs whose phase relationship can be arbitrarily set, so that all the remaining phase relationships can be inferred.

• Result: An implicit representation of all solutions to the PPH problem.

Page 26: Haplotyping via Perfect Phylogeny: A Direct Approach

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

A runningexample.

Page 27: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6Each node representsa column in M, and eachedge indicates that thepair of columns hasa row with 2’sin both columns.

The algorithm builds thisgraph, and then checkswhether any pair of nodesis forced in or out of phase.

Graph G

Page 28: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6Each Red edge indicatesthat the columns areforced in-phase.

Each Blue edge indicatesthat the columns areforced out-of-phase.

Let Gf be the subgraph of Gcdefined by the red and blueedges.

Graph Gc

Page 29: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6

Graph Gf has threeconnected components.

Page 30: Haplotyping via Perfect Phylogeny: A Direct Approach

The Central TheoremThere is a solution to the PPH problem for M ifand only if there is a coloring of the dashed edges of Gc with the following property:

For any triangle (i,j,k) in Gc, where there is one row containing 2’s in all three columns i,j and k (any triangle containing at least one dashed edge will be of this type), the coloring makes either 0 or 2 of the edges blue (out-of-phase). Nice, but how do we find such a coloring?

Page 31: Haplotyping via Perfect Phylogeny: A Direct Approach

Note on CMU talk Feb. 28, 2003

In that talk I oversimplified the central theorem,focusing only on the triangles with at least onedashed edge. This approach can be made to work, but wasn’t quite right as stated in the talk. The statement in the prior slide is correct.

Page 32: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6

Theorem 1: If there are anydashed edges whose ends are in the same connected component of Gf, atleast one edge is in a trianglewhere the other edges arenot dashed, and in every PPHsolution, it must be coloredso that the triangle has aneven number of Blue (out ofPhase) edges. This is an “inferred” coloring.

Graph Gf

Triangle Rule

Page 33: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6

Page 34: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6

Page 35: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6

Page 36: Haplotyping via Perfect Phylogeny: A Direct Approach

Corollary

Inside any connected component of Gf, ALL the phaserelationships on edges (columns of M) are uniquely determined, either as forced relationships based onpairwise column comparisons, or by triangle-based inferred colorings.

Hence, the phase relationships of all the columns in a connected component of Gf are INVARIANT over allthe solutions to the PPH problem.

Page 37: Haplotyping via Perfect Phylogeny: A Direct Approach

The dashed edges in Gf can be ordered so thatthe inferred colorings can be done in lineartime. Modification of DFS. See the paperfor details, or assign it as a homework exercise.

Page 38: Haplotyping via Perfect Phylogeny: A Direct Approach

Finishing the Solution

Problem: A connected component C of G may contain several connected components of Gf, so any edge crossing two components of Gf will still be dashed. How should they be colored?

Page 39: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6

How should we colorthe remaining dashededges in aconnected component Cof Gc?

Page 40: Haplotyping via Perfect Phylogeny: A Direct Approach

Answer

For a connected component C of G with k connectedcomponents of Gf, select any subset S of k-1 dashed edges in C, so that S together with the red and blue edges span all thenodes of C.

Arbitrarily, color each edge in S either red or blue.

Infer the color of any remaining dashed edges by successive use of the triangle rule.

Page 41: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6

Pick and color edges(2,5) and (3,7)The remaining dashededges are colored byusing the triangle rule.

Page 42: Haplotyping via Perfect Phylogeny: A Direct Approach

1 7

2

5

3

4

6

Page 43: Haplotyping via Perfect Phylogeny: A Direct Approach

Theorem 2

• Any selected S works (allows the triangle rule to work) and any coloring of the edges in S determines the colors of any remaining dashed edges.

• Different colorings of S determine different colorings of the remaining dashed edges.

• Each different coloring of S determines a different solution to the PPH problem.

• All PPH solutions can be obtained in this way, i.e. using just one selected S set, but coloring it in all 2^(k-1) ways.

Page 44: Haplotyping via Perfect Phylogeny: A Direct Approach

1 2 2 2 0 0 0

1 2 2 2 0 0 0

1

0 2 0 0 0 2

0 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

1 2 0 0 0 2 0

0 2 0 0 0 2 0

a

a

b

b

cc

d

ed

e

1 2 3 4 5 6 7

How does thecoloring determine a PPH solution? Eachcomponent of Gis handledindependently. So,assume only one component of G.

Arbitrarily set the2’s in column 1,say as 1 0

Page 45: Haplotyping via Perfect Phylogeny: A Direct Approach

1 1 2 2 0 0 0

1 0 2 2 0 0 0

1

0 2 0 0 0 2

0 0 2 0 0 0 2

1 1 2 2 0 2 0

1 0 2 2 0 2 0

1 1 2 0 2 0 0

1 0 2 0 2 0 0

1 1 0 0 0 2 0

0 0 0 0 0 2 0

a

a

b

b

cc

d

ed

e

1 2 3 4 5 6 7For j from 2 to m,If a row in columnj has a 2, scan tothe left for a columnj’ in M with a 2 inthat row. If j’is found, use thephase relationshipbetween j and j’ toSet those 2’s in col.j. Otherwise, set them arbitrarily.

Page 46: Haplotyping via Perfect Phylogeny: A Direct Approach

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 0 1 0

1 0 1 1 0 0 0

1 1 0 0 1 0 0

1 0 1 0 0 0 0

1 1 0 0 0 1 0

0 0 0 0 0 0 0

a

a

b

b

cc

d

ed

e

1 2 3 4 5 6 7

PPH solutionderived from the edge coloring

Page 47: Haplotyping via Perfect Phylogeny: A Direct Approach

A biologically more meaningful restatement?

Once a PPH solution is found we use the connected components of Gf to partition thecolumns (sites) into blocks. Inside each block,the haplotype pairs are fixed. But in any block, all the shaded 0’s and 1’s can be switched, changing the complete haplotypes, formed fromall the blocks.

Page 48: Haplotyping via Perfect Phylogeny: A Direct Approach

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 49: Haplotyping via Perfect Phylogeny: A Direct Approach

Corollary

• In a single connected component C of G with k connected components in Gf, there are exactly 2^(k-1) different solutions to the PPH problem in the columns of M represented by C.

• If G has r connected components and t connected components of Gf, then there are exactly 2^(t-r) solutions to the PPH problem.

• There is one unique PPH solution if and only if each connected component in G is a connected component in Gf.

Page 50: Haplotyping via Perfect Phylogeny: A Direct Approach

Algorithm

• Build Graph G and find its connected components. Solve each connected component C of G separately.

• Find the forced (red or blue) edges. Let Gf be the subgraph of C containing colored edges.

• Find each connected component of Gf and make the inferred edge colorings (phase decisions).

• Find a spanning tree of uncolored edges in C, and color those edges arbitrarily, and follow the inferred edge colorings.

Page 51: Haplotyping via Perfect Phylogeny: A Direct Approach

Secondary information and optimization

• The partition shows explicitly what added phase information is useful and what is redundant. Phase information for an edge is redundant if and only if the edge is inside a component of Gf. Apply this successively as additional phase 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 52: Haplotyping via Perfect Phylogeny: A Direct Approach

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 53: Haplotyping via Perfect Phylogeny: A Direct Approach

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 54: Haplotyping via Perfect Phylogeny: A Direct Approach

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 55: Haplotyping via Perfect Phylogeny: A Direct Approach

Program DPPH

Program DPPH implements the solution to the PPH problom discussed in this talk. It can be obtained at wwwcsif.cs.ucdavis.edu/~gusfield/

Page 56: Haplotyping via Perfect Phylogeny: A Direct Approach

Observed running timesThe following are typical running times ofProgram DPPH running on an 800 MHZMac G4 Powerbook. The first number is thenumber of genotypes and the second the number of sites.

20,30 0.01 sec 400,500 14.8 sec50,50 0.02 sec 400,600 23.5 sec50,100 0.09 sec 500,1000 117.94 sec100,100 0.16 sec 500,2000 770 sec300,300 3.8 sec

Page 57: Haplotyping via Perfect Phylogeny: A Direct Approach

The full paper

Technical Report from UCD, July 17, 2002can be found on the recent papers page throughwwwcsif.cs.ucdavis.edu/~gusfield