Turn a huge BindingDB TSV file (millions of rows, 640 columns) into one self-contained HTML report that you can open in any browser, with no Python knowledge needed to read it.
Live example: https://turfstack.github.io/bindingdb-report/example_report/bindingdb_report.html (works once GitHub Pages is switched on for this repo)
- Reads a BindingDB TSV file read-only. Nothing is cleaned, dropped or changed.
- Writes one HTML file with nine sections: Overview, Organisms, Completeness, Affinity, Ligand/Protein, Targets, Duplicates, Issue log, Columns.
- The report contains aggregate statistics only (counts, histograms, top-N names and IDs). No data rows are copied into it.
- Streams the file in chunks, so it fits on a normal laptop (developed on Windows with 16 GB RAM).
Most of this code was generated with the help of a large language model (Claude, by Anthropic), then run and checked by the author. It may contain mistakes. Please verify any number that matters to your work (see "Checking the numbers" below).
- Python 3.9 or newer
pandas1.3 or newer andnumpy(listed inrequirements.txt)- A BindingDB TSV file, downloaded from the BindingDB download page: https://www.bindingdb.org/rwd/bind/chemsearch/marvin/Download.jsp
1. Get the code and install the packages
git clone https://github.com/turfstack/bindingdb-report.git
cd bindingdb-report
python -m venv .venvActivate the environment:
source .venv/bin/activate # Linux / macOS / WSL
.venv\Scripts\Activate.ps1 # Windows PowerShellpip install -r requirements.txt2. Try it on a small slice first (about a minute)
python bindingdb_report.py "path/to/BindingDB_All.tsv" --max-rows 100000 --out trial.html3. Run it on the whole file
python bindingdb_report.py "path/to/BindingDB_All.tsv" --out bindingdb_report.htmlThen open bindingdb_report.html in your browser.
| Option | Default | Meaning |
|---|---|---|
tsv (required) |
Path to the BindingDB TSV file | |
--out |
bindingdb_report.html |
Output HTML file |
--chunk |
50000 |
Rows read at a time. Lower it (for example 25000) if you run out of memory |
--max-rows |
all rows | Only profile the first N rows (trial run) |
--title |
BindingDB data assessment |
Report title |
--human-labels |
Homo sapiens, Human, Homo sapiens (Human) |
Organism spellings counted as human |
- Overview: size of the file and headline counts. The "lines in file vs rows parsed" card shows whether any lines were skipped.
- Organisms: which organism labels exist, and which spellings are counted as human.
- Completeness: how full the key columns are, and how many of the 640 columns are empty or sparse.
- Affinity: how many values are exact numbers, censored (
>or<), or text; pKd / pKi / pIC50 histograms. - Ligand/Protein: distinct SMILES, InChI Keys and sequences, and length distributions.
- Targets: UniProt IDs, target names, and IDs with more than one sequence or name.
- Duplicates: three definitions from loose to strict (same ligand + target + organism; plus identical affinity values; plus identical source).
- Issue log: observations with counts and shares. These are simple proportions, not severity ratings.
- Columns: fill rate of every column that has data.
- Built for the standard BindingDB TSV column layout. If a required column is missing, the script stops and lists what it could not find. Other BindingDB TSV downloads with the same columns should work, but they have not been tested.
- Targets are keyed by the UniProt ID of chain 1 only.
- A cell counts as "filled" if it is not an empty string, so whitespace-only cells count as filled in the column statistics.
- Duplicate counts are heuristics, and assay conditions are not compared.
- "Distinct" counts use 64-bit hashes of the text. A collision is possible in theory but extremely unlikely at this size.
Two independent checks you can run yourself (Linux, macOS or WSL):
wc -l BindingDB_All.tsvThis counts lines. Subtract 1 for the header and compare with the row count in the report.
awk -F'\t' 'NR==1{for(i=1;i<=NF;i++) if($i=="Target Source Organism According to Curator or DataSource") c=i; next} $c=="Homo sapiens"||$c=="Human"||$c=="Homo sapiens (Human)"{n++} END{print n}' BindingDB_All.tsvThis counts rows with one of the three human labels. It should match the "Rows matching human labels" card, give or take a few rows where whitespace was trimmed.
Validation done so far:
- Compared against an independent pandas computation on a synthetic 640-column test file.
-
- Full run on
BindingDB_All.tsv(release 202610, 3,243,660 rows): theawkcount of human-labelled rows was 2,695,170, matching the report, and the line count matched the rows parsed (nothing skipped). Run time: about 3 minutes on a Windows laptop with 16 GB RAM (observed, not formally timed).
- Full run on
This repository contains code and an example report only, not BindingDB data.
- BindingDB: https://www.bindingdb.org
- Data curated by BindingDB is shared under a Creative Commons Attribution license; data imported from ChEMBL is CC BY-SA 3.0. See https://www.bindingdb.org/rwd/bind/info.jsp for the current terms.
- Please cite BindingDB:
Liu T, Hwang L, Burley SK, Nitsche CI, Southan C, Walters WP, Gilson MK. BindingDB in 2024: a FAIR knowledgebase of protein-small molecule binding data. Nucleic Acids Research 53(D1):D1633-D1644 (2025). https://doi.org/10.1093/nar/gkae1075
- The example report was generated from BindingDB release
202610(BindingDB_All.tsv). - The code in this repository is released under the MIT License (see
LICENSE). The license covers the code only, not BindingDB's data.
