Example 2.4 — SMILES vs SMARTS queries (4-chloroaniline)¶

A reproducible record of an AI-assisted BindingDB analysis: each prompt, the BindingDB tool calls that answered it with their recorded results, the answer, and its figures. Run all cells to show the recorded results, or rerun every call on your own copy of the database and check each result against the recorded one.

  • Date: 2026-11-23
  • Model: claude-sonnet-5-5
  • Data: BindingDB release 202611 (BDB-mySQL_All_202611_dmp.zip, SHA-256 daea9260d404919a183ce02d91bf4b9c49b410bea7eaaeba105c8e0280510381)
  • Database build: 2026-11-21T01:08:15+00:00, DuckDB 1.5.6
  • Derived data: standard InChIKeys computed from SMILES by RDKit 2026.03.6; compound_property computed from SMILES (largest fragment) by RDKit 2026.03.6
  • Server: mcp-bindingdb v0.1.17, commit 79dae5d22c0f
  • Software: python 3.12.7, duckdb 1.5.6, rdkit 2026.03.6, mcp 2.3.0, gemmi 0.7.5
  • Notebook generated: 2026-11-24T04:55:15Z
  • Contents: 1 exchange · 4 tool calls

How to run¶

Keep the notebook in its folder, which holds everything it needs: requirements.txt (mcp-bindingdb at its commit and the versions of the packages it needs) and the recorded results in data/. With uv, from that folder (replace the path with yours):

cd /path/to/2.4-smiles-vs-smarts-notebook
uv run --no-project --with-requirements requirements.txt --with jupyterlab jupyter lab 2.4-smiles-vs-smarts-notebook.ipynb

then choose Run → Run All Cells. The first start installs the packages, which takes a minute or two; the cells show the recorded results, so no database is needed. Without uv: pip install -r requirements.txt jupyterlab, then jupyter lab 2.4-smiles-vs-smarts-notebook.ipynb in the folder.

How to rerun the calls¶

To rerun every BindingDB call on your own copy of release 202611 and check each result against the recorded one, set RERUN = True in the setup cell and run all cells, or rerun the notebook without opening Jupyter, writing a copy with the new results:

cd /path/to/2.4-smiles-vs-smarts-notebook
BINDINGDB_RERUN=1 uv run --no-project --with-requirements requirements.txt --with nbconvert jupyter nbconvert --to notebook --execute --output 2.4-smiles-vs-smarts-notebook-rerun.ipynb 2.4-smiles-vs-smarts-notebook.ipynb

A rerun needs the database: the one BINDINGDB_DUCKDB=/path/to/bindingdb_202611.duckdb names (put it before uv run), else the newest one mcp-bindingdb built on this computer, for example for Claude Desktop. With neither, the first rerun builds one, which takes about half an hour and 2.4 GB. To build exactly release 202611, with a clone of mcp-bindingdb:

git clone https://github.com/sbl-sdsc/mcp-bindingdb.git
cd mcp-bindingdb
git checkout 79dae5d22c0f15b8ded9b49adc8b105f0463703a
scripts/build_duckdb.sh --release 202611

The setup cell checks the database's release and source checksum against the recorded ones.

Run as it is, each call cell shows its recorded result, read from data/ and checked against the SHA-256 digest recorded in the cell. Rerun, it shows the new result with ✅ when it matches the recorded one (floats to 10 significant digits, ids of viewers and files left out). Calls to PubChem, RCSB or PDBe depend on those services and may differ. The prose answers are the model's and are not recomputed.

In [ ]:
# Shows the results recorded during the session (data/), so the notebook runs without a database. Set
# RERUN = True (or start Jupyter with BINDINGDB_RERUN=1) to rerun every BindingDB call on a local copy of
# the database instead and check it against its recorded result: see 'How to rerun the calls' above.
from mcp_bindingdb.notebook import Replay

RERUN = False
replay = Replay(release='202611', source_zip_sha256='daea9260d404919a183ce02d91bf4b9c49b410bea7eaaeba105c8e0280510381', rerun=RERUN)
Recorded with BindingDB release 202611, mcp-bindingdb v0.1.17 (commit 79dae5d22c0f)
python 3.12.7, duckdb 1.5.6, rdkit 2026.03.6, mcp 2.3.0, gemmi 0.7.5

Exchange 1¶

👤 User

Find compounds with a 4-chloroaniline group. What changes if I require a free NH2 (primary amine)?

In [ ]:
Call 1 · substructure_search · ran 2026-11-24 04:55:13 UTC (3 lines)
# Call 1 · substructure_search · ran 2026-11-24 04:55:13 UTC
await replay.call(1, 'substructure_search', {'query': 'Nc1ccc(Cl)cc1', 'count_only': True},
                  sha256='65857e018b47ebc2fbdf81eab35cdc4067315a7c7da2ba532ff945d7c35c823f')

