Recherche Motifs
Recherche Motifs
de recherche de motifs
dans les séquences
Jacques Nicolas
Participants
1
Recherche de motifs (String matching)
Le cours d’aujourd’hui
2
Chromosomes: le support de l’hérédité
10 14 cellules chez
chaque individu
Eukaryotes :
chromosomes
dans un noyau
(sinon prokaryote
bactéries +archées)
Homme :
génome= 23 paires
de chromosomes
3
5'P 3'OH
ACGTATGCCCATACGCGCG
Le séquençage TGCATACGGGTATGCGCGC
3'OH 5'P
4
Taille de quelques génomes
16 700 MB
2 734 MB
278 MB
1,7 MB
9749 B
Médiateur
ARN :
5
Transcription : synthèse de l’ARN
Alphabet
équivalent
A, U, G, C
Structure de l’ARN :
simple brin et palindromes…
5'P A U C G G C U U A G A C G A U G A A G C C G U C C C G G A A A 3'OH
A
G A
U G
HIV A C
protéase GC
CG
AU
GC
5'P A U C G G C U U A C C G G A A A 3'OH
6
Traduction : synthèse des protéines
Alphabet des
acides aminés :
20 lettres
Le code génétique
7
L’art des mots…
8
Deux notions fondamentales:
periode et bord
Period of word x : Positive integer p such that
Exercice
9
Solution
babbababbab 5
babbababbab 8
babbababbab 10
babbababbab 11
abbabaabbabb
---121123453
period of abbab : 5-2=3, period of the word : 12-3=9
Complexité : hypothèses
d’opérations en temps constant
10
Exercice : complexité
What is the complexity (in time and space) of a naive
string matching approach for the search of a word of length
m in a sequence of length n ?
11
Recherche exacte de chaîne :
deux voies
Prétraitement du motif
12
Prétraitement du motif
Quelques notations
But :
Calculer tous les départs possibles (via Zi) du mot
Zi
longueur du plus long mot commun aux positions 0 et i≠0
[li , ri ]
Position du bord le plus à droite calculé par Zj , j= 1 à i
ATAT
AT présent en 0 et 2
Z1= 0, Z2= 2, Z3= 0
[l1,r1]= [0,0] [l2,r2]= [l3,r3] = [2,3]
13
Exercice
Solution
¾
attataattataa
002017002011
14
Comment calculer Zi incrémentalement
a)
p i-l l i r
b)
c)
15
Exercice
Exemple de prétraitement
ATATCATATA
AT(AT)C[AT{AT]A} Case c)
i:7 l=5, r=8, Z[2]=2, q=1 Z[7]=1+8+1-7=3 , l=7, r=9
16
Table des résultats
17
Complexité linéaire du prétraitement
• m loops on update_Z ;
• Other loops are calls to prefix length,
making a number of comparisons;
• r increases each time by the number of successful
comparisons and r is bounded by m.
• at each step, there is at most 1 failure comparison, that is at
most m altogether.
Un algorithme linéaire
(Main & Lorentz 1984)
ATAT$GATATAAATACATATATG
0200040301130104040200
18
Note sur l’ algorithme équivalent
KMP
Principe de KMP
i+1
i
x
sequence
pattern y
border z
y
z
x ≠ y, y≠z:
In case of matching failure on y, it is sufficient to restart
after the border of the correct prefix (MP), or better, a
smaller border starting with a different letter (KMP)
19
Exercice : chromosomes circulaires
Solution
20
Les meilleurs algorithmes actuels
Approche Numérique
21
Notations pour la méthode
Shift-And
R. Baeza-Yates, G. Gonnet 1992.
Efficient search of short patterns.
22
«Shift-And» : l’ algorithme
Let’s consider an increasing position k in sequence Seq
M=0m; I=0mt ; for i from 0 to m-1, I[Pattern[i] ]= I[Pattern[i] ] or 0m-i-110i
Exercice
Essayer le Shift-And algorithm et donner les
valeurs de M pour chaque valeur de k.
ATAT ATATCATATA
Motif Séquence
23
Méthode « Shift-And » : Exemple
ATATCATATA
K=
0 A M= 0001∧0101= 0001
TATA 1 T M= 0011∧1010= 0010
A 0101 0
2 A M= 0101∧0101= 0101
C 0000 1
3 T M= 1011∧1010= 1010
G 0000 2
4 C M= 0101∧0000= 0000
T 1010 3
5 A M= 0001∧0101= 0001
M 0000 4 6 T M= 0011∧1010= 0010
7 A M= 0101∧0101= 0101
8 T M= 1011∧1010= 1010
9 A M= 0101∧0101= 0101
24
Principle of the subword approach
Property 1
Given a pattern p of size m and a sequence Seq, if there exists 0≤i <m,
Seq[k+i..k+m-1] is not a subword of p, then there exists no match of p
in Seq between position k and k+i.
(contrapositive of if p matches w, then all its subwords match w).
Property 2
Given a pattern p of size m and a sequence Seq, if there exists last <m
such that for all i such that 0≤i <last, Seq[k+i..k+m-1] is not a prefix of
p, then there exists not match of p in Seq between position k and
k+last-1.
25
BOM : la structure de données
d’oracle des facteurs
Recent algorithm :
reference A. Allauzen, M. Crochemore, M. Raffinot 2001
k
x
sequence
pattern
subword y u x≠y
26
Oracle des facteurs:
1ère caractérisation
Schéma
u ≠ αv ≠ αw
0 i j k
α
α
i j k
uα uα
27
Oracle des facteurs:
caractérisation en ligne
1. Build the maximal canonical automaton recognizing
the pattern (internal transitions);
create-factor-oracle(word):
2. For i from 1 to m do
1. Create state qi; δ(qi-1, word[i]):=qi;
No word [i] transition
2. j:= link(i-1); from j
3. While ( j ≠ ⊥ and δ(qj, word[i])= ⊥Go) Backward
do
1. δ(qj, word[i]):= qi; j:= link(j); on the link path
4. od
5. If j= ⊥ then link(i):= 0
else link(i):= k / qk=δ(qj,word[i]) fi
3. od
28
Oracle des facteurs pour reverse(ATAT)
A
0 0 1 0 1 2
T T A
⊥ ⊥ ⊥
A
0 1 2 3 4
T A T A
⊥
The automaton recognizes just factors in this case
It recognizes just one word of the size of the pattern : the pattern itself.
Algorithme BOM
29
Exercice
ATAT ATATCATATA
Motif Sequence
0 1 2 3 4
T A T A
30
Comparaison empirique des algorithmes
Extrait de Navarro et Raffinot “Flexible pattern matching in strings” 2002
Size
alphabet
Size
Pattern
Recherche de « répétitions »;
Assemblage de séquences
31
Exemple de Motif de Protéine/ADN
Idée de résolution
32
Recherche de chaînes multiples
If one has to search for a set of k patterns, a trivial
solution is to repeat k times the previous algorithm :
complexity o(k(n+m)).
G I M H
E A N E U
E T D M
N M R
E X L A
O E R
9 T N
I
M T A O
1 I
N 8
E E C N
A
E
2 T
3 4 6 Link from each node to
7 the node accepting the
1 edge = 1 letter 5
longest proper suffix of
1 node = word read on path from root node the word on this node.
1 number= 1 word
33
Application : recherche de tags
STSs
(Sequenced Tagged Site)
are small DNA sequences
150-300 bases long
whose extremities
(20-30 nucleotides) are
unique in a whole genome
Given a new sequence, locate it in the whole genome, wrt these STSs.
34
Aho-Corasick’s algorithm
35
Visualisation de génomes (paysages)
Remark :
Subwords may label either the nodes or the branches of the tree
36
An elementary Suffix Tree
Root
Example : GOOGOL
G O L
O O G L
O L G O
G O L
O L
37
Exemple de ST sur GOOGOL
GO $
L$ O
OGOL$ L$ GOL$ L$
OGOL$
AT GT T
$3,4
T
Plusieurs séquences
représentées dans le
même arbre AT$1,1 GT $2,4
T$2,1 $3,1
38
Exercice :
Le GST au secours de la contamination
When one purifies, clones or sequences samples of DNA
or proteins in a laboratory, there may be a possible
contamination of these samples with the experimenter,
the host organism or used products.
ε (Root):2
A:2 C:1 $:0
AC$:0 C:1 AAC$:0 $:0
AAC$:0 $:0
39
Exercice : attributs de ST & GST
Longest repeat;
Length of the longest common word of 2
sequences (Knuth’s conjecture in 70 : the
problem is not solvable in linear time !)
• Longest repeat :
Synthesized attribute S on internal nodes
S(Parent)= if ( leaf, 0, max Child ( S( Child))+ length( Parent) )
40
L’arbre des suffixes est
une structure de données efficace
The size of the sequence is n, size of pattern is m
Construction of the tree in O(n) ;
Memory space complexity O(n) ;
(Max 2n+1 nodes, 2n edges, obtained for a « comb » on An)
String matching in O(m).
41
Ukkonen’s construction algorithm (1995)
| | | | | |
0 j-1 j i-1 i n
1 number= 1 word
42
Implication des répétitions dans
les maladies
43
Reputer :
un outil utilisant les arbres de suffixes
Developed in 1999 at Bielefeld University by S. Kurtz
and C. Schleiermacher
44
Recherche de maximal repeats :
solution
T(Parent):= if (leaf(Parent,i),
Sequence[i-1],
(S:=∪ Child(T(Child));
if |S| >1 then true else S) )
45
Exemple d’arbre d’analyse de la
séquence d’un gène (illustrations de D. Searls)
R CS
CF RE RE
Hiérarchie de Chomsky
From D. Searls
46
Inverted repeats (Tige-boucle)
et pseudo-noeuds
47
Schéma de base de l’assemblage
Recherche de recouvrements
Shotgun
48
Assemblage :
un problème NP-complet/difficile
Illustration
du problème abstrait d’assemblage
E
A
ATACGACTTGC G
E
A B
B F
C Genome
D
H
C
I
H D
49
Programmes d’assemblage:
état de l’art rapide
3 méthodes principales
Algorithme Overlap-Layout-Consensus
Algorithme overlap-layout-consensus
1 4 7
2 5 8
3 6 9
1 2 3 4 5 6 7 8 9
Overlap
2 3 1 3 1
1 3
2 2
Layout
(oter la
2 3 2 3
1 transitivité)
1 1 2
3
ACCTGA
ACCTGA Consensus
AGCTGA (correction
ACCAGA d’erreurs)
50
De la difficulté de l’assemblage…
Tandem I
c b
a d
III
+b II
c
a c
b
Excision
I II III IV
a b c d e f
Réarrangement
I a III II IV
a d e b c f
51
52