text algorithms (4ap) biological measures of similarity

42
9.10.2008 1 Text Algorithms (4AP) Biological measures of similarity Jaak Vilo 2008 fall 1 MTAT.03.190 Text Algorithms Jaak Vilo Complete genomes Lecture 1, Tuesday April 1, 2003 Serafim Batzoglou http://ai.stanford.edu/~serafim/

Upload: others

Post on 27-Dec-2021

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

1

Text Algorithms (4AP)Biological measures of similarity

Jaak Vilo

2008 fall

1MTAT.03.190 Text Algorithms Jaak Vilo

Complete genomes

Lecture 1, Tuesday April 1, 2003 Serafim Batzoglou http://ai.stanford.edu/~serafim/

Page 2: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

2

Evolution

Lecture 1, Tuesday April 1, 2003 Serafim Batzoglou http://ai.stanford.edu/~serafim/

• W. Gilbert NATURE 349:99 1991.

• For 15 years the DNA databases have grown by 60 per cent a• For 15 years, the DNA databases have grown by 60 per cent a year, a factor of ten every five years. The human genome project will continue and accelerate this rate of increase. Thus I expect that sequence data for all of the model organisms and half of the total knowledge of the human organism will be available in five to seven years, and all of it by the end of the decade....To use this flood of knowledge, which will pour across the computer networks of the world, biologists not only must become computer‐literate, but also change their approach to the problem of understanding life.

Page 3: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

3

Technology Review, Oct 6, 2008

http://www.technologyreview.com/biomedicine/21466/page1/

Methods

• Dot‐plot

• Needleman‐Wunsch (global alignment)

– Affine gap penalties

• Smith‐Waterman (lovcal alignment)

– Affine gap penalties

BLAST• BLAST

• BLAT, …

Page 4: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

4

Dot plots

• Lecture notes on Dot‐plot (Benjamin Corum)

• Brian Golding, McMaster Univ. (course outline)

Dot plot: black if ai=bi, white otherwise

Page 5: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

5

5 matches

8 matches

Page 6: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

6

8‐positions, 1 mismatch

Priit Adler: http://www.bioinf.ebc.ee/dotplot/plot.cgi

10,2

Priit Adler: http://www.bioinf.ebc.ee/dotplot/plot.cgi

Page 7: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

7

Evolution at the DNA level

C

…ACGGTGCAGTCACCA…

Lecture 1, Tuesday April 1, 2003

…ACGTTGCAGTCCACCA…

SEQUENCE EDITS REARRANGEMENTS

Evolutionary Rates

OK

OK

OK

next generation

Lecture 1, Tuesday April 1, 2003

XX

Still OK?

Page 8: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

8

Sequence conservation implies function

Lecture 1, Tuesday April 1, 2003

Interleukin region in human and mouse

Sequence AlignmentAGGCTATCACCTGACCTCCAGGCCGATGCCCTAGCTATCACGACCGCGGTCGATTTGCCCGAC

-AGGCTATCACCTGACCTCCAGGCCGA--TGCCC---TAG-CTATCAC--GACCGC--GGTCGATTTGCCCGAC

DefinitionGiven two strings x = x1x2...xM, y = y1y2…yN,

an alignment is an assignment of gaps to positions

Lecture 1, Tuesday April 1, 2003

0,…, N in x, and 0,…, N in y, so as to line up each letter in one sequence with either a letter, or a gap

in the other sequence

Page 9: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

9

What is a good alignment?

Alignment:The “best” way to match the letters of one sequence with those of the otherthe other

How do we define “best”?

Alignment:A hypothesis that the two sequences come from a common ancestor through sequence edits

Lecture 1, Tuesday April 1, 2003

Parsimonious explanation:Find the minimum number of edits that transform one sequence into the other

Serafim Batzoglou http://ai.stanford.edu/~serafim/

Scoring Function

• Sequence edits:AGGCCTC

M t ti– MutationsAGGACTC

– InsertionsAGGGCCTC

– DeletionsAGG.CTC

Scoring Function:Match: +mMismatch: s

Lecture 1, Tuesday April 1, 2003

Mismatch: -sGap: -d

