CHEESE API

Random sampling

Draw a bounded, optionally seeded sample with explicit distribution semantics.

Suggest an edit

POST /api/v2/sample draws 1–1,000 assembled molecules from one chemical space.

{
  "database_id": "enamine-real-v5a",
  "count": 100,
  "seed": 12345,
  "include_synthons": false
}

For a combinatorial space, route_product_tuple means reactions are weighted by valid tuple counts and a tuple is drawn uniformly from the chosen route. Deduplication means this is not necessarily uniform over unique canonical molecules. Enumerated spaces may advertise eligible_row instead. Always read sampling_method, sampling_version, database_release, and warnings.

The response reports requested, returned, and deduplicated — the number of draws removed because they assembled to a product already in the sample, so returned can be below count.

A seed is reproducible only with the same database release and sampling algorithm version. Omitting it lets the server choose and return a seed. Constrained sampling uses a sample strategy in /selections; it is never implemented by fetching a random shortlist and filtering on the client.

molecules = dmc.sample(
    database="enamine-real-v5a",
    count=100,
    seed=12345,
)