SlideShare a Scribd company logo
Finding Regulatory Motifs
in DNA Sequences
1. Implanting Patterns in Random Text
2. Gene Regulation
3. Regulatory Motifs
4. The Gold Bug Problem
5. The Motif Finding Problem
6. Brute Force Motif Finding
7. The Median String Problem
8. Search Trees
9. Branch-and-Bound Motif Search
10. Branch-and-Bound Median String Search
11. Consensus and Pattern Branching: Greedy Motif Search
12. Planted Motif Search: Exhaustive Motif Search
Outline
Random Sample
atgaccgggatactgataccgtatttggcctaggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg
acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaatactgggcataaggtaca
tgagtatccctgggatgacttttgggaacactatagtgctctcccgatttttgaatatgtaggatcattcgccagggtccga
gctgagaattggatgaccttgtaagtgttttccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga
tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatggcccacttagtccacttatag
gtcaatcatgttcttgtgaatggatttttaactgagggcatagaccgcttggcgcacccaaattcagtgtgggcgagcgcaa
cggttttggcccttgttagaggcccccgtactgatggaaactttcaattatgagagagctaatctatcgcgtgcgtgttcat
aacttgagttggtttcgaaaatgctctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta
ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatttcaacgtatgccgaaccgaaagggaag
ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttctgggtactgatagca
Implanting Motif AAAAAAAGGGGGGG
atgaccgggatactgatAAAAAAAAGGGGGGGggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg
acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaataAAAAAAAAGGGGGGGa
tgagtatccctgggatgacttAAAAAAAAGGGGGGGtgctctcccgatttttgaatatgtaggatcattcgccagggtccga
gctgagaattggatgAAAAAAAAGGGGGGGtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga
tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatAAAAAAAAGGGGGGGcttatag
gtcaatcatgttcttgtgaatggatttAAAAAAAAGGGGGGGgaccgcttggcgcacccaaattcagtgtgggcgagcgcaa
cggttttggcccttgttagaggcccccgtAAAAAAAAGGGGGGGcaattatgagagagctaatctatcgcgtgcgtgttcat
aacttgagttAAAAAAAAGGGGGGGctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta
ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatAAAAAAAAGGGGGGGaccgaaagggaag
ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttAAAAAAAAGGGGGGGa
Where is the Implanted Motif?
atgaccgggatactgataaaaaaaagggggggggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg
acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaataaaaaaaaaggggggga
tgagtatccctgggatgacttaaaaaaaagggggggtgctctcccgatttttgaatatgtaggatcattcgccagggtccga
gctgagaattggatgaaaaaaaagggggggtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga
tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaataaaaaaaagggggggcttatag
gtcaatcatgttcttgtgaatggatttaaaaaaaaggggggggaccgcttggcgcacccaaattcagtgtgggcgagcgcaa
cggttttggcccttgttagaggcccccgtaaaaaaaagggggggcaattatgagagagctaatctatcgcgtgcgtgttcat
aacttgagttaaaaaaaagggggggctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta
ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcataaaaaaaagggggggaccgaaagggaag
ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttaaaaaaaaggggggga
ImplantingAAAAAAGGGGGGG with 4 Mutations
atgaccgggatactgatAgAAgAAAGGttGGGggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg
acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaatacAAtAAAAcGGcGGGa
tgagtatccctgggatgacttAAAAtAAtGGaGtGGtgctctcccgatttttgaatatgtaggatcattcgccagggtccga
gctgagaattggatgcAAAAAAAGGGattGtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga
tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatAtAAtAAAGGaaGGGcttatag
gtcaatcatgttcttgtgaatggatttAAcAAtAAGGGctGGgaccgcttggcgcacccaaattcagtgtgggcgagcgcaa
cggttttggcccttgttagaggcccccgtAtAAAcAAGGaGGGccaattatgagagagctaatctatcgcgtgcgtgttcat
aacttgagttAAAAAAtAGGGaGccctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta
ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatActAAAAAGGaGcGGaccgaaagggaag
ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttActAAAAAGGaGcGGa
Now Where is the Motif?
atgaccgggatactgatagaagaaaggttgggggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg
acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaatacaataaaacggcggga
tgagtatccctgggatgacttaaaataatggagtggtgctctcccgatttttgaatatgtaggatcattcgccagggtccga
gctgagaattggatgcaaaaaaagggattgtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga
tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatataataaaggaagggcttatag
gtcaatcatgttcttgtgaatggatttaacaataagggctgggaccgcttggcgcacccaaattcagtgtgggcgagcgcaa
cggttttggcccttgttagaggcccccgtataaacaaggagggccaattatgagagagctaatctatcgcgtgcgtgttcat
aacttgagttaaaaaatagggagccctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta
ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatactaaaaaggagcggaccgaaagggaag
ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttactaaaaaggagcgga
Why Finding the Hidden Motif is Difficult
atgaccgggatactgatAgAAgAAAGGttGGGggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg
acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaatacAAtAAAAcGGcGGGa
tgagtatccctgggatgacttAAAAtAAtGGaGtGGtgctctcccgatttttgaatatgtaggatcattcgccagggtccga
gctgagaattggatgcAAAAAAAGGGattGtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga
tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatAtAAtAAAGGaaGGGcttatag
gtcaatcatgttcttgtgaatggatttAAcAAtAAGGGctGGgaccgcttggcgcacccaaattcagtgtgggcgagcgcaa
cggttttggcccttgttagaggcccccgtAtAAAcAAGGaGGGccaattatgagagagctaatctatcgcgtgcgtgttcat
aacttgagttAAAAAAtAGGGaGccctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta
ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatActAAAAAGGaGcGGaccgaaagggaag
ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttActAAAAAGGaGcGGa
AgAAgAAAGGttGGG
cAAtAAAAcGGcGGG
..|..|||.|..|||
Challenge Problem
• Find a motif in a sample of 20 “random” sequences (e.g. 600
nucleotides long).
• Each sequence contains an implanted pattern of length 15.
• Each pattern appears with 4 mismatches.
• More generally, an (n, k) motif is a pattern of length n which
appears with k mismatches within a DNA sequence.
• So our challenge problem is to find a (15,4) motif in a group
of 20 sequences.
Why (15,4)-motif is hard to find?
• Goal: recover original pattern P from its (unknown!) instances:
P1 , P2 , … , P20
• Problem: Although P and Pi are similar for each i (4 mutations
for a (15,4) motif), given two different instances Pi and Pj, they
may differ twice as much (4 + 4 = 8 mutations for a (15,4)
motif).
• Conclusions:
1. Pairwise similiarities are misleading.
2. Multiple similarities are difficult to find.
Combinatorial Gene Regulation
• A microarray experiment showed
that when gene X is knocked out,
20 other genes are not expressed
• Motivating Question: How can
one gene have such drastic
effects?
DNA Microarray
Regulatory Proteins
• Answer: Gene X encodes regulatory protein, a.k.a. a
transcription factor (TF)
• The 20 unexpressed genes rely on gene X’s TF to induce
transcription
• A single TF may regulate multiple genes
Regulatory Regions
• Every gene contains a regulatory region (RR) typically
stretching 100-1000 bp upstream of the transcriptional start
site.
• Located within the RR are the Transcription Factor Binding
Sites(TFBS), also known as motifs, which are specific for a
given transcription factor.
• TFs influence gene expression by binding to a specific TFBS.
• A TFBS can be located anywhere within the regulatory region.
• TFBS may vary slightly across different regulatory regions
since non-essential bases could mutate.
Transcription Factors and Motifs: Example
geneATCCCG
geneTTCCGG
geneATCCCG
geneATGCCG
geneATGCCC
Transcription Factors and Motifs: Illustration
http://www.cs.uiuc.edu/homes/sinhas/work.html
Motif Logos
• Motifs can mutate on
unimportant bases.
• The five motifs in five different
genes have mutations in position
3 and 5.
• Representations called motif
logos illustrate the conserved
and variable regions of a motif.
• At right is an example of a
motif logo.
TGGGGGA
TGAGAGA
TGGGGGA
TGAGAGA
TGAGGGA
Motif Logos: An Additional Example
(http://www-lmmb.ncifcrf.gov/~toms/sequencelogo.html)
Identifying Motifs
• Recall that a TFBS is represented by a motif.
• Therefore finding similar motifs in multiple genes’ regulatory
regions suggests a regulatory relationship among those genes.
Identifying Motifs: Complications
• We do not know the motif sequence in advance.
• We do not know where the motif is located relative to the
genes’ start.
• As we have seen, a motif can differ slightly from one gene to
the next.
• How do we discern a motif with a real pattern from “random”
motifs that don’t represent real correlation between genes?
Detour: A Motif Finding Analogy
• The Motif Finding Problem is similar to the problem posed by
Edgar Allan Poe (1809 – 1849) in his short story “The Gold
Bug.”
The Gold Bug Problem
• “Here Legrand, having re-heated the parchment, submitted it to
my inspection. The following characters were rudely traced, in a
red tint, between the death's head and the goat:”
53++!305))6*;4826)4+.)4+);806*;48!8`60))85;]8*:+*8!83(88)5
*!;
46(;88*96*?;8)*+(;485);5*!2:*+(;4956*2(5*-4)8`8*;
4069285);)6
!8)4++;1(+9;48081;8:8+1;48!85;4)485!528806*81(+9;48;(88;4(
+?3
4;48)4+;161;:188;+?;
• Legrand’s Goal: Decipher the message on the parchment.
Gold Bug Problem: Assumptions
• The encrypted message is in English
• Each symbol corresponds to one letter in the English alphabet
• Conversely, no letter corresponds to more than one symbol
• No punctuation marks are encoded
Gold Bug Problem: Naïve Approach
• Count the frequency of each symbol in the encrypted message
• Find the frequency of each letter in the alphabet in the English
language
• Compare the frequencies of the previous steps, try to find a
correlation and map the symbols to a letter in the alphabet
Gold Bug Problem: Symbol Frequencies
• Gold Bug Message:
• English Language:
e t a o i n s r h l d c u m f p g w y b v k x j q z
Most frequent Least frequent
Symbol 8 ; 4 ) + * 5 6 ( ! 1 0 2 9 3 : ? ` - ] .
Frequency 34 25 19 16 15 14 12 11 9 8 7 6 5 5 4 4 3 2 1 1 1
Gold Bug Problem: Symbol Frequencies
• Result of using symbol frequencies:
sfiilfcsoorntaeuroaikoaiotecrntaeleyrcooestvenpinelefheeosnlt
arhteenmrnwteonihtaesotsnlupnihtamsrnuhsnbaoeyentacrmuesotorl
eoaiitdhimtaecedtepeidtaelestaoaeslsueecrnedhimtaetheetahiwfa
taeoaitdrdtpdeetiwt
• The result does not make sense.
• Therefore, we must use some other method to decode the
message.
Gold Bug Problem: l-tuple count
• A better approach is to examine the frequencies of l-tuples,
which are subsequences of 2 symbols, 3 symbols, etc.
• “The” is the most frequent 3-tuple in English and “;48” is the
most frequent 3-tuple in the encrypted text.
• We make inferences of unknown symbols by examining other
frequent l-tuples.
Gold Bug Problem: l-tuple count
• Mapping “the” to “;48” and substituting all occurrences of the
symbols:
53++!305))6*the26)h+.)h+)te06*the!e`60))e5t]e*:+*e!e3(ee)5*!t
h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*h)e`e*th0692e5)t)6!e
)h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3ht
he)h+t161t:1eet+?t
The Gold Bug Message Decoding: Second Attempt
• Make inferences:
53++!305))6*the26)h+.)h+)te06*the!e`60))e5t]e*:+*e!e3(ee)5*!t
h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*h)e`e*th0692e5)t)6!e
)h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3ht
he)h+t161t:1eet+?t
The Gold Bug Message Decoding: Second Attempt
• Make inferences:
53++!305))6*the26)h+.)h+)te06*the!e`60))e5t]e*:+*e!e3(ee)5*!t
h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*h)e`e*th0692e5)t)6!e
)h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3ht
he)h+t161t:1eet+?t
• “thet(ee” most likely means “the tree”
• Infer “(“ = “r”
The Gold Bug Message Decoding: Second Attempt
• Make inferences:
53++!305))6*the26)h+.)h+)te06*the!e`60))e5t]e*:+*e!e3(ee)5*!t
h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*h)e`e*th0692e5)t)6!e
)h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3ht
he)h+t161t:1eet+?t
• “thet(ee” most likely means “the tree”
• Infer “(“ = “r”
• “th(+?3h” becomes “thr+?3h”
• Can we guess “+” and “?”?
Gold Bug Problem: Solution
• Using inferences like these to figure out all the mappings, the
final message is:
AGOODGLASSINTHEBISHOPSHOSTELINTHEDEVILSSEATWENYONEDEGRE
ESANDTHIRTEENMINUTESNORTHEASTANDBYNORTHMAINBRANCHSEVENT
HLIMBEASTSIDESHOOTFROMTHELEFTEYEOFTHEDEATHSHEADABEELINE
FROMTHETREETHROUGHTHESHOTFIFTYFEETOUT
Gold Bug Problem: Solution
• Using inferences like these to figure out all the mappings, the
final message is:
AGOODGLASSINTHEBISHOPSHOSTELINTHEDEVILSSEATWENYONEDEGRE
ESANDTHIRTEENMINUTESNORTHEASTANDBYNORTHMAINBRANCHSEVENT
HLIMBEASTSIDESHOOTFROMTHELEFTEYEOFTHEDEATHSHEADABEELINE
FROMTHETREETHROUGHTHESHOTFIFTYFEETOUT
• Punctuation is important:
A GOOD GLASS IN THE BISHOP’S HOSTEL IN THE DEVIL’S SEA,
TWENTY ONE DEGREES AND THIRTEEN MINUTES NORTHEAST AND BY NORTH,
MAIN BRANCH SEVENTH LIMB, EAST SIDE, SHOOT FROM THE LEFT EYE OF
THE DEATH’S HEAD A BEE LINE FROM THE TREE THROUGH THE SHOT,
FIFTY FEET OUT.
Gold Bug Problem: Prerequisites
• There are two prerequisites that we need to solve the gold bug
problem:
1. We need to know the relative frequencies of single letters,
as well as the frequencies of 2-tuples and 3-tuples in
English.
2. We also need to know all the words in the English
language.
Gold Bug Problem and Motif Finding: Similarities
Motif Finding:
• Nucleotides in motifs encode for a message in the “genetic”
language.
• In order to solve the problem, we analyze the frequencies of
patterns in the nucleotide sequences
• Knowledge of established regulatory motifs makes the
Motif Finding problem simpler.
Gold Bug Problem:
• Symbols in “The Gold Bug” encode for a message in
English.
• In order to solve the problem, we analyze the frequencies of
patterns in the text written in English
• Knowledge of the words in the English language helps
Gold Bug Problem and Motif Finding: Similarities
Motif Finding:
• Nucleotides in motifs encode for a message in the “genetic”
language.
• In order to solve the problem, we analyze the frequencies of
patterns in the nucleotide sequences
• Knowledge of established regulatory motifs makes the
Motif Finding problem simpler.
Gold Bug Problem:
• Symbols in “The Gold Bug” encode for a message in
English.
• In order to solve the problem, we analyze the frequencies of
patterns in the text written in English
• Knowledge of the words in the English language helps
Gold Bug Problem and Motif Finding: Similarities
Motif Finding:
• Nucleotides in motifs encode for a message in the “genetic”
language.
• In order to solve the problem, we analyze the frequencies of
patterns in the nucleotide sequences
• Knowledge of established regulatory motifs makes the
Motif Finding problem simpler.
Gold Bug Problem:
• Symbols in “The Gold Bug” encode for a message in
English.
• In order to solve the problem, we analyze the frequencies of
patterns in the text written in English
• Knowledge of the words in the English language helps
Gold Bug Problem and Motif Finding: Differences
• Motif Finding is more difficult than the Gold Bug problem:
1. We don’t have the complete dictionary of motifs
2. The “genetic” language does not have a standard
“grammar”
3. Only a small fraction of nucleotide sequences encode for
motifs; the size of the data is enormous
The Motif Finding Problem: Informal Statement
• Given a random sample of DNA sequences:
cctgatagacgctatctggctatccacgtacgtaggtcctctgtgcgaatctatgcgtttccaaccat
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
aaacgtacgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtacgtc
• Find the pattern that is implanted in each of the individual
sequences, namely, the motif
The Motif Finding Problem: Additional Info
• The hidden sequence is of length 8.
• The pattern is not necessarily the same in each array because
random mutations (substitutions) may occur in the sequences,
as we have seen.
The Motif Finding Problem
• The patterns revealed with no mutations:
cctgatagacgctatctggctatccacgtacgtaggtcctctgtgcgaatctatgcgtttccaaccat
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
aaacgtacgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtacgtc
acgtacgt
Consensus String
The Motif Finding Problem
• The patterns with 2-point mutations:
cctgatagacgctatctggctatccaGgtacTtaggtcctctgtgcgaatctatgcgtttccaaccat
agtactggtgtacatttgatCcAtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
aaacgtTAgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtCcAtataca
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaCcgtacgGc
The Motif Finding Problem
• The patterns with 2-point mutations:
cctgatagacgctatctggctatccaGgtacTtaggtcctctgtgcgaatctatgcgtttccaaccat
agtactggtgtacatttgatCcAtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
aaacgtTAgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtCcAtataca
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaCcgtacgGc
• Can we still find the motif now?
Defining Motifs
• To define a motif, lets say we know where the motif starts in
the sequence.
• The motif start positions in their sequences can be represented
as s = (s1,s2,s3,…,st).
Motifs: Profiles and Consensus
• Line up the patterns by their
start indexes
s = (s1, s2, …, st)
• Construct profile matrix with
frequencies of each nucleotide
in columns
• Consensus nucleotide in each
position has the highest score
in column
a G g t a c T t
C c A t a c g t
Alignment a c g t T A g t
a c g t C c A t
C c g t a c g G
_________________
A 3 0 1 0 3 1 1 0
Profile C 2 4 0 0 1 4 0 0
G 0 1 4 0 0 0 3 1
T 0 0 0 5 1 0 1 4
_________________
Consensus A C G T A C G T
Consensus String
• Think of the consensus string as an “ancestor” motif, from
which mutated motifs emerged
• The distance between a real motif and the consensus sequence
is generally less than the distance between two real motifs
Consensus String
Evaluating Motifs
• We have a guess about the consensus sequence, but how
“good” is this consensus?
• We need to introduce a scoring function to compare different
consensus strings.
• Keep in mind that we really want to choose the starting
positions, but since the consensus is obtained from an array of
starting positions, we will determine how to compare
consensus strings and then work backward to choosing starting
positions.
Parameters: Definitions
• t - number of sample DNA sequences
• n - length of each DNA sequence
• DNA - sample of DNA sequences (stored as a t x n array)
• l - length of the motif (l-mer)
• si - starting position of an l-mer in sequence i
• s = (s1, s2,… st) - array of motif’s starting positions
Parameters: Example
cctgatagacgctatctggctatccaGgtacTtaggtcctctgtgcgaatctatgcgtttccaaccat
agtactggtgtacatttgatCcAtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
aaacgtTAgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtCcAtataca
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaCcgtacgGc
l = 8 (length of the motif)
t=5
DNA
s1 = 26 s2 = 21 s3= 3 s4 = 56 s5 = 60s
n = 69
(starting positions)
Scoring Motifs
• Given starting positions s = (s1, … st )
and DNA:
score(s, DNA) =
• Here count(k, i) represents the
frequency of nucleotide k in the motif
starting at si
• At right is an example for a given array
of starting positions
l
t

 
l
i GCTAk
ikcount
1 },,,{
),(max
Profile
a G g t a c T t
C c A t a c g t
a c g t T A g t
a c g t C c A t
C c g t a c g G
_________________
A 3 0 1 0 3 1 1 0
C 2 4 0 0 1 4 0 0
G 0 1 4 0 0 0 3 1
T 0 0 0 5 1 0 1 4
_________________
Consensus a c g t a c g t
Score 3+4+4+5+3+4+3+4=30
Finding the Best Profile Matrix
• If starting positions s = (s1, s2,… st ) are given, finding the
consensus is easy even with mutations in the sequences
because we can simply construct the profile matrix in order to
find the consensus string.
• But…the starting positions s are usually not given. How can
we find the “best” profile matrix?
The Motif Finding Problem: Formal Statement
• Goal: Given a set of DNA sequences, find a set of tl-mers, one
from each sequence, that maximizes the consensus score
• Input: A t x n matrix of DNA, and l, the length of the pattern to
find
• Output: An array of t starting positions s = (s1, s2, … st )
maximizing score(s, DNA)
The Motif Finding Problem: Brute Force Method
• Compute the scores for each possible combination of starting
positions s.
• The best score will determine the best profile and the
consensus pattern in DNA.
• The goal is to maximize Score(s, DNA) by varying the starting
positions si, where:
si = [1, …, n-l+1]
i = [1, …, t]
BruteForceMotifSearch: Pseudocode
1. BruteForceMotifSearch(DNA, t, n, l )
2. bestScore  0
3. for each s=(s1,s2 , . . ., st ) from (1,1 . . . 1)
to (n-l+1, . . ., n-l+1)
4. if score (s, DNA) >bestScore
5. bestScore  score (s, DNA)
6. bestMotif  (s1,s2 , . . . , st)
7. return bestMotif
BruteForceMotifSearch: Running Time
• Varying (n – l + 1) positions in each of t sequences, we’re
looking at (n – l + 1)t sets of starting positions
• For each set of starting positions, the scoring function
makes l operations, so the algorithm’s complexity is
l (n – l + 1)t = O(l nt)
• That means that for t = 8, n = 1000,l = 10 we must perform
approximately 1020 computations – the algorithm will take
billions of years to complete on such a problem instance
BruteForceMotifSearch: Running Time
• Varying (n – l + 1) positions in each of t sequences, we’re
looking at (n – l + 1)t sets of starting positions
• For each set of starting positions, the scoring function
makes l operations, so the algorithm’s complexity is
l (n – l + 1)t = O (l nt )
• That means that for t = 8, n = 1000,l = 10 we must perform
approximately 1020 computations – the algorithm will take
billions of years to complete on such a problem instance
• Conclusion: We need to view the problem in a new light
Changing Gears: The Median String Problem
• Given a set of t DNA sequences, find a pattern that appears in
all t sequences with the minimum number of mutations.
• This pattern will be the motif.
• Key Difference: Rather than varying the starting positions and
trying to find a consensus string representing a motif, we will
instead vary all possible motifs directly.
Hamming Distance
• Given two nucleotide strings v and w, dH(v,w) is the number of
nucleotide pairs that do not match when v and w are aligned.
• For example:
dH(AAAAAA, ACAAAC) = 2
Total Distance: Definition
• For each DNA sequence i, compute all dH(v, x), where x is an
l-mer with starting position si (1 < si < n – l + 1)
• Find minimum of dH(v, x) among all l-mers in sequence i
• TotalDistance(v, DNA) is the sum of the minimum Hamming
distances for each DNA sequencei
• TotalDistance(v, DNA) = minsdH(v, s), where s is the set of
starting positions s1, s2,… st
Total Distance: Example
• Given v = “acgtacgt” and s the starting points below:
acgtacgt
cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat
acgtacgt
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
acgtacgt
aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
acgtacgt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
acgtacgt
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc
v is the sequence in red, x is the sequence in blue
Total Distance: Example
• Given v = “acgtacgt” and s the starting points below:
acgtacgt
cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat
acgtacgt
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
acgtacgt
aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
acgtacgt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
acgtacgt
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc
v is the sequence in red, x is the sequence in blue
dH(v, x) = 1
Total Distance: Example
• Given v = “acgtacgt” and s the starting points below:
acgtacgt
cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat
acgtacgt
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
acgtacgt
aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
acgtacgt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
acgtacgt
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc
v is the sequence in red, x is the sequence in blue
dH(v, x) = 1
dH(v, x) = 0
Total Distance: Example
• Given v = “acgtacgt” and s the starting points below:
acgtacgt
cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat
acgtacgt
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
acgtacgt
aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
acgtacgt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
acgtacgt
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc
v is the sequence in red, x is the sequence in blue
dH(v, x) = 2
dH(v, x) = 1
dH(v, x) = 0
Total Distance: Example
• Given v = “acgtacgt” and s the starting points below:
acgtacgt
cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat
acgtacgt
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
acgtacgt
aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
acgtacgt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
acgtacgt
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc
v is the sequence in red, x is the sequence in blue
dH(v, x) = 2
dH(v, x) = 1
dH(v, x) = 0
dH(v, x) = 0
Total Distance: Example
• Given v = “acgtacgt” and s the starting points below:
acgtacgt
cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat
acgtacgt
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
acgtacgt
aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
acgtacgt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
acgtacgt
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc
v is the sequence in red, x is the sequence in blue
dH(v, x) = 2
dH(v, x) = 1
dH(v, x) = 0
dH(v, x) = 0
dH(v, x) = 1
Total Distance: Example
• Given v = “acgtacgt” and s the starting points below:
acgtacgt
cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat
acgtacgt
agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc
acgtacgt
aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt
acgtacgt
agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca
acgtacgt
ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc
v is the sequence in red, x is the sequence in blue
• TotalDistance(v, DNA) = 1+0+2+0+1 = 4
dH(v, x) = 2
dH(v, x) = 1
dH(v, x) = 0
dH(v, x) = 0
dH(v, x) = 1
The Median String Problem: Formulation
• Goal: Given a set of DNA sequences, find a median string.
• Input: A t x n matrix DNA, and l, the length of the pattern to
find.
• Output: A (median) string v of l nucleotides that minimizes
TotalDistance(v, DNA) over all strings of that length.
The Median String Problem: Formulation
• Goal: Given a set of DNA sequences, find a median string.
• Input: A t x n matrix DNA, and l, the length of the pattern to
find.
• Output: A (median) string v of l nucleotides that minimizes
TotalDistance(v, DNA) over all strings of that length.
• Note: This implies the natural brute force algorithm of
calculating TotalDistance(v, DNA) for all strings v (next slide)
MedianStringSearch: Pseudocode
1. MedianStringSearch (DNA, t, n, l )
2. bestWord  AAA…A
3. bestDistance  ∞
4. for each l-mer v from AAA…A to TTT…T
5. if TotalDistance (v, DNA) < bestDistance
6. bestDistance  TotalDistance (v, DNA)
7. bestWord  v
8. return bestWord
Motif Finding Problem = Median String Problem
• The Motif Finding is a maximization problem while Median
String is a minimization problem.
• However, the Motif Finding problem and Median String
problem are computationally equivalent.
• We need to show that minimizing TotalDistance is equivalent
to maximizing Score.
Motif Finding Problem == Median String Problem
• At any column i
Scorei + TotalDistancei = t
• Because there are l columns
Score + TotalDistance = l * t
• Rearranging:
Score = l * t - TotalDistance
• l * t is constant, so the minimization
of the right side is equivalent to the
maximization of the left side
l
t
a G g t a c T t
C c A t a c g t
Alignment a c g t T A g t
a c g t C c A t
C c g t a c g G
_________________
A 3 0 1 0 3 1 1 0
Profile C 2 4 0 0 1 4 0 0
G 0 1 4 0 0 0 3 1
T 0 0 0 5 1 0 1 4
_________________
Consensus a c g t a c g t
Score 3+4+4+5+3+4+3+4
TotalDistance 2+1+1+0+2+1+2+1
Sum 5 5 5 5 5 5 5 5
Motif Finding Problem vs. Median String Problem
• Why bother reformulating the Motif Finding problem into the
Median String problem?
• The Motif Finding Problem needs to examine all possible
choices for s. Recall that this is (n — l + 1)t possibilities!!!
• The Median String Problem needs to examine all 4l
combinations for v. This number is typically smaller,
although if l is large using brute force will still be
infeasible.
Median String: Improving the Running Time
1. MedianStringSearch (DNA, t, n, l )
2. bestWord  AAA…A
3. bestDistance  ∞
4. for each l-mer v from AAA…A to TTT…T
5. if TotalDistance (v, DNA) < bestDistance
6. bestDistance  TotalDistance (v, DNA)
7. bestWord  v
8. return bestWord
Structuring the Search
• For the Median String Problem we need to consider all 4l
possible l-mers:
aa… aa
aa… ac
aa… ag
aa… at
.
.
tt… tt
How to organize this search?
l
Alternative Representation of the Search Space
• Let A = 1, C = 2, G = 3, T = 4
• Then the sequences from AA…A to TT…T become:
11…11
11…12
11…13
11…14
.
.
44…44
• Notice that the sequences above simply list all numbers as if we
were counting on base 4 without using 0 as a digit.
l
First Try: Linked List
• Suppose l = 2
aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt
• We need to visit all the predecessors of a sequence before
visiting the sequence itself.
• Unfortunately this isn’t very efficient.
Start
Better Structure: Search Tree
• Instead, let’s try grouping the sequences by their prefixes.
aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt
Better Structure: Search Tree
• Instead, let’s try grouping the sequences by their prefixes
aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt
a- c- g- t-
Better Structure: Search Tree
• Instead, let’s try grouping the sequences by their prefixes
aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt
a- c- g- t-
--
root
Analyzing Search Trees
• Characteristics of search trees:
• The sequences are contained in its leaves
• The parent of a node is the prefix of its children
• How can we move through the tree?
Moving through the Search Trees
• Four common moves in a search tree that we are about to
explore:
1. Move to the next leaf
2. Visit all the leaves
3. Visit the next node
4. Bypass the children of a node
Move 1: Visit the Next Leaf
1. NextLeaf( a, L, k ) // a : the array of digits
2. for i L to 1 // L: length of the array
3. if ai <k // k : max digit value
4. ai ai + 1
5. return a
6. ai  1
7. return a
• Given a current leaf a , we need to compute the “next” leaf:
Note: In the case of the nucleotide alphabet, we are using k = 4
Move 1: Visit the Next Leaf
• The algorithm is common addition base-k:
1. Increment the least significant digit
2. “Carry the one” to the next digit position when the digit is
at maximal value
NextLeaf: Example
• Moving to the next leaf:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Current Location
NextLeaf: Example
• Moving to the next leaf:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44

--
Next Location
NextLeaf: Example
• Moving to the next leaf:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Location
NextLeaf: Example
• Moving to the next leaf:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Location
NextLeaf: Example
• Moving to the next leaf:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Location
NextLeaf: Example
• Moving to the next leaf:
• Etc.
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Location
Move 2: Visit All Leaves
• Printing all l-mers in ascending order:
1. AllLeaves(L, k) // L: length of the sequence
2. a  (1,...,1) // k : max digit value
3. while forever // a: array of digits
4. output a
5. a  NextLeaf(a, L, k)
6. if a = (1,...,1)
7. return
Visit All Leaves: Example
• Moving through all the leaves in order:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
--
Order of steps
Depth First Search
• So we can search through the leaves.
• How about searching through all vertices of the tree?
• We will do this with a depth firstsearch.
• Specifically we need an algorithm to visit the next vertex.
Move 3: Visit the Next Vertex
1. NextVertex(a, i, L, k ) // a: the array of digits
2. if i < L // i : prefix length
3. ai+1 1 // L: max length
4. return (a, i +1 ) // k: max digit value
5. else
6. for j  l to 1
7. if aj < k
8. aj  aj +1
9. return (a, j )
10. return (a,0)
Next Vertex: Example
• Moving to the next vertex:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Current Location
Next Vertex: Example
• Moving to the next vertex:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Vertex: Example
• Moving to the next vertex:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Vertex: Example
• Moving to the next vertex:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Vertex: Example
• Moving to the next vertex:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Vertex: Example
• Moving to the next vertex:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Location after 5
next vertex moves
Move 4: Bypass
• Given a prefix (internal vertex), find the next vertex after
skipping all the prefix’s children.
1. ByPass(a, i, L, k) // a: array of digits
2. for j  i to 1 // i : prefix length
3. if aj < k // L: maximum length
4. aj aj +1 // k : max digit value
5. return (a, j )
6. return (a, 0)
Bypass: Example
• Bypassing the descendants of “2-”:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Current Location
Bypass: Example
• Bypassing the descendants of “2-”:
1- 2- 3- 4-
11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44
--
Next Location
Revisiting Brute Force Search
• Now that we have method for navigating the tree, lets look again
at BruteForceMotifSearch.
Brute Force Search Revisited
1. BruteForceMotifSearchAgain(DNA, t, n, l)
2. s  (1,1,…, 1)
3. bestScore  score (s, DNA)
4. while forever
5. s  NextLeaf (s, t, n — l +1 )
6. if score (s,DNA) >bestScore
7. bestScore  score (s, DNA)
8. bestMotif  (s1,s2 , . . . , st)
9. return bestMotif
Can We Streamline the Algorithm?
• Sets of s = (s1, s2, …, st) may have a weak profile for the first i
positions (s1, s2, …, si)
• Every row of the alignment matrix may add at most l to score
• Optimistic View: all subsequent (t-i) positions (si+1, …st) add
(t – i ) * l to score(s, i, DNA)
• So if score(s, i, DNA) + (t – i ) * l < bestScore, it makes no
sense to search through vertices of the current subtree
• In this case, we can use ByPass() to skip frivolous branches.
• This leads to what is called in general a “branch and bound”
method for motif finding.
Branch and Bound Algorithm for Motif Search
• Since each level of the tree goes
deeper into search, discarding a
prefix discards all following
branches.
• This saves us from looking at
(n – l + 1)t-i leaves.
• We use NextVertex() and
ByPass() to navigate the tree.
Branch and Bound Motif Search: Pseudocode
1. BranchAndBoundMotifSearch(DNA, t, n,l )
2. s  (1,…,1)
3. bestScore  0
4. i  1
5. while i > 0
6. if i <t
7. optimisticScore  score(s, i, DNA) + (t – i ) * l
8. if optimisticScore < bestScore
9. (s, i) ByPass(s, i, n – l +1)
10. else
11. (s, i) NextVertex(s, i, n – l +1)
12. else
13. if score(s, DNA) > bestScore
14. bestScore  score(s)
15. bestMotif  (s1, s2, s3, …, st )
16. (s, i)  NextVertex(s, i, t, n – l + 1)
17. return bestMotif
Median String Search Improvements
• Recall the computational differences between motif search and
median string search.
• The Motif Finding Problem needs to examine all (n – l +1)t
combinations for s.
• The Median String Problem needs to examine 4l
combinations of v. This number is usually relatively small.
• We want to use the median string algorithm with the Branch
and Bound trick!
Median String Search with Branch and Bound
• Note that if the total distance for a prefix is greater than that
for the best word so far:
TotalDistance (prefix, DNA) >BestDistance
then there is no use exploring the remaining part of the word.
• We can eliminate that branch and BYPASS exploring that
branch further.
Median String Search with Branch and Bound
1. BranchAndBoundMedianStringSearch(DNA, t, n, l )
2. s  (1,…,1)
3. bestDistance  ∞
4. i  1
5. while i > 0
6. if i < l
7. prefix  string corresponding to the first i nucleotides of s
8. optimisticDistance  TotalDistance(prefix, DNA)
9. if optimisticDistance > bestDistance
10. (s, i ) ByPass(s, i, l, 4)
11. else
12. (s, i )NextVertex(s, i, l, 4)
13. else
14. word  nucleotide string corresponding to s
15. if TotalDistance(s, DNA ) < bestDistance
16. bestDistance  TotalDistance(word, DNA)
17. bestWord  word
18. (s, i )  NextVertex(s, i, l, 4)
19. return bestWord
Improving the Bounds
• Given an l-mer w, divided into two parts at point i:
• u : prefix w1, …, wi,
• v : suffix wi+1, ..., wl
• Find minimum distance for u in a sequence.
• No instances of u in the sequence have distance less than the
minimum distance.
• Note: this doesn’t tell us anything about whether u is part of
any motif. We only get a minimum distance for prefix u.
Improving the Bounds
• Repeating the process for the suffix v gives us a
minimum distance for v.
• Since u and v are two substrings of w, and included in
motif w, we can assume that the minimum distance of
u plus minimum distance of v can only be less than
the minimum distance for w.
Improving the Bounds
Improving the Bounds
• If d(prefix) + d(suffix) > bestDistance:
• Motif w (prefix.suffix) cannot give a better (lower) score
than d(prefix) + d(suffix)
• In this case, we can ByPass()
Better Bounded Median String Search
1. ImprovedBranchAndBoundMedianString(DNA, t, n, l )
2. s= (1, 1, …, 1)
3. bestDistance = ∞
4. i = 1
5. while i > 0
6. if i < l
7. prefix = nucleotide string corresponding to (s1, s2, s3, …, si )
8. optimisticPrefixDistance = TotalDistance (prefix, DNA )
9. if optimisticPrefixDistance <bestSubstring [i ]
10. bestSubstring[i ] = optimisticPrefixDistance
11. if (l – i <i )
12. optimisticSuffixDistance = bestsubstring [l -i ]
13. else
14. optimisticSuffixDistance = 0;
15. if optimisticPrefixDistance + optimisticSuffixDistance > bestDistance
16. (s, i ) = ByPass(s, i, l, 4)
17. else
18. (s, i ) = NextVertex(s, i, l, 4)
19. else
20. word = nucleotide string corresponding to (s1,s2, s3, …, st)
21. if TotalDistance(word, DNA ) < bestDistance
22. bestDistance = TotalDistance(word, DNA)
23. bestWord = word
24. (s,i ) = NextVertex(s, i, l, 4)
25. return bestWord
Notes on Motif Finding
• Exhaustive Search and Median String are both exact
algorithms.
• They always find the optimal solution, though they may be too
slow to perform practical tasks.
• Many algorithms sacrifice optimal solution for speed.
CONSENSUS: Greedy Motif Search
• Finds two closest l -mers in sequences 1 and 2 and forms
2 x l alignment matrix with score(s, 2, DNA).
• At each of the following t-2 iterations CONSENSUS finds a
“best” l -mer in sequence i from the perspective of the already
constructed (i-1) x l alignment matrix for the first (i-1)
sequences.
• In other words, it finds an l - mer in sequence i maximizing
score(s, i, DNA)
under the assumption that the first (i-1) l -mers have been
already chosen.
• CONSENSUS sacrifices optimal solution for speed: in fact
the bulk of the time is actually spent locating the first 2 l -mers.
Some Motif Finding Programs
• CONSENSUS
Hertz, Stromo (1989)
• GibbsDNA
Lawrence et al (1993)
• MEME
Bailey, Elkan (1995)
• RandomProjections
Buhler, Tompa (2002)
• MULTIPROFILER Keich,
Pevzner (2002)
• MITRA
Eskin, Pevzner (2002)
• Pattern Branching
Price et al.,
lo (2003)

More Related Content

Viewers also liked

Epitope prediction and its algorithms
Epitope prediction and its algorithmsEpitope prediction and its algorithms
Epitope prediction and its algorithms
Prasanthperceptron
 
Ethiopan Pharmacology 2015
Ethiopan Pharmacology 2015Ethiopan Pharmacology 2015
Ethiopan Pharmacology 2015
yayakuku
 
CLASS GENERAL ANAESTHESIA
CLASS GENERAL ANAESTHESIACLASS GENERAL ANAESTHESIA
CLASS GENERAL ANAESTHESIA
Raghu Prasada
 
Aditi M. Panditrao's Inhalational anaes agents
Aditi M. Panditrao's Inhalational anaes agentsAditi M. Panditrao's Inhalational anaes agents
Aditi M. Panditrao's Inhalational anaes agents
Prof. Mridul Panditrao
 
mechanism of action of drugs
mechanism of action of drugsmechanism of action of drugs
mechanism of action of drugs
Koppala RVS Chaitanya
 
Thermo regulation – physiology temperature monitoring
Thermo regulation – physiology temperature monitoringThermo regulation – physiology temperature monitoring
Thermo regulation – physiology temperature monitoring
balu muppala
 
Mechanism of general anaesthesia at molecular level.
Mechanism of general anaesthesia at molecular level.Mechanism of general anaesthesia at molecular level.
Mechanism of general anaesthesia at molecular level.
narasimha reddy
 
Drug use in hepatic and renal impairment
Drug use in hepatic and renal impairmentDrug use in hepatic and renal impairment
Drug use in hepatic and renal impairment
Akshil Mehta
 
General anesthesia
General anesthesiaGeneral anesthesia
General anesthesia
bhavyalatha
 
Inhalational Agents
Inhalational AgentsInhalational Agents
Inhalational Agents
meducationdotnet
 
General anaesthesia (New) - drdhriti
General anaesthesia (New) - drdhriti General anaesthesia (New) - drdhriti
General anaesthesia (New) - drdhriti
http://neigrihms.gov.in/
 

Viewers also liked (11)

Epitope prediction and its algorithms
Epitope prediction and its algorithmsEpitope prediction and its algorithms
Epitope prediction and its algorithms
 
Ethiopan Pharmacology 2015
Ethiopan Pharmacology 2015Ethiopan Pharmacology 2015
Ethiopan Pharmacology 2015
 
CLASS GENERAL ANAESTHESIA
CLASS GENERAL ANAESTHESIACLASS GENERAL ANAESTHESIA
CLASS GENERAL ANAESTHESIA
 
Aditi M. Panditrao's Inhalational anaes agents
Aditi M. Panditrao's Inhalational anaes agentsAditi M. Panditrao's Inhalational anaes agents
Aditi M. Panditrao's Inhalational anaes agents
 
mechanism of action of drugs
mechanism of action of drugsmechanism of action of drugs
mechanism of action of drugs
 
Thermo regulation – physiology temperature monitoring
Thermo regulation – physiology temperature monitoringThermo regulation – physiology temperature monitoring
Thermo regulation – physiology temperature monitoring
 
Mechanism of general anaesthesia at molecular level.
Mechanism of general anaesthesia at molecular level.Mechanism of general anaesthesia at molecular level.
Mechanism of general anaesthesia at molecular level.
 
Drug use in hepatic and renal impairment
Drug use in hepatic and renal impairmentDrug use in hepatic and renal impairment
Drug use in hepatic and renal impairment
 
General anesthesia
General anesthesiaGeneral anesthesia
General anesthesia
 
Inhalational Agents
Inhalational AgentsInhalational Agents
Inhalational Agents
 
General anaesthesia (New) - drdhriti
General anaesthesia (New) - drdhriti General anaesthesia (New) - drdhriti
General anaesthesia (New) - drdhriti
 

Similar to Ch04 motifs

Lecture 4.ppt
Lecture 4.pptLecture 4.ppt
Lecture 4.ppt
khadijarafique14
 
Modern concept of gene.pdf
Modern concept of gene.pdfModern concept of gene.pdf
Modern concept of gene.pdf
MeeraTaraSuresh
 
Ch09 combinatorialpatternmatching
Ch09 combinatorialpatternmatchingCh09 combinatorialpatternmatching
Ch09 combinatorialpatternmatching
BioinformaticsInstitute
 
Understanding mechanisms underlying human gene expression variation with RNA ...
Understanding mechanisms underlying human gene expression variation with RNA ...Understanding mechanisms underlying human gene expression variation with RNA ...
Understanding mechanisms underlying human gene expression variation with RNA ...
Joseph Pickrell
 
B.sc biochem i bobi u 4 gene prediction
B.sc biochem i bobi u 4 gene predictionB.sc biochem i bobi u 4 gene prediction
B.sc biochem i bobi u 4 gene prediction
Rai University
 
B.sc biochem i bobi u 4 gene prediction
B.sc biochem i bobi u 4 gene predictionB.sc biochem i bobi u 4 gene prediction
B.sc biochem i bobi u 4 gene prediction
Rai University
 
Ff meeting 25nov03
Ff meeting 25nov03Ff meeting 25nov03
Ff meeting 25nov03
moniajit
 
Genome Browsing, Genomic Data Mining and Genome Data Visualization with Ensem...
Genome Browsing, Genomic Data Mining and Genome Data Visualization with Ensem...Genome Browsing, Genomic Data Mining and Genome Data Visualization with Ensem...
Genome Browsing, Genomic Data Mining and Genome Data Visualization with Ensem...
VHIR Vall d’Hebron Institut de Recerca
 
Defense Talk Slides
Defense Talk SlidesDefense Talk Slides
Defense Talk Slides
April Wright
 
Dna forensic
Dna forensicDna forensic
Dna forensic
Bruno Mmassy
 
Exome Sequencing
Exome SequencingExome Sequencing
Exome Sequencing
Dr. Mohammad Reza Nateghi
 
Pathema Burkholderia Annotation Jamboree: Prokaryotic Annotation Overview
Pathema Burkholderia Annotation Jamboree: Prokaryotic Annotation OverviewPathema Burkholderia Annotation Jamboree: Prokaryotic Annotation Overview
Pathema Burkholderia Annotation Jamboree: Prokaryotic Annotation Overview
Pathema
 
Wright_Evolution2013
Wright_Evolution2013Wright_Evolution2013
Wright_Evolution2013
April Wright
 
An introduction to promoter prediction and analysis
An introduction to promoter prediction and analysisAn introduction to promoter prediction and analysis
An introduction to promoter prediction and analysis
Sarbesh D. Dangol
 
Bioinformatics
BioinformaticsBioinformatics
Bioinformatics
Afra Fathima
 
CpG Island Identification with Hidden Markov Models
CpG Island Identification with Hidden Markov ModelsCpG Island Identification with Hidden Markov Models
CpG Island Identification with Hidden Markov Models
Kshitij Tayal
 
Transposons is.pptx
Transposons is.pptxTransposons is.pptx
Transposons is.pptx
AnukrittiMehra
 
Arnab kumar de
Arnab kumar deArnab kumar de
Arnab kumar de
Arnab De
 
Algorithm Implementation of Genetic Association ‎Analysis for Rheumatoid Arth...
Algorithm Implementation of Genetic Association ‎Analysis for Rheumatoid Arth...Algorithm Implementation of Genetic Association ‎Analysis for Rheumatoid Arth...
Algorithm Implementation of Genetic Association ‎Analysis for Rheumatoid Arth...
Fatma Sayed Ibrahim
 
The Human Genome Project - Part I
The Human Genome Project - Part IThe Human Genome Project - Part I
The Human Genome Project - Part I
hhalhaddad
 

Similar to Ch04 motifs (20)

Lecture 4.ppt
Lecture 4.pptLecture 4.ppt
Lecture 4.ppt
 
Modern concept of gene.pdf
Modern concept of gene.pdfModern concept of gene.pdf
Modern concept of gene.pdf
 
Ch09 combinatorialpatternmatching
Ch09 combinatorialpatternmatchingCh09 combinatorialpatternmatching
Ch09 combinatorialpatternmatching
 
Understanding mechanisms underlying human gene expression variation with RNA ...
Understanding mechanisms underlying human gene expression variation with RNA ...Understanding mechanisms underlying human gene expression variation with RNA ...
Understanding mechanisms underlying human gene expression variation with RNA ...
 
B.sc biochem i bobi u 4 gene prediction
B.sc biochem i bobi u 4 gene predictionB.sc biochem i bobi u 4 gene prediction
B.sc biochem i bobi u 4 gene prediction
 
B.sc biochem i bobi u 4 gene prediction
B.sc biochem i bobi u 4 gene predictionB.sc biochem i bobi u 4 gene prediction
B.sc biochem i bobi u 4 gene prediction
 
Ff meeting 25nov03
Ff meeting 25nov03Ff meeting 25nov03
Ff meeting 25nov03
 
Genome Browsing, Genomic Data Mining and Genome Data Visualization with Ensem...
Genome Browsing, Genomic Data Mining and Genome Data Visualization with Ensem...Genome Browsing, Genomic Data Mining and Genome Data Visualization with Ensem...
Genome Browsing, Genomic Data Mining and Genome Data Visualization with Ensem...
 
Defense Talk Slides
Defense Talk SlidesDefense Talk Slides
Defense Talk Slides
 
Dna forensic
Dna forensicDna forensic
Dna forensic
 
Exome Sequencing
Exome SequencingExome Sequencing
Exome Sequencing
 
Pathema Burkholderia Annotation Jamboree: Prokaryotic Annotation Overview
Pathema Burkholderia Annotation Jamboree: Prokaryotic Annotation OverviewPathema Burkholderia Annotation Jamboree: Prokaryotic Annotation Overview
Pathema Burkholderia Annotation Jamboree: Prokaryotic Annotation Overview
 
Wright_Evolution2013
Wright_Evolution2013Wright_Evolution2013
Wright_Evolution2013
 
An introduction to promoter prediction and analysis
An introduction to promoter prediction and analysisAn introduction to promoter prediction and analysis
An introduction to promoter prediction and analysis
 
Bioinformatics
BioinformaticsBioinformatics
Bioinformatics
 
CpG Island Identification with Hidden Markov Models
CpG Island Identification with Hidden Markov ModelsCpG Island Identification with Hidden Markov Models
CpG Island Identification with Hidden Markov Models
 
Transposons is.pptx
Transposons is.pptxTransposons is.pptx
Transposons is.pptx
 
Arnab kumar de
Arnab kumar deArnab kumar de
Arnab kumar de
 
Algorithm Implementation of Genetic Association ‎Analysis for Rheumatoid Arth...
Algorithm Implementation of Genetic Association ‎Analysis for Rheumatoid Arth...Algorithm Implementation of Genetic Association ‎Analysis for Rheumatoid Arth...
Algorithm Implementation of Genetic Association ‎Analysis for Rheumatoid Arth...
 
The Human Genome Project - Part I
The Human Genome Project - Part IThe Human Genome Project - Part I
The Human Genome Project - Part I
 

More from BioinformaticsInstitute

Graph genome
Graph genome Graph genome
Nanopores sequencing
Nanopores sequencingNanopores sequencing
Nanopores sequencing
BioinformaticsInstitute
 
A superglue for string comparison
A superglue for string comparisonA superglue for string comparison
A superglue for string comparison
BioinformaticsInstitute
 
Comparative Genomics and de Bruijn graphs
Comparative Genomics and de Bruijn graphsComparative Genomics and de Bruijn graphs
Comparative Genomics and de Bruijn graphs
BioinformaticsInstitute
 
Биоинформатический анализ данных полноэкзомного секвенирования: анализ качес...
 Биоинформатический анализ данных полноэкзомного секвенирования: анализ качес... Биоинформатический анализ данных полноэкзомного секвенирования: анализ качес...
Биоинформатический анализ данных полноэкзомного секвенирования: анализ качес...BioinformaticsInstitute
 
Вперед в прошлое. Методы генетической диагностики древней днк
Вперед в прошлое. Методы генетической диагностики древней днкВперед в прошлое. Методы генетической диагностики древней днк
Вперед в прошлое. Методы генетической диагностики древней днк
BioinformaticsInstitute
 
Knime &amp; bioinformatics
Knime &amp; bioinformaticsKnime &amp; bioinformatics
Knime &amp; bioinformatics
BioinformaticsInstitute
 
"Зачем биологам суперкомпьютеры", Александр Предеус
"Зачем биологам суперкомпьютеры", Александр Предеус"Зачем биологам суперкомпьютеры", Александр Предеус
"Зачем биологам суперкомпьютеры", Александр Предеус
BioinformaticsInstitute
 
Иммунотерапия раковых опухолей: взгляд со стороны системной биологии. Максим ...
Иммунотерапия раковых опухолей: взгляд со стороны системной биологии. Максим ...Иммунотерапия раковых опухолей: взгляд со стороны системной биологии. Максим ...
Иммунотерапия раковых опухолей: взгляд со стороны системной биологии. Максим ...
BioinformaticsInstitute
 
Рак 101 (Мария Шутова, ИоГЕН РАН)
Рак 101 (Мария Шутова, ИоГЕН РАН)Рак 101 (Мария Шутова, ИоГЕН РАН)
Рак 101 (Мария Шутова, ИоГЕН РАН)
BioinformaticsInstitute
 
Плюрипотентность 101
Плюрипотентность 101Плюрипотентность 101
Плюрипотентность 101
BioinformaticsInstitute
 
Секвенирование как инструмент исследования сложных фенотипов человека: от ген...
Секвенирование как инструмент исследования сложных фенотипов человека: от ген...Секвенирование как инструмент исследования сложных фенотипов человека: от ген...
Секвенирование как инструмент исследования сложных фенотипов человека: от ген...
BioinformaticsInstitute
 
Инвестиции в биоинформатику и биотех (Андрей Афанасьев)
Инвестиции в биоинформатику и биотех (Андрей Афанасьев)Инвестиции в биоинформатику и биотех (Андрей Афанасьев)
Инвестиции в биоинформатику и биотех (Андрей Афанасьев)
BioinformaticsInstitute
 
Biodb 2011-05
Biodb 2011-05Biodb 2011-05

More from BioinformaticsInstitute (20)

Graph genome
Graph genome Graph genome
Graph genome
 
Nanopores sequencing
Nanopores sequencingNanopores sequencing
Nanopores sequencing
 
A superglue for string comparison
A superglue for string comparisonA superglue for string comparison
A superglue for string comparison
 
Comparative Genomics and de Bruijn graphs
Comparative Genomics and de Bruijn graphsComparative Genomics and de Bruijn graphs
Comparative Genomics and de Bruijn graphs
 
Биоинформатический анализ данных полноэкзомного секвенирования: анализ качес...
 Биоинформатический анализ данных полноэкзомного секвенирования: анализ качес... Биоинформатический анализ данных полноэкзомного секвенирования: анализ качес...
Биоинформатический анализ данных полноэкзомного секвенирования: анализ качес...
 
Вперед в прошлое. Методы генетической диагностики древней днк
Вперед в прошлое. Методы генетической диагностики древней днкВперед в прошлое. Методы генетической диагностики древней днк
Вперед в прошлое. Методы генетической диагностики древней днк
 
Knime &amp; bioinformatics
Knime &amp; bioinformaticsKnime &amp; bioinformatics
Knime &amp; bioinformatics
 
"Зачем биологам суперкомпьютеры", Александр Предеус
"Зачем биологам суперкомпьютеры", Александр Предеус"Зачем биологам суперкомпьютеры", Александр Предеус
"Зачем биологам суперкомпьютеры", Александр Предеус
 
Иммунотерапия раковых опухолей: взгляд со стороны системной биологии. Максим ...
Иммунотерапия раковых опухолей: взгляд со стороны системной биологии. Максим ...Иммунотерапия раковых опухолей: взгляд со стороны системной биологии. Максим ...
Иммунотерапия раковых опухолей: взгляд со стороны системной биологии. Максим ...
 
Рак 101 (Мария Шутова, ИоГЕН РАН)
Рак 101 (Мария Шутова, ИоГЕН РАН)Рак 101 (Мария Шутова, ИоГЕН РАН)
Рак 101 (Мария Шутова, ИоГЕН РАН)
 
Плюрипотентность 101
Плюрипотентность 101Плюрипотентность 101
Плюрипотентность 101
 
Секвенирование как инструмент исследования сложных фенотипов человека: от ген...
Секвенирование как инструмент исследования сложных фенотипов человека: от ген...Секвенирование как инструмент исследования сложных фенотипов человека: от ген...
Секвенирование как инструмент исследования сложных фенотипов человека: от ген...
 
Инвестиции в биоинформатику и биотех (Андрей Афанасьев)
Инвестиции в биоинформатику и биотех (Андрей Афанасьев)Инвестиции в биоинформатику и биотех (Андрей Афанасьев)
Инвестиции в биоинформатику и биотех (Андрей Афанасьев)
 
Biodb 2011-everything
Biodb 2011-everythingBiodb 2011-everything
Biodb 2011-everything
 
Biodb 2011-05
Biodb 2011-05Biodb 2011-05
Biodb 2011-05
 
Biodb 2011-04
Biodb 2011-04Biodb 2011-04
Biodb 2011-04
 
Biodb 2011-03
Biodb 2011-03Biodb 2011-03
Biodb 2011-03
 
Biodb 2011-01
Biodb 2011-01Biodb 2011-01
Biodb 2011-01
 
Biodb 2011-02
Biodb 2011-02Biodb 2011-02
Biodb 2011-02
 
Ngs 3 1
Ngs 3 1Ngs 3 1
Ngs 3 1
 

Ch04 motifs

  • 2. 1. Implanting Patterns in Random Text 2. Gene Regulation 3. Regulatory Motifs 4. The Gold Bug Problem 5. The Motif Finding Problem 6. Brute Force Motif Finding 7. The Median String Problem 8. Search Trees 9. Branch-and-Bound Motif Search 10. Branch-and-Bound Median String Search 11. Consensus and Pattern Branching: Greedy Motif Search 12. Planted Motif Search: Exhaustive Motif Search Outline
  • 3. Random Sample atgaccgggatactgataccgtatttggcctaggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaatactgggcataaggtaca tgagtatccctgggatgacttttgggaacactatagtgctctcccgatttttgaatatgtaggatcattcgccagggtccga gctgagaattggatgaccttgtaagtgttttccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatggcccacttagtccacttatag gtcaatcatgttcttgtgaatggatttttaactgagggcatagaccgcttggcgcacccaaattcagtgtgggcgagcgcaa cggttttggcccttgttagaggcccccgtactgatggaaactttcaattatgagagagctaatctatcgcgtgcgtgttcat aacttgagttggtttcgaaaatgctctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatttcaacgtatgccgaaccgaaagggaag ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttctgggtactgatagca
  • 4. Implanting Motif AAAAAAAGGGGGGG atgaccgggatactgatAAAAAAAAGGGGGGGggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaataAAAAAAAAGGGGGGGa tgagtatccctgggatgacttAAAAAAAAGGGGGGGtgctctcccgatttttgaatatgtaggatcattcgccagggtccga gctgagaattggatgAAAAAAAAGGGGGGGtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatAAAAAAAAGGGGGGGcttatag gtcaatcatgttcttgtgaatggatttAAAAAAAAGGGGGGGgaccgcttggcgcacccaaattcagtgtgggcgagcgcaa cggttttggcccttgttagaggcccccgtAAAAAAAAGGGGGGGcaattatgagagagctaatctatcgcgtgcgtgttcat aacttgagttAAAAAAAAGGGGGGGctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatAAAAAAAAGGGGGGGaccgaaagggaag ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttAAAAAAAAGGGGGGGa
  • 5. Where is the Implanted Motif? atgaccgggatactgataaaaaaaagggggggggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaataaaaaaaaaggggggga tgagtatccctgggatgacttaaaaaaaagggggggtgctctcccgatttttgaatatgtaggatcattcgccagggtccga gctgagaattggatgaaaaaaaagggggggtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaataaaaaaaagggggggcttatag gtcaatcatgttcttgtgaatggatttaaaaaaaaggggggggaccgcttggcgcacccaaattcagtgtgggcgagcgcaa cggttttggcccttgttagaggcccccgtaaaaaaaagggggggcaattatgagagagctaatctatcgcgtgcgtgttcat aacttgagttaaaaaaaagggggggctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcataaaaaaaagggggggaccgaaagggaag ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttaaaaaaaaggggggga
  • 6. ImplantingAAAAAAGGGGGGG with 4 Mutations atgaccgggatactgatAgAAgAAAGGttGGGggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaatacAAtAAAAcGGcGGGa tgagtatccctgggatgacttAAAAtAAtGGaGtGGtgctctcccgatttttgaatatgtaggatcattcgccagggtccga gctgagaattggatgcAAAAAAAGGGattGtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatAtAAtAAAGGaaGGGcttatag gtcaatcatgttcttgtgaatggatttAAcAAtAAGGGctGGgaccgcttggcgcacccaaattcagtgtgggcgagcgcaa cggttttggcccttgttagaggcccccgtAtAAAcAAGGaGGGccaattatgagagagctaatctatcgcgtgcgtgttcat aacttgagttAAAAAAtAGGGaGccctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatActAAAAAGGaGcGGaccgaaagggaag ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttActAAAAAGGaGcGGa
  • 7. Now Where is the Motif? atgaccgggatactgatagaagaaaggttgggggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaatacaataaaacggcggga tgagtatccctgggatgacttaaaataatggagtggtgctctcccgatttttgaatatgtaggatcattcgccagggtccga gctgagaattggatgcaaaaaaagggattgtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatataataaaggaagggcttatag gtcaatcatgttcttgtgaatggatttaacaataagggctgggaccgcttggcgcacccaaattcagtgtgggcgagcgcaa cggttttggcccttgttagaggcccccgtataaacaaggagggccaattatgagagagctaatctatcgcgtgcgtgttcat aacttgagttaaaaaatagggagccctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatactaaaaaggagcggaccgaaagggaag ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttactaaaaaggagcgga
  • 8. Why Finding the Hidden Motif is Difficult atgaccgggatactgatAgAAgAAAGGttGGGggcgtacacattagataaacgtatgaagtacgttagactcggcgccgccg acccctattttttgagcagatttagtgacctggaaaaaaaatttgagtacaaaacttttccgaatacAAtAAAAcGGcGGGa tgagtatccctgggatgacttAAAAtAAtGGaGtGGtgctctcccgatttttgaatatgtaggatcattcgccagggtccga gctgagaattggatgcAAAAAAAGGGattGtccacgcaatcgcgaaccaacgcggacccaaaggcaagaccgataaaggaga tcccttttgcggtaatgtgccgggaggctggttacgtagggaagccctaacggacttaatAtAAtAAAGGaaGGGcttatag gtcaatcatgttcttgtgaatggatttAAcAAtAAGGGctGGgaccgcttggcgcacccaaattcagtgtgggcgagcgcaa cggttttggcccttgttagaggcccccgtAtAAAcAAGGaGGGccaattatgagagagctaatctatcgcgtgcgtgttcat aacttgagttAAAAAAtAGGGaGccctggggcacatacaagaggagtcttccttatcagttaatgctgtatgacactatgta ttggcccattggctaaaagcccaacttgacaaatggaagatagaatccttgcatActAAAAAGGaGcGGaccgaaagggaag ctggtgagcaacgacagattcttacgtgcattagctcgcttccggggatctaatagcacgaagcttActAAAAAGGaGcGGa AgAAgAAAGGttGGG cAAtAAAAcGGcGGG ..|..|||.|..|||
  • 9. Challenge Problem • Find a motif in a sample of 20 “random” sequences (e.g. 600 nucleotides long). • Each sequence contains an implanted pattern of length 15. • Each pattern appears with 4 mismatches. • More generally, an (n, k) motif is a pattern of length n which appears with k mismatches within a DNA sequence. • So our challenge problem is to find a (15,4) motif in a group of 20 sequences.
  • 10. Why (15,4)-motif is hard to find? • Goal: recover original pattern P from its (unknown!) instances: P1 , P2 , … , P20 • Problem: Although P and Pi are similar for each i (4 mutations for a (15,4) motif), given two different instances Pi and Pj, they may differ twice as much (4 + 4 = 8 mutations for a (15,4) motif). • Conclusions: 1. Pairwise similiarities are misleading. 2. Multiple similarities are difficult to find.
  • 11. Combinatorial Gene Regulation • A microarray experiment showed that when gene X is knocked out, 20 other genes are not expressed • Motivating Question: How can one gene have such drastic effects? DNA Microarray
  • 12. Regulatory Proteins • Answer: Gene X encodes regulatory protein, a.k.a. a transcription factor (TF) • The 20 unexpressed genes rely on gene X’s TF to induce transcription • A single TF may regulate multiple genes
  • 13. Regulatory Regions • Every gene contains a regulatory region (RR) typically stretching 100-1000 bp upstream of the transcriptional start site. • Located within the RR are the Transcription Factor Binding Sites(TFBS), also known as motifs, which are specific for a given transcription factor. • TFs influence gene expression by binding to a specific TFBS. • A TFBS can be located anywhere within the regulatory region. • TFBS may vary slightly across different regulatory regions since non-essential bases could mutate.
  • 14. Transcription Factors and Motifs: Example geneATCCCG geneTTCCGG geneATCCCG geneATGCCG geneATGCCC
  • 15. Transcription Factors and Motifs: Illustration http://www.cs.uiuc.edu/homes/sinhas/work.html
  • 16. Motif Logos • Motifs can mutate on unimportant bases. • The five motifs in five different genes have mutations in position 3 and 5. • Representations called motif logos illustrate the conserved and variable regions of a motif. • At right is an example of a motif logo. TGGGGGA TGAGAGA TGGGGGA TGAGAGA TGAGGGA
  • 17. Motif Logos: An Additional Example (http://www-lmmb.ncifcrf.gov/~toms/sequencelogo.html)
  • 18. Identifying Motifs • Recall that a TFBS is represented by a motif. • Therefore finding similar motifs in multiple genes’ regulatory regions suggests a regulatory relationship among those genes.
  • 19. Identifying Motifs: Complications • We do not know the motif sequence in advance. • We do not know where the motif is located relative to the genes’ start. • As we have seen, a motif can differ slightly from one gene to the next. • How do we discern a motif with a real pattern from “random” motifs that don’t represent real correlation between genes?
  • 20. Detour: A Motif Finding Analogy • The Motif Finding Problem is similar to the problem posed by Edgar Allan Poe (1809 – 1849) in his short story “The Gold Bug.”
  • 21. The Gold Bug Problem • “Here Legrand, having re-heated the parchment, submitted it to my inspection. The following characters were rudely traced, in a red tint, between the death's head and the goat:” 53++!305))6*;4826)4+.)4+);806*;48!8`60))85;]8*:+*8!83(88)5 *!; 46(;88*96*?;8)*+(;485);5*!2:*+(;4956*2(5*-4)8`8*; 4069285);)6 !8)4++;1(+9;48081;8:8+1;48!85;4)485!528806*81(+9;48;(88;4( +?3 4;48)4+;161;:188;+?; • Legrand’s Goal: Decipher the message on the parchment.
  • 22. Gold Bug Problem: Assumptions • The encrypted message is in English • Each symbol corresponds to one letter in the English alphabet • Conversely, no letter corresponds to more than one symbol • No punctuation marks are encoded
  • 23. Gold Bug Problem: Naïve Approach • Count the frequency of each symbol in the encrypted message • Find the frequency of each letter in the alphabet in the English language • Compare the frequencies of the previous steps, try to find a correlation and map the symbols to a letter in the alphabet
  • 24. Gold Bug Problem: Symbol Frequencies • Gold Bug Message: • English Language: e t a o i n s r h l d c u m f p g w y b v k x j q z Most frequent Least frequent Symbol 8 ; 4 ) + * 5 6 ( ! 1 0 2 9 3 : ? ` - ] . Frequency 34 25 19 16 15 14 12 11 9 8 7 6 5 5 4 4 3 2 1 1 1
  • 25. Gold Bug Problem: Symbol Frequencies • Result of using symbol frequencies: sfiilfcsoorntaeuroaikoaiotecrntaeleyrcooestvenpinelefheeosnlt arhteenmrnwteonihtaesotsnlupnihtamsrnuhsnbaoeyentacrmuesotorl eoaiitdhimtaecedtepeidtaelestaoaeslsueecrnedhimtaetheetahiwfa taeoaitdrdtpdeetiwt • The result does not make sense. • Therefore, we must use some other method to decode the message.
  • 26. Gold Bug Problem: l-tuple count • A better approach is to examine the frequencies of l-tuples, which are subsequences of 2 symbols, 3 symbols, etc. • “The” is the most frequent 3-tuple in English and “;48” is the most frequent 3-tuple in the encrypted text. • We make inferences of unknown symbols by examining other frequent l-tuples.
  • 27. Gold Bug Problem: l-tuple count • Mapping “the” to “;48” and substituting all occurrences of the symbols: 53++!305))6*the26)h+.)h+)te06*the!e`60))e5t]e*:+*e!e3(ee)5*!t h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*h)e`e*th0692e5)t)6!e )h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3ht he)h+t161t:1eet+?t
  • 28. The Gold Bug Message Decoding: Second Attempt • Make inferences: 53++!305))6*the26)h+.)h+)te06*the!e`60))e5t]e*:+*e!e3(ee)5*!t h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*h)e`e*th0692e5)t)6!e )h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3ht he)h+t161t:1eet+?t
  • 29. The Gold Bug Message Decoding: Second Attempt • Make inferences: 53++!305))6*the26)h+.)h+)te06*the!e`60))e5t]e*:+*e!e3(ee)5*!t h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*h)e`e*th0692e5)t)6!e )h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3ht he)h+t161t:1eet+?t • “thet(ee” most likely means “the tree” • Infer “(“ = “r”
  • 30. The Gold Bug Message Decoding: Second Attempt • Make inferences: 53++!305))6*the26)h+.)h+)te06*the!e`60))e5t]e*:+*e!e3(ee)5*!t h6(tee*96*?te)*+(the5)t5*!2:*+(th956*2(5*h)e`e*th0692e5)t)6!e )h++t1(+9the0e1te:e+1the!e5th)he5!52ee06*e1(+9thet(eeth(+?3ht he)h+t161t:1eet+?t • “thet(ee” most likely means “the tree” • Infer “(“ = “r” • “th(+?3h” becomes “thr+?3h” • Can we guess “+” and “?”?
  • 31. Gold Bug Problem: Solution • Using inferences like these to figure out all the mappings, the final message is: AGOODGLASSINTHEBISHOPSHOSTELINTHEDEVILSSEATWENYONEDEGRE ESANDTHIRTEENMINUTESNORTHEASTANDBYNORTHMAINBRANCHSEVENT HLIMBEASTSIDESHOOTFROMTHELEFTEYEOFTHEDEATHSHEADABEELINE FROMTHETREETHROUGHTHESHOTFIFTYFEETOUT
  • 32. Gold Bug Problem: Solution • Using inferences like these to figure out all the mappings, the final message is: AGOODGLASSINTHEBISHOPSHOSTELINTHEDEVILSSEATWENYONEDEGRE ESANDTHIRTEENMINUTESNORTHEASTANDBYNORTHMAINBRANCHSEVENT HLIMBEASTSIDESHOOTFROMTHELEFTEYEOFTHEDEATHSHEADABEELINE FROMTHETREETHROUGHTHESHOTFIFTYFEETOUT • Punctuation is important: A GOOD GLASS IN THE BISHOP’S HOSTEL IN THE DEVIL’S SEA, TWENTY ONE DEGREES AND THIRTEEN MINUTES NORTHEAST AND BY NORTH, MAIN BRANCH SEVENTH LIMB, EAST SIDE, SHOOT FROM THE LEFT EYE OF THE DEATH’S HEAD A BEE LINE FROM THE TREE THROUGH THE SHOT, FIFTY FEET OUT.
  • 33. Gold Bug Problem: Prerequisites • There are two prerequisites that we need to solve the gold bug problem: 1. We need to know the relative frequencies of single letters, as well as the frequencies of 2-tuples and 3-tuples in English. 2. We also need to know all the words in the English language.
  • 34. Gold Bug Problem and Motif Finding: Similarities Motif Finding: • Nucleotides in motifs encode for a message in the “genetic” language. • In order to solve the problem, we analyze the frequencies of patterns in the nucleotide sequences • Knowledge of established regulatory motifs makes the Motif Finding problem simpler. Gold Bug Problem: • Symbols in “The Gold Bug” encode for a message in English. • In order to solve the problem, we analyze the frequencies of patterns in the text written in English • Knowledge of the words in the English language helps
  • 35. Gold Bug Problem and Motif Finding: Similarities Motif Finding: • Nucleotides in motifs encode for a message in the “genetic” language. • In order to solve the problem, we analyze the frequencies of patterns in the nucleotide sequences • Knowledge of established regulatory motifs makes the Motif Finding problem simpler. Gold Bug Problem: • Symbols in “The Gold Bug” encode for a message in English. • In order to solve the problem, we analyze the frequencies of patterns in the text written in English • Knowledge of the words in the English language helps
  • 36. Gold Bug Problem and Motif Finding: Similarities Motif Finding: • Nucleotides in motifs encode for a message in the “genetic” language. • In order to solve the problem, we analyze the frequencies of patterns in the nucleotide sequences • Knowledge of established regulatory motifs makes the Motif Finding problem simpler. Gold Bug Problem: • Symbols in “The Gold Bug” encode for a message in English. • In order to solve the problem, we analyze the frequencies of patterns in the text written in English • Knowledge of the words in the English language helps
  • 37. Gold Bug Problem and Motif Finding: Differences • Motif Finding is more difficult than the Gold Bug problem: 1. We don’t have the complete dictionary of motifs 2. The “genetic” language does not have a standard “grammar” 3. Only a small fraction of nucleotide sequences encode for motifs; the size of the data is enormous
  • 38. The Motif Finding Problem: Informal Statement • Given a random sample of DNA sequences: cctgatagacgctatctggctatccacgtacgtaggtcctctgtgcgaatctatgcgtttccaaccat agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc aaacgtacgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtacgtc • Find the pattern that is implanted in each of the individual sequences, namely, the motif
  • 39. The Motif Finding Problem: Additional Info • The hidden sequence is of length 8. • The pattern is not necessarily the same in each array because random mutations (substitutions) may occur in the sequences, as we have seen.
  • 40. The Motif Finding Problem • The patterns revealed with no mutations: cctgatagacgctatctggctatccacgtacgtaggtcctctgtgcgaatctatgcgtttccaaccat agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc aaacgtacgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtacgtc acgtacgt Consensus String
  • 41. The Motif Finding Problem • The patterns with 2-point mutations: cctgatagacgctatctggctatccaGgtacTtaggtcctctgtgcgaatctatgcgtttccaaccat agtactggtgtacatttgatCcAtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc aaacgtTAgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtCcAtataca ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaCcgtacgGc
  • 42. The Motif Finding Problem • The patterns with 2-point mutations: cctgatagacgctatctggctatccaGgtacTtaggtcctctgtgcgaatctatgcgtttccaaccat agtactggtgtacatttgatCcAtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc aaacgtTAgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtCcAtataca ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaCcgtacgGc • Can we still find the motif now?
  • 43. Defining Motifs • To define a motif, lets say we know where the motif starts in the sequence. • The motif start positions in their sequences can be represented as s = (s1,s2,s3,…,st).
  • 44. Motifs: Profiles and Consensus • Line up the patterns by their start indexes s = (s1, s2, …, st) • Construct profile matrix with frequencies of each nucleotide in columns • Consensus nucleotide in each position has the highest score in column a G g t a c T t C c A t a c g t Alignment a c g t T A g t a c g t C c A t C c g t a c g G _________________ A 3 0 1 0 3 1 1 0 Profile C 2 4 0 0 1 4 0 0 G 0 1 4 0 0 0 3 1 T 0 0 0 5 1 0 1 4 _________________ Consensus A C G T A C G T
  • 45. Consensus String • Think of the consensus string as an “ancestor” motif, from which mutated motifs emerged • The distance between a real motif and the consensus sequence is generally less than the distance between two real motifs
  • 47. Evaluating Motifs • We have a guess about the consensus sequence, but how “good” is this consensus? • We need to introduce a scoring function to compare different consensus strings. • Keep in mind that we really want to choose the starting positions, but since the consensus is obtained from an array of starting positions, we will determine how to compare consensus strings and then work backward to choosing starting positions.
  • 48. Parameters: Definitions • t - number of sample DNA sequences • n - length of each DNA sequence • DNA - sample of DNA sequences (stored as a t x n array) • l - length of the motif (l-mer) • si - starting position of an l-mer in sequence i • s = (s1, s2,… st) - array of motif’s starting positions
  • 50. Scoring Motifs • Given starting positions s = (s1, … st ) and DNA: score(s, DNA) = • Here count(k, i) represents the frequency of nucleotide k in the motif starting at si • At right is an example for a given array of starting positions l t    l i GCTAk ikcount 1 },,,{ ),(max Profile a G g t a c T t C c A t a c g t a c g t T A g t a c g t C c A t C c g t a c g G _________________ A 3 0 1 0 3 1 1 0 C 2 4 0 0 1 4 0 0 G 0 1 4 0 0 0 3 1 T 0 0 0 5 1 0 1 4 _________________ Consensus a c g t a c g t Score 3+4+4+5+3+4+3+4=30
  • 51. Finding the Best Profile Matrix • If starting positions s = (s1, s2,… st ) are given, finding the consensus is easy even with mutations in the sequences because we can simply construct the profile matrix in order to find the consensus string. • But…the starting positions s are usually not given. How can we find the “best” profile matrix?
  • 52. The Motif Finding Problem: Formal Statement • Goal: Given a set of DNA sequences, find a set of tl-mers, one from each sequence, that maximizes the consensus score • Input: A t x n matrix of DNA, and l, the length of the pattern to find • Output: An array of t starting positions s = (s1, s2, … st ) maximizing score(s, DNA)
  • 53. The Motif Finding Problem: Brute Force Method • Compute the scores for each possible combination of starting positions s. • The best score will determine the best profile and the consensus pattern in DNA. • The goal is to maximize Score(s, DNA) by varying the starting positions si, where: si = [1, …, n-l+1] i = [1, …, t]
  • 54. BruteForceMotifSearch: Pseudocode 1. BruteForceMotifSearch(DNA, t, n, l ) 2. bestScore  0 3. for each s=(s1,s2 , . . ., st ) from (1,1 . . . 1) to (n-l+1, . . ., n-l+1) 4. if score (s, DNA) >bestScore 5. bestScore  score (s, DNA) 6. bestMotif  (s1,s2 , . . . , st) 7. return bestMotif
  • 55. BruteForceMotifSearch: Running Time • Varying (n – l + 1) positions in each of t sequences, we’re looking at (n – l + 1)t sets of starting positions • For each set of starting positions, the scoring function makes l operations, so the algorithm’s complexity is l (n – l + 1)t = O(l nt) • That means that for t = 8, n = 1000,l = 10 we must perform approximately 1020 computations – the algorithm will take billions of years to complete on such a problem instance
  • 56. BruteForceMotifSearch: Running Time • Varying (n – l + 1) positions in each of t sequences, we’re looking at (n – l + 1)t sets of starting positions • For each set of starting positions, the scoring function makes l operations, so the algorithm’s complexity is l (n – l + 1)t = O (l nt ) • That means that for t = 8, n = 1000,l = 10 we must perform approximately 1020 computations – the algorithm will take billions of years to complete on such a problem instance • Conclusion: We need to view the problem in a new light
  • 57. Changing Gears: The Median String Problem • Given a set of t DNA sequences, find a pattern that appears in all t sequences with the minimum number of mutations. • This pattern will be the motif. • Key Difference: Rather than varying the starting positions and trying to find a consensus string representing a motif, we will instead vary all possible motifs directly.
  • 58. Hamming Distance • Given two nucleotide strings v and w, dH(v,w) is the number of nucleotide pairs that do not match when v and w are aligned. • For example: dH(AAAAAA, ACAAAC) = 2
  • 59. Total Distance: Definition • For each DNA sequence i, compute all dH(v, x), where x is an l-mer with starting position si (1 < si < n – l + 1) • Find minimum of dH(v, x) among all l-mers in sequence i • TotalDistance(v, DNA) is the sum of the minimum Hamming distances for each DNA sequencei • TotalDistance(v, DNA) = minsdH(v, s), where s is the set of starting positions s1, s2,… st
  • 60. Total Distance: Example • Given v = “acgtacgt” and s the starting points below: acgtacgt cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat acgtacgt agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc acgtacgt aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt acgtacgt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca acgtacgt ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc v is the sequence in red, x is the sequence in blue
  • 61. Total Distance: Example • Given v = “acgtacgt” and s the starting points below: acgtacgt cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat acgtacgt agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc acgtacgt aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt acgtacgt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca acgtacgt ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc v is the sequence in red, x is the sequence in blue dH(v, x) = 1
  • 62. Total Distance: Example • Given v = “acgtacgt” and s the starting points below: acgtacgt cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat acgtacgt agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc acgtacgt aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt acgtacgt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca acgtacgt ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc v is the sequence in red, x is the sequence in blue dH(v, x) = 1 dH(v, x) = 0
  • 63. Total Distance: Example • Given v = “acgtacgt” and s the starting points below: acgtacgt cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat acgtacgt agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc acgtacgt aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt acgtacgt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca acgtacgt ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc v is the sequence in red, x is the sequence in blue dH(v, x) = 2 dH(v, x) = 1 dH(v, x) = 0
  • 64. Total Distance: Example • Given v = “acgtacgt” and s the starting points below: acgtacgt cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat acgtacgt agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc acgtacgt aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt acgtacgt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca acgtacgt ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc v is the sequence in red, x is the sequence in blue dH(v, x) = 2 dH(v, x) = 1 dH(v, x) = 0 dH(v, x) = 0
  • 65. Total Distance: Example • Given v = “acgtacgt” and s the starting points below: acgtacgt cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat acgtacgt agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc acgtacgt aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt acgtacgt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca acgtacgt ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc v is the sequence in red, x is the sequence in blue dH(v, x) = 2 dH(v, x) = 1 dH(v, x) = 0 dH(v, x) = 0 dH(v, x) = 1
  • 66. Total Distance: Example • Given v = “acgtacgt” and s the starting points below: acgtacgt cctgatagacgctatctggctatccacgtacAtaggtcctctgtgcgaatctatgcgtttccaaccat acgtacgt agtactggtgtacatttgatacgtacgtacaccggcaacctgaaacaaacgctcagaaccagaagtgc acgtacgt aaaAgtCcgtgcaccctctttcttcgtggctctggccaacgagggctgatgtataagacgaaaatttt acgtacgt agcctccgatgtaagtcatagctgtaactattacctgccacccctattacatcttacgtacgtataca acgtacgt ctgttatacaacgcgtcatggcggggtatgcgttttggtcgtcgtacgctcgatcgttaacgtaGgtc v is the sequence in red, x is the sequence in blue • TotalDistance(v, DNA) = 1+0+2+0+1 = 4 dH(v, x) = 2 dH(v, x) = 1 dH(v, x) = 0 dH(v, x) = 0 dH(v, x) = 1
  • 67. The Median String Problem: Formulation • Goal: Given a set of DNA sequences, find a median string. • Input: A t x n matrix DNA, and l, the length of the pattern to find. • Output: A (median) string v of l nucleotides that minimizes TotalDistance(v, DNA) over all strings of that length.
  • 68. The Median String Problem: Formulation • Goal: Given a set of DNA sequences, find a median string. • Input: A t x n matrix DNA, and l, the length of the pattern to find. • Output: A (median) string v of l nucleotides that minimizes TotalDistance(v, DNA) over all strings of that length. • Note: This implies the natural brute force algorithm of calculating TotalDistance(v, DNA) for all strings v (next slide)
  • 69. MedianStringSearch: Pseudocode 1. MedianStringSearch (DNA, t, n, l ) 2. bestWord  AAA…A 3. bestDistance  ∞ 4. for each l-mer v from AAA…A to TTT…T 5. if TotalDistance (v, DNA) < bestDistance 6. bestDistance  TotalDistance (v, DNA) 7. bestWord  v 8. return bestWord
  • 70. Motif Finding Problem = Median String Problem • The Motif Finding is a maximization problem while Median String is a minimization problem. • However, the Motif Finding problem and Median String problem are computationally equivalent. • We need to show that minimizing TotalDistance is equivalent to maximizing Score.
  • 71. Motif Finding Problem == Median String Problem • At any column i Scorei + TotalDistancei = t • Because there are l columns Score + TotalDistance = l * t • Rearranging: Score = l * t - TotalDistance • l * t is constant, so the minimization of the right side is equivalent to the maximization of the left side l t a G g t a c T t C c A t a c g t Alignment a c g t T A g t a c g t C c A t C c g t a c g G _________________ A 3 0 1 0 3 1 1 0 Profile C 2 4 0 0 1 4 0 0 G 0 1 4 0 0 0 3 1 T 0 0 0 5 1 0 1 4 _________________ Consensus a c g t a c g t Score 3+4+4+5+3+4+3+4 TotalDistance 2+1+1+0+2+1+2+1 Sum 5 5 5 5 5 5 5 5
  • 72. Motif Finding Problem vs. Median String Problem • Why bother reformulating the Motif Finding problem into the Median String problem? • The Motif Finding Problem needs to examine all possible choices for s. Recall that this is (n — l + 1)t possibilities!!! • The Median String Problem needs to examine all 4l combinations for v. This number is typically smaller, although if l is large using brute force will still be infeasible.
  • 73. Median String: Improving the Running Time 1. MedianStringSearch (DNA, t, n, l ) 2. bestWord  AAA…A 3. bestDistance  ∞ 4. for each l-mer v from AAA…A to TTT…T 5. if TotalDistance (v, DNA) < bestDistance 6. bestDistance  TotalDistance (v, DNA) 7. bestWord  v 8. return bestWord
  • 74. Structuring the Search • For the Median String Problem we need to consider all 4l possible l-mers: aa… aa aa… ac aa… ag aa… at . . tt… tt How to organize this search? l
  • 75. Alternative Representation of the Search Space • Let A = 1, C = 2, G = 3, T = 4 • Then the sequences from AA…A to TT…T become: 11…11 11…12 11…13 11…14 . . 44…44 • Notice that the sequences above simply list all numbers as if we were counting on base 4 without using 0 as a digit. l
  • 76. First Try: Linked List • Suppose l = 2 aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt • We need to visit all the predecessors of a sequence before visiting the sequence itself. • Unfortunately this isn’t very efficient. Start
  • 77. Better Structure: Search Tree • Instead, let’s try grouping the sequences by their prefixes. aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt
  • 78. Better Structure: Search Tree • Instead, let’s try grouping the sequences by their prefixes aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt a- c- g- t-
  • 79. Better Structure: Search Tree • Instead, let’s try grouping the sequences by their prefixes aa ac ag at ca cc cg ct ga gc gg gt ta tc tg tt a- c- g- t- -- root
  • 80. Analyzing Search Trees • Characteristics of search trees: • The sequences are contained in its leaves • The parent of a node is the prefix of its children • How can we move through the tree?
  • 81. Moving through the Search Trees • Four common moves in a search tree that we are about to explore: 1. Move to the next leaf 2. Visit all the leaves 3. Visit the next node 4. Bypass the children of a node
  • 82. Move 1: Visit the Next Leaf 1. NextLeaf( a, L, k ) // a : the array of digits 2. for i L to 1 // L: length of the array 3. if ai <k // k : max digit value 4. ai ai + 1 5. return a 6. ai  1 7. return a • Given a current leaf a , we need to compute the “next” leaf: Note: In the case of the nucleotide alphabet, we are using k = 4
  • 83. Move 1: Visit the Next Leaf • The algorithm is common addition base-k: 1. Increment the least significant digit 2. “Carry the one” to the next digit position when the digit is at maximal value
  • 84. NextLeaf: Example • Moving to the next leaf: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Current Location
  • 85. NextLeaf: Example • Moving to the next leaf: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Next Location
  • 86. NextLeaf: Example • Moving to the next leaf: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Next Location
  • 87. NextLeaf: Example • Moving to the next leaf: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Next Location
  • 88. NextLeaf: Example • Moving to the next leaf: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Next Location
  • 89. NextLeaf: Example • Moving to the next leaf: • Etc. 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Next Location
  • 90. Move 2: Visit All Leaves • Printing all l-mers in ascending order: 1. AllLeaves(L, k) // L: length of the sequence 2. a  (1,...,1) // k : max digit value 3. while forever // a: array of digits 4. output a 5. a  NextLeaf(a, L, k) 6. if a = (1,...,1) 7. return
  • 91. Visit All Leaves: Example • Moving through all the leaves in order: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -- Order of steps
  • 92. Depth First Search • So we can search through the leaves. • How about searching through all vertices of the tree? • We will do this with a depth firstsearch. • Specifically we need an algorithm to visit the next vertex.
  • 93. Move 3: Visit the Next Vertex 1. NextVertex(a, i, L, k ) // a: the array of digits 2. if i < L // i : prefix length 3. ai+1 1 // L: max length 4. return (a, i +1 ) // k: max digit value 5. else 6. for j  l to 1 7. if aj < k 8. aj  aj +1 9. return (a, j ) 10. return (a,0)
  • 94. Next Vertex: Example • Moving to the next vertex: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Current Location
  • 95. Next Vertex: Example • Moving to the next vertex: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 --
  • 96. Next Vertex: Example • Moving to the next vertex: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 --
  • 97. Next Vertex: Example • Moving to the next vertex: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 --
  • 98. Next Vertex: Example • Moving to the next vertex: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 --
  • 99. Next Vertex: Example • Moving to the next vertex: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Location after 5 next vertex moves
  • 100. Move 4: Bypass • Given a prefix (internal vertex), find the next vertex after skipping all the prefix’s children. 1. ByPass(a, i, L, k) // a: array of digits 2. for j  i to 1 // i : prefix length 3. if aj < k // L: maximum length 4. aj aj +1 // k : max digit value 5. return (a, j ) 6. return (a, 0)
  • 101. Bypass: Example • Bypassing the descendants of “2-”: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Current Location
  • 102. Bypass: Example • Bypassing the descendants of “2-”: 1- 2- 3- 4- 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 -- Next Location
  • 103. Revisiting Brute Force Search • Now that we have method for navigating the tree, lets look again at BruteForceMotifSearch.
  • 104. Brute Force Search Revisited 1. BruteForceMotifSearchAgain(DNA, t, n, l) 2. s  (1,1,…, 1) 3. bestScore  score (s, DNA) 4. while forever 5. s  NextLeaf (s, t, n — l +1 ) 6. if score (s,DNA) >bestScore 7. bestScore  score (s, DNA) 8. bestMotif  (s1,s2 , . . . , st) 9. return bestMotif
  • 105. Can We Streamline the Algorithm? • Sets of s = (s1, s2, …, st) may have a weak profile for the first i positions (s1, s2, …, si) • Every row of the alignment matrix may add at most l to score • Optimistic View: all subsequent (t-i) positions (si+1, …st) add (t – i ) * l to score(s, i, DNA) • So if score(s, i, DNA) + (t – i ) * l < bestScore, it makes no sense to search through vertices of the current subtree • In this case, we can use ByPass() to skip frivolous branches. • This leads to what is called in general a “branch and bound” method for motif finding.
  • 106. Branch and Bound Algorithm for Motif Search • Since each level of the tree goes deeper into search, discarding a prefix discards all following branches. • This saves us from looking at (n – l + 1)t-i leaves. • We use NextVertex() and ByPass() to navigate the tree.
  • 107. Branch and Bound Motif Search: Pseudocode 1. BranchAndBoundMotifSearch(DNA, t, n,l ) 2. s  (1,…,1) 3. bestScore  0 4. i  1 5. while i > 0 6. if i <t 7. optimisticScore  score(s, i, DNA) + (t – i ) * l 8. if optimisticScore < bestScore 9. (s, i) ByPass(s, i, n – l +1) 10. else 11. (s, i) NextVertex(s, i, n – l +1) 12. else 13. if score(s, DNA) > bestScore 14. bestScore  score(s) 15. bestMotif  (s1, s2, s3, …, st ) 16. (s, i)  NextVertex(s, i, t, n – l + 1) 17. return bestMotif
  • 108. Median String Search Improvements • Recall the computational differences between motif search and median string search. • The Motif Finding Problem needs to examine all (n – l +1)t combinations for s. • The Median String Problem needs to examine 4l combinations of v. This number is usually relatively small. • We want to use the median string algorithm with the Branch and Bound trick!
  • 109. Median String Search with Branch and Bound • Note that if the total distance for a prefix is greater than that for the best word so far: TotalDistance (prefix, DNA) >BestDistance then there is no use exploring the remaining part of the word. • We can eliminate that branch and BYPASS exploring that branch further.
  • 110. Median String Search with Branch and Bound 1. BranchAndBoundMedianStringSearch(DNA, t, n, l ) 2. s  (1,…,1) 3. bestDistance  ∞ 4. i  1 5. while i > 0 6. if i < l 7. prefix  string corresponding to the first i nucleotides of s 8. optimisticDistance  TotalDistance(prefix, DNA) 9. if optimisticDistance > bestDistance 10. (s, i ) ByPass(s, i, l, 4) 11. else 12. (s, i )NextVertex(s, i, l, 4) 13. else 14. word  nucleotide string corresponding to s 15. if TotalDistance(s, DNA ) < bestDistance 16. bestDistance  TotalDistance(word, DNA) 17. bestWord  word 18. (s, i )  NextVertex(s, i, l, 4) 19. return bestWord
  • 111. Improving the Bounds • Given an l-mer w, divided into two parts at point i: • u : prefix w1, …, wi, • v : suffix wi+1, ..., wl • Find minimum distance for u in a sequence. • No instances of u in the sequence have distance less than the minimum distance. • Note: this doesn’t tell us anything about whether u is part of any motif. We only get a minimum distance for prefix u.
  • 112. Improving the Bounds • Repeating the process for the suffix v gives us a minimum distance for v. • Since u and v are two substrings of w, and included in motif w, we can assume that the minimum distance of u plus minimum distance of v can only be less than the minimum distance for w.
  • 114. Improving the Bounds • If d(prefix) + d(suffix) > bestDistance: • Motif w (prefix.suffix) cannot give a better (lower) score than d(prefix) + d(suffix) • In this case, we can ByPass()
  • 115. Better Bounded Median String Search 1. ImprovedBranchAndBoundMedianString(DNA, t, n, l ) 2. s= (1, 1, …, 1) 3. bestDistance = ∞ 4. i = 1 5. while i > 0 6. if i < l 7. prefix = nucleotide string corresponding to (s1, s2, s3, …, si ) 8. optimisticPrefixDistance = TotalDistance (prefix, DNA ) 9. if optimisticPrefixDistance <bestSubstring [i ] 10. bestSubstring[i ] = optimisticPrefixDistance 11. if (l – i <i ) 12. optimisticSuffixDistance = bestsubstring [l -i ] 13. else 14. optimisticSuffixDistance = 0; 15. if optimisticPrefixDistance + optimisticSuffixDistance > bestDistance 16. (s, i ) = ByPass(s, i, l, 4) 17. else 18. (s, i ) = NextVertex(s, i, l, 4) 19. else 20. word = nucleotide string corresponding to (s1,s2, s3, …, st) 21. if TotalDistance(word, DNA ) < bestDistance 22. bestDistance = TotalDistance(word, DNA) 23. bestWord = word 24. (s,i ) = NextVertex(s, i, l, 4) 25. return bestWord
  • 116. Notes on Motif Finding • Exhaustive Search and Median String are both exact algorithms. • They always find the optimal solution, though they may be too slow to perform practical tasks. • Many algorithms sacrifice optimal solution for speed.
  • 117. CONSENSUS: Greedy Motif Search • Finds two closest l -mers in sequences 1 and 2 and forms 2 x l alignment matrix with score(s, 2, DNA). • At each of the following t-2 iterations CONSENSUS finds a “best” l -mer in sequence i from the perspective of the already constructed (i-1) x l alignment matrix for the first (i-1) sequences. • In other words, it finds an l - mer in sequence i maximizing score(s, i, DNA) under the assumption that the first (i-1) l -mers have been already chosen. • CONSENSUS sacrifices optimal solution for speed: in fact the bulk of the time is actually spent locating the first 2 l -mers.
  • 118. Some Motif Finding Programs • CONSENSUS Hertz, Stromo (1989) • GibbsDNA Lawrence et al (1993) • MEME Bailey, Elkan (1995) • RandomProjections Buhler, Tompa (2002) • MULTIPROFILER Keich, Pevzner (2002) • MITRA Eskin, Pevzner (2002) • Pattern Branching Price et al., lo (2003)