Score F = (# matches) m - (# mismatches) s – (#gaps) d

Page 10: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

10

How do we compute the best alignment?

AGTGCCCTGGAACCCTGACGGTGGGTCACAAAACTTCTGGA

AGTTGACCTGGGAAGACCCTGACCCTGGG

Too many possible alignments:

O( 2M+N)

Lecture 1, Tuesday April 1, 2003

GTCACAAAACTC

Three Main Steps

• 1. Assign similarity scores

– A numerical value (score) is assigned to every cell in the array depending on i il it /di i il itsimilarity/dissimilarity

– Similarity scores may be simple, or related to chemical similarities or frequency of observed substitutions

• 2. Score paths through array

– For each cell want to know the maximum possible score for an alignment ending at that point

– Cumulative score by adding in a path through the matrix

– Searches subrow and subcolumn for the highest score

G lt i d d t f th l th f th– Gap penalty independent of the length of the gap

– The best match is the pathway with the highest score

– Maximum match = largest number of amino acids of one protein that can be matched with those of another protein while allowing for all possible deletions

• 3. Construct an alignment

Page 11: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

11

1. Values are assigned to each matching pair of residues based upon a similarity matrix. Here the matrix is the simplest: match = 1 mismatch = 0 More complex similarity matrices, such as PAM or BLOSUM, may be used.

• Assign Relative Values

2 R l ti l th i d t h ll f• 2. Relative values are then assigned to each cell of the array, based upon the maximum scoring pathway through the array.

• * Search subrow and subcolumn to assign the score for each cell. Each cell is assigned the highest possible score based upon it's own score + thepossible score based upon it s own score + the highest score in the diagonal preceeding it.

• * Gaps are allowed and gap penalties may be assigned. In this example there are no gap penalties.

Page 12: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

12

• Pathfinding

• 3 Alignments producing a maximummatch are constructed• 3. Alignments producing a maximum match are constructed.

• * The maximum match score will always be in the outermost row or column.

• * A maximum alignment can be constructed by following the maximum scores in each row backwards from the outermost maximum score.

• * The two equal maximal alignments resulting from this example are displayed below the array.

• * These alignments are global every nucleotide or amino acid must be included in the alignment. This algorithm therefore misses many motif or domain similarities.

Page 13: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

13

affine gaps : 1 longer is more likely than 

many small gaps

(n) = d  + (n – 1)e| |

de

(n)

gap gapopen extend

To compute optimal alignment,

At position i,j, need to “remember” best score if gap is openbest score if gap is not open

d

Lecture 2, Thursday April 3, 2003

F(i, j): score of alignment x1…xi to y1…yjifif xi aligns to yj

G(i, j): score ifif xi, or yj, aligns to a gap

Page 14: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

14

Scoring the gaps more accurately

Current model:(n)

Gap of length  n

incurs penalty nd

However, gaps usually occur in bunches

Convex gap penalty function ( )

Lecture 2, Thursday April 3, 2003

Convex gap penalty function:

(n):for all n, (n + 1) ‐ (n)  (n) ‐ (n – 1) 

(n)

Needleman‐Wunsch with affine gaps

Initialization: F(i, 0) = d + (i – 1)eF(0, j) = d + (j – 1)e

Iteration:F(i – 1, j – 1) + s(xi, yj)

F(i, j) = maxG(i – 1, j – 1) + s(xi, yj)

F(i – 1, j) – d F(i, j – 1) – d 

Lecture 2, Thursday April 3, 2003

( , j )G(i, j) = max 

G(i, j – 1) – eG(i – 1, j) – e 

Termination: same

Page 15: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

15

• Needleman, S. B., Wunsch, C. D., J. Mol. Biol. (1970) 48:443‐453– (from Aoife McLysaght and NCBI workshop slides)

• General algorithm for sequence comparison• Fundamental principle ‐ to calculate the alignment score S(i,j) you only 

need to enumerate and score all ways in which one aligned pair can be added to a shorter alignment to produce an alignment of the first i residues of seq1 and the first j residues of seq2 (dynamic programming)

• All possible pairs are represented by a two‐dimensional array• All possible pairs are represented by a two‐dimensional array, and all possible comparisons are represented by pathways through this array

• Global alignments ... i.e. every residue of the two sequences has to participate ‐ therefore will not detect motif or active site homology alone

Global vs local alignment

• Global alignment methods give the optimal end to end alignment between two sequencesend alignment between two sequences.

• However, homologous sequences may share similarity in a sub‐region of the sequence. In trying to choose the optimal end‐to‐end alignment, global alignments can fail to pick up local homology Localalignments can fail to pick up local homology. Local alignment methods will return alignments with high scoring regional homology.

Page 16: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

16

Global vs local alignment

• Needleman and Wunsch ("Global" Alignment)

• Uses a global alignment algorithm meaning that:• Uses a global alignment algorithm, meaning that:

• a. the full sequence must be aligned .

• b. gaps at the end of the sequence are penalized as much as internal gaps.

• Smith‐Waterman ("Local" Alignment)

• Uses a local alignment algorithm, meaning that:

• a. it searches for both full and partial sequence matches .

• b. gaps at the end of the sequence essentially have a penalty of zero.

The local alignment problem

Given two strings  x = x1……xM, 

y = y1……yN

Find substrings x’, y’ whose similarity 

(optimal global alignment value)

is maximum

Lecture 2, Thursday April 3, 2003

is maximum

e.g. x = aaaacccccgggg

y = cccgggaaccaacc

Page 17: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

17

Why local alignment

• Genes are shuffled between genomes

• Portions of proteins (domains) are often conserved

Lecture 2, Thursday April 3, 2003

The Smith‐Waterman algorithm

Idea: Ignore badly aligning regions

Modifications to Needleman‐Wunsch:

Initialization: F(0, j) = F(i, 0) = 0

0

Lecture 2, Thursday April 3, 2003

Iteration: F(i, j) = max  F(i – 1, j) – d

F(i, j – 1) – d

F(i – 1, j – 1) + s(xi, yj)  

Page 18: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

18

The Smith‐Waterman algorithm

Termination:

1. If we want the best local alignment…

FOPT = maxi,j F(i, j)

Lecture 2, Thursday April 3, 2003

2. If we want all local alignments scoring > t

For all i, j find F(i, j) > t, and trace back

General gap dynamic programming

Initialization: same

Iteration:

F(i‐1, j‐1) + s(xi, yj)

F(i, j)  = max maxk=0…i‐1F(k,j) – (i‐k) maxk=0…j‐1F(i,k) – (j‐k)

Termination: same

Lecture 2, Thursday April 3, 2003

Running Time: O(N2M) (assume N>M)

Space: O(NM)

Page 19: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

19

• Smith, T. F., Waterman, M. S., J. Mol. Biol. (1981) 147:195‐197

• Based on N‐W Algorithmg

• Instead of looking at each sequence in its entirety, this compares segments of all possible lengths and chooses whichever optimise the similarity measure (local alignments)

• Comparing two sequences A (=a1 a2 a3 ... an) and B (=b1 b2 b3 ... bm)

• Hij=max{Hi‐1, j‐1 +s(ai,bj), max{Hi‐k,j ‐Wk}, max{Hi, j‐l ‐Wl}, 0}

• Hij is the maximum similarity of two segments ending in ai and b respectivelybj respectively.

• Including the alternative that the similarity score be zero in the expression for Hijallows the local alignment to restart at any pair of aligned residues. In addition, it makes the calculation much more sensitive to the precise match and mismatch scores and gap penalties.

Smith‐Waterman

• Uses a local alignment algorithm, meaning that:

a. it searches for both full and partial sequence matches .p q

b. gaps at the end of the sequence essentially have a penalty of zero.

• Assigns a score to each pair of bases

– Uses similarity scores only

– Uses positive scores for related residues

– Uses negative scores for substitutions and gaps

• Initializes edges of the matrix with zeros

A th d i th t i b l 0 i d d• As the scores are summed in the matrix, any score below 0 is recorded as 0.

• Begins the trace back at the maximum value found anywhere in the matrix

• Continues until the score falls to 0.

Page 20: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

20

• Scoring metrics are of two types:

• Distance (cost) Scores• Distance (cost) Scores

– The distance between identical residues must be 0.

– The distance, or cost, for aligning two non‐identical residues must be greater than 0 (i.e. negative distances are not allowed).

• Similarity Scores

– Identical or similar residues have positive scores

– Dissimilar residues can have 0 or even negative scores

Page 21: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

21

Smith‐Waterman example ‐‐Penalties

• Assigning values in the S‐W 2‐dimensional array requires the use of gap penalties. In this example scores are derived from a simple similarity matrix plus a gap initiation and gap extension penalty as follows:

– Match = + 1

– MisMatch = 1/3

– Gap = (1 + 1/3k*)• (* where k = number of residues included in gap)

• All cell values start at zero and are not allowed to fall below zero (so a new (alignment path can begin at any point).

• Assigns value to cell based upon value of cell plus the highest value in subrow, subcolumn or direct diagonal (as shown) when gap penalties are taken into account.

Page 22: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

22

• Relative values in adjacent cells of a path can i t th f llrise, stay the same or fall.

• Alignments can begin and end anywhere in the sequence, not just the final row or columncolumn.

• The value in any cell is the highest score for an alignment of any length ending at that cell.

* The alignment for the path shown in red in the 2-dimensional array to the right is displayed below.

Page 23: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

23

* The alignment for the path shown in red in the 2-dimensional array to the right is displayed below.

• The alignment for the path shown in d i th 2 di i l t th red in the 2-dimensional array to the

right is displayed below.

Page 24: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

24

• Alignment Scores: The higher the score ... the better the alignment.

• Alignment Scores and Search Algorithms (Baylor College of Medicine)

b h f h l d f l h f h ll d• A Substitution Score is chosen for each aligned pair of letters. The set of these scores is called the substitution matrix. The matrix scores highly identical matches of bases, and also gives 'better' scores to alignments of non‐identical bases that are similiar in some way, and a 'worse' score to pairs that are very dissimilar. This system can preserve alignments based on function by identifying, for example, sections of the two sequences that are similarly hydrophobic, even if not identical in sequence.

• A gap scoring system (affine gap costs) is used to chose scores for 'gaps'. A gap is one or more adjacent nulls in one sequence aligned with letters in the other sequence. Ideally, the gap scoring system charges a large initial penality for the existence of a gap, and smaller penalities for each individual residue This takes into account that each mutational event canpenalities for each individual residue. This takes into account that each mutational event can insert or delete multiple residues at a time ‐ the bulk of the gap cost penalty is for the existence of the mutation itself, not the length.

• The alignment score is the sum of the scores specified for each of the aligned pairs of letters, and letters with nulls, in the alignment. The higher the alignment score, the better the alignment.

• Vaata eestikeelseid referaate:

• Leopold Parts

• Mark Tehver

Page 25: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

25

• Smith‐Waterman algorithm finds best‐matching substrings between two sequences

• It uses simple dynamic programming, except the longer gaps can be supported with affine penalty scores.

• Maximum is taken between

• 1) comparison scores for last characters plus score without the last characters

• 2) max for all prefixes of first sequence plus the gap cost

