Before you start
- You have seen where biological data is stored in Where the data lives.
- Any term new? The Glossary has it.
Learning objectives
By the end of this lesson you will be able to: name the major databases (NCBI, Ensembl, UniProt) and what each holds, recognise the common gene ID types (symbol, Ensembl ENSG, Entrez/NCBI gene ID, RefSeq NM_), explain why ID mapping matters, and fetch records politely with an API while respecting etiquette.
Where the data lives
Public bioinformatics data is spread across a few large hubs, each with a focus. You rarely download whole databases; instead you query them through an API (an application programming interface), which lets your script ask for exactly the records you need.
| Database | Holds | How to access |
|---|---|---|
| NCBI | GenBank and RefSeq sequences, SRA reads, dbSNP variants, PubMed | Entrez E-utilities |
| Ensembl | Genes, transcripts, annotation, comparative genomics | BioMart and a REST API |
| UniProt | Protein sequences and functional annotation | REST API and a mapping tool |
RefSeq vs GenBank
GenBank is the archive of sequences as researchers submitted them; RefSeq is NCBI's non-redundant reference set, mostly curated (curated mRNAs start with NM_; computer-predicted ones start with XM_). When you want a single canonical record per gene, you usually want RefSeq.
1ID types and why mapping matters
The same gene is named differently in different systems, and tools only join data when the IDs match exactly. A gene symbol is human-friendly but ambiguous and changes over time; the stable database IDs are what you should key your analysis on.
| ID type | Example | Source |
|---|---|---|
| Gene symbol | TP53 | HGNC (human-friendly, can change) |
| Ensembl gene ID | ENSG00000141510 | Ensembl (stable and versioned, e.g. ENSG00000141510.18) |
| Entrez / NCBI gene ID | 7157 | NCBI (a number) |
| RefSeq transcript | NM_000546 | NCBI RefSeq |
| UniProt accession | P04637 | UniProt (protein) |
Joining two datasets that use different ID systems requires mapping one to the other. Common tools are Ensembl BioMart and, in R, the org.Hs.eg.db annotation package.
2Fetching politely: API etiquette
Public APIs are a shared resource. Good citizenship keeps them fast for everyone and keeps you from being blocked.
- Identify yourself: for NCBI Entrez, always set
Entrez.email(and an API key for higher limits). - Respect rate limits: NCBI allows 3 requests per second without an API key and 10 with one. Biopython slows your requests to stay under the limit, but asking for many IDs in one call is still faster and kinder than looping one ID at a time.
- Cache results: save what you download so a re-run does not hit the server again.
3Worked example: Biopython Entrez efetch
This snippet (shown for illustration, not meant to be run as-is) fetches a nucleotide record from NCBI with Biopython. Note the email set up front: NCBI asks every user to set an email (Biopython warns if you leave it out) so they can contact you before blocking heavy traffic.
# illustration only -- set a real email before running from Bio import Entrez, SeqIO Entrez.email = "you@example.com" # required etiquette handle = Entrez.efetch( db="nucleotide", id="NM_000546", # RefSeq mRNA for TP53 rettype="gb", retmode="text", ) record = SeqIO.read(handle, "genbank") handle.close() print(record.id, len(record.seq))
Why set Entrez.email
If a query misbehaves, NCBI uses the email to contact you before blocking your traffic. Leaving it unset is both impolite and a fast way to get rate-limited.
Check your understanding
Sources & further reading
- Sayers EW, Bolton EE, Fine AM, et al. Database resources of the National Center for Biotechnology Information in 2026. Nucleic Acids Research 54: D20-D27, 2026. doi:10.1093/nar/gkaf1060
- Yates AD, Austine-Orimoloye O, Azov AG, et al. Ensembl 2026. Nucleic Acids Research 54: D1053-D1060, 2026. doi:10.1093/nar/gkaf1239
- UniProt Consortium. UniProt: the Universal Protein Knowledgebase in 2025. Nucleic Acids Research 53: D609-D617, 2025. doi:10.1093/nar/gkae1010
- Seal RL, Braschi B, Gray K, et al. Genenames.org: the HGNC resources in 2023. Nucleic Acids Research 51: D1003-D1009, 2023. (who names human genes) doi:10.1093/nar/gkac888
Last reviewed: October 2026.
