Problemadvanced
Minimum error correction problem
Also called MEC problem.
Flip the fewest alleles in a fragment matrix so that the rows split into two conflict-free haplotypes. NP-hard even for gapless rows, it is fixed-parameter tractable in the coverage.
The minimum error correction problem (MEC) is the usual combinatorial form of haplotype assembly. Each read of a diploid genome shows, at the heterozygous sites that it covers, which allele it carries, and the reads of one copy of the chromosome should agree with each other. Because of sequencing errors, they do not always agree. MEC asks for the smallest number of entries to change so that the reads split into two groups, each without disagreement inside; the two groups then spell the two haplotypes. Lippert et al. (2002) defined it. It is NP-hard, and Cilibrasi et al. (2007) proved that it stays NP-hard when every fragment is gapless. It is fixed-parameter tractable in the coverage: the dynamic program of WhatsHap solves it in time.
In plain words
Think of a table with one row for each read and one column for each place where the two copies of a chromosome can differ. Each cell holds 0, 1 or nothing, if the read does not reach that column.
If the reads had no errors, you could sort the rows into two groups so that, in each column, all rows of a group show the same value. With errors, that may be impossible. So change as few cells as you can until it works. The two groups then tell you the two copies.
Definition
Input. A fragment matrix with rows, the fragments, and columns, the sites. Each entry is 0, 1 or a hole . A fragment is gapless if its non-hole entries are consecutive.
Conflicts. Two fragments conflict if they have different values at some column where neither has a hole. The conflict graph has the fragments as vertices and an edge for each conflict. The matrix is feasible if its rows can be split into two sets without a conflict inside either set, which is the same as a bipartite conflict graph: a set of binary rows with no conflict between any two has, at each column, one value shared by all its non-hole entries.
MEC. Find the fewest entries of to change from 0 to 1 or from 1 to 0 so that the matrix becomes feasible. An equivalent form is a 2-clustering in Hamming distance with holes ignored:
where counts the non-hole entries of that differ from . Each fragment goes to the haplotype it is closer to, and the entries that differ from it are the ones changed.
Weighted MEC. Each entry has a weight, such as its Phred quality, and the cost is the sum of the weights of the changed entries.
All-heterozygous MEC. If every column is known to be heterozygous, must be the complement of .
Variants
- Minimum fragment removal (MFR). Remove the fewest fragments so that the rest is feasible. This is odd cycle transversal on the conflict graph.
- Minimum SNP removal (MSR). Remove the fewest columns so that the matrix is feasible.
- Weighted and all-heterozygous forms, as above.
- Polyploid MEC. Split the rows into groups for a genome with copies.
- Probabilistic forms. Maximize the likelihood of the reads with an error rate for each entry, which gives MEC when all error rates are equal and small.
Examples
A matrix that is not feasible. Six gapless fragments over four sites:
| fragment | site 1 | site 2 | site 3 | site 4 |
|---|---|---|---|---|
| 0 | 0 | 1 | - | |
| 0 | 0 | - | - | |
| - | 0 | 1 | 1 | |
| 1 | 1 | 0 | - | |
| - | 1 | 0 | 0 | |
| 1 | 0 | 0 | 0 |
The fragments , and conflict with each other pairwise, which is a triangle in the conflict graph, so no split into two conflict-free sets exists. Changing the 0 of at site 2 to 1 makes agree with and . Then spells and spells , and the cost is 1. A search over all pairs of haplotypes confirms that 1 is the optimum, and that the only optimal pair is . MFR also has cost 1 here: remove .
The weighted example of WhatsHap. The four fragments of Patterson et al. (2015), worked out on the page of the fixed-parameter dynamic program, have weighted MEC cost 1, both in the free and in the all-heterozygous form.
Known algorithms
| method | page | result | time |
|---|---|---|---|
| dynamic program over columns (WhatsHap) | fixed-parameter MEC | exact for weighted MEC | for coverage |
| search over haplotypes | none | exact | , or for the all-heterozygous form |
| HapCUT | haplotype assembly | heuristic: repeated cuts of a graph of the sites, in the spirit of max cut | fast in practice, no bound on the quality |
| local search and greedy methods | none | heuristic | fast |
The search over haplotypes is exponential in the number of sites, and the dynamic program is exponential only in the coverage, which is small for most data after read selection.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Fixed-parameter MEC dynamic programming | O(2^c m) worst · average · best | O(2^c m) extra | deterministicexactofflineiterative | 1 language |
Bounds
- NP-hard. MEC is NP-hard in general (Lippert et al., 2002), and Cilibrasi et al. (2007) showed that it is NP-hard also when all fragments are gapless. MFR and MSR, by contrast, are polynomial for gapless fragments (Lancia et al., 2001).
- Fixed-parameter tractable in the coverage. The time of the dynamic program is polynomial for each fixed coverage . With the symmetry of the two sides, the bound is .
- Fixed number of sites. For a fixed , the search over haplotype pairs is polynomial in .
- Feasibility. Whether the cost is 0 is easy to decide: it is the question whether the conflict graph is bipartite, which bipartiteness testing answers in linear time in the size of the graph.
Reductions
- From haplotype assembly. The reads and the heterozygous sites of one sample give the fragment matrix; see haplotype assembly.
- To clustering. MEC is a 2-median clustering of the rows in Hamming distance with holes; see clustering.
- MFR to odd cycle transversal. The removed fragments are a set of vertices whose removal makes the conflict graph bipartite.
- To weighted graph cuts. With one vertex per site and edges weighted by how many reads say the two sites have the same or opposite phase, a good phase is a cut, which is the idea of HapCUT.
Applications
- Phasing one genome from reads. Long reads, linked reads and pairs with long inserts cover several heterozygous sites, and MEC turns them into phase blocks.
- Clinical genetics. Whether two variants in one gene are on the same copy or on different copies.
- Allele-specific analysis. Expression and methylation of each copy, once the reads are split by haplotype.
- Assembly. The separation of the two copies of a diploid genome in a phased assembly.
References
- Ross Lippert, Russell Schwartz, Giuseppe Lancia and Sorin Istrail, Algorithmic strategies for the single nucleotide polymorphism haplotype assembly problem, Briefings in Bioinformatics 3(1), 2002, the sections on the fragment conflict models (fragment removal, SNP removal and error correction) and their complexity
- Rudi Cilibrasi, Leo van Iersel, Steven Kelk and John Tromp, The complexity of the single individual SNP haplotyping problem, Algorithmica 49(1), 2007, pp. 13 to 36 (MEC is NP-hard also when no fragment has a hole, and some polynomial cases)
- SNPs problems, complexity, and algorithms, the sections on the conflict graph of fragments, minimum fragment removal and minimum SNP removal, and the gapless case
- Murray Patterson, Tobias Marschall, Nadia Pisanti, Leo van Iersel, Leen Stougie, Gunnar W. Klau and Alexander Schönhuth, WhatsHap, weighted haplotype assembly for future-generation sequencing reads, Journal of Computational Biology 22(6), 2015, pp. 498 to 509 (weighted MEC and its dynamic program, exponential only in the coverage)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag FWK7XY Edit this page History Report an error Markdown