• 3) max for all prefixes of second sequence plus the gap cost3) max for all prefixes of second sequence plus the gap cost

• The used parameters:GAP_PENALTY ‐ penalty to start a gapGAP_EXTENSION ‐ penalty to extend an existing gapMATCH_PENALTY ‐match scoreMISMATCH_PENALTY ‐mismatch score

SwTable(String A, String B):

table[i][0] = 0, 0 <= j <= length(B)

table[0][i] = 0, 0 <= i <= length(A)

for(i = 1; i <= length(A); ++i)

for(j = 1; j <= length(B); ++j)

maxRow = -INFINITY;

maxColumn = -INFINITY;

// find the best score from column

maxColumn = max(maxColumn, table[i - k][j] - gapScore(k)); 0 < k < i

// find the best score from row

maxRow = max(maxColumn, table[i][j - k] - gapScore(k)); 0 < k < j

table[i][j] = max( // new value is a max of 4:

table[i-1][j-1] + letterScore(Ai, Bj),

maxRow,,

maxColumn,

0 // no negative values

);

gapScore(k) = GAP_PENALTY + GAP_EXTENSION*k

letterScore(c, d) = MATCH_PENALTY , if c = d

MISMATCH_PENALTY, if c != d

Page 26: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

26

Gap penalties

