Skip to main content

Efficient and comprehensive metadata acquisition from the NCBI databases (includes SRA).

Project description

PyPI version GitHub license GitHub issues Build Status codecov


Efficient and comprehensive metadata acquisition from the NCBI databases (includes SRA).

Why NCBImeta?

NCBImeta is a Python application that retrieves and organizes metadata from the National Centre for Biotechnology Information (NCBI). While the NCBI web browser experience allows filtered searches, the output does not facilitate inter-record comparison or bulk record retrieval. NCBImeta tackles this issue by creating a local database of NCBI metadata constructed by user-defined search criteria and customizable metadata columns. The output of NCBImeta, optionally a SQLite database or text files, can then be used by computational biologists for applications such as record filtering, project discovery, sample interpretation, or meta-analyses of published work.


NCBImeta is written in Python 3 and supported on Linux and macOS.
Python 3 dependencies include BioPython, PyYAML, and NumPy which are downloaded through the default installation.
Check all Python versions and OS with verified build status

Installation (Recommended)

pip install NCBImeta

Installation From Source

git clone   
cd NCBImeta
python install

Test that the installation was successful: --version

Quick Start Example

Access the quick start config file

Download the NCBImeta github repository to get access to the example configuration files:

git clone   
cd NCBImeta

Run the program

Download a selection of genomic metadata pertaining to the plague pathogen Yersinia pestis. --flat --config example/config.yaml

(Note: The 'quick' start config file forces slow downloads to accommodate users with slow internet. For faster record retrieval, please see the Config File README to start editing config files.)

Example output of the command-line interface (v0.4.0):

Annotate the database with tab-separated text files of metadata --database example/yersinia_pestis_db.sqlite --annotfile example/annot.txt --table BioSample

Note that the first column of your annotation file MUST be a column that is unique to each record. An Accession number or ID is highly recommended. The column headers in your annotation file must also exactly match the names of your columns in the database., as the name implies, replaces the existing annotation with the data in your custom metadata file. Alternatively, the script will concatenate your custom metadata with the pre-existing value in the database cell (separated by a semi-colon). --database example/yersinia_pestis_db.sqlite --annotfile example/annot.txt --table BioSample

Join NCBI tables into a unified master table --database example/yersinia_pestis_db.sqlite --final Master --anchor BioSample --accessory "BioProject Assembly SRA Nucleotide" --unique "BioSampleAccession BioSampleAccessionSecondary BioSampleBioProjectAccession"

The rows of the output "Master" table will be from the anchor table "BioSample", with additional columns added in from the accessory tables "BioProject", "Assembly", "SRA", and "Nucleotide". Unique accession numbers for BioSample (both primary and secondary) and BioProject allow this join to be unambiguous.

Export the database to tab-separated text files by table. --database example/yersinia_pestis_db.sqlite --outputdir example/

Each table within the database will be exported to its own tab-separated .txt file in the specified output directory.


  1. Explore your database text files using a spreadsheet viewer (Microsoft Excel, Google Sheets, etc.)
  2. Browse your SQLite database using DB Browser for SQLite (
  3. Use the columns with FTP links to download your data files of interest.

Example database output (a subset of the Assembly table)

Currently Supported NCBI Tables



To get started with customizing the search terms, database, and metadata fields, please read:

  1. Config File README
  2. Schema File README

Issues, Questions, and Suggestions

Please submit your questions, suggestions, and bug reports to the Issue Tracker


  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request!


Author: Katherine Eaton (

forthebadge made-with-python

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for NCBImeta, version 0.5.0
Filename, size File type Python version Upload date Hashes
Filename, size NCBImeta-0.5.0-py3-none-any.whl (39.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size NCBImeta-0.5.0.tar.gz (22.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page