Lesson 1 of 8 ⏱ 45 min 🎯 Beginner-friendly 📘 Theory + Concepts ✓ Free

What is Sequence Search?
BLAST Concepts

Understand why sequence similarity search was invented, how BLAST thinks about your DNA, and master the vocabulary — E-value, bit score, HSP — that appears in every paper you will ever read.

What is BLAST?

🧬 BLAST Defined

BLAST stands for Basic Local Alignment Search Tool. It searches a sequence database for regions that are locally similar to your input sequence. "Local" is the key word: BLAST does not require your query to align across its full length — it finds the best-matching regions, even if the rest of the sequence is totally different.

The word local distinguishes BLAST from global alignment tools like Needleman-Wunsch, which try to align two sequences from end to end. Local alignment is more useful for biology because:

  • Genes often share only functional domains, not their entire sequence
  • Proteins from distantly related organisms may share a conserved catalytic site but differ everywhere else
  • Your query (a 200 bp fragment) is often much shorter than the database sequence (a 50 kb chromosome)

BLAST was created at the NCBI (National Center for Biotechnology Information) and is available both as a web tool at ncbi.nlm.nih.gov/blast and as a standalone command-line program you install locally. In this module, we focus on the command-line version — because that is what you use in automated pipelines.

Your query sequence ────────────────────── ↓ BLAST search Database (e.g. nr, RefSeq, UniProt, your custom genome) ↓ finds similar regions HSP 1: query 45–120 db_seq_A 1203–1278 identity 94% HSP 2: query 45–120 db_seq_B 88–163 identity 72% HSP 3: query 45–120 db_seq_C 5501–5576 identity 61%

BLAST Flavours — Which One Do You Use?

BLAST is not a single program — it is a family of programs, each designed for a specific combination of query type and database type. Choosing the wrong one is a common beginner mistake.

Program Query type Database type When to use
blastn nucleotide nucleotide Find similar DNA/RNA sequences; check primer specificity
blastp protein protein Find similar proteins; annotate protein function
blastx nucleotide protein Translate DNA in all 6 frames and search protein DB — great for gene prediction
tblastn protein nucleotide Search translated nucleotide DB with a protein query — find genes in unannotated genomes
tblastx nucleotide nucleotide Translates both sides; slowest but most sensitive for distant homology
dc-megablast nucleotide nucleotide Very fast for highly similar sequences (e.g. same species variants)
🌾
Plant genomics tip: When working with rice or sorghum gene models, blastx is especially powerful — you take your newly assembled transcript, translate it in all 6 frames, and instantly check whether it matches any known plant protein in UniProt. This is how gene function is predicted in genome annotation pipelines.

Key Concepts You Must Know

BLAST output contains a set of statistics that look intimidating at first but each has a precise biological meaning. You will see these in every paper, every pipeline, and every database result page.

Term What it measures Good value means
E-value Expected number of hits this good by random chance in a database of this size Smaller is better. E < 1e-5 = significant; E < 1e-50 = very confident
Bit score A normalised alignment quality score (independent of database size) Higher is better. Comparable across different BLAST runs
% Identity Percentage of aligned positions that are identical Higher is better. >90% = likely same gene; 30–50% = likely same protein family
% Coverage How much of your query aligns to the subject Higher is better. Low coverage (<50%) may mean only a domain matches
HSP High-scoring Segment Pair — a local alignment region Each hit may have multiple HSPs; take the best one
Raw score Sum of match scores minus gap penalties in the alignment Depends on scoring matrix used; bit score is the normalised version

E-value: A Deep Dive

🎲 Why E-value, Not P-value?

The E-value is the expected number of hits at least as good as your alignment that you would find purely by chance if you searched a database of this size with a random sequence. It is not a probability of a single hit — it is an expectation over the whole database. An E-value of 0.01 means you expect 1 false positive per 100 searches of this database.

The E-value depends on three things:

  • The alignment score — higher scores give lower E-values
  • The database size — a larger database gives a higher E-value for the same score (more chances for a random hit). This is why you cannot compare E-values from different databases directly
  • The scoring matrix — BLOSUM62 for proteins, match/mismatch scores for DNA
E-value thresholds commonly used: E < 1e-100 Virtually certain homologue same gene, same function E < 1e-50 Very high confidence functionally related, likely same family E < 1e-10 Significant statistically meaningful hit E < 1e-5 Borderline significant worth investigating further E > 0.01 Not reliable likely a chance match
⚠️
Common mistake: Never compare E-values from searches against different databases. An E-value of 1e-10 against the full nr database (billions of sequences) is much more significant than 1e-10 against a small custom genome (thousands of sequences). Always report which database you searched.

The formula behind E-value is:

E = K · m · n · e^(−λ · S) where: K = statistical constant (depends on scoring matrix) m = effective length of your query sequence n = effective total length of the database λ = statistical constant (depends on scoring matrix) S = raw alignment score → You rarely need to compute this by hand — BLAST does it for you. Understanding what goes into E-value helps you interpret results correctly.

HSPs — High-Scoring Segment Pairs

🔗 What is an HSP?

An HSP (High-Scoring Segment Pair) is a contiguous region of alignment between your query and a database sequence that has no gaps and achieves a high alignment score. BLAST reports one or more HSPs per database hit. Multiple HSPs for a single hit usually indicate repeated domains or multiple exons matching the same database entry.

BLAST output shows HSPs like this (pairwise format):

BLAST pairwise output
Score = 285 bits (308),  Expect = 2e-75
Identities = 147/158 (93%),  Gaps = 0/158 (0%)
Strand = Plus/Plus

