BacCurate turns heterogeneous public sequencing metadata into a standardized resource for comparative genomics, genomic epidemiology, and One Health research.
This repository contains the source code that extracts and harmonizes BioSample metadata. The dataset itself, and the documentation, are on the website.
As of the 2026-07-09 BioSample snapshot, ~1.5 million BioSample records are covered, including all ESKAPEE pathogens:
- Enterococcus faecium
- Enterococcus faecalis
- Staphylococcus aureus
- Klebsiella pneumoniae species complex
- Acinetobacter baumannii
- Pseudomonas aeruginosa
- Enterobacter spp.
- Escherichia coli
- The NCBI BioSample XML dump is parsed and the records of the registered taxa are indexed.
- The attribute-value pairs of interest from each record are selected.
- Values are resolved against the reference vocabularies in
data/reference/:- Isolation source: Large Language Model (LLM) assisted mapping to a purpose-built ontology
of 103 terms (
ontology/terms.tsv), with SSSOM mappings to external ontologies. - Host organism: mapped to NCBI taxonomy
(
taxonomy/) taxids and scientific names. - Geographic location: mapped to the INSDC Geographic Location Name List and Natural Earth map units for coordinate-derived countries.
- Collection dates: parsed with custom-built rules and normalized to ISO 8601.
- Isolation source: Large Language Model (LLM) assisted mapping to a purpose-built ontology
of 103 terms (
LLMs are only used for isolation-source standardization, everything else is deterministic and driven by hand-curated rules.
For more information on the methods and the interpretation of the output data, read the full documentation here (still WIP).
Requires Python 3.12 or later.
git clone https://github.com/ELTEbioinformatics/BacCurate.git
cd BacCurateUsing uv:
uv syncIf you'd rather not install uv, pip install -e . also works in a standard venv:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .Note
The commands below use uv. With a venv activated instead, drop the uv run prefix.
Verify the installation:
uv run baccurate --helpBy default, isolation-source standardization utilizes an OpenAI compatible API.
Create a .env file in the repository root with your API credentials:
API_KEY="sk-..."
SERVER="https://api.openai.com/v1"
LLM_MODEL="gpt-4o-mini"
Use --skip-llm to process without LLMs.
The starting dataset is assembled from:
- NCBI BioSample metadata (
biosample_set.xml.gz) - AllTheBacteria metadata (sylph/GTDB species profiling)
- NCBI Genbank metadata
- NCBI RefSeq metadata
- NCBI SRA metadata
Place these in data/raw.
The NCBI taxonomy dump (nodes.dmp, names.dmp,
merged.dmp) goes in data/reference/taxonomy/. Then run:
uv run python scripts/parse_biosample_xml.py
uv run python scripts/filter_sequence_accessions.py
uv run python scripts/build_biosample_index.pyuv run baccurateOutputs are in output/<timestamp>/.
You can provide taxon keywords defined in config/taxa.yaml to only process select taxa.
# Acinetobacter baumannii and Escherichia coli
uv run baccurate abaumannii ecoliThe --standardize option accepts host, date, loc, and iso (host organism, collection
date, geographical location and isolation-source).
# Collection date and geographical location standardization
uv run baccurate abaumannii --standardize date locExtraction (selecting the attribute-value pairs of interest from the raw BioSample metadata) runs
only if output/extracted_metadata.tsv does not exist.
To re-extract, either delete it or specify a new filename:
uv run baccurate --extracted-metadata extracted_metadata_new.tsvEnable verbose logging:
uv run baccurate --debug