First generation sequencing and pairwise alignment
Analysis of Biological Sequences 140.638
where do sequences come from?
DNA is not hard to extract (getting DNA from a strawberry is a classic elementary school project).The trick is to get a lot of DNA that has exactly the same sequence.
where do sequences come from?
Molecular Cell Biology. 4th edition. 2000
Holland-Frei Cancer Medicine. 5th edition. 2000
sequence-specific cleavage enzymes (restriction enzymes)
and PCR (polymerase chain reaction)
dye-terminator sequencing (sequencing by synthesis)
TGCAGAATTC*TGCAGAATTCA*TGCAGAATTCAG*TGCAGAATTCAGT*TGCAGAATTCAGTG*
smaller products come through the substrate first
dye-terminator sequencing (sequencing by synthesis)when fluorophore intensities are low, the identity of the base is unclear; this is reflected in the quality of the base
so now we have our sequence!
what is it? what does it do?
Two approaches: analyze intrinsic properties of the sequence look for similarities to already known sequences
Goals of sequence alignment
determine the function of an uncharacterized sequence• look for matches to protein-coding or noncoding sequences• look for conserved domains
find the mutational distance between sequences (for species characterization, forensics etc)
Steps in sequence alignment
• Obtain sequences• Align sequences• Score alignment• Is it significant, mathematically? Biologically?
Example alignment
PLSQETFSDLWKLL---PENNVLSPLPSQAMD---------DLMLSPDDIEQWFTEPLSQETF+ LW L +N L+ + +Q +D DL + + IE PLSQETFNQLWTTLGDITDNGNLTQIVTQPLDFSFSETGVADLDIHENRIEMEVER
human TP53 vs acorn worm genome
is this a statistically significant similarity?is this biologically significant?
Dot matrix analysis
The simplest, most visual, most intuitive way to create an alignment
Reference: Gibbs AJ, McIntyre GA. The diagram, a method for comparing sequences. Its use with amino acid and nucleotide sequences. Eur J. Biochem 1970 16(1):1-11.
Dot matrix alignment
PKD protein against itself
Dot matrix alignment
PKD vs itself with better parameters
Dot matrix alignment
• Lots of variations—can align DNA vs DNA, protein vs protein, many scoring schemes
• Sequence repeats and inverse repeats readily apparent• Can be used to find self-complementary portions of sequences (e.g. RNA)
to help predict secondary structure• Still used today—you will see it occasionally even in major papers
Elements of an alignment
ACC--TAGCTAGCCGAT-ACCCCTAGG----CGAAA
• Matches• Mismatches• Gaps/indels
• aligned vs unaligned: the relationship between these two sequences would likely be stored in three sections (the aligned pieces)
Creating alignments from scratch
Example: ACCTAGCTAGCCGATAnd ACCCCTAGGCGAAA
Possible alignment:ACC--TAGCTAGCCGAT-ACCCCTAGG----CGAAA
Choosing the best alignment
ACC--TAGCTAGCCGAT-ACCCCTAG---G-CGAAA
ACCTAGCTAGCCGAT-ACCC--CTAG-CGAAA
ACC--TAGCTAGCCGAT-ACCCC----TAGGCGAAA
Need Scoring Rules
For example: score = (#matches) - (#mismatches) - (#gaps)x2
ACC--TAGCTAGCCGAT-ACCCCTAG---G-CGAAA
ACCTAGCTAGCCGAT-ACCC--CTAG-CGAAA
ACC--TAGCTAGCCGAT-ACCCC----TAGGCGAAA
Score = 10 - 1 - 7x2 = -5
Score = 10 - 2 - 4x2 = 0
Score = 9 - 1 - 7x2 = -6
Need Scoring Rules
For example: score = 3x(#matches) - 4x(#mismatches) - (#gaps)
ACC--TAGCTAGCCGAT-ACCCCTAG---G-CGAAA
ACCTAGCTAGCCGAT-ACCC--CTAG-CGAAA
ACC--TAGCTAGCCGAT-ACCCC----TAGGCGAAA
Score = 3x10 - 4x1 - 7 = 19
Score = 3x10 - 4x2 - 4 = 18
Score = 3x9 - 4x1 - 7 = 16
Global alignment: Needleman-Wunsch algorithm (Gotoh)
Dynamic programming: achieve optimal alignment by constructing optimal alignments of smaller subsequences
Assume that the optimal alignment is known up to a point, and then extend the alignment optimally to create a new optimal alignment
Global alignment: Needleman-Wunsch-Gotoh
Algorithm:
ACTTGAA CACA| ||| |AGTTGTA CTCA
ACTTGAAC ACA| ||| ||AGTTGTAC TCA
ACTTGAAC ACA| ||| |AGTTGTA- CTCA
ACTTGAA- CACA| ||| |AGTTGTAC TCA
Dynamic programming algorithm: example
DNA alignment rules: match = 2, mismatch = -1, gap = -2
Global alignment: start at the beginning of the sequences and progress to the end
Score of the alignment = score of the alignment up to the previous character + maximum score of aligning the next two symbols or adding a gap in either sequence.
Implementation: dynamic programming
- A C C T G
- 0 -2 -4 -6 -8 -10
A -2
C -4
T -6
T -8
G -10
rules: match +2
mismatch -1 gap -2
Cross vertical line = put gap in sequence B Cross horizontal line = put gap in sequence A
Cross at an intersection = align two residues
Implementation: dynamic programming
- A C C T G
- 0 -2 -4 -6 -8 -10
A -2 2
C -4
T -6
T -8
G -10
rules: match +2
mismatch -1 gap -2
Cross vertical line = put gap in sequence B Cross horizontal line = put gap in sequence A
Cross at an intersection = align two residues
Implementation: dynamic programming
- A C C T G
- 0 -2 -4 -6 -8 -10
A -2 2 0
C -4 0
T -6
T -8
G -10
rules: match +2
mismatch -1 gap -2
Cross vertical line = put gap in sequence B Cross horizontal line = put gap in sequence A
Cross at an intersection = align two residues
Implementation: dynamic programmingrules:
match +2 mismatch -1
gap -2A C
A 2 0
C 04 -2-2
- A C C T G
- 0 -2 -4 -6 -8 -10
A -2 2 0
C -4 0 4
T -6
G -8
G -10
Implementation: dynamic programming Backtracking step
- A C C T G
- 0 -2 -4 -6 -8 -10
A -2 2 0 -2 -4 -6
C -4 0 4 2 0 -2
T -6 -2 2 3 4 2
G -8 -4 0 1 2 6
G -10 -6 -2 -1 0 4
rules: match +2
mismatch -1 gap -2
Implementation: dynamic programming Backtracking step
GTCCAGGTCA
G-TCCAGGT-CA
G-TCCAGGTC-A
-GTCCAGGTC-A
-GTCCAGGT-CA
- A C C T G
- 0 -2 -4 -6 -8 -10
A -2 2 0 -2 -4 -6
C -4 0 4 2 0 -2
T -6 -2 2 3 4 2
G -8 -4 0 1 2 6
G -10 -6 -2 -1 0 4
Reference
Needleman and Wunsch, “A general method applicable to the search for similarities in the amino acid sequence of two proteins” J. Mol. Biol. (1970) 48:443-453
(available through PubMed)
Local alignment
A local alignment between two sequences is an alignment with maximum similarity between a substring of sequence a and a substring of sequence b
Smith and Waterman, “Identification of Common Molecular Subsequences,” J. Mol Biol. (1981) 147:195-197 (available through PubMed)
Local alignment: Smith-Waterman
• Exactly the same algorithm as NWG except that if the score drops below zero, the alignment is terminated.
• This means that subsequences can be aligned optimally, without incurring penalties from surrounding irrelevant sequence that aligns badly
• Can end up with more than one optimal alignment, and the same piece of sequence can have more than one alignment to the other sequence
Local alignment: Smith-Waterman
Algorithm:
ACTTGAA CACA| ||| |AGTTGTA CTCA
ACTTGAAC ACA| ||| ||AGTTGTAC TCA
ACTTGAAC ACA| ||| |AGTTGTA- CTCA
ACTTGAA- CACA| ||| |AGTTGTAC TCA
ACTTGAA CACA| ||| |AGTTGTA CTCA
Implementation: dynamic programming for local alignment
rules: match +2
mismatch -1 gap -2
A C
A 2 0
C 04 -2-2
- A C C T G
- 0 0 0 0 0 0
A 0 2
C 0
T 0
G 0
G 0 XX
Implementation: dynamic programming for local alignment
- A C C T G
- 0 0 0 0 0 0
A 0 2 0 0 0 0
C 0 0 4 2 0 0
T 0 0 2 3 4 2
G 0 0 0 1 2 6
G 0 0 0 0 0 4
rules: match +2
mismatch -1 gap -2
Implementation: dynamic programming for local alignment
- A C C T G
- 0 0 0 0 0 0
A 0 2 0 0 0 0
C 0 0 4 2 0 0
T 0 0 2 3 4 2
G 0 0 0 1 2 6
G 0 0 0 0 0 4
rules: match +2
mismatch -1 gap -2
GTCCAGT-CA
GTCCAGTC-A
Local vs global
• Scoring matrix or match/mismatch scores will determine whether a local alignment is obtained
• Needleman-Wunsch can return a local alignment depending on the weighting of end gaps and other scoring parameters
• Look at alignment: if there are long internal gaps, the alignment is local• The best way to tell what’s going on is to align random or unrelated
sequences under the same conditions (next lecture)
Local vs global
- A C T
-
A
C
0 -2 -4 -6
-2 2 0 -2
-4 0 4 2
rules: match +2 mismatch -1 gap -2
Local vs global
- A C T
-
A
C
0 0 0 0
0 2 0 0
0 0 4 2
rules: match +2 mismatch -1 gap -2
Scoring rules/matrices
Why are they important?• Choice of scoring rule can dramatically influence the sequence
alignments obtained and, therefore, the analysis being done• Different scoring matrices have been developed for different
situations; using the wrong one can make a big difference (choosing the wrong sequence as a potential functional ortholog, for example)
Scoring rules/matrices
What do they mean?• Your goal is to figure out whether the two sequences have a
common ancestor• Scoring matrices implicitly represent a particular theory of
evolution• Elements of the matrices reflect significance of co-occurence of
each pair of amino acid residues or nucleotides
Substitution Matrices
We need scoring terms for each aligned residue pairModels: Random model (R): letter a occurs with frequency qa
Substitution Matrices—random model
ACCTGCC|| | |ACGTCCA
p(A)= 0.2p(T)= 0.2p(C)= 0.3p(G)= 0.3
x = ACCTGCCy = ACGTCCA
Substitution Matrices—match model
Models: Match model (M): aligned pairs of residues have joint probability pabpab=probability that a and b came from common ancestor residue
Substitution Matrices
Odds ratio:
=
=
Substitution Matrices
Change to a sum by using logarithms . . .
Score =
Where s(a,b) is just the score of aligning a residue of type a to a residue of type b
Substitution Matrices
s(a,b)
A G M Y
A 4 0 -1 -3
G 0 6 -3 -2
M -1 -3 5 -1
Y -3 -2 -1 11
Substitution Matrices
s(a,b)
A G M Y
A 4 0 -1 -3
G 0 6 -3 -2
M -1 -3 5 -1
Y -3 -2 -1 11
=
=
MAGAMAGY score = 12
Two major scoring matrices
PAM = accepted point mutation• derived from 71 trees with 1572 accepted mutations,
sequences with >85% identity• “accepted” means new amino acid doesn’t disrupt the
protein’s function too severely
BLOSUM = Blocks substitution matrices• Based on BLOCKS database (Henikoff & Henikoff, 1992) of
over 2000 conserved amino acid patterns in over 500 proteins
PAM overview
based on well-accepted phylogenetic trees
STTWC
SSTWCSTTPC
STTPC
observations: one S/T change between close relatives, one P/W change over distant branches, no change from C
BLOSUM overview
based on alignments of known protein motifs, evolutionary relationship unknown
STTWCSSTWCSTTPCSTTWC
observations: three T/S mismatches, three P/W mismatches, no change from C
PAM matrices
• Each matrix describes changes expected for a given period of evolutionary time (measured by expected similarity of proteins)
• Count # of changes to each amino acid in the phylogenetic group and divide by the “exposure to mutation” of the residue
• Exposure to mutation = frequency of occurrence of amino acid * #amino acid changes in the group/100 sites
PAM matrices—assumptions
• P(X->Y) = P(Y->X)• P(X->Z->Y) is low in a single PAM period• changes are independent across time• neighboring amino acids have no influence on probability of
substitution• All sequences have similar amino acid composition
BLOSUM
Henikoff & Henikoff used PROTOMAT program to create BLOCKS database from Prosite catalog of aligned proteins
PROTOMAT looks for A1-d1-A2-d2-A3 where A1, A2, A3 are conserved residues and d1,d2 < 25 residue intervening sequence
BLOSUM construction1. Count mutations
VVAPV AAAPA PVAPV PAAAV
NAA = 0+1+6+0+0 = 7 NVV = 0+1+0+0+3 = 4 NPP = 1+0+0+3+0 = 4 NAV = 1+4+0+0+3 = 8 NAP = 2+0+0+3+0 = 5 NPV = 2+0+0+0+0 = 2
BLOSUM construction2. Tallying mutation frequencies
qij = # times amino acid j mutates to amino acid iSince we don’t know ancestry, each mutation gets entered twice
VVAPV AAAPA PVAPV PAAAV
qij A V P
A 14 8 5
V 8 8 2
P 5 2 8
qAA = 14 qAV = qVA = 8
BLOSUM construction3. Matrix of mutation probabilities
• Create probabilities from mutation frequencies by dividing by total number of observations (60)
pij A V P
A 14/60 8/60 5/60
V 8/60 8/60 2/60
P 5/60 2/60 8/60
BLOSUM construction4. Calculate probability of observing each residue
pi is the marginal probability, meaning the expected probability of occurrence of amino acid i
VVAPV AAAPA PVAPV PAAAV
pi
A 9/20
V 6/20
P 5/20
BLOSUM construction5. Obtaining a BLOSUM matrix
BLOSUM is a log-likelihood matrix: Sij = 2log2(pij/(pipj))
Sij A V P
A 0.41
V -0.04 1.13
P -0.87 -2.34 2.19
AAPVA APPVA
Choice of matrix
High PAM numbers (up to PAM250) are derived from multiplying lots of PAM1 matrices.Low BLOSUM numbers (down to BLOSUM 30) come from very similar sequence blocks
Long sequences and sequences from very distantly related organisms should be aligned with high PAM or low BLOSUM #s.
The best alignments between sequences with high similarity come from high BLOSUM or low PAM numbers.
BLOSUM vs PAM
BLOSUM: based on short conserved sequences (blocks)• Based on a range of evolutionary periods• Each matrix constructed separately• Indirectly accounts for interdependence of residues• Range of sequences, range of replacements• Overcounts related mutations
PAM: evolutionary model• Based on extrapolation from a short evolutionary period• Errors in PAM1 are magnified through PAM250• Assumes Markov process• Many sequences depart from average composition• Rare replacements too infrequent to be represented accurately
Issues
Both BLOSUM and PAM matrices are derived from small sets of sequences from biased databases
Both types of matrices require aligned sequences for their construction
Both types of matrices depend on global, ungapped alignments