Heuris'c)search:)FastA)and)BLAST)
COMPSCI)260)–)Spring)2016)
Previous)lectures)
• Global)alignment)
• Local)alignment)
• Dynamic)programming)algorithms:)O(mn))'me)
Database)searches)
• O(mn))algorithms)are)very)efficient)• But)this)is)too)slow)for)searching)large)databases)of)DNA)or)
protein)sequences)))
NCBI)genomic)data)
Database)searches)
• INPUT:)– Database)
– Query:))RGIKW)• OUTPUT:))
– sequences)similar)to)query))
• What)does)“similar”)mean)?))
Heuris'cs)
• Heuris'c)methods)can)be)used)to)perform)fast)approxima'ons))– Tradeoff:)accuracy)of)solu'on)vs.)speed)
• We)have)seen)another)tradeoff:)– Speed)vs.)space)
• Popular)heuris'c)algorithms)are)the)result)of)our)willingness)for)our)solu'on)to)loose)accuracy)in)return)for)a)speedup)
• Loss)of)accuracy:)false)posi'ves)or)(more)commonly))false)nega'ves.))
Heuris'cs)
• False)posi'ves)represent)results)returned)by)your)algorithm)as)successful)(in)our)case,)as)high)scoring)alignments))that)really)aren’t)))
• False)nega'ves)are)just)the)opposite:)really)high)scoring)alignments)that)get)overlooked)by)the)algorithm)
• Trade`off:)sensi'vity)vs.)selec'vity)
The)history)of)the)alignment)problem))
Global)Alignment)) Needleman`Wunsch)algorithm)(linear)gap)) 1972)
Global)Alignment) Affine)gap)(Gotoh’s)solu'on)in)quadra'c)'me)) 1980)
Exact)Local)Alignment) Smith`Waterman)algorithm) 1981)
Heuris'c)Local)Alignment) FastN)+)FastP)=)FastA) 1985))
Heuris'c)Local)Alignment) BLAST)1.0:)Basic)Local)Alignment)Search)Tool)) 1990)
Heuris'c)Local)Alignment) BLAST)2.0:)Gapped)BLAST)) 1997)
run much faster, at the expense of possibly missing some significant hits (i.e. getting false
negatives) due to the heuristics employed
Heuris'c)local)alignment))
• Heuris'c)local)alignment)algorithms)are)usually)seed$and$extend)approaches:)small)exact)matches)are)found,)which)are)then)extended)to)obtain)long)inexact)matches)
)• Preprocessing:)for)every)W`mer))
(e.g.)W=3),)list)every)loca'on)in))the)database)where)it)occurs)– W`mer:)a)string)of)length)W)
• Query:))– Generate)W`mers)and)look))them)up)in)the)database))
– Process)the)results)to)obtain)longer,)inexact)matches))
FastA)
• FastA)(which)stands)for)Fast`All))is)a)combina'on)of)FastN)(nucleo'de))and)FastP)(protein)))
• It)was)the)first)good)heuris'c)local)alignment)program,)and)it)was)capable)of)finding)
– DNA:DNA)– DNA:protein)(by)inferring)transla'on))and))– protein:protein)alignments)
• The)original)paper:))David)J.)Lipman)and)William)R.)Pearson)“Rapid)and)sensi've)protein)similarity)searches”)(Science'1985))))
FastA)paper)`)Abstract)
An algorithm was developed which facilitates the search for similarities between newly determined amino acid sequences and sequences already available in databases. Because of the algorithm's efficiency on many microcomputers, sensitive protein database searches may now become a routine procedure for molecular biologists. The method efficiently identifies regions of similar sequence and then scores the aligned identical and differing residues in those regions by means of an amino acid replaceability matrix. This matrix increases sensitivity by giving high scores to those amino acid replacements which occur frequently in evolution. The algorithm has been implemented in a computer program designed to search protein databases very rapidly. For example, comparison of a 200-amino-acid sequence to the 500,000 residues in the National Biomedical Research Foundation library would take less than 2 minutes on a minicomputer, and less than 10 minutes on a microcomputer (IBM PC).
FastA)
• General)idea:)– Choose)regions)of)the)two)sequences)that)look)promising)(have)some)degree)of)similarity)))
– Compute)local)alignment)using)dynamic)programming)in)these)regions))
• Assump'on:)a)good)alignment)probably)has)some)exact)matches.))
• The)algorithm)treats)these)exact)matches)as)anchors)or)seeds)of)a)larger)alignment)with)some)gaps))
FastA)
• Assump'on:)a)good)alignment)probably)has)some)exact)matches.))
• Is)this)true?)
• Two)sequences)of)9)aa)each,)with)7)iden''es)))There)must)be)a)stretch)of)3)aa)perfectly)conserved))
• Two)sequences)of)9)aa)with)at)most)1)mismatch))There)must)be)a)stretch)of)4)aa)perfectly)conserved))
• More)generally:)pigeonhole)principle)))If)you)have)2)pigeons)and)3)holes,)there))must)be)at)least)one)hole)with)no)pigeon))
)))
FastA)–)Step)1)
• The)algorithm)begins)by)looking)for)occurrences)of)exact)matches)of)length)k)between)the)two)sequences)
• These)are)referred)to)as)k>tuples)and)their)length)is)set)by)the)FastA)parameter)ktup))
• This)search)is)a)rela'vely)fast)one))
FastA)–)Step)2)
• Score)diagonals)with)k`word)matches,)to)iden'fy)the)10)best)diagonals))
• Construct)an)(m)×)n))grid)and)place)a)dot)at)every)(i,)j))that)begins)a)k`tuple)
k=2
• The)end)result)will)be)a)table)with)some)runs)of)diagonal)dots)))• This)table)is)called)a)dot)matrix)
• Why)diagonal?))– Consider)the)case)where)k)=)2)and)we)have)a)match)of)5)characters)in)a)
row)star'ng)at)posi'on)(i,)j).)Not)only)will)there)be)a)dot)in)the)(i,)j))posi'on,)but)also)in)the)(i)+)1,)j)+)1),)(i + 2, j + 2) and)(i + 3, j + 3) posi'ons.)This)will)results)in)a)run)of)4)diagonal)dots.)
Dot)matrix,)k=1)(DNA)sequences)of)size)1875)and)2013)bp))
Dot)matrix,)k=4)(DNA)sequences)of)size)1875)and)2013)bp))
Dot)matrix,)k=8)(DNA)sequences)of)size)1875)and)2013)bp))
Dot)matrix,)k=16)(DNA)sequences)of)size)1875)and)2013)bp))
FastA)–)Step)2)
• Score)diagonals)with)k`word)matches,)to)iden'fy)the)10)best)diagonals))
• Construct)an)(m)×)n))grid)and)place)a)dot)at)every)(i,)j))that)begins)a)k`tuple)
k=2
• The)con'guous)diagonal)runs)of)dots)in)the)dot)plot)represent)exact)matches,)so)we)want)to)find)long)diagonal)runs)
• It)can)be)done)without)genera'ng)the)en're)matrix)• We)want)to)this)very)efficiently)('me)and)space))
1. Iden'fy)common)k`words)between)X)and)Y))2. Score)diagonals)with)k`word)matches,)to)iden'fy)the)10)best)
diagonals))3. Rescore)ini'al)regions)with)a)subs'tu'on)matrix))
– Each)of)the)ten)diagonal)runs)with)highest)scores)(iden'fied)in)step)2))are)further)processed)
– Within)each)of)these)diagonal)runs,)an)op'mal)local)
alignment)is)computed)using)a)subs'tu'on)matrix)– These)alignments)are)called))ini(al'regions))
– The)score)of)the)best)sub`alignment)is)found)in)this)phase)is)reported)as)init1))
FastA)–)Outline)
1. Iden'fy)common)k`words)between)X)and)Y))2. Score)diagonals)with)k`word)matches,)to)iden'fy)the)10)best)
diagonals))3. Rescore)ini'al)regions)with)a)subs'tu'on)matrix))4. Join)ini'al)regions)using)gaps)
FastA)–)Outline)
FastA)–)Step)4:)Join)ini'al)regions)using)gaps))
• Two)offset)diagonals)can)be)joined)with)a)gap,)if)the)resul'ng)alignment)has)a)higher)score))– Separate)gap)open)and)extension)are)used)(affine)gap))– Idea:)find)the)best`scoring)combina'on)of)diagonals)
– The)score)of)this)alignment)is)reported)as)initn))– initn)is)used)to)rank)the)library)sequences)
1. Iden'fy)common)k`words)between)X)and)Y))2. Score)diagonals)with)k`word)matches,)to)iden'fy)the)10)best)
diagonals))3. Rescore)ini'al)regions)with)a)subs'tu'on)score)matrix))4. Join)ini'al)regions)using)gaps)5. Perform)dynamic)programming)to)find)the)final)alignments))
FastA)–)Outline)
FastA)–)Step)5:)Local)alignment)in)the)highest`scoring)region))
• Last)step)of)FastA:)perform)local)alignment)using)dynamic)programming)around)the)highest`scoring)region)
highest`scoring)region)
• Do)we)fill)in)the)en're)DP)matrix?)(Smith`Waterman))
• NO,)we)can)apply)banded'Smith`Waterman)))
FastA)–)Step)5:)Local)alignment)in)the)highest`scoring)region))
• Banded'Smith`Waterman))• Idea:)A)high)quality)alignment)will)stay)close)to)the)diagonal)
– If)we)are)only)interested)in)high)quality)alignments,)we)can)skip)filling)in)cells)that)can't)possibly)lead)to)a)high)quality)alignment)
• Region)to)be)aligned)covers)±w))characters)from)the)highest`)scoring)diagonals))
• With)long)sequences,)this)region)is))typically)very)small)compared)to)the))whole)n)x)m)matrix)
• The)score)of)the)resul'ng)alignment))is)reported)as)opt'
Dynamic)programming)matrix)is)filled)only)for)the)green)region))
Proper'es)of)FastA))
• Fast)compared)to)local)alignment)using)dynamic)programming)only))– Only)a)narrow)region)of)the)full)matrix)is)aligned)
• For)DNA)sequence)comparisons,)the)ktup'parameter)can)range)from)1)to)6)
• Increasing)ktup)decreases)the)number)of)hits))– increases)specificity)(the)method)does)not)produce)many)incorrect)results))
– decreases)sensi'vity)(produces)fewer)of)the)correct)results))
• FastA)looks)for)ini'al)exact)matches)to)the)query)sequence)– But)two)proteins)can)have)very)different)amino)acid)sequences)and)s'll)be)biologically)similar))
– This)may)lead)to)a)lack)of)sensi'vity)for)diverged)
sequences)
• FastA)determines)a)highest))scoring)region,)not'all)high)scoring)alignments)between)two)sequences.)Hence,)it)may)miss)instances)of)repeats)or)mul'ple)domains)shared)by)two)proteins)
Proper'es)of)FastA))
The)history)of)the)alignment)problem))
Global)Alignment)) Needleman`Wunsch)algorithm)(linear)gap)) 1972)
Global)Alignment) Affine)gap)(Gotoh’s)solu'on)in)quadra'c)'me)) 1980)
Exact)Local)Alignment) Smith`Waterman)algorithm) 1981)
Heuris'c)Local)
Alignment)FastN)+)FastP)=)FastA) 1985))
Heuris'c)Local)Alignment) BLAST)1.0:)Basic)Local)Alignment)Search)Tool)) 1990)
Heuris'c)Local)Alignment) BLAST)2.0:)Gapped)BLAST)) 1997)
run much faster, at the expense of possibly missing some significant hits (i.e. getting false
negatives) due to the heuristics employed
BLAST)`)Basic)Local)Alignment)Search)Tool))
• Altschul)SF,)Gish)W,)Miller)W),Myers)EW,)Lipman)DJ,)“Basic)local)alignment)search)tool”)(J'of'Molecular'Biology,)1990))
• Perhaps)the)most)widely)used)bioinforma'cs)tool)• It)is)an)alignment)heuris'c)that)determines)local)alignments)
between)a)query)and)a)database)• It)uses)an)approxima'on)of)the)Smith`Waterman)algorithm))• BLAST)consists)of)two)components:))
– search)algorithm))
– computa'on)of)the)sta's'cal)significance)of)solu'ons)• Speed)is)achieved)by)using)a)procedure)that)typically)finds)“most”)
matches)with)scores)>)S))
BLAST paper is the most cited paper of its decade, with more than 20,000 citations.
BLAST)`)Basic)Local)Alignment)Search)Tool))
• BLAST)1.0)only)reports)ungapped)alignments)• Assump'ons:)
– all)the)user)was)probably)interested)in)were)ungapped)alignments)
– if)the)user)wanted)to)find)an)alignment)with)gaps,)the)whole)alignment)could)be)s'tched)together)using)pieces)of)the)ungapped)alignments)returned)by)BLAST)1.0)
• However,)we)know)that)it)is)perfectly)valid)to)want)the)algorithm)to)return)gapped)alignments))
• It)is)osen)not)feasible)to)reconstruct)a)gapped)alignment)from)a)series)of)ungapped)alignments)
• Thus,)BLAST)2.0)was)introduced)in)a)paper)co`authored)by)many)of)the)original)BLAST)1.0)authors)
Idea:)Seed)and)Extend))
• Homologous)sequences)are)likely)to)contain)a)short)high)scoring)word)pair,)or)seed)
• BLAST)finds)high)scoring)seeds)and)tries)to)extend)them)to)compute)maximal)high)scoring)segment)pairs)(HSPs))
BLAST)–)Step)1:)Preprocess)query)
• Split)query)into)overlapping)words)of)length)W))– The)length)of)the)query)word,)W,)is)3)for)protein)sequences)
• Find)the)neighborhood)for)each)word,)for)a)similarity)threshold)T)
What are these scores?
The)threshold)T)is)based)on)a)subs'tu'on)matrix)
PQG)PMG)))
BLOSUM62
7+0+6=13)
BLAST)–)Step)1:)Preprocess)query)
• Split)query)into)overlapping)words)of)length)W))– The)length)of)the)query)word,)W,)is)3)for)protein)sequences)
• Find)the)neighborhood)for)each)word,)for)a)similarity)threshold)T)
What are these scores?
BLAST)–)Step2:)Construct)query)word)hash)table)
BLAST)–)Step)3:)Database)scanning)
• Iden'fy)all)exact)matches)of)W`mers)with)DB)sequences)
• A)segment>pair)(s,t))(or)hit))consists)of)two)segments,)one)in)the)query)and)one)in)the)database,)of)the)same)length)
BLAST)–)Step)3:)Database)scanning)
Query: GSVEDTTGSQSLAALLNKCKTPQG
PQG PEG PRG PKG PNG
Neighborhood words
Neighborhood score threshold (T=13)
PDG PHG PMG PSQ PQA PQN
325 365SLAALLNKCKTPQG
290 330TLASVLDCTVTPMG
High-scoring Segment Pair (HSP)
+LA++L+ TP G R++ +W+ P+ D + ER + A
etc... X
18 15 14 14 13 13 13 13 13 12 12
Query:
Sbjct:
Query word (W =3)
QRLVNQWIKQPLMDKNRIEERLNLVEAFVEDAELRQTLQEDL
QRLVNQWIKQPLMDKNRIEERLNLVEA
SRMLKRWLHMPVRDTRVLLERQQTIGA
THE BLAST SEARCH ALGORITHM
Adapted from: Baxevanis, Andy. "Nucleotide and Protein Sequence Analysis I." Lecture presentation, National Human Genome Research
Institute Current Topics in Genome Analysis, Bethesda, MD, February 1, 2005. Figure by MIT OCW.
Segment pair, or seed (s, t)
BLAST)–)Step)4:)Extend)seeds)to)HSP)
• Each)such)seed)(s,)t'))is)extended)in)both)direc'ons)un'l)its)score)cannot)be)increased))
• All)extensions)with)score)≥)S)are)reported))• These)are)called)high`scoring)segment)pairs)(HSPs))• Originally)(in)BLAST1.0))the)extension)did)not)include)gaps.)
The)BLAST2.0)algorithm)allows)inser'on)of)gaps))
BLAST)–)Step)5:)Evalua'on)
• Evaluate)the)alignment)sta's'cally)
• E>value:))the)number)of)HSPs)having)score)S)(or)higher))expected)to)occur)by)chance)(given)the)database)))
• Smaller)E`value)means)more)significant)score)• Big)E`value)corresponds)to)random)alignments)
• P>value:)the)probability)that)an)HSP)with)score)S)(or)higher))is)generated)by)chance)
Assessing)the)significance)of)sequence)alignment)
• We)want))to)evaluate)the)probability)that)a)score)between)random)(unrelated))sequences)will)reach)the)score)found)between)the)two)sequences)on)interest)
• What)is)the)distribu'on)of)scores)between)2)random)sequences?)
• Karlin)and)Altschul)observed)that)in)the)framework)of)local)alignments)without)gaps,)the)distribu'on)of)random)sequence)alignment)scores)follows)an)extreme)value)
distribu'on)
Parameters that depend on the length and composition of the sequences, and on the scoring function
Assessing)the)significance)of)sequence)alignment)
P`value)=)the)probability)of))obtaining)a)score)equal)to)or))greater)than)x)by)chance)Score A - significant
Score B – not significant
Assessing)the)significance)of)sequence)alignment)
• P`value:))– Probability)that)an)alignment)with)this)score)occurs)by)chance)in)a)database)of)size)N)
– The)closer)the)P`value)is)towards)0,)the)beuer)the)alignment))
• E`value:))– Number)of)matches)with)this)score)one)can)expect)to)find)by)chance)in)a)database)of)size)N)
– The)closer)the)E`value)is)towards)0,)the)beuer)the)alignment))
• In)a)database)of)size)N:)P)x)N)=)E)
Assessing)the)significance)of)sequence)alignment)
• Local)alignment)without)gaps:)– Extreme)Value)Distribu'on)
– Theore'cal)work)of)Karlin)and)Altschul)
Assessing)the)significance)of)sequence)alignment)
• Local)alignments)with)gaps:)– Extreme)Value)Distribu'on)derived)from)empirical)studies)
BLAST)parameters))
• Larger)values)of)W)increases)the)number)of)neighborhood)words,)but)decreases)the)number)of)chance)matches)in)the)database)– In)prac'ce,)W'=)12)for)DNA,)3)for)protein)sequences)
• Larger)values)of)T)decrease)the)overall)execu'on)'me,)but)increase)the)chance)of)missing)a)MSP)having)score)≥)S))
• Larger)values)of)S)increase)the)specificity.)The)value)of)S)is)affected)by)changes)in)the)expecta'on)value)parameter)
BLAST)parameters))
• The)more)filtering)we)do)the)less)work)we)end)up)having)to)do)in)later)steps)of)the)algorithm)
• However,)the)more)filtering)we)do)the)greater)our)chances)of)having)false)nega'ves)
• The)less)filtering)we)do)the)more)sequences)we)are)forced)to)analyze)aser)the)filtering)step,)but)the)fewer)false)nega'ves)we)encounter))
Very)similar)sequences))
Quite)similar)sequences))
Not)similar)sequences))
Blast)versions))
Program Database Query
BLASTN Nucleotide Nucleotide
BLASTP Protein Protein
BLASTX Protein Nucleotide translated in to protein
TBLASTN Nucleotide translated into protein Protein
TBLASTX Nucleotide translated into protein
Nucleotide translated into protein
NCBI)Blast))