rascore-api / README.md
ilkhamfy's picture
Add README.md
38680a7 verified
|
Raw
History Blame Contribute Delete
2 kB
---
title: RAScore API
sdk: docker
app_port: 7860
pinned: false
license: mit
---
# RAScore micro-service (isolated)
A small, CORS-enabled REST service that returns the **Retrosynthetic Accessibility
score (RAScore)** for a list of SMILES. RAScore (Thakkar et al., *Chem. Sci.* 2021,
[10.1039/D0SC05401A](https://doi.org/10.1039/D0SC05401A)) is the probability that a
computer-aided synthesis-planning tool (AiZynthFinder) can find a route to the
molecule: **0 = hard / no route found, 1 = readily synthesizable**. It is a fast,
learned make-ability signal that complements the Ertl SA score.
## Why this is a separate Space
RAScore's pretrained XGBoost model only unpickles under 2020-era pins
(Python 3.7, scikit-learn 0.22.1, xgboost 1.0.2), which are **incompatible with the
modern ADMET-AI / Chemprop stack**. Running it in its own container means it can
never destabilise the ADMET endpoint. (The `Dockerfile` installs RAScore with
`--no-deps` so it does not pull TensorFlow, which is only needed for the unused
neural-net model.)
## API
```
POST /score
Content-Type: application/json
{ "smiles": ["CCO", "c1ccccc1", ...] } # up to 1000 per request
-> { "results": [ { "smiles": "CCO", "RAScore": 0.97 }, ... ] }
```
`GET /health` returns `{ "status": "ok" }`.
## Deploy
1. Create a new Hugging Face Space, **SDK = Docker**.
2. Add `Dockerfile` and `app.py` from this folder.
3. Wait for the build (first build is slow; the legacy pins are finicky — if it
fails, check the logs, usually a numpy / scikit-learn ABI mismatch).
4. The Space serves at `https://<user>-<space>.hf.space`.
Local alternative: `docker build -t rascore . && docker run -p 7860:7860 rascore`.
## Point MolParetoLab at it
In the app, click **"Make-ability score (RAScore)"** in the sidebar and paste your
Space URL when prompted (stored in `localStorage`). The app fetches `RAScore` for
every loaded molecule and exposes it as a Pareto objective (maximize) and an axis
under "Make-ability & cost".