• Gaps were rather freely permitted in the overly simple implementations of the Needleman‐Wunsch and Smith‐Waterman algorithms shown above. What would happen if you feel that gaps should be rarer events in your particular protein? It is possible to assign a different weight to gaps. This can be done by subtracting from the score, some predetermined value every time a gap is required. In this case you can 

define a weight asW = a + bk , where k is the length of the gap. Hence you can control whether many 

short gaps occur or whether long gaps occur but more infrequently. Deletions do occur but when they occur it is seldom many small, short deletions but rather fewer and longer deletions.

• How do you choose a gap penalty?

• Unfortunately, there is little knowledge to help here. Most of the tests done so far depend on an empirical basis designed to achieve some end. For example, Smith and Fitch have derived (by exhaustive search) gap penalties that will best align distantly related haemoglobin genes. But there is no guarantee that these values would work well for the protein or (worse) the nucleotide sequence that you are interested in. Typical values are

0.5 < a < 5

0.05 < b < 1.0

b < abut there is nothing special about these values other than the fact that they seem to work well for some

of the common comparisons. Note that in general a > b. This corresponds with biological knowledge of how gaps are generated ‐ it is easier to generate one gap of two residues rather than two gaps of one residue since the former can be created by a single mutational event.

Substitution rates

• Weights for different mismatches should be permitted. A transition is more likely than a transversion; a Ile‐Val more likely than Ile‐Arg change.

