Key Formulas & Code Examples
Bit Score: S' = (ฮปS โ ln K) / ln 2
E-value: E = K ร m ร n ร eโฮปS
m = query length, n = database length, K and ฮป are parameters
GC Content: GC% = (G + C) / (A + T + G + C) ร 100
Probability of error: P = 10โQ/10
s = substitution score, d = gap penalty
seq = "ATCGATCG"
counts = {base: seq.count(base) for base in "ATCG"}
# Output: {'A': 2, 'T': 2, 'C': 2, 'G': 2}
Core Concepts
Comparing DNA, RNA, or protein sequences to identify regions of similarity. Global alignment (Needleman-Wunsch) aligns entire sequences; local alignment (Smith-Waterman) finds the best matching subsequences.
Basic Local Alignment Search Tool โ compares a query sequence against a database. Uses seed words, extension, and statistical evaluation (E-value) to rapidly find significant matches.
Diagrams showing evolutionary relationships among species or genes. Built using distance methods (UPGMA, Neighbor-Joining) or character-based methods (Maximum Parsimony, Maximum Likelihood, Bayesian).
Reconstructing complete genomes from short sequencing reads. De Bruijn graph methods (Velvet, SPAdes) break reads into k-mers and reconstruct paths through the graph.
Prediction and analysis of 3D protein structures. Homology modeling, ab initio prediction, and molecular dynamics simulations (GROMACS, AMBER) study protein folding and interactions.
Core Definitions
Worked Examples
A BLAST hit with bit score S = 50, ฮป = 0.267, K = 0.041, m = 200, n = 10โท:
E = 0.041 ร 200 ร 10โท ร eโ0.267ร50 โ 0.041 ร 2ร10โน ร eโ13.35 โ ~10โปโด (significant)
Sequence: ATGCGCTA (3 G/C out of 8 bases)
GC% = 3/8 ร 100 = 37.5%
High GC content indicates thermostability (three H-bonds in G-C pairs).
If a base has Phred Q = 30: Perror = 10โ30/10 = 10โ3 = 0.001
Accuracy = 99.9%. Q20 = 99% accuracy, Q30 = 99.9% accuracy.
Practice Problems
Answer: GC% = 5/13 ร 100 = 38.5%
Answer: Position 3: Cโ G, Position 5: Aโ C. Distance = 2
Answer: Yes. E = 0.001 means we expect 0.001 random hits of this quality by chance. Below the standard 0.05 threshold.
Answer: Orthologs diverged through speciation (same gene in different species). Paralogs diverged through gene duplication (different genes in same genome).
Answer: Total bases = 90M ร 150 = 13.5 billion. Coverage = 13.5B / 3B = 45ร