Module DNA Pattern Finding Algorithms - Google Slides
Module DNA Pattern Finding Algorithms - Google Slides
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
The “Copying Mechanism” The “Copying Mechanism”
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Meselson and Stahl’s insight: one isotope of nitrogen, Meselson and Stahl’s insight: one isotope of nitrogen,
Nitrogen-14 (14N), is lighter and more abundant than Nitrogen-14 (14N), is lighter and more abundant than
Nitrogen-15 (15N). Nitrogen-15 (15N).
Meselson and Stahl grew E. coli for many rounds of Meselson and Stahl grew E. coli for many rounds of
replication in a 15N medium, which caused the bacteria to gain replication in a 15N medium, which caused the bacteria to gain
weight as they absorbed the heavier isotope into their DNA. weight as they absorbed the heavier isotope into their DNA.
They then transferred the heavy E. coli cells to a less dense They then transferred the heavy E. coli cells to a less dense
14 14
N medium. N medium.
The Most Beautiful Experiment in Biology The Most Beautiful Experiment in Biology
(1958) (1958)
STOP: After one round of replication, Meselson and Stahl STOP: After one round of replication, Meselson and Stahl
spun the DNA in a centrifuge. Why? spun the DNA in a centrifuge. Why?
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
The Most Beautiful Experiment in Biology The Most Beautiful Experiment in Biology
(1958) (1958)
STOP: What would we observe in the centrifuge for the Key Point: After two rounds, the DNA divided into two
other two models after two rounds of replication? different densities!
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
...ACTGATAACCCAGTATCAGACCAGTATCGAGGACGATACGTA...
DNA String
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
...ACTGATAACCCAGTATCAGACCAGTATCGAGGACGATACGTA... ...ACTGATAACCCAGTATCAGACCAGTATCGAGGACGATACGTA...
DNA String DNA String
Copy 1
...ACTGATAACCCAGTATCAGACCAGTATCGAGGACGATACGTA...
...ACTGATAACCCAGTATCAGACCAGTATCGAGGACGATACGTA...
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Copy 2
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Origin of Replication The Finding ori Problem
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Let’s hack out this DNA Let’s hack out this DNA
fragment. Can the fragment. Can the
genome replicate without genome replicate without
it? it?
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Looking for ori Looking for ori
Verified ori of Vibrio cholerae, the bacterium that Verified ori of Vibrio cholerae, the bacterium that
causes cholera (~500 nucleotides): causes cholera (~500 nucleotides):
atcaatgatcaacgtaagcttctaagcatgatcaaggtgctcacacagtttatccacaac atcaatgatcaacgtaagcttctaagcatgatcaaggtgctcacacagtttatccacaac
ctgagtggatgacatcaagataggtcgttgtatctccttcctctcgtactctcatgacca ctgagtggatgacatcaagataggtcgttgtatctccttcctctcgtactctcatgacca
cggaaagatgatcaagagaggatgatttcttggccatatcgcaatgaatacttgtgactt cggaaagatgatcaagagaggatgatttcttggccatatcgcaatgaatacttgtgactt
gtgcttccaattgacatcttcagcgccatattgcgctggccaaggtgacggagcgggatt gtgcttccaattgacatcttcagcgccatattgcgctggccaaggtgacggagcgggatt
acgaaagcatgatcatggctgttgttctgtttatcttgttttgactgagacttgttagga acgaaagcatgatcatggctgttgttctgtttatcttgttttgactgagacttgttagga
tagacggtttttcatcactgactagccaaagccttactctgcctgacatcgaccgtaaat tagacggtttttcatcactgactagccaaagccttactctgcctgacatcgaccgtaaat
tgataatgaatttacatgcttccgcgacgatttacctcttgatcatcgatccgattgaag tgataatgaatttacatgcttccgcgacgatttacctcttgatcatcgatccgattgaag
atcttcaattgttaattctcttgcctcgactcatagccatgatgagctcttgatcatgtt atcttcaattgttaattctcttgcctcgactcatagccatgatgagctcttgatcatgtt
tccttaaccctctattttttacggaagaatgatcaagctgctgctcttgatcatcgtttc tccttaaccctctattttttacggaagaatgatcaagctgctgctcttgatcatcgtttc
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
We Have Two Scientific Problems Outline
1. Given a bacterial genome (~3 Mbp), where is ori? • An Intro to DNA Replication
• Hidden Messages in the Replication Origin
• Hunting for Frequent Words
• A Faster Frequent Words Approach
• Some Hidden Messages are More Surprising than
Others
• An Explosion of Hidden Messages
• Replication Asymmetry Leads Us to the Replication
2. Given ori (~500 bp), what is the “hidden message” Origin
saying that replication should start here?
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Hidden Message Problem Revisited Hidden Message Problem Revisited
Replication initiation is mediated by a protein called Replication initiation is mediated by a protein called
DnaA . DnaA .
DnaA binds to a short segment in ori known as a DnaA DnaA binds to a short segment in ori known as a DnaA
box, a hidden message saying: “bind here!” box, a hidden message saying: “bind here!”
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
STOP: Would it make sense for an organism to have Answer: Multiple DnaA boxes 🡪 higher chance of
multiple DnaA boxes, or just one? binding 🡪 higher “fitness”
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Hidden Message Problem Revisited Outline
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
atcaatgatcaacgtaagcttctaagcatgatcaaggtgctcacacagtttatccacaac atcaatgatcaacgtaagcttctaagcatgatcaaggtgctcacacagtttatccacaac
ctgagtggatgacatcaagataggtcgttgtatctccttcctctcgtactctcatgacca ctgagtggatgacatcaagataggtcgttgtatctccttcctctcgtactctcatgacca
cggaaagatgatcaagagaggatgatttcttggccatatcgcaatgaatacttgtgactt cggaaagatgatcaagagaggatgatttcttggccatatcgcaatgaatacttgtgactt
gtgcttccaattgacatcttcagcgccatattgcgctggccaaggtgacggagcgggatt gtgcttccaattgacatcttcagcgccatattgcgctggccaaggtgacggagcgggatt
acgaaagcatgatcatggctgttgttctgtttatcttgttttgactgagacttgttagga acgaaagcatgatcatggctgttgttctgtttatcttgttttgactgagacttgttagga
tagacggtttttcatcactgactagccaaagccttactctgcctgacatcgaccgtaaat tagacggtttttcatcactgactagccaaagccttactctgcctgacatcgaccgtaaat
tgataatgaatttacatgcttccgcgacgatttacctcttgatcatcgatccgattgaag tgataatgaatttacatgcttccgcgacgatttacctcttgatcatcgatccgattgaag
atcttcaattgttaattctcttgcctcgactcatagccatgatgagctcttgatcatgtt atcttcaattgttaattctcttgcctcgactcatagccatgatgagctcttgatcatgtt
tccttaaccctctattttttacggaagaatgatcaagctgctgctcttgatcatcgtttc tccttaaccctctattttttacggaagaatgatcaagctgctgctcttgatcatcgtttc
We are looking for surprisingly frequent substrings We are looking for surprisingly frequent substrings
(contiguous strings appearing within) this ori. (contiguous strings appearing within) this ori.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Key Point: We think of a string as just an array of Key Point: We think of a string as just an array of
symbols. (So it should be 0-indexed.) symbols. (So it should be 0-indexed.)
text[7, 10]
Key Point: We think of a string as just an array of Key Point: We think of a string as just an array of
symbols. (So it should be 0-indexed.) symbols. (So it should be 0-indexed.)
STOP: How would we refer to this substring? STOP: How would we refer to this substring?
Answer: text[0, 3]
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Substring Indexing Substring Indexing
Key Point: We think of a string as just an array of Key Point: We think of a string as just an array of
symbols. (So it should be 0-indexed.) symbols. (So it should be 0-indexed.)
STOP: What about this substring? STOP: What about this substring?
Answer: text[3, 6]
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Key Point: We think of a string as just an array of Key Point: We think of a string as just an array of
symbols. (So it should be 0-indexed.) symbols. (So it should be 0-indexed.)
Key Point: We think of a string as just an array of Key Point: We think of a string as just an array of
symbols. (So it should be 0-indexed.) symbols. (So it should be 0-indexed.)
STOP: How would we refer to the substring of text of STOP: How would we refer to the substring of text of
length k starting at position i? length k starting at position i?
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Our Idea for Counting Patterns Our Idea for Counting Patterns
Exercise: Try
writing
pseudocode to
count pattern
occurrences.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
A k-mer pattern is a most frequent k -mer in a string if A k-mer pattern is a most frequent k -mer in a string if
no other k-mer is more frequent than pattern. no other k-mer is more frequent than pattern.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Solving the Frequent Words Problem Solving the Frequent Words Problem
Example: If text = ACGTTTCACGTTTTACGG and k = 3, Exercise: How might we solve this problem with an
then the most frequent words are ACG and TTT (both array? What subroutines would you find useful?
occur three times).
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
One Frequent Words Solution One Frequent Words Solution
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count 3 count 3 2
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count 3 2 2 count 3 2 2 3
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
One Frequent Words Solution One Frequent Words Solution
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count 3 2 2 3 1 count 3 2 2 3 1 1
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count 3 2 2 3 1 1 1 count 3 2 2 3 1 1 1 3
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
One Frequent Words Solution One Frequent Words Solution
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count 3 2 2 3 1 1 1 3 2 count 3 2 2 3 1 1 1 3 2 2
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count 3 2 2 3 1 1 1 3 2 2 3 count 3 2 2 3 1 1 1 3 2 2 3 3
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
One Frequent Words Solution One Frequent Words Solution
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count 3 2 2 3 1 1 1 3 2 2 3 3 1 count 3 2 2 3 1 1 1 3 2 2 3 3 1 1
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
1. Create an array count of length len(text) - k + 1. 1. Create an array count of length len(text) - k + 1.
2. For each i, set count[i] equal to the number of times 2. For each i, set count[i] equal to the number of times
text[i, i+k] appears in text. text[i, i+k] appears in text.
3. Take k-mers having the maximum values of count[i]. 3. Take k-mers having the maximum values of count[i].
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
count 3 2 2 3 1 1 1 3 2 2 3 3 1 1 3 1 count 3 2 2 3 1 1 1 3 2 2 3 3 1 1 3 1
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Solving the Frequent Words Problem Solving the Frequent Words Problem
FrequentWords(text, k) FrequentWords(text, k)
freqPatterns 🡪 an array of strings of length 0 freqPatterns 🡪 an array of strings of length 0
n 🡪 Len(text) n 🡪 Len(text)
count 🡪 array of integers of length n - k + 1 count 🡪 array of integers of length n - k + 1
for every integer i between 0 and n – k for every integer i between 0 and n – k
pattern 🡪 text[i, i+k] pattern 🡪 text[i, i+k]
count[i] 🡪 PatternCount(pattern, text) count[i] 🡪 PatternCount(pattern, text)
max 🡪 MaxArray(count) max 🡪 MaxArray(count)
for every integer i between 0 and n - k for every integer i between 0 and n - k
if count[i] = max if count[i] = max
pattern 🡪 text[i, i+k] pattern 🡪 text[i, i+k]
freqPatterns 🡪 Append(freqPatterns, pattern) freqPatterns 🡪 freqPatterns 🡪 Append(freqPatterns, pattern) freqPatterns 🡪
RemoveDuplicates(freqPatterns) RemoveDuplicates(freqPatterns)
return freqPatterns return freqPatterns
PatternCount: our pattern counting function from before STOP: This algorithm is inefficient; why? How could we
MaxArray: take maximum value in an array a make it better?
RemoveDuplicates: remove duplicates from list patterns
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and
Pevzner. Pevzner.
What if the Indices Aren’t Integers? What if the Indices Aren’t Integers?
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and
Pevzner. Pevzner.
Note that not every 2-mer is a key... Rewriting Frequent Words Pseudocode
BetterFrequentWords(text, k)
Pattern count freqPatterns 🡪 an empty array
Map/Dictionary: An freqMap 🡪 empty map
association of keys “AA” 17 n 🡪 Len(text)
for every integer i between 0 and n - k
with values . “AC” 4
pattern 🡪 text[i, i+k]
“CG” 15 if freqMap[pattern] doesn’t exist
freqMap[pattern] = 1
We use a variable “GA” 23 else
(say, freq) to refer to “GG” 3 freqMap[pattern] 🡪 freqMap[pattern] + 1
maxCount 🡪 MaxMap(freqMap)
the map. “GT” 30 for all strings pattern in freqMap
if freqMap[pattern] = maxCount
“TA” 18
freqPatterns 🡪 Append(freqPatterns, pattern)
Value access is like “TG” 2 return freqPatterns
arrays: freq[“GT”] “TT” 24
Note: We don’t need RemoveDuplicates() or Count() !
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and
And this is much faster!
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and
Pevzner. Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
atcaatgatcaacgtaagcttctaagcATGATCAAGgtgctcacacagtttatccacaacctgagtgga atcaatgatcaacgtaagcttctaagcATGATCAAGgtgctcacacagtttatccacaacctgagtgga
tgacatcaagataggtcgttgtatctccttcctctcgtactctcatgaccacggaaagATGATCAAGag tgacatcaagataggtcgttgtatctccttcctctcgtactctcatgaccacggaaagATGATCAAGag
aggatgatttcttggccatatcgcaatgaatacttgtgacttgtgcttccaattgacatcttcagcgcc aggatgatttcttggccatatcgcaatgaatacttgtgacttgtgcttccaattgacatcttcagcgcc
atattgcgctggccaaggtgacggagcgggattacgaaagcatgatcatggctgttgttctgtttatct atattgcgctggccaaggtgacggagcgggattacgaaagcatgatcatggctgttgttctgtttatct
tgttttgactgagacttgttaggatagacggtttttcatcactgactagccaaagccttactctgcctg tgttttgactgagacttgttaggatagacggtttttcatcactgactagccaaagccttactctgcctg
acatcgaccgtaaattgataatgaatttacatgcttccgcgacgatttacCTCTTGATCATcgatccga acatcgaccgtaaattgataatgaatttacatgcttccgcgacgatttacCTCTTGATCATcgatccga
ttgaagatcttcaattgttaattctcttgcctcgactcatagccatgatgagCTCTTGATCATgtttcc ttgaagatcttcaattgttaattctcttgcctcgactcatagccatgatgagCTCTTGATCATgtttcc
ttaaccctctattttttacggaagaATGATCAAGctgctgCTCTTGATCATcgtttc ttaaccctctattttttacggaagaATGATCAAGctgctgCTCTTGATCATcgtttc
Most frequent 9-mers in this ori (all appear 3 times): Most frequent 9-mers in this ori (all appear 3 times):
ATGATCAAG, CTTGATCAT, TCTTGGATCA, ATGATCAAG, CTTGATCAT, TCTTGGATCA,
CTCTTGATC CTCTTGATC
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Reverse Complement Problem Or in One Line …
STOP: Try to write the shortest possible pseudocode STOP: Try to write the shortest possible pseudocode
function solving this problem. function solving this problem.
ReverseComplement(text) ReverseComplement(text)
x 🡪 Reverse(text) return Reverse(Complement(text))
y 🡪 Complement(x)
return y
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Hidden Messages in T. petrophila? Hidden Messages in T. petrophila?
aactctatacctcctttttgtcgaatttgtgtgatttatagagaaaatcttattaactgaaactaaa aactctatacctcctttttgtcgaatttgtgtgatttatagagaaaatcttattaactgaaactaaa
atggtaggtttggtggtaggttttgtgtacattttgtagtatctgatttttaattacataccgtata atggtaggtttggtggtaggttttgtgtacattttgtagtatctgatttttaattacataccgtata
ttgtattaaattgacgaacaattgcatggaattgaatatatgcaaaacaaacctaccaccaaactct ttgtattaaattgacgaacaattgcatggaattgaatatatgcaaaacaaacctaccaccaaactct
gtattgaccattttaggacaacttcagggtggtaggtttctgaagctctcatcaatagactatttta gtattgaccattttaggacaacttcagggtggtaggtttctgaagctctcatcaatagactatttta
gtctttacaaacaatattaccgttcagattcaagattctacaacgctgttttaatgggcgttgcaga gtctttacaaacaatattaccgttcagattcaagattctacaacgctgttttaatgggcgttgcaga
aaacttaccacctaaaatccagtatccaagccgatttcagagaaacctaccacttacctaccactta aaacttaccacctaaaatccagtatccaagccgatttcagagaaacctaccacttacctaccactta
cctaccacccgggtggtaagttgcagacattattaaaaacctcatcagaagcttgttcaaaaatttc cctaccacccgggtggtaagttgcagacattattaaaaacctcatcagaagcttgttcaaaaatttc
aatactcgaaacctaccacctgcgtcccctattatttactactactaataatagcagtataattgat aatactcgaaacctaccacctgcgtcccctattatttactactactaataatagcagtataattgat
ctgaaaagaggtggtaaaaaa ctgaaaagaggtggtaaaaaa
Not one occurrence of ATGATCAAG or CTTGATCAT! Different genomes 🡪 different hidden messages
Applying Frequent Words Problem to this ori: Applying Frequent Words Problem to this ori:
AACCTACCA, ACCTACCAC, GGTAGGTTT AACCTACCA, ACCTACCAC, GGTAGGTTT
TGGTAGGTT, AAACCTACC, CCTACCACC TGGTAGGTT, AAACCTACC, CCTACCACC
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Returning to “Problem 1” Bacteria with Unknown ori
We have found hidden messages if ori is given. But we STOP: Now that we know that “hidden messages” may
still don’t know how to find ori in a (long) genome. differ, how could we look for ori in a newly sequenced
bacterial genome?
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
OLD strategy: given a previously known ori (500 nucleotide OLD strategy: given a previously known ori (500 nucleotide
window), find frequent words (clumps) in ori as candidate DnaA window), find frequent words (clumps) in ori as candidate DnaA
boxes. boxes.
replication origin → frequent words replication origin → frequent words
Defining and Hunting for “Clumps” Defining and Hunting for “Clumps”
A k-mer forms an (L, t )-clump inside Genome if there is FindClumps(text, k, L, t,H)
patterns 🡪 an array of strings of length 0
a short (length L ) interval of Genome in which it n 🡪 Len(text)
appears many (at least t ) times. for every integer i between 0 and n – L
window 🡪 text[i, i + L]
freqMap 🡪 FrequencyMap(window, k)
Clump Finding Problem for every string pattern in freqMap
if freqMap[pattern] >= t
• Input: A string Genome and integers k (length of a patterns 🡪 Append(patterns, pattern)
patterns 🡪 RemoveDuplicates(patterns)
pattern), L (window length), and t (number of return patterns
patterns in a clump).
• Output: All k-mers forming (L, t )-clumps in Genome. Note: A complicated function can be made easier by
using subroutines as building blocks.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Defining and Hunting for “Clumps” What’s the Issue?
FindClumps(text, k, L, t)
patterns 🡪 an array of strings of length 0
n 🡪 Len(text) Genomes have many repeats , some more useful than
for every integer i between 0 and n – L
window 🡪 text[i, i + L] others. Alu in humans is ~300 bp long and occurs (with
freqMap 🡪 FrequencyMap(window, k) some changes) 1 million times.
for every string pattern in freqMap
if freqMap[pattern] >= t
patterns 🡪 Append(patterns, pattern)
patterns 🡪 RemoveDuplicates(patterns)
return patterns
Genomes have many repeats , some more useful than Let’s hack out this DNA
others. Alu in humans is ~300 bp long and occurs (with fragment. Can the
some changes) 1 million times. genome replicate without
it?
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Taking Difference in G – C Taking Difference in G – C
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
DNA Strands Have Directions Four DNA Polymerases Can Do the Job
ori
5’ ori 3’
5’ 3’
3’ ori 5’ 3’ 5’
ori
terC
terC
terC terC
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
If you Were a UNIDIRECTIONAL DNA
Continue as Replication Fork Enlarges
Polymerase, how Would you Replicate a Genome?
5’ 3’
5’ 3’
3’ 5’
3’ 5’
5’ 3’ 5’ 3’
3’ 5’ 3’ 5’
Note: Leading/lagging
No problem replicatinghalf-strands
reverse half-strands are complementary
(thick lines).
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Wait until the Fork Opens and Replicate Iterate this Process
5’ 3’
3’ 5’
Okazaki
fragments
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Okazaki
fragments
The genome has been
replicated!
Many Okazaki
fragments are
replicated.
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Different Lifestyles of Half-strands Different Lifestyles of Half-strands
waiting waiting
The leading half-strand lives The leading half-strand lives
a double-stranded life most a double-stranded life most
of the time. of the time.
waiting waiting
The lagging half-strand The lagging half-strand
spends a large portion of its spends a large portion of its
life single-stranded , waiting life single-stranded , waiting
to be replicated. to be replicated.
Cytosine (C) rapidly mutates into thymine (T) through Cytosine (C) rapidly mutates into thymine (T) through
deamination ; deamination rates rise 100-fold when DNA deamination ; deamination rates rise 100-fold when DNA
is single-stranded! is single-stranded!
lagging
...C...
...G...
leading
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Cytosine (C) rapidly mutates into thymine (T) through Cytosine (C) rapidly mutates into thymine (T) through
deamination ; deamination rates rise 100-fold when DNA deamination ; deamination rates rise 100-fold when DNA
is single-stranded! is single-stranded!
lagging lagging lagging
...C... ...C... ...T...
lagging lagging
...C... ...C...
...G... ...G...
leading
...C... leading
...C... ...C...
...G... ...G... ...G...
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Take a Walk Along the Genome
Deamination is the Answer #G - #C is DECREASING #G - #C is INCREASING
5’ 3’
3’ ori 5’
Cytosine (C) rapidly mutates into thymine (T) through
deamination ; deamination rates rise 100-fold when DNA
C low
is single-stranded! C high
G low
You walk along the genome and see that #G - #C has G high
been decreasing and then suddenly starts increasing.
lagging lagging lagging
...C... ...T... ...T... Where are you in the genome?
lagging
...C... ...A...
leading terC
...G...
leading
...C... ...C... ...C...
C high/G low → #G - #C is DECREASING as C low/G high → #G - #C is INCREASING
...G... ...G... ...G... we walk along the LEADING half-strand as we walk along the LAGGING half-strand
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
terC
3’ ori 5’
C high C low
G low
STOP: What will the skew array of a G high
ori
bacterial genome look like?
terC
You walk along the genome and see that #G - #C have been decreasing and then
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
suddenly starts Bioinformatics
increasing . Where are you in the genome?
Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Given a bacterial genome (~3 Mbp), where is ori? Given a bacterial genome (~3 Mbp), where is ori?
aatgatgatgacgtcaaaaggatccggataaaacatggtgattgcctcgcataacgcggta aatgatgatgacgtcaaaaggatccggataaaacatggtgattgcctcgcataacgcggta
tgaaaatggattgaagcccgggccgtggattctactcaactttgtcggcttgagaaagacc tgaaaatggattgaagcccgggccgtggattctactcaactttgtcggcttgagaaagacc
tgggatcctgggtattaaaaagaagatctatttatttagagatctgttctattgtgatctc tgggatcctgggtattaaaaagaagatctatttatttagagatctgttctattgtgatctc
ttattaggatcgcactgccctgtggataacaaggatccggcttttaagatcaacaacctgg ttattaggatcgcactgccctgtggataacaaggatccggcttttaagatcaacaacctgg
aaaggatcattaactgtgaatgatcggtgatcctggaccgtataagctgggatcagaatga aaaggatcattaactgtgaatgatcggtgatcctggaccgtataagctgggatcagaatga
ggggttatacacaactcaaaaactgaacaacagttgttctttggataactaccggttgatc ggggttatacacaactcaaaaactgaacaacagttgttctttggataactaccggttgatc
caagcttcctgacagagttatccacagtagatcgcacgatctgtatacttatttgagtaaa caagcttcctgacagagttatccacagtagatcgcacgatctgtatacttatttgagtaaa
ttaacccacgatcccagccattcttctgccggatcttccggaatgtcgtgatcaagaatgt ttaacccacgatcccagccattcttctgccggatcttccggaatgtcgtgatcaagaatgt
tgatcttcagtg tgatcttcagtg
But there are no frequent 9-mers (that appear three But there are no frequent 9-mers (that appear three
or more times) in this region of E. coli! or more times) in this region of E. coli!
Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner. Bioinformatics Algorithms: An Active Learning Approach. © 2020 Compeau and Pevzner.
Moral? Homework problem
Ex. ATGCATGCATGCATGCATGCATGCATGC