• If the two sequences have no obvious relationship at their right and left ends, then end gaps should not be penalized.

• Unless two sequences are known to be homologous over their entire length, a local alignment is preferable to a global alignment.

• An optimal alignment is by no means necessarily statistically significant. One must make some estimate of the probability that a given alignment is due to chance.

• An alignment demonstrates similarity, not necessarily, homology. Homology is an evolutionary inference based on examination of the similarity and its biological meaning. Sequence similarity may result from homology but it may also result from chance, convergence or analogy.

Page 27: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

27

PAM:[Taken from the NCBI Glossary PAM definition].

• Percent Accepted Mutation. A unit introduced by Dayhoff et al to quantify the amount of evolutionaryDayhoff et al. to quantify the amount of evolutionary change in a protein sequence. 1.0 PAM unit, is the amount of evolution which will change, on average, 1% of amino acids in a protein sequence. A PAM(x) substitution matrix is a look‐up table in which scores for each amino acid substitution have been calculated based on the frequency of that substitution in closely related proteins that have experienced a certain amount (x) of evolutionary divergence.

Page 28: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

28

BLOSUM

• Blocks Substitution Matrix. A substitution matrix in which scores for each position are derived from observations of thescores for each position are derived from observations of the frequencies of substitutions in blocks of local alignments in related proteins. Each matrix is tailored to a particular evolutionary distance. In the BLOSUM62 matrix, for example, the alignment from which scores were derived was created using sequences sharing no more than 62% identity. Sequences more identical than 62% are represented by a single sequence in the alignment so as to avoid over‐weighting closely related family members. (Henikoff and Henikoff)

Page 29: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

29

Homology

• Orthology / orthologous

– the “same” gene in different species

• Paralogy / Paralogous

– Similar gene in the same organism 

– E.g. gene duplication 

– Paralogous genes can evolve independently and– Paralogous genes can evolve independently and acquire new different functions 

– Or become redundant, and “disappear”

Page 30: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

30

BLAST

• Basic Local Alignment Search Tool. (Altschul et al. J. Mol. Biol. 215(3):403‐10, 1990)215(3):403 10, 1990)

• A sequence comparison algorithm optimized for speed used to search sequence databases for optimal local alignments to a query. The initial search is done for a word of length "W" that scores at least "T" when compared to the query using a substitution matrix. Word hits are then extended in either direction in an attempt to generate an alignment with a score p g gexceeding the threshold of "S". The "T" parameter dictates the speed and sensitivity of the search.

Page 31: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

31

Indexing-based local alignment

(BLAST- Basic Local Alignment Search Tool)

