ADMET Predictor
Predict absorption, distribution, metabolism, excretion and toxicity (ADMET) properties for small molecules from their SMILES alone – no protein structure is involved. Unlike most modules this one has a single submission step: create_project() sends everything and blocks until the prediction finishes, after which the result methods below become available.
One token is charged per submission regardless of molecule count (up to 5,001 molecules in one call), so batching a library into one submission is always cheaper than splitting it.
Create ADMET Predictor Project
Start by creating a project object:
import molcube as mc
from molcube.admet_predictor import AdmetRoute, AdmetTarget
molcube = mc.API("api.molcube.com", 443)
molcube.authenticate(api_token="your-api-token")
admet = molcube.create_admet_predictor_project()
Use create_project() to submit and block until the prediction completes. The available options are:
title (str): Project title, 100 characters or fewer. Raises
ValueErrorif empty or longer.molecules (list[str | dict], optional): SMILES strings, or
{"smiles": ..., "name": ...}dicts when you want names in the results. Ids are assigned automatically. Mutually exclusive withcsv_path– raisesValueErrorif neither or both are given, if the list is empty or exceeds 5,001 molecules, or if any entry has no SMILES.csv_path (str | Path, optional): Local
.csvwith asmilescolumn (required) and an optionalnamecolumn. The file is uploaded as-is and kept with the project. RaisesValueErrorif the extension isn’t.csv, the file isn’t UTF-8, thesmilescolumn is missing, or no row has a usable value.route (AdmetRoute):
ORAL,IV, orTOPICAL(default:ORAL). Absorption endpoints (HIA, Bioavailability, Caco-2) are only scored forORALand return “N/A” otherwise.target (AdmetTarget):
CNSorNON_CNS(default:NON_CNS). Flips the grading direction of several endpoints – BBB penetration most notably: a permeability of 0.5 is a failure forCNS(the drug never reaches the brain) and close to a pass forNON_CNS(it stays out, avoiding central side effects).workspace (str):
"personal"or"team"(default:"personal").strict_smiles (bool): admet-ai silently drops SMILES it cannot parse – the molecule comes back with
predicted=Falseand no values. By default (False, matching the web app) this is only a warning and the submission still goes through; passTrueto raiseValueErrorand refuse the submission instead.
All of the above are checked locally before anything is sent to the server.
SMILES list – the equivalent of the web app’s “SMILES Text” tab:
assert admet.create_project(
"kinase_hit_list",
molecules=[
"CC(=O)Oc1ccccc1C(=O)O", # aspirin
"CN1C=NC2=C1C(=O)N(C(=O)N2C)C", # caffeine
],
route=AdmetRoute.ORAL,
target=AdmetTarget.NON_CNS,
)
Named molecules – mix plain SMILES with dicts when you want names in the results:
assert admet.create_project(
"kinase_hit_list",
molecules=[
"CC(=O)Oc1ccccc1C(=O)O",
{"smiles": "CN1C=NC2=C1C(=O)N(C(=O)N2C)C", "name": "caffeine"},
],
)
CSV upload – for larger libraries:
assert admet.create_project(
"library_screen",
csv_path="./library.csv", # columns: smiles (required), name (optional)
route=AdmetRoute.ORAL,
target=AdmetTarget.CNS,
)
Inspect State / Preview Payload
get_state()– returns the current local state as a dict. Does not contact the server.preview_payload()– returns the payload the next submission (e.g. aresubmit()) would send, for inspection.
admet.get_state()
admet.preview_payload()
Resubmit / Stop
resubmit(*, molecules=None, csv_path=None, route=None, target=None, strict_smiles=False)– re-runs the prediction on the same project. Every argument is optional and anything omitted keeps its current value, soresubmit(target=AdmetTarget.CNS)re-scores the same molecules under the other target context. This mirrors going back to Step 1 in the web app and changing one field – the project id is reused rather than a new project being created. Costs another token.stop_project()– cancels the running task (mirrors the Cancel button in the web app).
assert admet.resubmit(target=AdmetTarget.CNS)
# Cancel if needed:
admet.stop_project()
Step 2 — Results
Once create_project() returns, read back the predictions.
get_step()– 1 while running, 2 once results are available.list_molecules()– a compact table: id, name, smiles,predicted,alerts_passed,alert_count.get_molecule(molecule_id)– one molecule’s raw result entry, including image data.get_predictions(molecule_id)– endpoint values, formatted the way the web app displays them (three decimal places, or"—"). For unrounded floats, readget_molecule(molecule_id)["predictions"]directly, or useget_dataframe()(see Bulk Screening), which is unaffected by this formatting.get_evaluated(molecule_id)– endpoint →{"status", "rule"}(Pass/Warn/Fail/N/A + the threshold text).get_full_evaluation(molecule_id)– value + status + rule + description merged into one dict per endpoint, the same view as the web app’s “All Predictions” tab. The description text is not part of the API response at all; it comes from a local copy of the backend’s description table.get_extended_metrics(molecule_id)– up to eight radar-chart axes (hERG, DILI, AMES, ClinTox, HIA, BBB, P-gp, CYP3A4 Inhibition), each withcat,name,val,score, andrisk(normalised so higher always means worse).get_structural_alerts(molecule_id)– PAINS / BRENK / NIH alert names. Computed independently of the ADMET model, so present even for molecules the engine could not predict.get_unpredicted()– SMILES the engine produced no prediction for.
molecules = admet.list_molecules()
mol_id = molecules[0]["id"]
admet.get_predictions(mol_id)
admet.get_evaluated(mol_id)
admet.get_full_evaluation(mol_id)
admet.get_extended_metrics(mol_id)
admet.get_structural_alerts(mol_id)
admet.get_unpredicted()
Note: get_full_evaluation()’s value field is the same display string as get_predictions() – read raw_value on the same entry for the unrounded float.
Endpoint Names
Endpoint keys in get_predictions() / get_evaluated() / get_dataframe() are the backend’s camelCase forms, in which the original admet-ai casing is partly lost (Solubility_AqSolDB arrives as SolubilityAqsoldb). The CSV from download_report() keeps the original spelling instead, so the two do not match exactly. Use normalize_endpoint() / original_endpoint_name() to move between them – both accept either spelling:
from molcube.admet_predictor import normalize_endpoint, original_endpoint_name
normalize_endpoint("Solubility_AqSolDB") # -> "SolubilityAqsoldb"
original_endpoint_name("SolubilityAqsoldb") # -> "Solubility_AqSolDB"
Bulk Screening
The web app shows one molecule at a time behind a paginated list, so comparing a whole library there is impractical. This is the main reason this module is worth having in the SDK.
get_dataframe(*, endpoints=None, kind="value") returns the results as a molecules-by-endpoints pandas.DataFrame, indexed by molecule id with name/smiles as the first columns. endpoints accepts either spelling of a name. kind is "value" (predicted values), "status" (Pass/Warn/Fail/N/A), or "both" (MultiIndex carrying both). Molecules the engine dropped appear as rows of NaN rather than zero, so a numeric filter excludes them instead of silently treating them as passing:
df = admet.get_dataframe()
status_df = admet.get_dataframe(kind="status")
clean = status_df[(status_df[["hERG", "AMES"]] == "Pass").all(axis=1)]
filter_molecules(*, status=None, max_count=0, endpoints=None, require_alerts_passed=False, require_predicted=True) screens the whole library by verdict count and structural alerts, returning a list of MoleculeSummary. Unpredicted molecules are excluded by default – otherwise a molecule with zero results also has zero failures and would pass every filter:
admet.filter_molecules(status="Fail") # zero Fail verdicts
admet.filter_molecules(require_alerts_passed=True) # no PAINS/BRENK/NIH hits
3D structures are not involved in this module, so there is no viewer – 2D structure images are covered next instead.
Molecule Images
get_molecule_image(molecule_id, alert=None)– a molecule’s 2D structure as PNG bytes. Passalert(a name fromget_structural_alerts()) to get the variant with that alert’s substructure highlighted.save_molecule_image(molecule_id, output_path, alert=None)– saves the same image to a file. A directory writes<molecule_id>.png(or<molecule_id>_<alert>.png) inside it.
admet.get_molecule_image(mol_id)
admet.save_molecule_image(mol_id, "./mol.png")
alerts = admet.get_structural_alerts(mol_id)
if alerts:
admet.save_molecule_image(mol_id, "./highlighted.png", alert=alerts[0])
Download Artifacts
download_report(output_path)– the full results as a CSV: one row per molecule-endpoint pair, with value, verdict, rule, and description.download_project(output_path)– the full project archive (.tar.gz). The web app has no button for this; the endpoint works regardless.
Note: output_path is optional. If omitted, files are saved to the current directory.
admet.download_report()
admet.download_project()