Algorithm Search⌘K

Problemcore

Motif finding

Also called motif discovery, regulatory motif finding.

Given sequences thought to share binding sites, find the short pattern or weight matrix over-represented in them.

Motif finding asks for a short pattern that occurs, with small changes, in each of a set of sequences that are thought to share a function. The usual input is a set of DNA regions upstream of genes that one transcription factor controls, and the pattern is the binding site of that factor. The output is one window in each sequence, the starts of the sites, and a summary of them: a consensus sequence or a position-specific scoring matrix. The common score counts the letters of the windows that differ from the consensus. With this score the problem is NP-hard, and it is equivalent to the median string problem.

In plain words

You have a few DNA pieces, perhaps a few hundred letters each. Somewhere in each piece there is a short word, such as a word of 15 letters, that a protein binds to. The copies of the word are not exact: each copy can have a few letters changed. You do not know the word, and you do not know where the copies are.

The job is to pick one window of the right length in each piece so that the picked windows look as much alike as possible. Write the windows one under the other. In each column, find the most common letter, and count the letters that are not that letter. A small total means a good choice. The most common letters, read across, give the guess for the hidden word.

Definition

Input. Sequences s1,…,sns_1, \ldots, s_n over the alphabet {A,C,G,T}\{A, C, G, T\}, each of length GG, and a motif length L≤GL \le G. Each sequence has W=G−L+1W = G - L + 1 windows of length LL. Positions on this page are 1-based; the code of the method pages uses 0-based positions.

A choice of sites is a vector p=(p1,…,pn)p = (p_1, \ldots, p_n) with 1≤pi≤W1 \le p_i \le W. It picks the window ti=si[pi..pi+L−1]t_i = s_i[p_i .. p_i + L - 1] in each sequence. Write the windows as the rows of an n×Ln \times L alignment matrix. For a column jj and a letter aa, let cj(a)c_j(a) be the number of rows with aa in column jj. The profile is the matrix cj(a)/nc_j(a)/n.

The score. The consensus of pp has in column jj a letter with the largest count cj(a)c_j(a). The score is the number of letters that differ from the consensus,

Score(p)=∑j=1L(n−max⁡acj(a)).\mathrm{Score}(p) = \sum_{j=1}^{L} \Big(n - \max_a c_j(a)\Big).

The question. Find a choice pp with the smallest score. Jones and Pevzner write the same objective as the largest value of ∑jmax⁡acj(a)=nL−Score(p)\sum_j \max_a c_j(a) = nL - \mathrm{Score}(p); the two forms have the same optimal choices.

Lemma (the consensus is the best center). For a fixed pp and any string vv of length LL, ∑idH(v,ti)≥Score(p)\sum_i d_H(v, t_i) \ge \mathrm{Score}(p), where dHd_H is the Hamming distance, with equality exactly when vv is a consensus of pp.

Proof. Count the mismatches by columns. Column jj adds n−cj(vj)n - c_j(v_j) to ∑idH(v,ti)\sum_i d_H(v, t_i), and n−cj(vj)≥n−max⁡acj(a)n - c_j(v_j) \ge n - \max_a c_j(a), with equality exactly when vjv_j has the largest count. Sum over jj. □\square

So the score of a choice is the total Hamming distance from its windows to their best center. This is the step that turns the problem into the median string problem below.

Variants

  • The total distance score. The score above. It is the Consensus Patterns problem of Li, Ma and Wang.
  • The largest distance score. Ask for a center vv and windows with max⁡idH(v,ti)≤d\max_i d_H(v, t_i) \le d. This is the closest substring problem. With random background sequences it is the planted motif problem.
  • Information content. Score the matrix by its information content, the relative entropy of the column frequencies against the background. CONSENSUS (Hertz and Stormo) and MEME use scores of this kind. A rare letter in a column counts more than a common one.
  • Likelihood models. Treat the sites as draws from a column-wise model and the rest as background, and fit the model by maximum likelihood (MEME, with expectation maximization) or sample it (Gibbs motif sampler, with Gibbs sampling). The models differ in how many sites a sequence may hold: exactly one, zero or one, or any number.
  • Both strands. A binding site can be on either strand of the DNA, so a method may also scan the reverse complement of each sequence.
  • Gaps and spacers. Some sites have two halves with a spacer of variable length between them. Gapped motifs need other models, such as a profile HMM.

