BIO-5-3
Situate modern ML in bioinformatics honestly
Search for "AI in biology" and you will drown in both directions of hype. One camp says machine learning has solved biology. The other says it is curve fitting in a lab coat. Both are wrong, and a working bioinformatician has to hold the honest middle: machine learning has genuinely changed what is answerable, and it has changed nothing about what counts as an answer. Here is the one sentence to keep for the whole lesson. ML predicts, biology validates.
You already have the pieces to see why. Nearly everything in this space is a function approximator (a model that learns a mapping from inputs to outputs by fitting many labeled examples) trained on omics features: sequences, methylation profiles, expression vectors. A programmer meets that idea already housebroken. The trouble is not the modeling. It is that biology quietly breaks the assumptions a programmer's intuition leans on.
Where ML genuinely helps
Three jobs where learned models earn their place, and one reason underneath all three. Each is a mapping from sequence to some property that nobody can write down by hand but that we can collect many labeled examples of. That is the exact shape supervised learning fits: show the model inputs paired with known correct outputs, and let it fit the function between them.
Variant-effect prediction. Recall the mutation types from S7.1. A single base change can be silent, missense, or nonsense. Knowing a variant is missense does not tell you whether it is harmless or disease-causing. The map from "this exact amino-acid change in this exact protein" to "damaging or benign" is a huge high-dimensional function no one can write out, but we have databases of variants already labeled benign or pathogenic. So you learn the function. Older tools (SIFT, PolyPhen) leaned on conservation and hand-built features. Newer ones (protein language models like ESM, and AlphaMissense) learn from evolutionary patterns across millions of sequences. All of them emit a score, a ranked guess, not a verdict.
Structure prediction. This is the famous one, and the callback is S4.2: a protein's amino-acid sequence determines its 3D fold, but the number of shapes a chain could adopt is astronomical (Levinthal's estimate), so simulating the physics to find the real one was, for fifty years, mostly hopeless. AlphaFold changed the result, and it is worth being precise about what changed, because the lesson generalizes. Three things arrived together. Decades of experimentally solved structures had piled up in the Protein Data Bank, giving tens of thousands of labeled sequence-to-shape examples. The decisive input feature turned out to be evolutionary: line up a protein's relatives (a multiple sequence alignment, from BIO-3), and pairs of positions that mutate together are almost always touching in the folded shape, so co-evolution leaks 3D contact information into a 1D sequence. And a large attention-based network with serious compute could turn those signals into coordinates. AlphaFold did not solve the physics of folding. It learned the sequence-to-structure map from the data.
Expression modeling. Given a stretch of regulatory DNA (a promoter or enhancer), predict how strongly a gene is transcribed, or predict a cell's whole expression profile. Models like Enformer read long DNA windows and predict expression tracks. Same shape once more: a function from sequence to a measured quantity, learned from many examples.
The programmer's model, and where it cracks
The programmer's read on all three is comfortable, and the danger hides in the comfort. In ordinary software you write the function and it is correct by construction: you can read the code and reason about exactly what it does. Here the function is inferred from data you did not fully control, so it can be right for the wrong reasons, and you can never prove it correct, only measure it on held-out examples. That measurement is where biology sabotages the programmer's instincts, because biology's test set is rarely independent of its training set. That is not a footnote. It is the central failure mode, and it wears three faces.
Data leakage: the test set that already knows the answer
Data leakage is when information that would not be available at prediction time sneaks into training, inflating your measured accuracy above anything you will see in reality. In bioinformatics the classic form is homology leakage. Recall from BIO-3 that genes and proteins fall into families of close relatives (homologs) that share ancestry and therefore share sequence. If you randomly split a protein dataset into train and test, close relatives land on both sides. The model then scores brilliantly on the test set, but only because it memorized the family, not because it learned biology. Point it at a genuinely new fold and it collapses.
Read the two splitting strategies below and trace what each does to a family of near-identical proteins. This is an illustrative panel to reason about, not runnable code with a Run button.
# Two ways to split a labeled protein dataset into train and test.
# Only one gives an honest estimate of real-world performance.
def random_split(proteins, test_fraction):
# WRONG for biology: close relatives can land on both sides,
# so the model memorizes families and the test score is inflated.
shuffled = shuffle(proteins)
cut = int(len(shuffled) * (1 - test_fraction))
return shuffled[:cut], shuffled[cut:]
def homology_aware_split(proteins, clusters, test_fraction):
# RIGHT: cluster by sequence similarity first (say at 30 percent
# identity), then assign WHOLE clusters to train or test, so no
# test protein has a close relative sitting in the training set.
train, test = [], []
holdout = pick_clusters(clusters, test_fraction)
for p in proteins:
if cluster_of(p) in holdout:
test.append(p)
else:
train.append(p)
return train, test
# Same model, same data. The two splits can report accuracies that differ
# by tens of points. The homology-aware number is the one that predicts how
# the model behaves on a protein it has never seen a relative of.
Distribution shift: valid only near home
Distribution shift is when the data a model is deployed on comes from a different distribution than the data it trained on, so its learned mapping no longer applies. Training data is never a random sample of biology. It is a sample of what has been studied. Variant-effect predictors are trained mostly on well-characterized human proteins, so they generalize poorly to understudied proteins or non-human organisms. Risk models built from genome-wide association studies in European-ancestry cohorts predict measurably worse in other populations, a documented harm and not a hypothetical. AlphaFold is strongest on the kinds of proteins the Protein Data Bank is full of and weaker on membrane proteins, disordered regions, and truly novel folds.
Interpretability: right answer, unknown reason
A deep model hands you a number, not a mechanism. High accuracy on a benchmark is not a causal explanation, and in a field where you act on the answer (order a wet-lab experiment, counsel a patient) "right answer, unknown reason" is genuinely dangerous. Worse, you often cannot tell whether the model learned biology or an artifact. Recall the batch effects and confounders from BIO-5.2. A model can reach high accuracy by keying on a scanner batch or a sample-handling quirk that happens to correlate with the label in your dataset and evaporates in the next one. Interpretability is the ability to say why a model made a call, and without it, accuracy alone cannot separate "learned the signal" from "learned the confounder."
AlphaFold, held honestly
AlphaFold deserves its own honesty, because it draws hype from both sides.
ML predicts, biology validates
Here is the discipline that ties the module together. A machine-learning output in biology is a prioritized hypothesis, not a result. Its proper job is to rank candidates so the expensive, slow, truth-bearing work (the wet-lab experiment, the clinical study) points at the most promising ones first. Everything you learned earlier in BIO-5 applies with extra force here: a model that scores a million variants is making a million statistical claims (the multiple-testing pressure from BIO-5.1), and it inherits every batch effect and provenance gap from BIO-5.2. The prediction narrows the search. The experiment settles it. Swap that order and you will ship a very confident wrong answer.
Key terms
- supervised learning
- Fitting a function from inputs to outputs using many examples whose correct output is already known, which is the shape of variant-effect, structure, and expression prediction.
- variant-effect prediction
- Learning to score whether a specific mutation is damaging or benign from labeled variant databases, since the sequence-to-effect map is too complex to write by hand.
- structure prediction
- Predicting a protein's 3D fold from its sequence. AlphaFold learned this map from solved structures plus evolutionary co-variation, rather than simulating the physics.
- data leakage
- Information that would not be available at prediction time contaminating training, inflating measured accuracy. In biology its classic form is homology leakage from a random train/test split.
- distribution shift
- Deployment data drawn from a different distribution than the training data, so the learned mapping no longer holds. A model is valid only near the data it learned from.
- interpretability
- The ability to explain why a model made a call. Without it, high accuracy cannot be distinguished from a model that keyed on a batch artifact or confounder.
- validation
- The experimental confirmation of a prediction. In biology the ML output is a hypothesis to prioritize, and only a wet-lab or clinical result settles whether it is true.
Why co-evolution leaks structure into sequence
The trick behind modern structure prediction is worth internalizing because it recurs. Take a protein and gather many evolutionary relatives into a multiple sequence alignment. If two positions are physically in contact in the folded protein, a mutation at one that would break the contact is only tolerated when a compensating mutation appears at the other, so across the family those two columns mutate together in a correlated way. Statistically detectable correlation between alignment columns is therefore a shadow of 3D proximity cast onto the 1D sequence record. AlphaFold's power came partly from learning to read those shadows at scale. The honest edge: this is why the method is data-hungry for relatives, and why a protein with few known homologs (an orphan, or a fast-designed synthetic) gives the model far less to work with and a shakier prediction.
Check yourself
1. What best explains why AlphaFold succeeded at structure prediction where fifty years of physics simulation had struggled?
2. You train a variant classifier, split proteins randomly into train and test, and measure 95 percent accuracy. In production on a newly discovered protein family it performs barely better than chance. What most likely happened, and what fixes it?
3. A polygenic risk model was trained on a European-ancestry cohort and returns a confident score on a patient from a different population. What is the correct read?
4. A model flags a mutation as very likely pathogenic with high confidence. What is the scientifically correct next step?