Behind the Build
Building an ORF Finder: Where Biology Meets Code
How a bioinformatics assignment became one of my favorite projects — and why translating DNA is just a lookup table with extra steps.
Before I was a software engineer, I was a biology student staring at sequences. Not the kind of sequences most developers think about — not arrays or linked lists — but long strings of four letters: A, T, G, and C. DNA. The code that runs living things.
One of the fundamental problems in genomics is figuring out where the genes are. DNA is one continuous strand of nucleotides, and buried inside it are the instructions for making proteins. But there are no line numbers, no syntax highlighting, no comments. You have to find the patterns yourself.
What’s an Open Reading Frame?
An Open Reading Frame (ORF) is a stretch of DNA that could encode a protein. The rules are simple: it starts with a start codon (ATG) and ends with a stop codon (TGA, TAA, or TAG). Everything in between gets read in groups of three nucleotides — codons — each of which maps to an amino acid. String the amino acids together and you have a protein.
The catch is that DNA can be read starting at any of three positions. Shift the reading frame by one nucleotide and the same stretch of DNA encodes a completely different set of codons, and therefore a completely different protein (or more likely, gibberish). So you need to scan all three frames: +1, +2, and +3.
DNA: A T G C C G T A A G C T ...
Frame +1: [ATG][CCG][TAA] ← stop codon, ORF ends
Frame +2: [TGC][CGT][AAG][CT...
Frame +3: [GCC][GTA][AGC][T...
Same DNA, three completely different readings.The Original: Perl and Bioinformatics
I wrote the original ORF Finder in Perl — which, if you’re under 30, might sound like an odd choice. But Perl was the language of bioinformatics for decades. BioPerl, the Human Genome Project, NCBI tools — all Perl. It’s built for text processing, and DNA analysis is essentially text processing at scale.
The algorithm is a state machine. For each reading frame, you walk through the DNA three nucleotides at a time. If you’re not in an ORF, you watch for ATG. Once you see it, you flip a flag, start counting codons, and begin translating. When you hit a stop codon, you check if the ORF is long enough to care about (the original script uses 100 codons as the threshold). If it is, you report it. If not, you reset and keep scanning.
for (let frame = 0; frame < 3; frame++) {
let inORF = false;
let orfLength = 0;
for (let i = frame; i <= dna.length - 3; i += 3) {
const codon = dna.substring(i, i + 3);
if (!inORF) {
// Watching for a start codon
if (codon === 'ATG') {
inORF = true;
orfLength = 1;
}
} else {
// Inside an ORF — translate or stop
if (STOP_CODONS.has(codon)) {
if (orfLength >= minimumCodons) {
// Report this ORF
}
inORF = false;
} else {
aminoSeq += CODON_TABLE[codon];
orfLength++;
}
}
}
}Translation: Biology’s Lookup Table
The most satisfying part of this project is the codon table. Every three-letter combination of A, T, G, and C maps to one of 20 amino acids (or a stop signal). There are 64 possible codons but only 20 amino acids, so the code is degenerate — multiple codons map to the same amino acid. For example, CTT, CTC, CTA, and CTG all encode Leucine (L).
In code, this is just a hash map. In biology, it’s the result of four billion years of evolution. The fact that you can represent one of nature’s most fundamental processes as a 64-entry dictionary is, honestly, one of the coolest things about working at the intersection of biology and computer science.
Porting It to the Web
The original Perl script reads from a file and prints to stdout. For the web version, I ported the algorithm to TypeScript and built a UI where you can paste any DNA sequence — raw or FASTA format — adjust the minimum ORF length, and see the results instantly. Each ORF is displayed with its reading frame, position, length, and the full translated amino acid sequence.
The input handler strips FASTA headers (lines starting with >), removes whitespace and digits, validates that only A/T/G/C remain, and then feeds the cleaned sequence into the same triple-frame scanner. It’s the kind of data cleaning pipeline that bioinformatics demands — real-world sequence data is messy, and your tool needs to handle it gracefully.
Why This Project Matters to Me
This isn’t the flashiest thing in my portfolio. It’s not a game, it doesn’t have animations, and most people won’t know what an ORF is. But it represents something important: the overlap between my biology background and my engineering work. I studied molecular biology because I was fascinated by how living systems encode information. I became a software engineer because I wanted to build tools that work with that information.
The ORF Finder is where those two halves meet. It’s a real bioinformatics tool that solves a real problem, written first in the traditional language of the field (Perl) and now available as an interactive web tool. If you’re a biology student, try pasting your sequence above. If you’re a developer, check out the source on GitHub — the original Perl is beautifully concise, and the TypeScript port shows how the same logic translates across languages and decades.
Ivan Pedroza
Software Engineer — Seattle, WA