Main idea:

1. Construct a dictionary of all the words in the query

2. Initiate a local alignment for each word match between query and DB

query

CS262 Lecture 3, Win06, Batzoglou

match between query and DB

Running Time: O(MN)

However, orders of magnitude faster than Smith-Waterman

DB

Indexing-based local alignment

Dictionary:

All words of length k (~10)

……queryg ( )

Alignment initiated between words of alignment score T

(typically T = k)

Alignment:

Ungapped extensions until score

b l t ti ti l th h ld

……

scan

CS262 Lecture 3, Win06, Batzoglou

below statistical threshold

Output:

All local alignments with score

> statistical threshold

DB

query

Page 32: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

32

Indexing-based local alignment—Extensions

A C G A A G T A A G G T C C A G T

G

A

Example:

k 4

T

G

G

A T

T

G

C

G

k = 4

The matching word GGTC initiates an alignment

Extension to the left and right with no gaps until alignment falls < C below

CS262 Lecture 3, Win06, Batzoglou C

C

C

T

T

C

C T

alignment falls C below best so far

Output:GTAAGGTCC

GTTAGGTCC

Indexing-based local alignment—Extensions

A C G A A G T A A G G T C C A G T

G

A

Gapped extensions

T

G

G

A

T

T

G

C

• Extensions with gaps in a band around anchor

CS262 Lecture 3, Win06, Batzoglou C

T

G

A

T

C

C T

Output:

GTAAGGTCCAGTGTTAGGTC-AGT

Page 33: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

33

Indexing-based local alignment—Extensions

A C G A A G T A A G G T C C A G T

G

A

Gapped extensions until threshold

T

G

G

A

T

T

G

C

• Extensions with gaps until score < C below best score so far

CS262 Lecture 3, Win06, Batzoglou C

T

G

A

T

C

C T

Output:

GTAAGGTCCAGTGTTAGGTC-AGT

Sensitivity-Speed Tradeoff

long words

(k = 15)

short words

(k = 7)X%

Sensitivity

Speed

Sens

CS262 Lecture 3, Win06, BatzoglouKent WJ, Genome Research 2002

Sens.

Speed

Page 34: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

34

Sensitivity-Speed Tradeoff

Methods to improve sensitivity/speed

1. Using pairs of words

2. Using inexact words

……ATAACGGACGACTGATTACACTGATTCTTAC……

……GGCACGGACCAGTGACTACTCTGATTCCCAG……

……ATAACGGACGACTGATTACACTGATTCTTAC……

CS262 Lecture 3, Win06, Batzoglou

3. Patterns—non consecutive positions

……GGCGCCGACGAGTGATTACACAGATTGCCAG……

TTTGATTACACAGATT G TT CAC G

Measured improvement

CS262 Lecture 3, Win06, BatzoglouKent WJ, Genome Research 2002

Page 35: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

35

Non-consecutive words—Patterns

Patterns increase the likelihood of at least one match within a long conserved region

3 common

5 common

7 common

Consecutive Positions Non-Consecutive Positions

6 common

CS262 Lecture 3, Win06, Batzoglou

On a 100-long 70% conserved region:Consecutive Non-consecutive

Expected # hits: 1.07 0.97Prob[at least one hit]: 0.30 0.47

Advantage of Patterns

11 positions

11 positions11 positions

10 positions

CS262 Lecture 3, Win06, Batzoglou

Page 36: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

36

Multiple patterns

TTTGATTACACAGAT

• K patternsT k K ti l t

T G TT CAC GT G T C CAGTTGATT A G

How long does it take to search the query?

CS262 Lecture 3, Win06, Batzoglou

Takes K times longer to scan Patterns can complement one another

• Computational problem: Given: a model (prob distribution) for homology between two regions Find: best set of K patterns that maximizes Prob(at least one match)

Buhler et al. RECOMB 2003Sun & Buhler RECOMB 2004

Variants of BLAST

• NCBI BLAST: search the universe http://www.ncbi.nlm.nih.gov/BLAST/• MEGABLAST: http://genopole.toulouse.inra.fr/blast/megablast.html

