Task tutorial
Rank a validated SMILES library by ECFP4 similarity
Compare one query molecule with a prevalidated local list and retain the highest local Tanimoto scores.
You will make
A reproducible top-hit list with the query, candidate SMILES, ECFP4 method, and score.
Steps
- Validate the library first so each score still maps to its input row.
- Set the query and candidate SMILES list.
- Run one-to-many ECFP4 Tanimoto scoring, sort descending, and retain the inputs with the scores.
import chematic
import numpy as np
query = "CC(=O)OC1=CC=CC=C1C(=O)O"
library = ["O=C(O)c1ccccc1O", "CCO", "c1ccccc1"] # validated SMILES
scores = chematic.bulk.tanimoto_search(query, library)
for index in np.argsort(scores)[::-1][:3]:
i = int(index)
print(library[i], f"{float(scores[i]):.3f}")Expected result
The script prints the candidates in descending ECFP4 Tanimoto score order. Re-running the same query and validated library gives the same ranking.
If it does not work
bulk.tanimoto_search skips invalid library entries, so do not use its array positions to identify raw source rows until validation is complete. Similarity is not evidence of activity, safety, or synthetic feasibility.