Query  1    ATGGTCAAGCTCGTCGACGAGCTCATCACCAACGAGAAGGACCCCAACATCAAGCTGAC  60
            |||||||||||||||||||||||||||||| ||||||||||||||||||| ||||||||||
Sbjct  203  ATGGTCAAGCTCGTCGACGAGCTCATCATCAACGAGAAGGACCCCAACATCAAGCTGAC  262

Query  61   CGAGCAGCTCAAGAAGGAGATCGAGCGCATGCTGCACAAGGAGCCCGTCGACGTCACCA  120
            |||||||||||||||||| ||||||||||||||||||||||||||||||||||||||||||
Sbjct  263  CGAGCAGCTCAAGAAGGATATCGAGCGCATGCTGCACAAGGAGCCCGTCGACGTCACCA  322

Reading an HSP:

  • Score — the raw + bit score pair. Bit score is in parentheses here; in tabular output it appears as a separate column
  • Expect — the E-value for this HSP against this database
  • Identities — matches / total aligned length. Pipes (|) show identical positions
  • Gaps — number of gap characters inserted to improve the alignment
  • Query / Sbjct lines — the actual aligned sequences with coordinates

How BLAST Works: The Algorithm in Plain English

BLAST achieves its speed through a clever heuristic — it avoids checking every possible alignment and instead uses a seed-and-extend strategy:

Step 1 — WORD FINDING Break query into overlapping k-mers (words) Default: k=11 for blastn, k=3 for blastp e.g. "ATGGTCAAG" → "ATGGTCAAG", "TGGTCAAGC", "GGTCAAGCT" ... Step 2 — NEIGHBOURHOOD GENERATION For each word, find all similar words scoring above threshold T This is why BLAST catches near-matches, not just exact matches Step 3 — DATABASE SCANNING Rapidly scan the database index for any of these words Using a pre-built index (makeblastdb) — this is why you index first Step 4 — EXTENSION When a word hit (seed) is found, extend the alignment in both directions Stop when the score drops below a cutoff (X-dropoff) This gives the HSP — the locally optimal aligned region Step 5 — EVALUATION Compute E-value for each HSP Report hits above your E-value threshold
Why this matters for pipelines: The makeblastdb step (building the database index) is done once and stored on disk. Every subsequent BLAST search against that database reuses the index — this is why local BLAST is much faster than re-scanning raw FASTA files. You will do this in Lesson 2.
🌱 BLAST vs Smith-Waterman — the tradeoff

Smith-Waterman is the gold-standard exact local alignment algorithm — it is guaranteed to find the best alignment. BLAST is a heuristic (an approximation) — it is fast but can miss very short or very divergent alignments. For most bioinformatics work, BLAST is more than sufficient. For critical decisions (e.g. confirming gene family membership), you may want to follow up with a full Smith-Waterman alignment or profile-based tools like HMMER.

Advertisement Support free bioinformatics education

Exercises

1
Identify the correct BLAST flavour

You have assembled a new transcript from Sorghum bicolor and want to find similar proteins in the UniProt database. Which BLAST program should you use, and why?

▶ Show answer
# Use blastx
# Reason: your query is a nucleotide (transcript = DNA/RNA),
# but UniProt is a protein database.
# blastx translates your nucleotide query in all 6 reading frames
# and searches a protein database — perfect for gene annotation.

# blastn would be wrong: it searches a nucleotide DB
# blastp would be wrong: it requires a protein query
2
Interpret an E-value

You run a BLAST search and your top hit has E-value = 3e-82. Your second hit has E-value = 0.04. Which hit is more reliable, and would you accept the second hit as evidence of homology?

▶ Show answer
# Hit 1 (E = 3e-82) is far more reliable.
# An E-value of 3e-82 means you would expect this good an alignment
# to occur by chance only 3 × 10^-82 times — essentially never.
# This is very strong evidence of true homology.

# Hit 2 (E = 0.04) is borderline.
# You would expect ~0.04 false positives per search at this score.
# Standard threshold is E < 1e-5 for significance.
# Most researchers would NOT accept E = 0.04 as evidence of homology
# without additional evidence (e.g. conserved domain, phylogeny).
3
E-value and database size

You search sequence A against database X (10,000 sequences) and get E = 1e-8. Your colleague searches the same sequence against NCBI nr (200 million sequences). Will their E-value be larger or smaller? Why?

▶ Show answer
# Their E-value will be LARGER (less significant).
# E-value = K × m × n × e^(-λ × S)
# where n = effective database size.

# NCBI nr has ~20,000× more sequences than your local DB.
# So for the same alignment score S, the E-value scales proportionally:
# your E = 1e-8
# colleague's E ≈ 1e-8 × 20000 ≈ 2e-4

# This does NOT mean the alignment is worse — the underlying biology
# is the same. It just means there are more random hits in a bigger DB.
# Always report which database you searched when reporting E-values!
4
Read an HSP

An HSP shows: Score = 420 bits, Expect = 5e-118, Identities = 198/210 (94%), Gaps = 2/210 (1%). In plain English, what does this tell you about the relationship between your query and the database sequence?

▶ Show answer
# This is an extremely high-confidence match.

# Score = 420 bits → very high alignment quality
# E = 5e-118 → essentially impossible to see by chance
# Identities = 94% → 198 out of 210 positions are identical
# Gaps = 1% → only 2 gap characters in 210 bp alignment

# Conclusion: this query and the database sequence are
# almost certainly the same gene or very recently diverged
# orthologues (e.g. same gene in closely related species).
# The 6% difference could be due to SNPs or allelic variation.

Your progress is saved in your browser.

Advertisement Support free bioinformatics education