Optimized to align very similar sequences• Works best when k = 4i 16• Works best when k = 4i 16• Linear gap penalty

• WU-BLAST: (Wash U BLAST) http://blast.wustl.edu/ Very good optimizations Good set of features & command line arguments

• BLAT http://genome.ucsc.edu/cgi-bin/hgBlat Faster, less sensitive than BLAST Good for aligning huge numbers of queries

• CHAOS http://www.cs.berkeley.edu/~brudno/chaos Uses inexact k-mers, sensitive

• PatternHunter http://www.bioinformaticssolutions.com/products/ph/index.php

CS262 Lecture 3, Win06, Batzoglou

p p p p p

Uses patterns instead of k-mers• BlastZ http://www.psc.edu/general/software/packages/blastz/

Uses patterns, good for finding genes• Typhon http://typhon.stanford.edu

Uses multiple alignments to improve sensitivity/speed tradeoff

Page 37: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

37

Example

Query: gattacaccccgattacaccccgattaca (29 letters) [2 mins]

Database: All GenBank+EMBL+DDBJ+PDB sequences (but no EST, STS, GSS, or phase 0, 1 or 2 HTGS sequences) 1,726,556 sequences; 8,074,398,388 t t l l tttotal letters

>gi|28570323|gb|AC108906.9| Oryza sativa chromosome 3 BAC OSJNBa0087C10 genomic sequence, complete sequence Length = 144487 Score = 34.2 bits (17), Expect = 4.5 Identities = 20/21 (95%) Strand = Plus / Plus

Query: 4 tacaccccgattacaccccga 24 ||||||| |||||||||||||

Sbjct: 125138 tacacccagattacaccccga 125158

Score = 34.2 bits (17),

Expect = 4 5 Identities = 20/21 (95%) Strand = Plus / Plus

CS262 Lecture 3, Win06, Batzoglou

Expect = 4.5 Identities = 20/21 (95%) Strand = Plus / Plus

Query: 4 tacaccccgattacaccccga 24||||||| |||||||||||||

Sbjct: 125104 tacacccagattacaccccga 125124

>gi|28173089|gb|AC104321.7| Oryza sativa chromosome 3 BAC OSJNBa0052F07 genomic sequence, complete sequence Length = 139823 Score = 34.2 bits (17), Expect = 4.5 Identities = 20/21 (95%) Strand = Plus / Plus

Query: 4 tacaccccgattacaccccga 24||||||| |||||||||||||

Sbjct: 3891 tacacccagattacaccccga 3911

Example

Query: Human atoh enhancer, 179 letters [1.5 min]

Result: 57 blast hits1. gi|7677270|gb|AF218259.1|AF218259 Homo sapiens ATOH1 enhanc... 355 1e-95 2. gi|22779500|gb|AC091158.11| Mus musculus Strain C57BL6/J ch... 264 4e-68 3. gi|7677269|gb|AF218258.1|AF218258 Mus musculus Atoh1 enhanc... 256 9e-66 4. gi|28875397|gb|AF467292.1| Gallus gallus CATH1 (CATH1) gene... 78 5e-12 5. gi|27550980|emb|AL807792.6| Zebrafish DNA sequence from clo... 54 7e-05 6. gi|22002129|gb|AC092389.4| Oryza sativa chromosome 10 BAC O... 44 0.068 7. gi|22094122|ref|NM_013676.1| Mus musculus suppressor of Ty ... 42 0.27 8. gi|13938031|gb|BC007132.1| Mus musculus, Similar to suppres... 42 0.27

gi|7677269|gb|AF218258.1|AF218258 Mus musculus Atoh1 enhancer sequence Length = 1517 Score = 256 bits (129), Expect = 9e-66 Identities = 167/177 (94%),

Gaps = 2/177 (1%) Strand = Plus / Plus

CS262 Lecture 3, Win06, Batzoglou

Query: 3 tgacaatagagggtctggcagaggctcctggccgcggtgcggagcgtctggagcggagca 62 ||||||||||||| ||||||||||||||||||| ||||||||||||||||||||||||||

Sbjct: 1144 tgacaatagaggggctggcagaggctcctggccccggtgcggagcgtctggagcggagca 1203