Examples

Take the five sequences of length G=12G = 12 from the sample of Rosalind problem BA2D, with L=3L = 3, so W=10W = 10:

ii sis_i
1 GGCGTTCAGGCA
2 AAGAATCAGTCA
3 CAAGGAGTTCGC
4 CACGTCAATCAC
5 CAATAATATTCG

The choice p=(7,7,1,6,1)p = (7, 7, 1, 6, 1) picks CAG, CAG, CAA, CAA and CAA. The first two columns are all C and all A, and the third column has two G and three A. So the consensus is CAA and the score is 0+0+2=20 + 0 + 2 = 2. The choice p=(5,5,8,8,9)p = (5, 5, 8, 8, 9) picks TTC, ATC, TTC, ATC and TTC, with consensus TTC and score 2+0+0=22 + 0 + 0 = 2.

An exhaustive check of all 10510^5 choices finds that 2 is the smallest score, and that 14 choices reach it. So the problem can have many optimal answers with different consensus strings. The median strings of the same input, with total distance 2, are CAA, TCA and TTC.

The sizes grow fast. In the challenge of Pevzner and Sze, n=20n = 20, G=600G = 600 and L=15L = 15, so W=586W = 586 and there are 58620≈2.28×1055586^{20} \approx 2.28 \times 10^{55} choices of sites. There are only 415=1,073,741,8244^{15} = 1{,}073{,}741{,}824 strings of length 15, which is why exact methods search the strings and not the sites.

Known algorithms

method type time source
all choices of sites exact O(LnWn)O(L n W^n) Jones and Pevzner, Section 4.6
all strings of length LL (median string) exact O(4LnWL)O(4^L n W L) Jones and Pevzner, Section 4.9
branch and bound on either tree exact same worst case, often much less Jones and Pevzner, Sections 4.7 to 4.9
greedy motif search heuristic O(W2nL)O(W^2 n L) Hertz, Hartzell and Stormo 1990; Compeau and Pevzner, Section 2.5
randomized motif search heuristic, randomized O(nWL)O(n W L) per iteration Compeau and Pevzner, Section 2.7
Gibbs motif sampler heuristic, randomized O(WL)O(W L) per step Lawrence et al. 1993
MEME local optimum of a likelihood O(nWL)O(n W L) per iteration Bailey and Elkan 1994
WINNOWER graph filter for (L,d)(L, d) motifs polynomial per round Pevzner and Sze 2000
PROJECTION randomized hashing and EM depends on the number of trials Buhler and Tompa 2002
polynomial-time approximation scheme approximation, total distance polynomial for each fixed ratio Li, Ma and Wang 2002
AlgorithmTimeSpacePropertiesCode
Branch-and-bound motif searchO(4^L n W) worstO(n W + L) extradeterministicexactofflinerecursive1 language
Gibbs motif samplerO(T n W L) worstO(n L + W) extrarandomizednot exactofflineiterative1 language
Greedy motif searchO(W^2 n L) worst · averageO(n L) extradeterministicnot exactofflineiterative1 language
MEMEO(n W^2 L + I n W L) worstO(N + L) extradeterministicnot exactofflineiterative1 language
Randomized motif searchO(R L^2 n^2 W) worstO(n L) extrarandomizednot exactofflineiterative1 language

