- Biotechnology: bioinformatics, biological data and the computer
What is sequence alignment?
Sequence alignment is lining up two or more DNA, RNA or protein sequences, letter under letter, so that as many positions as possible match, with gaps inserted where one sequence has letters the other lacks. Each alignment gets a score from its matches, mismatches and gaps; a high score and a high percent identity suggest the sequences share an ancestor and often a function.
The topic explained
Lining up letters to find a shared past
What is sequence alignment, and why is it the basic act of bioinformatics? When a gene is copied down the generations, letters change, a few are lost and a few are added, yet most stay. Two genes that come from the same ancestral gene, homologous genes, therefore still share much of their sequence. Sequence alignment finds that shared order by placing one sequence under the other so that identical letters fall in the same column.
Where one sequence has letters the other lacks, the alignment inserts a gap, written as a dash. A gap stands for an insertion in one sequence or a deletion in the other since they parted. A common misreading is that a gap is a missing piece of data. It is part of the answer: it says where the two histories differ.
Scoring an alignment by hand
Many alignments of the same two sequences are possible, so each is given a score. A simple scheme gives +1 for a match, −1 for a mismatch and −2 for each gap. Align the invented sequences ACGTTGCA and ACGTGCA. With a gap under the second T, ACGT-GCA, there are 7 matches, no mismatches and one gap: . Without a gap, the last letters slip out of step: 4 matches, 3 mismatches and one gap at the end, . The alignment with the higher score, the first, is preferred.
The percent identity is the share of aligned positions that are identical: here. Students often divide by the length of the shorter sequence instead; the identity must state what it was divided by, and here it is the length of the alignment, gaps included.
Global and local alignment
Trying every possible alignment by hand is impossible for long sequences, but computers use dynamic programming, which builds the best alignment from the best alignments of shorter pieces. In 1970 Saul Needleman and Christian Wunsch published a global method, which aligns two sequences along their whole length and suits sequences of similar length and similar throughout. In 1981 Temple Smith and Michael Waterman published a local method, which finds the best matching region and ignores the rest, the right choice when only one part, such as a shared domain of two proteins, is related.
Proteins are scored with a substitution matrix rather than plain matches. In BLOSUM62, published by Steven and Jorja Henikoff in 1992, replacing an amino acid with a chemically similar one loses few points or even gains, while a very different one costs more.
What an alignment can tell
High identity over a long alignment is strong evidence of a shared ancestor, and genes that share an ancestor often share a function, so an unknown gene can be given a first guess at its job. But similarity is evidence, not proof: some related proteins have changed their job, and the guess is tested in the laboratory. Alignment also guides the bench directly: lining up a gene from several species shows which positions never change, and those are the places a researcher targets when designing primers that should work in all of them, or avoids when planning a harmless mutation. The same scores, applied to millions of sequences at once, are what database searches such as BLAST rank their results by.
Practice: sequence alignment
For 11th grade biotechnology students. Use match +1, mismatch −1, gap −2 unless told otherwise. Show your counting, then check your answers.
Free, no sign-up. The answer key prints on the second page. Regenerating a new worksheet on the same topic needs a free account.
Count the matches and mismatches in this alignment, and calculate its score and percent identity.
What does the box marked with a question mark hold, and what does it mean in evolution?
Score both alignments of ACGTTGCA with ACGTGCA: with the gap after ACGT, and with no gap until the end. Which is better?
Why is a gap usually penalized more than a mismatch?
Which kind of alignment is shown in each pair, and when would you choose the lower one?
Two proteins are 90% identical over their whole length. Another pair is 30% identical over a short region only. What can you conclude about each?
Why does a substitution matrix like BLOSUM62 give some mismatches better scores than others?
Common questions
What is the difference between identity and similarity?
Identity counts positions with exactly the same letter. Similarity in proteins also counts positions where the amino acids differ but are chemically alike, so similarity is always at least as high as identity.
What is a multiple sequence alignment?
An alignment of three or more sequences at once, used to find positions that stay the same across many species, which often mark the parts of a protein essential to its work.
Who invented sequence alignment algorithms?
Needleman and Wunsch published a global method in 1970, often credited as the first use of dynamic programming in molecular biology, and Smith and Waterman a local one in 1981.
Does high similarity mean two genes do the same job?
Often, but not always. Related genes can take on new jobs over time, so a function suggested by alignment is a hypothesis to test in the laboratory.
Can I align sequences without programming?
Yes. Free web tools, such as those of the NCBI and EMBL-EBI, align two or more sequences in a browser and show the matches, gaps and scores.

Still have a question? Ask Lessi
Any question about this subject. Lessi answers right here, step by step.
Try asking
Asking needs a free account; your question is kept while you sign up. Answers are written by AI and can contain mistakes. Lessi doesn’t give medical or legal advice.
Learn it with a teacher
Learn this topic live with Lessi
Lessi, the AI teacher, explains it out loud on a board, with short quizzes, at your pace. The first 60 minutes are free.