Query: 63 cgcgctgtcagctggtgagcgcactctcctttcaggcagctccccggggagctgtgcggc 122 |||||||||||||||||||||||||| ||||||||| |||||||||||||||| |||||

Sbjct: 1204 cgcgctgtcagctggtgagcgcactc-gctttcaggccgctccccggggagctgagcggc 1262

Query: 123 cacatttaacaccatcatcacccctccccggcctcctcaacctcggcctcctcctcg 179 ||||||||||||| || ||| |||||||||||||||||||| |||||||||||||||

Sbjct: 1263 cacatttaacaccgtcgtca-ccctccccggcctcctcaacatcggcctcctcctcg 1318 http://www.ncbi.nlm.nih.gov/BLAST/

Page 38: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

38

Examples:

• >sp|P48432|SOX2_MOUSE Transcription factor SOX‐2 OS=Mus musculus GN=Sox2 PE=1 SV=2 MYNMMETELKPPGPQQASGGGGGGGNATAAATGGNQKNSPDRVKRPMNAFMVWSRGQRRK MAQENPKMHNSEISKRLGAEWKLLSETEKRPFIDEAKRLRALHMKEHPDYKYRPRRKTKTMAQENPKMHNSEISKRLGAEWKLLSETEKRPFIDEAKRLRALHMKEHPDYKYRPRRKTKT LMKKDKYTLPGGLLAPGGNSMASGVGVGAGLGGGLNQRMDSYAHMNGWSNGSYSMMQEQL GYPQHPGLNAHGAAQMQPMHRYVVSALQYNSMTSSQTYMNGSPTYSMSYSQQGTPGMALG SMGSVVKSEASSSPPVVTSSSHSRAPCQAGDLRDMISMYLPGAEVPEPAAPSRLHMAQHY QSGPVPGTAKYGTLPLSHM

• ctattaactt gttcaaaaaa gtatcaggag ttgtcaaggc agagaagaga gtgtttgcaa aaagggaaaa gtactttgct gcctctttaa gactagggct gggagaaaga agaggagaga  gaaagaaagg agagaagttt ggagcccgag gcttaagcct ttccaaaaac taatcacaac

• http://blast.ncbi.nlm.nih.gov/

• http://genome.ucsc.edu/cgi‐bin/hgBlat?command=start

• http://genome.ucsc.edu/FAQ/FAQblat

Lessons learned?

• New searching technique: 

– Filter based on partial hits

– Refine the search on the candidate hits

• Statistical significance• Statistical significance

– Probability of a “good‐looking hit” increases when DB grows

Page 39: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

39

CS262 Lecture 3, Win06, Batzoglou

• Multiple alignment: find the alignment for t if t h d d th d ftens, if not hundreds or thousands of sequences

• Very importamt for actual biological interpretation, say describing protein families through the evolution.g

Page 40: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

40

• Relevant Citations

• Needleman, S.B. and Wunsch, C.D. A general method applicable to the g ppsearch for similarities in the amino acid sequence of two proteins. J Mol Biol. 48(3):443‐53 (1970).PubMed:5420325

• Smith, T.F. and Waterman, M.S. Identification of common molecular subsequences. J Mol Biol. 147(1):195‐7 (1981). PubMed:7265238

• Pearson, W.R. and Lipman, D.J. Improved tools for biological sequence comparison. Proc Natl Acad Sci U S A. 85(8):2444‐8 (1988). PubMed:3162770

• Altschul SF, Gish W, Miller W, Myers EW, Lipman DJ. Basic local alignment search tool. J Mol Biol. 215(3):403‐10 (1990). PubMed:2231712

• Evolution sets restrictions on possible mutations

• One needs to use substitution cost matrices that somehow reflect the evolutionary distance

• Links

– Distance Measures, edited by B.Golding, Feb 1996 web

– (Itshack Pe`er)

– Sequence alignment algorithms (Benjamin Corum)

– And some of them with local copies:

– Amino acids distancesAmino acids distances

– PAM matrices (Margaret Dayhoff)

– PAM units

– PAM matrices

– Amino acids distances

Page 41: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

41

Page 42: Text Algorithms (4AP) Biological measures of similarity

9.10.2008

42