Bounds

  • NP-hard. With the total distance score and LL part of the input, the problem is NP-hard; this is the Consensus Patterns result of Li, Ma and Wang (2002). So no exact method runs in polynomial time unless P = NP. See NP-hard.
  • Fixed motif length. For a fixed LL, the median string search tries 4L4^L strings, each in O(nWL)O(nWL) time, so the time is polynomial in nn and GG.
  • Fixed number of sequences. For a fixed nn, the WnW^n choices of sites can be tried one by one, so the time is polynomial in GG and LL.
  • Approximation. Li, Ma and Wang give a polynomial-time approximation scheme for the total distance score: for each ϵ>0\epsilon > 0, a choice with score at most (1+ϵ)(1 + \epsilon) times the optimum. Its running time is polynomial in the input for each fixed ϵ\epsilon, but the exponent grows fast as ϵ\epsilon falls, and it is not used in practice.
  • A trivial bound. Every choice has 0≤Score(p)≤L(n−⌈n/4⌉)0 \le \mathrm{Score}(p) \le L(n - \lceil n/4 \rceil), because the largest of four counts that add to nn is at least ⌈n/4⌉\lceil n/4 \rceil.

Reductions

  • To the median string problem. By the lemma, min⁡pScore(p)=min⁡pmin⁡v∑idH(v,ti)\min_p \mathrm{Score}(p) = \min_p \min_v \sum_i d_H(v, t_i). Swap the two minima: for a fixed vv, the best window of each sequence can be picked on its own, which gives the total distance D(v)=∑imin⁡qdH(v,si[q..q+L−1])D(v) = \sum_i \min_{q} d_H(v, s_i[q .. q + L - 1]). So the smallest score equals the smallest D(v)D(v), and an optimal vv with its closest windows is an optimal choice of sites. The median string problem page gives the full proof.
  • To closest substring. With the largest distance in place of the sum, the same swap gives the closest substring problem: a string vv and a window in each sequence, all within distance dd of vv. The planted motif problem is this problem on random input.
  • From the sites to a scanner. An optimal choice gives an alignment of sites. Its counts, with pseudocounts and a background, give a position-specific scoring matrix, and the matrix can then scan new sequences. The p-value of a matrix score says how strong a hit is.

Applications

  • Transcription factor binding sites. Find the site of a factor in the promoters of genes that it controls, for example genes that change together in an expression experiment or regions bound in a ChIP experiment.
  • Phylogenetic footprinting. Find sites that stay the same in the regions upstream of one gene in several species. See phylogenetic footprinting.
  • Protein motifs. The Gibbs site sampler was first used on protein sequences, to align short conserved blocks of distant proteins. The alphabet then has 20 letters.
  • Motif databases and logos. The found sites give a matrix for a database of binding profiles and a sequence logo for display.

References

  1. Neil C. Jones and Pavel A. Pevzner, An Introduction to Bioinformatics Algorithms, MIT Press, 2004, Chapter 4, Sections 4.6 to 4.9 (the motif finding problem, search trees, finding motifs and finding a median string)
  2. Phillip Compeau and Pavel Pevzner, Bioinformatics Algorithms, An Active Learning Approach, Volume I, 2nd edition, Active Learning Publishers, 2015, Chapter 2, Sections 2.3 (scoring motifs) and 2.4 (from motif finding to finding a median string)
  3. Ming Li, Bin Ma and Lusheng Wang, Finding similar regions in many sequences, Journal of Computer and System Sciences 65(1), 2002, the Consensus Patterns problem, its NP-hardness and its polynomial-time approximation scheme
  4. Gerald Z. Hertz and Gary D. Stormo, Identifying DNA and protein patterns with statistically significant alignments of multiple sequences, Bioinformatics 15, 1999, the information content score of an alignment of sites and its p-value
  5. Charles E. Lawrence, Stephen F. Altschul, Mark S. Boguski, Jun S. Liu, Andrew F. Neuwald and John C. Wootton, Detecting subtle sequence signals, a Gibbs sampling strategy for multiple alignment, Science 262(5131), 1993, pp. 208 to 214, the site sampler for one site in each sequence

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.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a contract.yaml