Bioinformatics Databases

Lesson 5 of 20 · 9 min

What an Accession Number Is

By the end of this lesson you will be able to take any accession number, hand it to a database, and get back the exact record it points to — from a web form or from a script. This is the skill the rest of the course leans on, so we start here.

What an accession actually is

An accession number is a stable, permanent ID for one database record. "Stable" means the ID never gets reused for something else, and it never silently changes meaning underneath you. "One record" is the important part: an accession names a single entry — one sequence, one structure, one gene page — not a search, not a category, not a species.

In the field map of the major databases you met NCBI, Ensembl, UniProt, PDB and the rest as institutions. An accession is the address of a single room inside one of those buildings. When BRCA1's RefSeq messenger-RNA record carries the accession NM_007294, that string is a promise: type it into NCBI today or in five years and you land on the same curated transcript.

This is why accessions matter more than names. The gene "BRCA1" is a label humans argue over; databases rename, merge, and re-annotate genes. An accession is machine-precise. A paper that says "we used BRCA1" is ambiguous; a paper that says "we used NM_007294.4" is reproducible.

Two shapes: unversioned and versioned

Almost every accession has the same anatomy — a prefix (letters that encode where the record lives and what kind of molecule it is) followed by digits that number the record. NM_007294 is prefix NM_ plus 007294 — the meaning of that prefix is unpacked in reading a prefix; for now just notice the two-part pattern.

Accessions come in two shapes:

  • Unversioned — prefix plus digits, e.g. NM_007294. This names the record as a living thing: "BRCA1's RefSeq transcript, whatever its current sequence is."
  • Versionedaccession.version, e.g. NM_007294.4. The suffix after the dot is a version counter. Every time curators change the underlying sequence, the number ticks up, so NM_007294.4 names one exact, frozen sequence that can never change.

The distinction is the difference between "the current edition of this book" and "the fourth printing, page for page." When we verified BRCA1 against NCBI while writing this lesson, the live record answered with NM_007294.4 — version 4 is today's edition. Use the unversioned form when you just want the current record; pin the version whenever the exact sequence has to stay reproducible.

One gene, three databases

The fastest way to feel what an accession does is to retrieve the same molecule from three different databases and watch each one hand back a different ID. Here is BRCA1, fetched by accession:

DatabaseWhat the record isAccession
NCBI RefSeqCurated BRCA1 mRNA (the agreed default transcript)NM_007294
EnsemblThe matching BRCA1 transcriptENST00000357654
UniProtThe BRCA1 protein entryP38398

Three databases, three accession styles, one gene. None of these is "more correct" — each is the retrieval key for that database's view of BRCA1. Learning to move between these accessions confidently is a skill this course keeps building on. (NM_007294 and ENST00000357654 describe a sequence-identical transcript — a deliberate agreement between NCBI and Ensembl, not a coincidence.)

The retrieval currency

An accession is the currency you spend to retrieve a record, and it works the same whether you click or script. In a browser you paste P38398 into the UniProt search box and land on the protein page. On the command line you spend the same accession through NCBI's E-utilities — the fetch endpoint is EFetch:

bash
efetch -db protein -id NP_009225 -format fasta

That pulls the BRCA1 RefSeq protein (NP_009225) as FASTA. The intro course walked through this idea in fetching a sequence; the point to hold onto is that the accession is the only thing that changes between fetching BRCA1 and fetching any other record.

In Python, Biopython's Bio.Entrez module does the same round-trip. You give it a database and an accession, and it streams back the record:

python
from Bio import Entrez, SeqIO

Entrez.email = "[email protected]"          # NCBI requires a contact address

with Entrez.efetch(db="nuccore",
                   id="NM_007294.4",       # versioned = an exact sequence
                   rettype="gb",
                   retmode="text") as handle:
    record = SeqIO.read(handle, "genbank")

print(record.id, len(record.seq), "bp")   # NM_007294.4 7088 bp

Try it yourself: run the snippet above, then change the id to the unversioned NM_007294. NCBI returns the current version either way — but only the versioned form guarantees you will get byte-for-byte the same sequence months from now. When a result must be reproducible, always pin the version. And set a real Entrez.email: unauthenticated E-utilities requests are capped at 3 requests per second, and NCBI uses the address to reach you before blocking abusive traffic.

An accession, then, is the whole game in miniature: one stable ID, one record, retrievable by hand or by code. Every database in this course exposes its records this way. Next we crack open the prefix and read what those leading letters are telling you.