Call 1 · substructure_search · recorded result · sha256 65857e018b47…

name smiles
query Nc1ccc(Cl)cc1
{
  "query": {
    "input": "Nc1ccc(Cl)cc1",
    "interpreted_as": "smiles",
    "canonical": "Nc1ccc(Cl)cc1"
  },
  "n_matching_compounds": 21350,
  "compounds_searched": 1466457,
  "compounds_indexed": 1466457
}
In [ ]:
Call 2 · substructure_search · ran 2026-11-24 04:55:15 UTC (3 lines)
# Call 2 · substructure_search · ran 2026-11-24 04:55:15 UTC
await replay.call(2, 'substructure_search', {'query': '[NX3;H2]c1ccc(Cl)cc1', 'query_type': 'smarts', 'count_only': True},
                  sha256='b60895ccd4615df653b8b39e9e91a66d809ddc7a0b3c529393e6fd352060024b')

Call 2 · substructure_search · recorded result · sha256 b60895ccd461…

name smiles
query (SMARTS) [N&X3&H2]c1ccc(Cl)cc1
{
  "query": {
    "input": "[NX3;H2]c1ccc(Cl)cc1",
    "interpreted_as": "smarts",
    "canonical": "[N&X3&H2]c1ccc(Cl)cc1"
  },
  "n_matching_compounds": 283,
  "compounds_searched": 1466457,
  "compounds_indexed": 1466457
}
In [ ]:
Call 3 · substructure_search · ran 2026-11-24 04:55:15 UTC (3 lines)
# Call 3 · substructure_search · ran 2026-11-24 04:55:15 UTC
await replay.call(3, 'substructure_search', {'query': 'Nc1ccc(Cl)cc1', 'limit': 8},
                  sha256='78f3ee9d21462b493fa4ca5cb975b89cadc9d1700c7e7892d2c472daa599a552')

Call 3 · substructure_search · recorded result · sha256 78f3ee9d2146…

name smiles
query Nc1ccc(Cl)cc1
{
  "query": {
    "input": "Nc1ccc(Cl)cc1",
    "interpreted_as": "smiles",
    "canonical": "Nc1ccc(Cl)cc1"
  },
  "compounds_searched": 100000,
  "search_set_size": 1466457
}

8 rows, truncated at the limit

