Skip to main content

🧬 BioFetch

Unified NCBI · UniProt · PDB CLI fetcher with local caching

Tests PyPI Python License Platform


BioFetch is a cross-platform Python CLI tool that gives you instant access to NCBI, UniProt, and RCSB PDB — all from your terminal. Search, fetch, and save biological records by accession ID, with smart local caching so you never hit the same API twice.

No conda. No virtual environments. Just pip and go.


✨ Features

Feature Description
🔍 Search Query NCBI, UniProt, and PDB with ranked results
⬇️ Fetch Download sequences and structures by accession ID
📋 Info Rich metadata panels — no full download needed
📦 Batch Bulk fetch hundreds of records with progress bar
⚡ Cache 7-day local disk cache — instant repeat lookups
🎨 Rich UI Beautiful terminal tables, spinners, and panels
🔄 Formats FASTA · GenBank · JSON · XML · PDB · mmCIF · TSV
🌍 Cross-platform Windows, Linux, macOS — pure pip

🚀 Quick Start

# Fetch a protein sequence from UniProt
biofetch fetch P68871 --source uniprot

# Fetch with full metadata panel
biofetch fetch P68871 --source uniprot --info

# Download a PDB structure file
biofetch fetch 1HHO --source pdb --format pdb --output 1HHO.pdb

# Fetch a gene from NCBI
biofetch fetch NM_007294 --source ncbi --db nucleotide

# Search UniProt (Swiss-Prot reviewed only)
biofetch search "hemoglobin" --source uniprot --reviewed --limit 5

# Search PDB for insulin structures
biofetch search "insulin" --source pdb --limit 5

# Search NCBI
biofetch search "BRCA1 human mRNA" --source ncbi --db nucleotide --limit 8

# Batch fetch and save to folder
biofetch batch P68871 P69905 P68873 --source uniprot --outdir ./sequences

# Cache management
biofetch cache stats
biofetch cache list
biofetch cache clear

📖 Commands

Command Description
biofetch fetch <ID> Fetch a single record by accession
biofetch search <query> Search a database
biofetch info <ID> Rich metadata summary
biofetch batch <IDs...> Bulk fetch and save
biofetch cache stats Cache size and entry count
biofetch cache list List all cached keys
biofetch cache clear Wipe the cache
biofetch cache delete <ID> Remove one cached entry
biofetch version Print version

⚙️ Fetch Options

Flag Description
--source / -s ncbi, uniprot, or pdb
--format / -f fasta, genbank, json, xml, pdb, cif, tsv
--db NCBI database: nucleotide, protein, gene, pubmed
--output / -o Save to file
--info / -i Show metadata panel
--no-preview Skip terminal preview
--no-cache Force fresh API call

💾 Cache

Results are cached locally for 7 days:

  • Linux/Mac: ~/.cache/biofetch/
  • Windows: %LOCALAPPDATA%\biofetch\
biofetch cache stats   # see how much is cached
biofetch cache clear   # wipe everything

📦 Dependencies

Package Purpose
biopython NCBI Entrez, sequence parsing
requests UniProt & PDB REST APIs
diskcache Local disk-based caching
rich Terminal formatting & tables
typer CLI framework

All pure pip — no conda, no virtualenv required.


🧪 Tests

git clone https://github.com/Eswar-mse/biofetch.git
cd biofetch
pip install -e .
python tests.py

34 tests, fully mocked — no network required to run the suite.


📄 License

MIT © Eswar-mse



🖥️ Demo

Fetch a protein with full metadata

Fetch with UniProt info panel

Search UniProt — ranked results table

UniProt search results

PDB structure metadata

PDB entry summary

Batch fetch multiple accessions

Batch fetch results

Metadata

Release files for biofetch-cli 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biofetch-cli 1.0.2
File Size Uploaded Provenance Actions
biofetch_cli-1.0.2.tar.gz 14.8 kB Without provenance Details for biofetch_cli-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for biofetch-cli 1.0.2
File Interpreter ABI Platform Actions
biofetch_cli-1.0.2-py3-none-any.whl Python 3 none any Details for biofetch_cli-1.0.2-py3-none-any.whl

Total release size: 29.9 kB

Release files / biofetch_cli-1.0.2.tar.gz

Download URL biofetch_cli-1.0.2.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fea2b0632432ea2a50a4fc837ca0f540e649058b78fb67f38388fad6e7075b60
BLAKE2b-256 checksum
How to use checksums
319c68a9f898d392946fe2ddf347f668c47ae3fc693122f664b564c42395037c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / biofetch_cli-1.0.2-py3-none-any.whl

Download URL biofetch_cli-1.0.2-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c8025d1f5f008600074e5ba2589f0119b8ad9abc7002424f4439143662d3057
BLAKE2b-256 checksum
How to use checksums
47f5287776286a793f1bb38e94da07f603f961be15b70b479571530979b19258
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Security for biofetch-cli 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page