6.4.3 · HinglishBioinformatics & Computational Biology

Explain sequence alignment (pairwise, multiple)

1,942 words9 min readRead in English

6.4.3 · Biology › Bioinformatics & Computational Biology


1. Alignment exactly kya hota hai?

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)

2. Scoring: biology ko numbers mein convert karna


3. Needleman–Wunsch ko scratch se derive karna

Hume aur 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:

  1. aligned with (match/mismatch)
  2. aligned with a gap
  3. 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 = prefixes aur 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.

Figure — Explain sequence alignment (pairwise, multiple)

4. Worked example — pairwise (Needleman–Wunsch)

GATTACA region ko simplified align karo. Use GCAT, GTAT. Scoring: match , mismatch , gap (yaani 1 subtract karo).

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
  • kyu? G vs G = match, to ; gap options se better hai.
  • kyu? T vs T match: . Best.

Traceback 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.

5. Multiple Sequence Alignment (MSA)


6. Common mistakes (steel-manned)


7. Feynman + Mnemonic

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.


8. Active-recall flashcards

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.

9. Connections

  • Dynamic Programming — algorithmic backbone (optimal substructure).
  • BLOSUM and PAM matrices — jahan substitution scores 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.

Concept Map

homology hypothesis

inserts

column types

needs

residue scores

gap cost

prefers

end-to-end

best subregion

algorithm

algorithm

uses

relies on

Common ancestor

Sequence alignment

Gaps -

Match Mismatch Gap

Scoring scheme

Substitution matrix BLOSUM/PAM

Affine gap penalty

One long indel

Global alignment

Local alignment

Needleman-Wunsch

Smith-Waterman

Dynamic programming

Optimal substructure