6.4.3 · Biology › Bioinformatics & Computational Biology
Intuition Ek saans mein core idea
Do DNA/protein sequences jo ek common ancestor se aayi hain unhe abhi bhi "line up" hona chahiye — lekin evolution ne letters insert, delete, aur swap kar diye hain. Alignment ka kaam hai sequences ko ek doosre ke upar slide karna aur gaps insert karna taaki matching letters ki sankhya maximise ho aur biological kahani (mutations, indels) saaf dikhaye.
KYU yeh zaroori hai: alignment quantify karta hai ki do sequences kitni related hain, conserved functional regions dhundhta hai, aur hume family trees banane deta hai.
KYA produce hota hai: letters aur dashes (-) wali sequences ki ek stack, plus ek score .
KAISE : optimal pairwise alignment ke liye dynamic programming; multiple ke liye heuristics/progressive methods.
Definition Sequence alignment
Sequences ka ek alignment ek aisa arrangement hai, ek ke neeche doosra, jisme gap characters (-) insert kiye ja sakte hain taaki har column us column ke residues ki homology (shared ancestry) ke baare mein ek hypothesis represent kare.
Teen column types:
Match — same letter (jaise A / A)
Mismatch — alag letters, yaani ek substitution (jaise A / G)
Gap — ek letter jo - se aligned hai, yaani ek insertion or deletion (indel)
Definition Global vs Local
Global alignment sequences ko end-to-end align karta hai (best for sequences of similar length & full-length homology). Algorithm: Needleman–Wunsch .
Local alignment best-matching sub-region dhundhta hai, poorly matching ends ko ignore karta hai (best for finding a domain inside a big protein). Algorithm: Smith–Waterman .
Intuition KYU scoring scheme?
Computer ko alignments ko rank karna hota hai. Isliye hum matches ko reward karte hain, mismatches aur gaps ko penalise karte hain. Penalties biology encode karti hain: ek random mutation common hai, lekin ek bada deletion rarer hai — isliye gaps zyada cost karte hain.
Definition Scoring scheme
s ( a , b ) = letter a ko b se align karne ka substitution score (proteins ke liye BLOSUM/PAM jaise matrix se, ya DNA ke liye simple + 1/ − 1 ).
Gap penalty. Linear : cost = g ⋅ L length L ke gap ke liye. Affine : cost = o + e ⋅ ( L − 1 ) , jahan o = gap-open , e = gap-extend , with o > e .
Intuition KYU affine gaps?
Ek single 5-base deletion ek biological event hai, paanch nahin. Ek baar bada opening cost charge karna, phir har base per sasta extension, model ko prefer karwata hai ek lamba gap over many scattered short ones — jo reality se match karta hai.
Hume X = x 1 … x m aur Y = y 1 … y n ka optimal global alignment chahiye.
Key insight (optimal substructure): kisi bhi alignment ke last column ko dekho. Yeh exactly teen cases mein se ek hoga:
x m aligned with y n (match/mismatch)
x m aligned with a gap
y n aligned with a gap
Us last column se pehle jo bhi aata hai woh khud shorter prefixes ka optimal alignment hai. Yahi property dynamic programming ko kaam karne deti hai.
Maano F ( i , j ) = prefixes x 1 … x i aur y 1 … y j ke best alignment ka score.
Traceback KAISE kaam karta hai: har cell mein yaad rakho ki teen cases mein se kaun jeeta; un arrows ke peeche chalte jao. Ek diagonal arrow → match/mismatch column; up/left → gap column.
GATTACA region ko simplified align karo. Use X = GCAT, Y = GTAT. Scoring: match + 1 , mismatch − 1 , gap g = 1 (yaani 1 subtract karo).
F banao (rows = X letters G,C,A,T; cols = Y letters G,T,A,T):
–
G
T
A
T
–
0
-1
-2
-3
-4
G
-1
1
0
-1
-2
C
-2
0
0
-1
-2
A
-3
-1
-1
1
0
T
-4
-2
0
0
2
F ( 1 , 1 ) = 1 kyu? G vs G = match, to F ( 0 , 0 ) + 1 = 1 ; gap options ( − 2 ) se better hai.
F ( 4 , 4 ) = 2 kyu? T vs T match: F ( 3 , 3 ) + 1 = 1 + 1 = 2 . Best.
Traceback F ( 4 , 4 ) = 2 se:
G C A T
G - A T → G C A T
G _ A T (final)
Ek optimal alignment (score 2):
G C A T
G T A T
Yeh step (T-A-T end) kyu? Diagonal chain of matches G…A…T dominate karti hai; C/T column woh ek mismatch hai jo hum accept karte hain kyunki gap force karna zyada cost karta hai.
Intuition KYU NW ko 3+ sequences tak extend nahin karte?
k sequences ke liye exact DP ko k -dimensional table chahiye → cost ∼ O ( L k ) , exponential. 20 proteins ko optimally align karna computationally impossible hai. Isliye hum heuristics use karte hain.
Definition Progressive alignment (workhorse, jaise Clustal, MUSCLE, MAFFT)
Sab pairwise alignment scores compute karo → distances.
Ek guide tree banao (quick clustering, jaise neighbour-joining) taaki most-similar sequences pehle group hon.
Tree ke order mein sequences/profiles ko align karo: closest pair pehle, phir progressively zyada add karte jao, profile-to-profile align karte hue.
Intuition KYU guide tree?
Easy (similar) sequences pehle align karna kam early mistakes karta hai. Gap jo pehle place ho jaata hai woh frozen ho jaata hai ("once a gap, always a gap") — isliye tum chahte ho ki tumhare sabse trustworthy decisions pehle lock ho jaayein.
Definition Sum-of-Pairs (SP) score
MSA ki quality aksar column-wise measure ki jaati hai jaise SP = ∑ columns ∑ i < j s ( a i , a j ) — har column mein har pair of sequences ke sab pairwise scores ka total.
Common mistake "Local vs global sequence length ke baare mein hai."
Kyu sahi lagta hai: local alignment aksar short queries vs long databases par use hota hai, isliye length trigger lagti hai.
Fix: asli distinction yeh hai ki sequences ka kitna hissa homologous hone ki umeed hai. Global use karo full-length similar sequences ke liye; local jab sirf ek sub-region (ek domain, ek motif) shared ho — length ki parwah kiye bina.
Common mistake "Zyada raw alignment score hamesha matlab zyada related."
Kyu sahi lagta hai: score literally hamara optimisation target hai.
Fix: raw score length aur composition par depend karta hai. Statistical significance (E-value / bit score ) batata hai ki match chance se better hai ya nahin.
Common mistake "Progressive MSA optimal alignment deta hai."
Kyu sahi lagta hai: yeh ek clean answer produce karta hai jo authoritative lagta hai.
Fix: yeh ek greedy heuristic hai. Early gap errors propagate hoti hain ("greedy, frozen gaps"). Iterative refinement (MUSCLE, MAFFT) isko reduce karne ke liye subgroups ko re-align karta hai.
Common mistake "Linear gap penalties use karo — simpler theek hai."
Kyu sahi lagta hai: linear code karna aur reason karna easy hai.
Fix: linear penalties bahut saare tiny gaps scatter karti hain, ek real indel event ko galat represent karti hain. Affine gaps (o > e ) biology ko kahin better model karte hain.
Recall Ek 12-saal ke bacche ko explain karo (click to reveal)
Socho do dost ek hi lambi sentence haath se copy kar rahe the, lekin dono ne typos kiye aur kabhi kabhi words skip ya add kar diye. Yeh dekhne ke liye ki unki copies kitni similar hain, tum sentences ko side by side slide karte ho aur jahan ek ne word skip kiya, wahan ek blank box (-) chhod dete ho. Tab tak slide karo jab tak sabse zyada words line up na ho jaayein. Line-up words count karna = score. Sirf do logon ke liye yeh karna pairwise hai; poori classroom ki copies ek saath line up karna multiple hai — aur yeh itna mushkil hai ki hum pehle sabse similar doston ko pair karte hain, phir baaki ko ek ek karke add karte hain.
Mnemonic Do algorithms yaad karo
N eedleman = N ationwide (gl obal, ends included). S mith = S mall s pot (loc al, best patch). Aur gaps: "Darwaza ek baar kholo, phir saste mein andar aate jao" = affine gap (bada open o , chhota extend e ).
Ek gap column kaunsa biological event represent karta hai? Ek sequence mein doosre ke relative ek insertion ya deletion (indel).
Kaun sa algorithm optimal GLOBAL pairwise alignment deta hai? Needleman–Wunsch (dynamic programming, end-to-end).
Kaun sa algorithm optimal LOCAL alignment deta hai aur uska key extra rule kya hai? Smith–Waterman; yeh 0 ke saath max add karta hai taaki scores negative na ho sakein, buri regions reset ho jaayein.
Needleman–Wunsch recurrence batao. F(i,j)=max{ F(i-1,j-1)+s(x_i,y_j), F(i-1,j)-g, F(i,j-1)-g }.
Linear ki jagah affine gap penalties kyu use karte hain? Ek indel ek single event hai; affine (open o, extend e, o>e) ek lamba gap prefer karta hai over many short ones, biology se match karta hai.
Hum DP extend karke MSA optimally kyu nahin solve kar sakte? k sequences ke liye cost O(L^k) hai — exponential, computationally infeasible.
Progressive alignment ke 3 steps batao. 1) sab pairwise distances, 2) guide tree banao, 3) most similar se progressively profile-to-profile align karo.
"Once a gap, always a gap" problem kya hai? Progressive MSA mein pehle place kiye gaye gaps frozen ho jaate hain aur errors propagate hoti hain; iterative refinement se fix hota hai.
Sum-of-Pairs score kya hai? Sab columns mein har pair of sequences ke pairwise substitution scores ka sum.
Global vs local — asli deciding factor kya hai? Sequences ka kitna hissa homologous hone ki umeed hai (poora vs sub-region), unki length nahin.
Dynamic Programming — algorithmic backbone (optimal substructure).
BLOSUM and PAM matrices — jahan substitution scores s ( a , b ) aate hain.
BLAST — database search ke liye heuristic local alignment (E-values).
Phylogenetic Trees — MSA unhe banane ka input hai; guide trees MSA seed karte hain.
Hidden Markov Models — profile HMMs MSA scoring ko generalise karte hain.
Homology and Orthology — biological meaning jo alignment infer karne ki koshish karta hai.
Substitution matrix BLOSUM/PAM