Selection builder
Build, validate, export, and replay molecule-selection/1 without local chemistry.
Builder methods are copy-on-write, so one base selection can safely create experimental arms.
from deepmedchem import Client, Selection
aspirin = "CC(=O)Oc1ccccc1C(=O)O"
selection = (
Selection.from_database("enamine-real-v5a")
.reference("aspirin", smiles=aspirin)
.ranked()
.maximize_similarity("rdkit.ecfp4_tanimoto", reference="aspirin")
.require_different_scaffold("rdkit.bemis_murcko", reference="aspirin")
.require_pattern("alpha-amino-acid/v1", min_count=1)
.where("rdkit.mol_wt", gt=250, units="Da", fidelity="exact_product")
.acquire_predicted_property(
"openadmet-herg-pchembl",
direction="minimize",
keep_fraction=0.25,
)
.limit(100)
.max_per_scaffold(5)
.include("properties", "constraint_evidence", "objective_components", "execution_plan")
)
selection.to_json()
selection.to_yaml()
replayed = Selection.model_validate(selection.to_dict())
with Client() as dmc:
validation = dmc.selections.validate(replayed)
estimate = dmc.selections.estimate(validation.normalized_selection)The builder does not infer shape versus electrostatic, logP versus logD, scaffold method, matching policy, or predictive model. Local validation checks the document shape; remote validation resolves release-specific capabilities and exactness.
acquire_predicted_property is available only for ranked selections that already have a
similarity objective. It reduces that similarity shortlist by a rank quantile; it is not a hard
ADMET constraint. Returned hit.acquisition.predicted_value and hit.acquisition.applicable
values are accompanied by response-level model version, direction, units, qualification, and
candidate-count provenance.
Predicted values are experimental acquisition signals, not measured assays. Use exact RDKit constraints for eligibility and consult the authenticated catalog before choosing an endpoint; endpoint support is release-specific.