TL;DR
Gene prediction is the job of finding the protein-coding stretches inside a genome, given only its DNA letters. A genome is billions of letters long, and most of it is not a gene, so the task is to find the few regions that are. Programs do this by looking for the start and stop signals of the genetic code and by scoring stretches with statistical models trained on known genes.
Builds on: Genetic Code, Hidden Markov Model · Leads to: Gene Expression, Sequence Alignment
Where it's used
Annotating a new genome. When a lab sequences a new bacterium, the raw output is a long string of letters with no labels. Gene prediction is the first step in turning it into a parts list, saying where each protein-coding gene starts and ends. Bacterial genomes are a few million letters long and are dense with genes.
Human and other eukaryotic genomes. The human genome has about 3 billion letters and, by current estimates, roughly 20,000 protein-coding genes. Most of the sequence is not coding. Many genes are broken into exons, the pieces that are kept in the message, with introns between them, the pieces that are cut out. The predictor must find the exons and join them correctly. Public annotation pipelines combine statistical predictions with evidence from RNA sequencing and from known proteins.
Metagenomics. Scientists sequence the DNA of a whole community of microbes from soil, seawater or a gut sample, without knowing which species are present. Gene prediction then has to work on many short, unlabelled pieces of many genomes at once. Finding enzymes in such samples can point to new industrial catalysts.
Clinical genetics. When a patient's DNA is sequenced, a variant such as a single-letter change only matters if it falls inside a coding exon. Reading the gene structure correctly is the first step in deciding which changes could affect a protein. This lesson is about how the computation works, not about interpreting any individual's results.
How it works
Take a tiny made-up stretch of 14 letters on one strand:
CCATGAAACCTTAG
- Find a start signal. The gene starts with the codon ATG, which the genetic code reads as methionine. Scanning from the left, the first ATG is at letters 3 to 5. Check: letters 3, 4 and 5 are A, T and G.
- Read in triplets. From the start, cut the sequence into groups of three letters, called codons, and translate each one. The next codons are AAA (lysine), CCT (proline) and TAG. Check: four codons cover letters 3 to 14, which is 12 letters.
- Stop at a stop signal. TAG is one of the three stop codons, with TAA and TGA. Reading stops here. Check: the open stretch from ATG to TAG has no stop codon in between, because the only stop found is the last one.
- Call it an open reading frame. The region from ATG to the stop is an open reading frame, or ORF: a run of codons with no stop in it. Check: it has three codons before the stop, so it is a candidate protein of three amino acids, Met-Lys-Pro.
- Score it. A three-codon ORF is too short to be trusted, because short stretches without stops are common by chance. A real predictor scores the candidate with a model of coding DNA, and it keeps only candidates that score well above what random sequence gets. The math section gives a simple log-odds version of this score, and the HMM view below describes the model that real gene finders use, a Hidden Markov Model.
flowchart LR
A["Raw DNA letters"] --> B["Find start codon ATG"]
B --> C["Read codons in triplets"]
C --> D{"Stop codon reached?"}
D -->|no| C
D -->|yes| E["Candidate ORF"]
E --> F["Score with statistical model"]
F --> G["Keep high-scoring genes"]
The math
Three quantities do most of the work: the chance of meeting a stop by accident, a score for each stretch, and the most likely labelling of the genome.
Step 1 and step 3 in symbols: how long a stop-free run is by chance
The three stop codons are TAA, TAG and TGA. If a codon's letters were random and equally likely, each codon would be a stop with probability , and a non-stop with probability .
For a run of codons with no stop in it, assuming each codon is independent of the others, the probability is
This assumes random letters, which is only roughly true. The formula shows the trend: longer stop-free runs become rarer fast, so a long ORF is more likely to be real.
Step 5 in symbols: a log-odds score
Let be the probability of base inside a gene and the probability of the same base outside genes. The score of a stretch is the sum of the per-base log-odds:
Here is the base-2 Logarithm, so is measured in bits. A positive score says the coding model explains the stretch better than the background model.
The HMM view
A gene finder does not score one stretch at a time. It runs a Hidden Markov Model with hidden states such as coding, noncoding, exon and intron. Each base is an observation produced by the current state, and the states move from one to another like a Markov chain. The transition probabilities say how often a gene ends or begins, and the Viterbi Algorithm finds the single most likely labelling of the whole sequence.
Worked examples
- Sequence:
CCATGAAACCTTAG, which has 14 letters. - First ATG: letters 3 to 5.
- Codons from letter 3: ATG, then AAA, CCT, TAG.
- Count the codons before the stop: ATG, AAA, CCT, then TAG as the stop. That is three coding codons and one stop.
- Translate: ATG is Met, AAA is Lys, CCT is Pro.
The predicted protein is Met-Lys-Pro. The stop codon is not an amino acid, so the protein has three residues.
Use the background model for every base. The coding model says , , , and .
- Per-base ratios: A gives , T gives , and G gives .
- Base-2 logs: , , and .
- The stretch ATGAAA has four A's, one T and one G. Add the logs: .
- The score is bits, which is positive.
The coding model explains ATGAAA better than the background, so this stretch leans toward being coding.
Suppose a candidate ORF has 100 codons with no stop, and assume random letters so that each codon avoids a stop with probability .
- Compute . Its natural log is .
- Exponentiate: .
- So about 0.8 percent of random sequences of this length would have no stop by chance.
A 100-codon ORF is therefore unusual, which is why length is a useful signal. Real genomes are not random, so this is one signal among several.
Try it: how likely is a 50-codon stop-free run under the same random model? Answer: has natural log , and , so about 9 percent.
Common mistakes and tradeoffs
Mistake 1: "Every ATG starts a gene." It is tempting to think the first ATG marks a gene. In fact ATG appears by chance all over the genome, and some genes use other start codons such as GTG or TTG in bacteria. The start is a candidate, and the gene model has to be checked as a whole.
Mistake 2: "A long open reading frame is always a gene." It is tempting to think any long ORF is real. In fact stop codons are rare in some genomes, especially GC-rich ones, and long spurious ORFs appear by chance. Overlapping ORFs on the opposite strand also occur. Length is evidence, not proof.
Mistake 3: "Read the genome in one frame and you have the gene." It is tempting to read a eukaryotic gene straight through. In fact introns interrupt the coding sequence, so the exons must be found and joined in order, with the signals at the intron edges. A pure ORF search misses these genes entirely.
Mistake 4: "A computer prediction is a finished annotation." It is tempting to trust the output. In fact predictions are checked against evidence: RNA-seq reads that cross exon boundaries, and matches to known proteins through Sequence Alignment. Combining the two is more accurate than either alone.
When to use each approach. For bacteria, where genes are dense and continuous, ORF-based and HMM-based predictors work well. For eukaryotes, use a gene model with splice signals and extra evidence. When there is no reference genome, as in metagenomics, the statistical model must do more of the work. Alternatives to pure prediction include aligning known protein sequences directly to the genome, which finds genes whose products are already known but misses new ones.
History
Early sequence data had no labels, and researchers first searched for long open reading frames by hand and with simple programs. The main idea was that a gene without stop codons for a long stretch is unlikely to be random. In the 1990s, statistical gene finders took over. GeneMark used separate statistical models for coding and noncoding DNA, and GENSCAN, released in 1997, was built on a Hidden Markov Model. Glimmer, released in 1998, used interpolated Markov models for bacterial genomes. The draft human genome in 2001 made eukaryotic gene finding a central problem, because the exon structure is far harder to predict than in bacteria. Gene prediction caught on because every new genome needs it, and the same methods now run across a very wide range of species.
Recap
- The genetic code gives start (ATG) and stop (TAA, TAG, TGA) signals, which define candidate open reading frames.
- A stop-free run gets rarer with length, so a long ORF is stronger evidence for a gene.
- A log-odds score compares a coding model with a background model, in bits per base.
- A hidden Markov model labels the whole sequence, and the Viterbi algorithm finds the most likely labelling.
Read next: Gene Expression for what the predicted gene does in the cell, Transcription for how the gene is copied into RNA, and Sequence Alignment for the evidence used to confirm a prediction.
Check yourself
QuestionWhich three codons are stop codons in the standard genetic code?Show answer
TAA, TAG and TGA. Reading a gene in triplets ends when one of them is reached.
QuestionA random sequence of 100 codons with no stop has a probability of about . Why is this a useful number?Show answer
It is the chance that a stop-free run of this length happens with random letters. Because it is small (about 0.8 percent), a long stop-free stretch is evidence that a real gene is present, not just a chance run.
QuestionWhy can a simple ORF search fail to find a eukaryotic gene?Show answer
Eukaryotic genes contain introns that interrupt the coding sequence, so a stop-free run is not the whole gene. The exons must be found and joined in order, which a plain ORF search does not do.
QuestionA stretch has per-base log-odds of , , and bits. What is its total score?Show answer
The sum is bits. The score is positive, so the coding model explains the stretch better than the background.