monomerid bdbm_id name smiles mol_weight n_activities n_targets
16673 BDBM16673 Nexavar CNC(=O)c1cc(ccn1)Oc2ccc(cc2)NC(=O)Nc3ccc(c(c3)C(F)(F)F)Cl 464.09 1731 434
4851 BDBM4851 PTK787 Clc1ccc(Nc2nnc(Cc3ccncc3)c3ccccc23)cc1 346.1 856 385
50001884 BDBM50001884 CLOZARIL CN1CCN(CC1)C2=Nc3cc(ccc3Nc4c2cccc4)Cl 326.13 635 89
4552 BDBM4552 BOSUTINIB CN1CCN(CC1)CCCOc2cc3c(cc2OC)c(c(cn3)C#N)Nc4cc(c(cc4Cl)Cl)OC 529.16 585 386
22869 BDBM22869 Leponex CN1CCN(C2=c3ccccc3=Nc3ccc(Cl)cc3N2)CC1 326.13 413 101
21278 BDBM21278 Acomplia Cc1c(nn(c1-c1ccc(Cl)cc1)-c1ccc(Cl)cc1Cl)C(=O)NN1CCCCC1 462.08 271 33
2483 BDBM2483 EFV c1cc2c(cc1Cl)[C@@](OC(=O)N2)(C#CC3CC3)C(F)(F)F 315.03 254 23
50000766 BDBM50000766 DIAZEPAM CN1c2ccc(cc2C(=NCC1=O)c3ccccc3)Cl 284.07 139 54
In [ ]:
Call 4 · substructure_search · ran 2026-11-24 04:55:15 UTC (3 lines)
# Call 4 · substructure_search · ran 2026-11-24 04:55:15 UTC
await replay.call(4, 'substructure_search', {'query': '[NX3;H2]c1ccc(Cl)cc1', 'query_type': 'smarts', 'limit': 8},
                  sha256='1311b84bb20408d65e97589e51d208ebc9b8fad97b75b011572763033c24b978')

Call 4 · substructure_search · recorded result · sha256 1311b84bb204…

name smiles
query (SMARTS) [N&X3&H2]c1ccc(Cl)cc1
{
  "query": {
    "input": "[NX3;H2]c1ccc(Cl)cc1",
    "interpreted_as": "smarts",
    "canonical": "[N&X3&H2]c1ccc(Cl)cc1"
  },
  "compounds_searched": 100000,
  "search_set_size": 1466457
}

8 rows, truncated at the limit

monomerid bdbm_id name smiles mol_weight n_activities n_targets
35371 BDBM35371 MLS000042514 Nc1c(cc(Cl)c2nonc12)N1CCCC1 238.06 19 12
50259519 BDBM50259519 CHEMBL4087260 Nc1ccc(Cl)cc1-c1cnc2ccc(Cl)nn12 279.13 11 11
50259524 BDBM50259524 CHEMBL4067477 CC[C@@H](CO)Nc1ccc2ncc(-c3cc(Cl)ccc3N)n2n1 |r| 331.81 11 11
50574672 BDBM50574672 CHEMBL4861912 CN1CCN(CC1)c1ccc(cc1NC(=O)c1cc(N)c(F)c(C)c1Cl)-n1cc(nn1)C(=O)NCCCN1CCOCC1 614.13 11 7
61213 BDBM61213 MLS000763081 CN(C)c1cc(Cl)c2nonc2c1N 212.05 8 6
50658547 BDBM50658547 CHEMBL6148436 Cc1c(F)c(N)cc(C(=O)Nc2cc(-c3ccc(NC(=O)CCCCCCC(=O)NO)cc3)ccc2N2CCN(C)CC2)c1Cl 639.17 8 8
50658552 BDBM50658552 CHEMBL6133389 Cc1c(F)c(N)cc(C(=O)Nc2cc(-c3ccc(C(=O)NCc4ccc(/C=C/C(=O)NO)cc4)cc3)ccc2N2CCN(C)CC2)c1Cl 671.17 8 8
160150 BDBM160150 US9040534, 91 C[C@H]1Cn2c(nnc2-c2cnccn2)C(=O)N1Cc1cc(N)ccc1Cl |r| 369.11 6 3

🧠 Assistant

Whether you require a free NH2 makes a 75-fold difference:

Query Written as What it means Matching compounds
Nc1ccc(Cl)cc1 SMILES a nitrogen on a ring carbon para to a chlorine, with any substitution on the N 21,350
[NX3;H2]c1ccc(Cl)cc1 SMARTS the same, but the N must carry exactly two hydrogens (a free -NH2) 283

So about 99% of the 4-chloroaniline hits have the nitrogen built into something larger: an amide, a urea, a ring or a secondary amine.

SMILES query: the best-studied matches (most measurements first):

Compound Measurements Targets SMILES
Sorafenib (Nexavar) 1,731 434 CNC(=O)c1cc(ccn1)Oc2ccc(cc2)NC(=O)Nc3ccc(c(c3)C(F)(F)F)Cl
Vatalanib (PTK787) 856 385 Clc1ccc(Nc2nnc(Cc3ccncc3)c3ccccc23)cc1
Clozapine (Clozaril) 635 89 CN1CCN(CC1)C2=Nc3cc(ccc3Nc4c2cccc4)Cl
Bosutinib 585 386 CN1CCN(CC1)CCCOc2cc3c(cc2OC)c(c(cn3)C#N)Nc4cc(c(cc4Cl)Cl)OC
Clozapine (Leponex) 413 101 CN1CCN(C2=c3ccccc3=Nc3ccc(Cl)cc3N2)CC1
Rimonabant (Acomplia) 271 33 Cc1c(nn(c1-c1ccc(Cl)cc1)-c1ccc(Cl)cc1Cl)C(=O)NN1CCCCC1
Efavirenz (EFV) 254 23 c1cc2c(cc1Cl)[C@@](OC(=O)N2)(C#CC3CC3)C(F)(F)F
Diazepam 139 54 CN1c2ccc(cc2C(=NCC1=O)c3ccccc3)Cl

In every one of these the nitrogen is substituted. It is part of a urea (sorafenib), a ring or carbamate (clozapine, diazepam, efavirenz), or a secondary amine (vatalanib, bosutinib). In rimonabant the matching "N" is even an aromatic pyrazole nitrogen. Clozapine appears twice, as two BindingDB entries (Clozaril and Leponex), the second drawn as another tautomer.

SMARTS query: free NH2 only:

| Compound | Measurements | Targets | SMILES | | --- | --- | --- | --- | | MLS000042514 | 19 | 12 | Nc1c(cc(Cl)c2nonc12)N1CCCC1 | | CHEMBL4087260 | 11 | 11 | Nc1ccc(Cl)cc1-c1cnc2ccc(Cl)nn12 | | CHEMBL4067477 | 11 | 11 | CC[C@@H](CO)Nc1ccc2ncc(-c3cc(Cl)ccc3N)n2n1 |r| | | CHEMBL4861912 | 11 | 7 | CN1CCN(CC1)c1ccc(cc1NC(=O)c1cc(N)c(F)c(C)c1Cl)-n1cc(nn1)C(=O)NCCCN1CCOCC1 | | MLS000763081 | 8 | 6 | CN(C)c1cc(Cl)c2nonc2c1N | | CHEMBL6148436 | 8 | 8 | Cc1c(F)c(N)cc(C(=O)Nc2cc(-c3ccc(NC(=O)CCCCCCC(=O)NO)cc3)ccc2N2CCN(C)CC2)c1Cl | | CHEMBL6133389 | 8 | 8 | Cc1c(F)c(N)cc(C(=O)Nc2cc(-c3ccc(C(=O)NCc4ccc(/C=C/C(=O)NO)cc4)cc3)ccc2N2CCN(C)CC2)c1Cl | | US9040534, 91 | 6 | 3 | C[C@H]1Cn2c(nnc2-c2cnccn2)C(=O)N1Cc1cc(N)ccc1Cl |r| |

These are smaller and much less studied. The best-studied has only 19 measurements, compared with 1,731 for sorafenib. A free aromatic NH2 is uncommon in optimized drugs.

Lesson: SMILES describes a molecule, SMARTS describes a pattern. When you search with a SMILES string, the server matches it as a pattern made of the heavy atoms and bonds you wrote. Hydrogen counts are ignored, so N (or even [NH2]) matches a nitrogen with any number of substituents. To make a property part of the query, write SMARTS, which lets you state it per atom:

  • [NX3;H2]: a three-connected nitrogen with exactly two H (a primary amine).
  • [NX3;H1]: exactly one H (a secondary amine or amide NH).
  • [n] vs [N]: aromatic vs non-aromatic nitrogen.
  • [#7]: any nitrogen, whatever its form.

With query_type="auto" the server falls back to SMARTS when a query is not valid SMILES. If you need H counts enforced, set query_type="smarts" yourself.

How this was answered

  1. substructure_search with Nc1ccc(Cl)cc1 (SMILES) and count_only=true: 21,350 compounds.
  2. substructure_search with [NX3;H2]c1ccc(Cl)cc1, query_type="smarts" and count_only=true: 283 compounds.
  3. The same two searches with limit=8: example compounds, ranked by number of measurements. A listing is capped by limit (and scans the 100,000 best-measured compounds), so it shows the best-studied matches, not a random sample.

Try next

  • "Which approved drugs contain a 4-chloroaniline, and what do they target?"
  • "How many compounds contain a quinazoline core?" (Example 2.3)

Verification¶

How each rerun call compared with its recorded result.

In [ ]:
replay.summary()

Recorded: 4 tool calls. Run all cells to compare.

How to cite¶

Cite this notebook (for example deposited with a DOI) together with the data and software it ran on:

  • Data: BindingDB release 202611, https://www.bindingdb.org/rwd/bind/BDB-mySQL_All_202611_dmp.zip (SHA-256 daea9260d404919a183ce02d91bf4b9c49b410bea7eaaeba105c8e0280510381)
  • Software: mcp-bindingdb v0.1.17, commit 79dae5d22c0f15b8ded9b49adc8b105f0463703a, https://github.com/sbl-sdsc/mcp-bindingdb
  • Analysis: Example 2.4 — SMILES vs SMARTS queries (4-chloroaniline), 2026-11-23, with claude-sonnet-5-5
  • 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

As BibTeX, for this server, BindingDB and RDKit (used for structure search, properties and drawings):

@software{rose2026mcp-bindingdb,
  title={MCP BindingDB Server},
  author={Rose, P.W.},
  year={2026},
  url={https://github.com/sbl-sdsc/mcp-bindingdb}
}

@article{liu2025bindingdb,
  title={BindingDB in 2024: a FAIR knowledgebase of protein-small molecule binding data},
  author={Liu, T. and Hwang, L. and Burley, S.K. and Nitsche, C.I. and Southan, C. and Walters, W.P. and Gilson, M.K.},
  journal={Nucleic Acids Research},
  volume={53},
  number={D1},
  pages={D1633--D1644},
  year={2025},
  doi={10.1093/nar/gkae1075}
}

@software{rdkit,
  title={RDKit: Open-source cheminformatics},
  author={Landrum, G. and others},
  version={2026.03.6},
  url={https://www.rdkit.org},
  doi={10.5281/zenodo.591637}
}