Docsity

Finding Maximal Repeats and Patterns in DNA Sequences: Combinatorial Matching - Prof. Wei , Study notes of Computer Science

Toggle sidebar
bg1
10/21/2008 Comp 590/Comp 790-90 Fall 2008 1
Lecture 16:
Lecture 16:
Combinatorial Pattern Matching
Combinatorial Pattern Matching
Study Chapter 9.1
Study Chapter 9.1 –
–9.5
9.5
10/21/2008 Comp 590/Comp 790-90 Fall 2008 2
Genomic Repeats
Genomic Repeats
•Example of repeats:
–ATGGTCTAGGTCCTAGTGGTC
•Motivation to find them:
–Genomic rearrangements are often associated
with repeats
–Trace evolutionary secrets
–Many tumors are characterized by an
explosion of repeats
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Finding Maximal Repeats and Patterns in DNA Sequences: Combinatorial Matching - Prof. Wei and more Study notes Computer Science in PDF only on Docsity!

10/21/2008 Comp 590/Comp 790-90 Fall 2008 1

Lecture 16:Lecture 16:

Combinatorial Pattern MatchingCombinatorial Pattern Matching

Study Chapter 9.1 –Study Chapter 9.1– 9.59.

Genomic Repeats Genomic Repeats

  • Example of repeats:
    • ATGGTCTAGGTCCTAGTGGTC
  • Motivation to find them:
    • Genomic rearrangements are often associated with repeats
    • Trace evolutionary secrets
    • Many tumors are characterized by an explosion of repeats

10/21/2008 Comp 590/Comp 790-90 Fall 2008 3

Genomic Repeats Genomic Repeats

  • The problem is often more difficult:
    • ATGGTCTAGGACCTAGTGTTC
  • Motivation to find them:
    • Genomic rearrangements are often associated with repeats
    • Trace evolutionary secrets
    • Many tumors are characterized by an explosion of repeats

l l-mer-mer RepeatsRepeats

  • Long repeats are difficult to find
  • Short repeats are easy to find
  • Simple approach to finding long repeats:
    • Find exact repeats of short l-mers (l is usually 10 to 13)
    • Use l-mer repeats to potentially extend into longer, maximal repeats

10/21/2008 Comp 590/Comp 790-90 Fall 2008 7

Maximal Repeats Maximal Repeats

  • To find maximal repeats in this way, we need ALL start locations of all l-mers in the genome
  • Hashing lets us find repeats quickly in this manner

Hashing: What is it? Hashing: What is it?

  • What does hashing do?
    • For different data, generate a unique integer
    • Store data in an array at the unique integer index generated from the data
  • Hashing is a very efficient way to store and retrieve data - E.g., Python directories are hashes

10/21/2008 Comp 590/Comp 790-90 Fall 2008 9

Hashing: Definitions Hashing: Definitions

  • Hash table: array used in hashing
  • Records: data stored in a hash table
  • Keys: identifies sets of records
  • Hash function: uses a key to generate an index to insert at in hash table
  • Collision: when more than one record is mapped to the same index in the hash table

Hashing: Example Hashing: Example

  • Where do the animals eat?
  • Records: each animal
  • Keys: where each animal eats

10/21/2008 Comp 590/Comp 790-90 Fall 2008 13

Hashing: Collisions Hashing: Collisions

  • Dealing with collisions: - “Chain” all start locations of l-mers (linked list)

Hashing: Summary Hashing: Summary

  • When finding genomic repeats from l-mers:
    • Generate a hash table index for each l-mer sequence
    • In each index, store all genome start locations of the l-mer which generated that index
    • Extend l-mer repeats to maximal repeats

10/21/2008 Comp 590/Comp 790-90 Fall 2008 15

Pattern Matching Pattern Matching

  • What if, instead of finding repeats in a genome, we want to find all sequences in a database that contain a given pattern?
  • This leads us to a different problem, the Pattern Matching Problem

Pattern Matching Problem Pattern Matching Problem

  • Goal: Find all occurrences of a pattern in a text
  • Input: Pattern p = p 1 … p (^) n and text t = t 1 … tm
  • Output: All positions 1< i < ( m – n + 1) such that the n -letter substring of t starting at i matches p
  • Motivation : Searching database for a known pattern

10/21/2008 Comp 590/Comp 790-90 Fall 2008 19

Exact Pattern Matching: Running Time Exact Pattern Matching: Running Time

  • PatternMatching runtime: O( nm )
  • Probability-wise, it’s more like O( m )
    • Rarely will there be close to n comparisons in line 4
  • Better solution: suffix trees
    • Can solve problem in O( m ) time
    • Conceptually related to keyword trees

Keyword Trees: Example Keyword Trees: Example

  • Keyword tree :
    • Apple

10/21/2008 Comp 590/Comp 790-90 Fall 2008 21

Keyword Trees: Example Keyword Trees: Example (cont(cont’’d)d)

  • Keyword tree :
    • Apple
    • Apropos

Keyword Trees: Example Keyword Trees: Example (cont(cont’’d)d)

  • Keyword tree :
    • Apple
    • Apropos
    • Banana

10/21/2008 Comp 590/Comp 790-90 Fall 2008 25

Keyword Trees: Properties Keyword Trees: Properties

  • Stores a set of keywords in a rooted labeled tree
  • Each edge labeled with a letter from an alphabet
  • Any two edges coming out of the same vertex have distinct labels
  • Every keyword stored can be spelled on a path from root to some leaf

Keyword Trees: Threading Keyword Trees: Threading (cont(cont’’d)d)

  • Thread “appeal”
    • appeal

10/21/2008 Comp 590/Comp 790-90 Fall 2008 27

Keyword Trees: Threading Keyword Trees: Threading (cont(cont’’d)d)

  • Thread “appeal”
    • appeal

Keyword Trees: Threading Keyword Trees: Threading (cont(cont’’d)d)

  • Thread “appeal”
    • appeal

10/21/2008 Comp 590/Comp 790-90 Fall 2008 31

Keyword Trees: Threading Keyword Trees: Threading (cont(cont’’d)d)

  • Thread “apple”
    • apple

Keyword Trees: Threading Keyword Trees: Threading (cont(cont’’d)d)

  • Thread “apple”
    • apple

10/21/2008 Comp 590/Comp 790-90 Fall 2008 33

Keyword Trees: Threading Keyword Trees: Threading (cont(cont’’d)d)

  • Thread “apple”
    • apple

Keyword Trees: Threading Keyword Trees: Threading (cont(cont’’d)d)

  • Thread “apple”
    • apple

10/21/2008 Comp 590/Comp 790-90 Fall 2008 37

Multiple Pattern Matching: Keyword Tree Multiple Pattern Matching: Keyword Tree

ApproachApproach

  • Or, we could use keyword trees:
    • Build keyword tree in O( N ) time; N is total length of all patterns
    • With naive threading: O( N + nm )
    • Aho-Corasick algorithm: O( N + m )

Keyword Trees: Threading Keyword Trees: Threading

  • To match patterns in a text using a keyword tree: - Build keyword tree of patterns - “Thread” the text through the keyword tree

10/21/2008 Comp 590/Comp 790-90 Fall 2008 39

Keyword Trees: Threading Keyword Trees: Threading

  • Threading is “complete” when we reach a leaf in the keyword tree
  • When threading is “complete,” we’ve found a pattern in the text

Suffix Trees=Collapsed Keyword Trees Suffix Trees=Collapsed Keyword Trees

  • Similar to keyword trees, except edges that form paths are collapsed - Each edge is labeled with a substring of a text - All internal edges have at least two outgoing edges - Leaves labeled by the index of the pattern.