API reference¶
The reference below is generated directly from the current Python sources. Names beginning with an underscore are implementation details.
Runtime¶
AMDockVSRuntime
¶
AMDockVSRuntime()
Bases: AppRuntime
Public AMDockVS runtime on top of the stable MolSuite API.
Methods:
| Name | Description |
|---|---|
has_shards |
Does the screening library live in shards? Read off the data, never declared: |
general_ligand_count |
How many screening ligands are rows here — what the importer asks before offering |
check_storage |
(level, title, text) of a fast check of the project's payload volumes. |
compact_storage_if_due |
Once no job is active, release the structures no row uses and compact the payload volumes |
repair_storage |
Clear the payload volumes' leftovers (see |
clear_transport |
Delete the files campaigns of rows packed for a queue (see |
track_job_items |
Say what a job's chunks hold, for the monitor: |
track_chunk_items |
|
job_title |
The monitor's |
measure_job |
The monitor's |
set_forced_dependencies |
Workflow channel: ids the NEXT submit_job call(s) must also depend on. Lets the |
submit_job |
Submit a job, auto-waiting for active prerequisite jobs by default. |
is_queue |
Whether |
submit_campaign |
Submit an |
job_destinations |
|
resume_job |
Continue a job that was canceled or interrupted, on |
resolve_job_dependencies |
Union of explicit depends_on and the ids of active jobs this one should wait for. |
wait_for_job |
Block until the job has ended. |
watch_job |
Display tqdm progress in a terminal or notebook and return the job status. |
watch_jobs |
Display concurrent tqdm progress for several jobs of this session. |
run_destinations |
Where a job may be sent now, as (executor_name, label): the executors that are |
Attributes:
| Name | Type | Description |
|---|---|---|
tools |
ToolAPI
|
Optional external programs managed by AMDockVS. |
shards |
ShardAPI
|
Access registered shard containers without wrapping their records. |
ligands_store |
The row tools' view of the library. The shard tools build their own store. |
|
workflow |
The single active workflow (a WorkflowRunner). Panels add steps to this shared |
Source code in src/amdockvs/runtime.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
shards
property
¶
shards: ShardAPI
Access registered shard containers without wrapping their records.
ligands_store
property
¶
ligands_store
The row tools' view of the library. The shard tools build their own store.
workflow
property
¶
workflow
The single active workflow (a WorkflowRunner). Panels add steps to this shared instance via runtime.workflow.add_step(...); it persists for the session.
has_shards
¶
has_shards() -> bool
Does the screening library live in shards? Read off the data, never declared: a project holds a sharded library by holding shards.
Source code in src/amdockvs/runtime.py
312 313 314 315 316 | |
general_ligand_count
¶
general_ligand_count() -> int
How many screening ligands are rows here — what the importer asks before offering to shard, since the two libraries cannot coexist.
Source code in src/amdockvs/runtime.py
318 319 320 321 322 | |
check_storage
¶
check_storage() -> tuple[str, str, str]
(level, title, text) of a fast check of the project's payload volumes.
Source code in src/amdockvs/runtime.py
436 437 438 439 440 441 | |
compact_storage_if_due
¶
compact_storage_if_due() -> dict | None
Once no job is active, release the structures no row uses and compact the payload volumes that are mostly dead bytes; the stats, or None when nothing was due.
Source code in src/amdockvs/runtime.py
443 444 445 446 447 448 449 450 451 | |
repair_storage
¶
repair_storage()
Clear the payload volumes' leftovers (see check_storage); refused while a job is active.
Source code in src/amdockvs/runtime.py
453 454 455 456 457 458 459 460 | |
clear_transport
¶
clear_transport() -> int
Delete the files campaigns of rows packed for a queue (see clear_transport); the bytes
freed. Refused while a job is active or interrupted: a campaign going on there needs them.
Source code in src/amdockvs/runtime.py
462 463 464 465 466 467 468 469 470 | |
track_job_items
¶
track_job_items(job_id: str, count, *, unit: str) -> None
Say what a job's chunks hold, for the monitor: count() -> (done, total) in unit.
Kept for this session only; a job of an earlier one shows its chunks alone.
Source code in src/amdockvs/runtime.py
492 493 494 495 496 497 | |
track_chunk_items
¶
track_chunk_items(job_id: str, total: int, per_chunk: int, *, unit: str) -> None
track_job_items for a job whose chunks hold per_chunk items each, the last one
fewer: read from the engine's own count, so the monitor's poll touches no database.
Source code in src/amdockvs/runtime.py
499 500 501 502 503 504 505 506 507 508 | |
job_title
¶
job_title(job_id: str, name: str) -> str
The monitor's title: "Docking · gnina (CNN)" for amdock_docking_job. A job of an
earlier session is titled from the params the journal kept of it.
Source code in src/amdockvs/runtime.py
510 511 512 513 514 515 516 517 518 519 520 | |
measure_job
¶
measure_job(job_id: str) -> dict | None
The monitor's measure: called on its polling thread, so count only reads.
Source code in src/amdockvs/runtime.py
522 523 524 525 526 527 528 529 | |
set_forced_dependencies
¶
set_forced_dependencies(job_ids: Optional[list[str]]) -> None
Workflow channel: ids the NEXT submit_job call(s) must also depend on. Lets the orchestrator inject same-category serialization that the category auto-deps don't cover, without every submit API needing a depends_on parameter. Cleared by passing None.
Source code in src/amdockvs/runtime.py
541 542 543 544 545 | |
submit_job
¶
submit_job(job, *, params: Any = None, executor_name: Optional[str] = None, cpu_required: Optional[int] = None, max_job_cpu: Optional[int] = None, max_inflight_tasks: Optional[int] = None, total_chunks: Optional[int] = None, depends_on: Optional[list[str]] = None, priority: int = 0, auto_depends: bool = True, queue_behind: Optional[str] = None, autobatch: int = 0) -> str
Submit a job, auto-waiting for active prerequisite jobs by default.
autobatch (a number of chunks) lets the executor size its tasks: they start at that
many of the job's chunks, never fewer than one, and grow while bigger ones pay (see
ms_flow.Engine.submit). Its chunks then run through the job's run_chunks; an
executor that takes one chunk to a task runs them one by one.
queue_behind names a lane (e.g. "docking"): the job goes a priority level below every
active job of that lane on the same executor, so long jobs of a kind run one after the
other, each on what the ones before it leave free, instead of sharing the machine.
With auto_depends=True (default) the job is held until every active job of its prerequisite categories finishes, so a deferred pipeline can be queued at once. Pass auto_depends=False to submit immediately regardless of running jobs. Returns the key of the job in the project's journal, which is its id everywhere here.
Source code in src/amdockvs/runtime.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
is_queue
¶
is_queue(executor_name: Optional[str]) -> bool
Whether executor_name is a cluster's queue: what goes there is a campaign.
Source code in src/amdockvs/runtime.py
624 625 626 627 | |
submit_campaign
¶
submit_campaign(job, *, params: Any, executor_name: str, priority: int = 0) -> str
Submit an ms_flow.campaign to the queue executor_name; its key in the journal is
its identity, so the same campaign submitted again is the job that already follows it.
ponytail: its elements are made now, from what the project has now: it waits for no job.
Source code in src/amdockvs/runtime.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
job_destinations
¶
job_destinations(job_id: str) -> list[tuple[str, str]]
run_destinations for a job on record: where it may be continued now. Nowhere for one
that cannot be submitted again; a campaign, only to an active queue.
Source code in src/amdockvs/runtime.py
665 666 667 668 669 670 671 672 673 674 | |
resume_job
¶
resume_job(job_id: str, executor_name: Optional[str] = None) -> str
Continue a job that was canceled or interrupted, on executor_name or where it was.
A job that is still running is canceled first and waited for, which is how it is moved to another executor: not from a thread that cannot wait. It waits for the jobs its kind waits for, as when it was submitted.
Source code in src/amdockvs/runtime.py
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | |
resolve_job_dependencies
¶
resolve_job_dependencies(job, explicit: Optional[list[str]] = None) -> Optional[list[str]]
Union of explicit depends_on and the ids of active jobs this one should wait for.
Source code in src/amdockvs/runtime.py
724 725 726 727 728 729 730 731 732 733 734 735 | |
wait_for_job
¶
wait_for_job(job_id: str, *, poll_s: float = 0.2) -> JobStatus
Block until the job has ended. poll_s is not used: the engine tells.
Source code in src/amdockvs/runtime.py
750 751 752 753 754 755 756 757 758 759 | |
watch_job
¶
watch_job(job_id: str, *, poll_s: float = 0.2) -> JobStatus
Display tqdm progress in a terminal or notebook and return the job status.
Source code in src/amdockvs/runtime.py
761 762 763 | |
watch_jobs
¶
watch_jobs(job_ids: Iterable[str], *, poll_s: float = 0.2) -> dict[str, JobStatus]
Display concurrent tqdm progress for several jobs of this session.
Source code in src/amdockvs/runtime.py
765 766 767 768 769 770 771 772 773 | |
run_destinations
¶
run_destinations(job=None) -> list[tuple[str, str]]
Where a job may be sent now, as (executor_name, label): the executors that are
active, the default one first. With job, only the ones that job can run on.
Source code in src/amdockvs/runtime.py
808 809 810 811 812 813 814 815 816 817 818 | |
Molecules¶
api
¶
Classes:
| Name | Description |
|---|---|
MoleculeAPI |
|
MoleculeAPI
dataclass
¶
MoleculeAPI(runtime: Any)
Methods:
| Name | Description |
|---|---|
get |
Return one molecule without exposing the project session to callers. |
excluded_ids |
Every excluded molecule ( |
excluded_since |
|
details |
Load the complete Details-panel projection for a molecule. |
list_sets |
List saved molecule sets newest first. |
resolve_set |
Resolve UI/catalog set values into the public typed set reference. |
sync_set_membership |
Reconcile the denormalized |
scope_clause |
Opaque SmartTable adapter for a public molecule scope. |
evaluate_filter |
Count filter outcomes without mutating molecules. |
apply_filter |
Apply an evaluated filter or persist its matches as a molecule set. |
molblock |
The molecule's current structure as a molfile — what the 2D editor opens. |
dependents |
What hangs from this molecule's structure and would go if an edit replaced it. |
edit |
Give a molecule an edited structure (a molfile from the 2D editor). |
stream |
Compatibility entry point; prefer iterating the returned Selection. |
library_shape |
|
has_receptors |
Whether any receptor row exists — a one-row lookup. |
shard_counts |
Inventory of the sharded library: shards, molecules in them, and how many are prepared. |
library_stats |
What the Project dialog shows of a sharded library: see |
shard_preps |
One shard's preparations: family -> (prepared records, failed records). |
select_fragment |
Make another component of the imported original the molecule's current structure. |
get
¶
get(molecule_id: int) -> MoleculeRecord | None
Return one molecule without exposing the project session to callers.
Source code in src/amdockvs/molecules/api.py
121 122 123 124 125 | |
excluded_ids
¶
excluded_ids() -> set[int]
Every excluded molecule (idx_mol_excluded holds only those): a run's "before".
Source code in src/amdockvs/molecules/api.py
127 128 129 130 131 | |
excluded_since
¶
excluded_since(before: set[int], *, limit: int = 10000) -> list[tuple[int, str, str]]
(id, name, reason) of the molecules excluded now but not in before — what a run
failed. ponytail: a run alongside it mixes its failures in; per-job ids if that matters.
Source code in src/amdockvs/molecules/api.py
133 134 135 136 137 138 139 140 141 142 143 144 145 | |
details
¶
details(molecule_id: int) -> Details | None
Load the complete Details-panel projection for a molecule.
Source code in src/amdockvs/molecules/api.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
list_sets
¶
list_sets() -> list[SetRecord]
List saved molecule sets newest first.
Source code in src/amdockvs/molecules/api.py
216 217 218 219 220 | |
resolve_set
¶
resolve_set(source: MoleculeSetRef | SetRecord | int) -> MoleculeSetRef
Resolve UI/catalog set values into the public typed set reference.
Source code in src/amdockvs/molecules/api.py
222 223 224 225 226 227 228 229 230 231 | |
sync_set_membership
¶
sync_set_membership() -> None
Reconcile the denormalized in_set molecule flag.
Source code in src/amdockvs/molecules/api.py
233 234 235 236 | |
scope_clause
¶
scope_clause(scope: MoleculeScope | Selection[Any])
Opaque SmartTable adapter for a public molecule scope.
ORM expressions stay behind the AMDock API; UI callers only pass the returned value to SmartTableView's external-clause hook.
Source code in src/amdockvs/molecules/api.py
238 239 240 241 242 243 244 245 246 247 248 | |
evaluate_filter
¶
evaluate_filter(scope: MoleculeScope | Selection[Any], criteria, *, exclusion_reason_prefix: str = '') -> dict[str, int]
Count filter outcomes without mutating molecules.
Source code in src/amdockvs/molecules/api.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
apply_filter
¶
apply_filter(scope: MoleculeScope | Selection[Any], criteria, *, action: str, reason: str = '', exclusion_reason_prefix: str = '', set_name: str = '') -> tuple[int, int | None]
Apply an evaluated filter or persist its matches as a molecule set.
Source code in src/amdockvs/molecules/api.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |
molblock
¶
molblock(molecule_id: int) -> str
The molecule's current structure as a molfile — what the 2D editor opens.
Source code in src/amdockvs/molecules/api.py
312 313 314 315 316 317 318 319 320 321 322 | |
dependents
¶
dependents(molecule_id: int) -> dict[str, int]
What hangs from this molecule's structure and would go if an edit replaced it.
Source code in src/amdockvs/molecules/api.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
edit
¶
edit(molecule_id: int, molblock: str, *, copy: bool = False) -> int | None
Give a molecule an edited structure (a molfile from the 2D editor).
copy=False replaces it: everything computed from the old structure goes (clear_derived:
conformers, engine preparations, descriptors, fingerprints, docking results...) and so do its
activities, measured on the old compound; the imported original (stored_payload_id), sets and
complexes stay. copy=True leaves the molecule alone and adds the edit as a new one, with
nothing of the old one's but its role. Returns the id holding the edit, or None when the
drawing is still the same compound, which changes nothing.
Source code in src/amdockvs/molecules/api.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
stream
¶
stream(scope: MoleculeScope | Selection[MoleculeRecord] | None = None) -> Iterator[MoleculeRecord]
Compatibility entry point; prefer iterating the returned Selection.
Source code in src/amdockvs/molecules/api.py
443 444 445 446 447 | |
library_shape
¶
library_shape() -> tuple[bool, bool]
(the library is sharded, any ligand row exists) — two one-row lookups.
What the catalog bar needs to know and the only thing it needs the db for: Shards is there when there are shards, Ligands lights up when there is any ligand row at all.
Source code in src/amdockvs/molecules/api.py
471 472 473 474 475 476 477 478 479 480 481 | |
has_receptors
¶
has_receptors() -> bool
Whether any receptor row exists — a one-row lookup.
Source code in src/amdockvs/molecules/api.py
483 484 485 486 487 488 | |
shard_counts
¶
shard_counts(*, engine: str = 'ad4') -> dict[str, int]
Inventory of the sharded library: shards, molecules in them, and how many are prepared.
Preparation is engine-specific and does not rewrite the chemical inventory.
Source code in src/amdockvs/molecules/api.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | |
library_stats
¶
library_stats()
What the Project dialog shows of a sharded library: see molecules.library_stats.
Source code in src/amdockvs/molecules/api.py
508 509 510 511 512 513 514 515 516 517 518 | |
shard_preps
¶
shard_preps(shard_id: int) -> dict[str, tuple[int, int]]
One shard's preparations: family -> (prepared records, failed records).
Source code in src/amdockvs/molecules/api.py
520 521 522 523 524 525 526 527 528 529 | |
select_fragment
¶
select_fragment(molecule_id: int, fragment_index: int) -> Any
Make another component of the imported original the molecule's current structure.
Fragments are not stored: this one is cut again from the original and written alone. What
was computed from the old structure goes (clear_derived); activities, measured on the
imported compound, stay.
Source code in src/amdockvs/molecules/api.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
Import¶
LoaderAPI
dataclass
¶
LoaderAPI(runtime: Any)
Methods:
| Name | Description |
|---|---|
duplicate_imports |
The files (resolved paths) imported completely into this project before. |
download |
Fetch |
shard_ligands |
The |
duplicate_imports
¶
duplicate_imports(files) -> list[str]
The files (resolved paths) imported completely into this project before.
Source code in src/amdockvs/io/api.py
100 101 102 103 104 105 | |
download
¶
download(source, ids: Iterable[str], *, keep: bool = True, progress=None, cancel=None)
Fetch ids from a download source (a key of amdockvs.io.downloads.SOURCES).
keep=False puts them in the project's temporary downloads: the import that reads them
deletes them once it has completed. Returns an Outcome (files, failures).
Source code in src/amdockvs/io/api.py
123 124 125 126 127 128 129 130 131 | |
shard_ligands
¶
shard_ligands(files: Iterable[PathLike], *, shard_size: int | None = None, executor_name: str = 'compute', depends_on: list[str] | None = None, molecule_kind: str = 'small_molecule', prefilter: Mapping[str, Any] | None = None, temporary_files: Iterable[PathLike] | None = None, force: bool = False) -> list[str]
The htpvs import: split the library into shards, materialize nothing.
Same feed as load_ligands — the byte-span splitter — with the record cap read as
shard size. What changes is the worker: it writes the span back out as a file and
registers a screening_shards row instead of parsing molecules into the project db.
Source code in src/amdockvs/io/api.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
Chemistry¶
ChemistryAPI
dataclass
¶
ChemistryAPI(runtime: Any)
Methods:
| Name | Description |
|---|---|
pkasso_gpu_support |
Whether pKasso's Uni-pKa can run on this machine's GPU. Takes seconds the first time |
run_ligand_pipeline |
Run several chemistry steps in one pass over the active screening library. |
run_shard_pipeline |
The same steps as |
predict_receptors |
Predict protein structures from sequence with the ESMFold API (thread executor). |
pkasso_gpu_support
¶
pkasso_gpu_support() -> GpuSupport
Whether pKasso's Uni-pKa can run on this machine's GPU. Takes seconds the first time for an installation (it starts PyTorch and CUDA there): not on a GUI thread.
Source code in src/amdockvs/chemistry/api.py
53 54 55 56 57 58 59 | |
run_ligand_pipeline
¶
run_ligand_pipeline(steps: Sequence[str | tuple[str, dict[str, Any]]], *, ligands: MoleculeSetRef | MoleculeScope | int | None = None, structure_source: str = 'current', batch_size: int = 128, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None, wait: bool = False) -> str | JobStatus
Run several chemistry steps in one pass over the active screening library.
run_ligand_pipeline(["standardize", "protonate", "generate_3d"]) reads and writes every
ligand once; the three single-step jobs read and rewrite the whole library three times.
With no explicit row scope, a sharded library dispatches whole shards automatically.
Passing ligands always selects the row adapter for curated/reference molecules.
Protonate and minimize steps are checked as their single-step methods check them (pH range, method and force-field names, tool installs). ponytail: the other steps' params go through as given and the worker raises.
Source code in src/amdockvs/chemistry/api.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
run_shard_pipeline
¶
run_shard_pipeline(steps: Sequence[str | tuple[str, dict[str, Any]]], *, params: dict[str, Any] | None = None, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None, wait: bool = False) -> str | JobStatus
The same steps as run_ligand_pipeline, over the shards of an htpvs project.
One shard per chunk, one file in and one file out. The run writes into a new generation and only switches to it if it finishes, so a crashed run changes nothing and the retry simply starts over from the generation that is still the library.
Source code in src/amdockvs/chemistry/api.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
predict_receptors
¶
predict_receptors(*, receptors: MoleculeSetRef | MoleculeScope | int | None = None, model: str = FAST_MODEL, force: bool = False, depends_on: list[str] | None = None, wait: bool = False) -> str | JobStatus
Predict protein structures from sequence with the ESMFold API (thread executor).
Only proteins without 3D by default; force=True predicts again and points the current structure
to the new model. The token comes from ESM_API_KEY and is never stored.
Source code in src/amdockvs/chemistry/api.py
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | |
Complexes¶
ComplexAPI
dataclass
¶
ComplexAPI(runtime: Any)
Methods:
| Name | Description |
|---|---|
details |
Load the complete Details-panel projection for a receptor-ligand pair. |
details
¶
details(complex_ref: ComplexRef | int) -> Details | None
Load the complete Details-panel projection for a receptor-ligand pair.
Source code in src/amdockvs/complexes/api.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
QSAR¶
QSARAPI
dataclass
¶
QSARAPI(runtime: Any)
Bases: BuildMixin, PredictMixin, ModelAnalysisMixin, ResultsMixin, ActivitiesMixin
Methods:
| Name | Description |
|---|---|
compute_descriptors |
Submit the descriptor job. only_missing=True skips ligands that already have |
compute_fingerprints |
Submit a Morgan-fingerprint job (also fills physchem descriptors as a side effect). |
compute_descriptors
¶
compute_descriptors(*, molecule_set: MoleculeSetRef | MoleculeScope | int | None = None, only_missing: bool = True, batch_size: int = DEFAULT_LIGAND_BATCH_SIZE, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None, compute_fingerprints: bool = False, fp_radius: int = 2, fp_nbits: int = 2048, alerts: bool = False, rdkit2d: bool = False, molecule_ids: list[int] | None = None) -> str
Submit the descriptor job. only_missing=True skips ligands that already have descriptors computed (MoleculeRecord.mw populated). With compute_fingerprints=True it also stores a Morgan fingerprint per ligand, and only_missing then means "lacks that fingerprint" so FPs can be added to already-described ligands. rdkit2d=True also stores the full RDKit 2D block the models train on (only_missing: lacks that block). With alerts=True it is the alerts job instead: PAINS and identity keys, which a library import leaves out. molecule_ids narrows the scope to those molecules.
Source code in src/amdockvs/qsar/api.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
compute_fingerprints
¶
compute_fingerprints(*, molecule_set: MoleculeSetRef | MoleculeScope | int | None = None, only_missing: bool = True, radius: int = 2, nbits: int = 2048, batch_size: int = DEFAULT_LIGAND_BATCH_SIZE, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None) -> str
Submit a Morgan-fingerprint job (also fills physchem descriptors as a side effect).
Source code in src/amdockvs/qsar/api.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
Binding sites¶
BindingSiteAPI
dataclass
¶
BindingSiteAPI(runtime: Any)
Methods:
| Name | Description |
|---|---|
select |
Build a lazy binding-site selection. |
delete_sites |
Deletes sites by id. The counterpart of prediction being additive. |
save_site |
Saves a site. Without |
reference_ligands |
(id, name) of the reference ligands that came with this receptor's structure: the |
suggest_box_from_ligand |
Auto box from a reference ligand: center = its centroid, size = cubic box |
active_site_id |
The id of the molecule's active site, None without one. |
select
¶
select(*, molecule_id: int | None = None, source: str | None = None, run_id: str | None = None, limit: int | None = None) -> Selection[BindingSite]
Build a lazy binding-site selection.
Source code in src/amdockvs/binding_sites/api.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
delete_sites
¶
delete_sites(binding_site_ids: Iterable[int]) -> int
Deletes sites by id. The counterpart of prediction being additive.
Source code in src/amdockvs/binding_sites/api.py
331 332 333 334 335 336 | |
save_site
¶
save_site(*, molecule_id: int, name: str = '', source: str = 'manual', source_ref: str = '', center: tuple[float, float, float], size: tuple[float, float, float], binding_site_id: int | None = None, set_active: bool = False, extra_data: dict[str, Any] | None = None) -> BindingSite
Saves a site. Without binding_site_id it creates a new one; with it, rewrites that one.
Source code in src/amdockvs/binding_sites/api.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
reference_ligands
¶
reference_ligands(receptor_id: int) -> list[tuple[int, str]]
(id, name) of the reference ligands that came with this receptor's structure: the co-crystal ligands its import paired with it. Library (screening) ligands never are, so this is the short, meaningful list to build a box from.
Source code in src/amdockvs/binding_sites/api.py
462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
suggest_box_from_ligand
¶
suggest_box_from_ligand(*, ligand_id: int, scale: float | None = None, padding: float | None = None) -> dict[str, Any]
Auto box from a reference ligand: center = its centroid, size = cubic box derived from the ligand's radius of gyration. Returns {center, size, rg}.
scale/padding default to the configured geometry (settings > binding_sites).
Source code in src/amdockvs/binding_sites/api.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | |
active_site_id
¶
active_site_id(molecule_id: int) -> int | None
The id of the molecule's active site, None without one.
Source code in src/amdockvs/binding_sites/api.py
523 524 525 526 527 528 529 530 531 | |
Docking¶
DockingAPI
dataclass
¶
DockingAPI(runtime: Any)
Methods:
| Name | Description |
|---|---|
check_protocol |
Check the program's current configuration without deleting or submitting anything. |
stored_protocol_hash |
The hash a run of this configuration will dock and skip under ( |
live_campaign_progress |
Ligands/docked/state of these receptors for one program ("" = summed over all). |
recoverable_ranked_runs |
Interrupted top-N campaigns recoverable from completed result shards. |
select_hits |
Select a recomputable Top-N from the durable HTP result dataset. |
recover_ranked_hits |
Materialize the best available N without submitting docking work. |
preparation_summary |
Return total/ready/failed preparation counts for a molecule scope. |
unprepared_molecules_clause |
Opaque SmartTable clause selecting molecules not ready for every engine family. |
receptor_setup_clause |
SmartTable clause for receptors needing preparation or an active search box. |
delete_results |
Delete results, their interactions and files. |
pairs_per_task |
Pairs per docking task: |
autobatch |
Tasks a docking job starts at, in its chunks, when the executor sizes them: the |
prepare_ligand_shards |
|
run_shards |
|
set_grid |
Save a box as the receptor's active site. A box drawn around a reference ligand says |
method_misfit_receptor_ids |
Receptors whose active box does not fit the docking |
list_box_residues |
Residues with at least one atom inside the receptor's active binding-site box. |
check_receptors |
Receptor-only half of check_required: preparation + grid status, no ligand scan. |
run |
Run docking over the active library, selecting its row or shard adapter. |
move_to_queue |
Continue a docking run over rows on a cluster's queue: it is stopped here (waited for, |
has_results |
Whether the project has docking results or completed screening fragments. |
ligand_summaries |
(best pose, pose count) per ligand, one page at a time. |
compute_diagrams |
Render 2D interaction diagrams for docking poses as a standalone job. |
diagram_path |
Convention path for a pose's diagram (may not exist yet). |
count_docked_pairs |
|
check_protocol
¶
check_protocol(*, program: str, engine_config: dict, protocol_metadata: dict | None = None, replace_existing: bool = False) -> dict
Check the program's current configuration without deleting or submitting anything.
Source code in src/amdockvs/docking/api.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
stored_protocol_hash
¶
stored_protocol_hash(*, program: str, protocol_hash: str) -> str
The hash a run of this configuration will dock and skip under (check_protocol keeps an
older project's hash for an unchanged configuration), without checking for a conflict.
Source code in src/amdockvs/docking/api.py
191 192 193 194 195 | |
live_campaign_progress
¶
live_campaign_progress(*, job_ids: list[str] | tuple[str, ...] = (), receptor_ids: list[int] | tuple[int, ...] = (), protocol_hash: str = '') -> dict[int, dict[str, Any]]
Ligands/docked/state of these receptors for one program ("" = summed over all).
Source code in src/amdockvs/docking/api.py
197 198 199 200 201 202 203 204 205 206 207 208 209 | |
recoverable_ranked_runs
¶
recoverable_ranked_runs() -> list[dict[str, Any]]
Interrupted top-N campaigns recoverable from completed result shards.
Source code in src/amdockvs/docking/api.py
211 212 213 214 215 216 217 | |
select_hits
¶
select_hits(*, run_id: str, protocol_hash: str, filters: dict[str, Any] | None = None, top_n: int) -> list[dict[str, Any]]
Select a recomputable Top-N from the durable HTP result dataset.
Source code in src/amdockvs/docking/api.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
recover_ranked_hits
¶
recover_ranked_hits(*, run_id: str, protocol_hash: str, top_n: int, threshold: float = 0.0) -> dict[str, int]
Materialize the best available N without submitting docking work.
Source code in src/amdockvs/docking/api.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
preparation_summary
¶
preparation_summary(scope: MoleculeScope, *, role_type: str, engine: str = 'ad4') -> dict[str, int]
Return total/ready/failed preparation counts for a molecule scope.
Source code in src/amdockvs/docking/api.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
unprepared_molecules_clause
¶
unprepared_molecules_clause(*, role_type: str, engines: list[str] | tuple[str, ...])
Opaque SmartTable clause selecting molecules not ready for every engine family.
Source code in src/amdockvs/docking/api.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
receptor_setup_clause
¶
receptor_setup_clause(*, engines: list[str] | tuple[str, ...])
SmartTable clause for receptors needing preparation or an active search box.
Source code in src/amdockvs/docking/api.py
312 313 314 315 316 317 318 319 320 321 | |
delete_results
¶
delete_results(result_ids: list[int] | tuple[int, ...], *, with_siblings: bool = False) -> int
Delete results, their interactions and files. with_siblings: every pose of the same
receptor, ligand, protocol and run as each id goes too — what a Results ligand row
(its best pose) stands for.
Source code in src/amdockvs/docking/api.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
pairs_per_task
¶
pairs_per_task(program_spec: DockingProgramSpec, batch_size: int | None = None) -> int
Pairs per docking task: batch_size when a caller gives one, else the program's own
setting (docking.<engine>.batch_size).
Source code in src/amdockvs/docking/api.py
349 350 351 352 353 | |
autobatch
¶
autobatch(program_spec: DockingProgramSpec, batch_size: int | None = None) -> int
Tasks a docking job starts at, in its chunks, when the executor sizes them: the
program's docking.<engine>.autobatch pairs, never under one chunk; 0 when it has none.
Source code in src/amdockvs/docking/api.py
355 356 357 358 359 360 | |
prepare_ligand_shards
¶
prepare_ligand_shards(*, program: str = key, force: bool = False, shard_ids: list[int] | None = None, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None) -> str
prepare_ligands for a sharded library: the unit of work is a shard, not a row.
shard_ids narrows it to those shards (the Shards table selection); None = every
shard. One shard is one task.
Source code in src/amdockvs/docking/api.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | |
run_shards
¶
run_shards(*, program: str = key, receptor_set: MoleculeSetRef | MoleculeScope | int | None = None, hit_threshold: float, hit_cap: int, output_dir: PathLike | None = None, exhaustiveness: int = 8, num_modes: int = 9, box_center: tuple[float, float, float] | None = None, box_size: tuple[float, float, float] | None = None, scoring_function: str = 'vina', vina_command: str = DEFAULT_VINA_COMMAND, vina_cpu: int = 1, seed: int = 0, spacing: float = 0.375, energy_range: float = 3.0, min_rmsd: float = 1.0, run_id: str | None = None, protocol_metadata: dict | None = None, engine_config: dict[str, Any] | None = None, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None, skip_existing: bool = True, payload: str = PAYLOAD_LIGHT, check_required: bool = True, selected_from_receptor_id: int | None = None, selected_top_n: int | None = None, replace_existing: bool = False, off_target_set: MoleculeSetRef | MoleculeScope | int | None = None) -> str
run for a sharded library: the campaign, with the gate that makes it end.
No ligand scope — the library is the inventory of prepared shards. When the run ends, the
best hit_cap ligands per receptor that pass the hit_threshold prefilter become rows;
both are required, not defaulted: a campaign without them writes back everything it
scored, which is the failure mode htpvs exists to prevent. A dependent off-target
stage sets selected_from_receptor_id; its deferred chunker reads that receptor's
durable Top-N and extracts only those records from the source shards.
On a cluster's queue (executor_name of kind queue) the whole of it is one job of the
queue (amdockvs.docking.campaign): with off_target_set, the best hit_cap of the one
receptor of receptor_set are docked against those receptors there too, and no
dependent stage is submitted here.
Source code in src/amdockvs/docking/api.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | |
set_grid
¶
set_grid(*, receptor_id: int, center: tuple[float, float, float], size: tuple[float, float, float], spacing: float = 0.375, engine: str = 'vina', metadata: dict[str, Any] | None = None, name: str = 'Manual Site', source: str = 'manual', source_ref: str = '') -> dict[str, Any]
Save a box as the receptor's active site. A box drawn around a reference ligand says
so (source="ligand", source_ref=str(ligand_id), e.g. name="SAR405 site"), as the
sites found at import do; the default is a manual one.
Source code in src/amdockvs/docking/api.py
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | |
method_misfit_receptor_ids
¶
method_misfit_receptor_ids(*, method: str) -> list[int]
Receptors whose active box does not fit the docking method (methods.py).
Receptors without a box are not judged: the user still has to define one. The source
structure is read: preparation keeps its metals.
Source code in src/amdockvs/docking/api.py
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | |
list_box_residues
¶
list_box_residues(*, receptor_id: int, engine: str = 'vina') -> list[dict[str, Any]]
Residues with at least one atom inside the receptor's active binding-site box.
Candidate set for flexible-residue selection — short because the box filters it. Returns [] when there's no active grid or the structure file is unavailable.
Source code in src/amdockvs/docking/api.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | |
check_receptors
¶
check_receptors(*, program: str = key, receptor_set: MoleculeSetRef | MoleculeScope | int | None = None) -> dict[str, Any]
Receptor-only half of check_required: preparation + grid status, no ligand scan.
check_required materializes the full ligand set to report missing ligands; that's the expensive part. The Receptors step only shows receptor prep/grid status, so this skips ligands entirely (receptor sets are small).
Source code in src/amdockvs/docking/api.py
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 | |
run
¶
run(*, program: str = key, ligands: MoleculeSetRef | MoleculeScope | Selection[MoleculeRecord] | int | None = None, receptors: MoleculeSetRef | MoleculeScope | Selection[MoleculeRecord] | int | None = None, ligand_set: MoleculeSetRef | MoleculeScope | int | None = None, receptor_set: MoleculeSetRef | MoleculeScope | int | None = None, output_dir: PathLike | None = None, batch_size: int | None = None, exhaustiveness: int = 8, num_modes: int = 9, box_center: tuple[float, float, float] | None = None, box_size: tuple[float, float, float] | None = None, scoring_function: str = 'vina', vina_command: str = DEFAULT_VINA_COMMAND, vina_cpu: int = 1, seed: int = 0, spacing: float = 0.375, energy_range: float = 3.0, min_rmsd: float = 1.0, run_id: str | None = None, protocol_metadata: dict | None = None, engine_config: dict[str, Any] | None = None, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None, check_required: bool = True, skip_existing: bool = True, compute_interactions: bool = False, hit_threshold: float | None = None, hit_cap: int = 0, payload: str = PAYLOAD_LIGHT, selected_from_receptor_id: int | None = None, selected_top_n: int | None = None, selected_max_score: float | None = None, replace_existing: bool = False) -> str
Run docking over the active library, selecting its row or shard adapter.
hit_threshold/hit_cap are optional for materialized rows and mandatory for a
sharded library, where returning every scored molecule would defeat the storage model.
compute_interactions finds each pose's interactions in the chunk that docked it.
An off-target stage sets selected_from_receptor_id/selected_top_n: the other
receptors dock only that receptor's Top-N ligands, read when the job starts — so it
depends_on the target's job. Over rows, selected_max_score keeps only those at
or below it (a sharded library uses hit_threshold for that).
Source code in src/amdockvs/docking/api.py
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 | |
move_to_queue
¶
move_to_queue(job_id: str, executor_name: str) -> str
Continue a docking run over rows on a cluster's queue: it is stopped here (waited for,
so not from a thread that cannot wait) and what it has not docked goes there as a run of
its own (_run_rows_on_queue), with its run id. The id of that new job.
Source code in src/amdockvs/docking/api.py
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 | |
has_results
¶
has_results() -> bool
Whether the project has docking results or completed screening fragments.
Source code in src/amdockvs/docking/api.py
1536 1537 1538 | |
ligand_summaries
¶
ligand_summaries(*, limit: int = 200, offset: int = 0, receptor_id: int | None = None, only_completed: bool = False, score_lte: float | None = None, metric_key: str | None = None, metric_lte: float | None = None, metric_gte: float | None = None, metric_filters: list[tuple[str, str, float]] | None = None, protocol_hash: str | None = None, exclude_run_kind: str | None = 'redocking')
(best pose, pose count) per ligand, one page at a time.
Source code in src/amdockvs/docking/api.py
1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 | |
compute_diagrams
¶
compute_diagrams(*, result_ids: list[int] | None = None, run_id: str = '', receptor_id: int | None = None, score_lte: float | None = None, pose_rank: int | None = 1, fmt: str = 'png', chunk_size: int = 64, replace_existing: bool = False, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None) -> str
Render 2D interaction diagrams for docking poses as a standalone job.
Files land next to each pose (see diagram.diagram_path_for); nothing
is written to the DB, so re-run with replace_existing=True to refresh.
Source code in src/amdockvs/docking/api.py
1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 | |
diagram_path
¶
diagram_path(*, pose_path: str, pose_rank: int = 1, fmt: str = 'png') -> str
Convention path for a pose's diagram (may not exist yet).
Source code in src/amdockvs/docking/api.py
1692 1693 1694 1695 1696 1697 | |
count_docked_pairs
¶
count_docked_pairs(*, engine: str = '', receptor_ids: list[int] | None = None, protocol_hash: str | None = None, run_kind: str | None = 'screening', program: str | None = None) -> int
program counts only the pairs docked against what its run would dock now: each
receptor's current preparation and stored grid (skip_existing docks the others again).
The spacing is the stored grid's, which is what the run docks with as well: a defined site always carries one, so the fallback here is only reached where there is no grid — and then there is nothing docked to count, every program requiring a site.
Source code in src/amdockvs/docking/api.py
1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 | |
Diversity¶
DiversityAPI
dataclass
¶
DiversityAPI(runtime: Any)
Methods:
| Name | Description |
|---|---|
cluster_job |
Submit the clustering job over the DB; results land in |
load_universe |
Load a scope's fingerprint matrix + 2-D projection for the interactive view. Samples a |
cluster_loaded |
Cluster an already-loaded |
analyze |
Convenience: |
scope_count |
How many molecules a scope holds — the cheap count used to route serial vs. parallel |
run_selection |
Cluster the ENTIRE scope (no sampling) and pick representatives — the real 'run the |
register_run_from_sidecar |
Register a finished parallel run as a saved result WITHOUT recomputing anything: the job's |
list_runs |
Persisted clustering runs, newest first: run id, method, cluster/centroid counts. |
pick_representatives |
Choose again what represents each cluster of a finished run. Nothing is clustered |
members_clause |
Opaque SmartTable adapter: the molecules of one cluster, or the run's representatives |
exclude_non_representatives |
Mark every non-representative of a run as excluded (the flag Filter uses; reversible). |
save_selection_as_set |
Persist the chosen representatives as a molecule set (an enrichment set) so the rest of |
molblock_for |
A 2-D-drawable molblock for one molecule (its stored structure), or None if there's |
save_clustering_result |
Persist an applied clustering as a durable run: the graph points (x, y, molecule_id, |
list_clustering_results |
Saved runs, newest first — for the results table. |
load_clustering_result |
Everything needed to redraw a saved run (graph points + cluster stats + evr) — read the |
cluster_job
¶
cluster_job(*, method: str = 'bitbirch', threshold: float = 0.65, per_cluster: int = 1, molecule_set: MoleculeSetRef | int | None = None, molecule_filters: dict[str, Any] | None = None, fp_radius: int = 2, fp_nbits: int = 2048, with_activity: str = '', cluster_run_id: str = '', num_cpus: int | None = None, executor_name: str = DEFAULT_LOCAL_CPU_EXECUTOR, depends_on: list[str] | None = None, shards: bool = False) -> str
Submit the clustering job over the DB; results land in clustering_results. Returns
the job id. The run is tagged with cluster_run_id (auto if blank) — read it back with
list_runs / get_run or persist its centroids with save_centroids_as_set.
with_activity (an activity endpoint) narrows the scope to the ligands measured for it.
Each cluster starts with its per_cluster centroid-nearest members as representatives;
pick_representatives chooses again, by any mode, without clustering again.
num_cpus sets the parallelism: >1 runs bblean multiround with that many processes and the
job requests exactly that many CPUs (cpu_required) so mf schedules it correctly. When
None it is derived from the scope size via plan_cpus.
shards clusters the library's shards instead (the scope arguments do not apply): a
fingerprint job packs them shard by shard, the clustering waits for it, and only the
representatives become molecule rows; every member stays in the run's sidecar by
io.shards.shard_key. Both jobs run at SHARDS_PRIORITY.
Source code in src/amdockvs/diversity/api.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
load_universe
¶
load_universe(*, molecule_set: MoleculeSetRef | int | None = None, molecule_filters: dict[str, Any] | None = None, fp_radius: int = 2, fp_nbits: int = 2048, with_activity: str = '', sample_limit: int = DEFAULT_SAMPLE_LIMIT, seed: int = 0, basis: Any = None, exclude_ids: Any = None) -> UniverseMatrix
Load a scope's fingerprint matrix + 2-D projection for the interactive view. Samples a
random sample_limit subset (seeded by seed so each preview draws a fresh subset),
skipping exclude_ids (molecules already previewed) so repeated previews cover more of
the space. Projects onto basis when given (a prior preview's fitted PCA axes) so runs
overlay in one comparable space; otherwise fits a new basis and returns it. Heavy (DB read +
PCA); call off the GUI thread. with_activity restricts the scope to ligands measured
for that endpoint, as in cluster_job. Cheap re-clustering then uses cluster_loaded.
Source code in src/amdockvs/diversity/api.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
cluster_loaded
staticmethod
¶
cluster_loaded(universe: UniverseMatrix, *, method: str = 'bitbirch', per_cluster: int = 1, **method_params: Any) -> AnalysisResult
Cluster an already-loaded UniverseMatrix — the cheap step that re-runs on every knob
change without touching the DB. method_params (threshold, batch_size, ...) go straight to
the registered method, so each method's own knobs pass through untouched.
Source code in src/amdockvs/diversity/api.py
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
analyze
¶
analyze(*, method: str = 'bitbirch', threshold: float = 0.65, per_cluster: int = 1, molecule_set: MoleculeSetRef | int | None = None, molecule_filters: dict[str, Any] | None = None, fp_radius: int = 2, fp_nbits: int = 2048, sample_limit: int = DEFAULT_SAMPLE_LIMIT) -> AnalysisResult
Convenience: load_universe then cluster_loaded in one call (scripting/preview).
Source code in src/amdockvs/diversity/api.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
scope_count
¶
scope_count(*, molecule_set: MoleculeSetRef | int | None = None, molecule_filters: dict[str, Any] | None = None, fp_radius: int = 2, fp_nbits: int = 2048, with_activity: str = '') -> int
How many molecules a scope holds — the cheap count used to route serial vs. parallel (no fingerprint load, no clustering). Reads ids only via the MolSuite query API.
Source code in src/amdockvs/diversity/api.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
run_selection
¶
run_selection(*, method: str = 'bitbirch', per_cluster: int = 1, molecule_set: MoleculeSetRef | int | None = None, molecule_filters: dict[str, Any] | None = None, fp_radius: int = 2, fp_nbits: int = 2048, **method_params: Any) -> dict[str, Any]
Cluster the ENTIRE scope (no sampling) and pick representatives — the real 'run the
selection' behind the interactive Preview. Every molecule's fingerprint is loaded and
clustered (bblean is fast); only the 2-D graph basis is fitted on a random sub-sample and
every point projected onto it (cheap), so the plot scales without the full-N SVD. Returns the
same mapping as cluster_loaded, over the whole scope. Heavy — call off the GUI thread.
Raises if the scope exceeds INLINE_RUN_LIMIT (that needs the parallel job).
Source code in src/amdockvs/diversity/api.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
register_run_from_sidecar
¶
register_run_from_sidecar(cluster_run_id: str, *, method: str, threshold: float, scope_label: str, fp_radius: int = 2, fp_nbits: int = 2048) -> str
Register a finished parallel run as a saved result WITHOUT recomputing anything: the job's
task already wrote the graph sidecar <root>/clustering_runs/<run_id>.parquet (PCA points +
cluster/centroid flags). Read it for the counts + aggregated cluster sizes and insert the
compact ClusteringRun summary pointing at it. No fingerprints, no PCA here.
Source code in src/amdockvs/diversity/api.py
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
list_runs
¶
list_runs() -> list[dict[str, Any]]
Persisted clustering runs, newest first: run id, method, cluster/centroid counts.
Source code in src/amdockvs/diversity/api.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | |
pick_representatives
¶
pick_representatives(cluster_run_id: str, *, mode: str = 'centroid', per_cluster: int = 1, fraction: float = 0.1, rank_by: str = '') -> dict[str, int]
Choose again what represents each cluster of a finished run. Nothing is clustered
again: the run already ranks every member, and this only reads that ranking (modes:
see clustering.pick_representatives). rank_by (an activity endpoint) replaces
similarity as what 'extremes' / 'quartiles' / 'proportional' spread over. Rewrites the
run's representative flags; returns {"n_molecules", "n_clusters", "n_reps"}.
ponytail: in-process over the run's columns (~20 B/molecule) and one UPDATE per 900 picks. Make it a job when a run outgrows the tens of millions.
Source code in src/amdockvs/diversity/api.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
members_clause
¶
members_clause(cluster_run_id: str, cluster_id: int | None = None)
Opaque SmartTable adapter: the molecules of one cluster, or the run's representatives when no cluster is given. A subquery, so it costs the same for 10 members or 10^6.
Source code in src/amdockvs/diversity/api.py
649 650 651 652 653 654 655 656 657 658 659 | |
exclude_non_representatives
¶
exclude_non_representatives(cluster_run_id: str) -> int
Mark every non-representative of a run as excluded (the flag Filter uses; reversible). Returns how many were marked.
Source code in src/amdockvs/diversity/api.py
661 662 663 664 665 666 667 668 669 670 671 672 673 | |
save_selection_as_set
¶
save_selection_as_set(molecule_ids: Iterable[int], *, name: str) -> MoleculeSetRef
Persist the chosen representatives as a molecule set (an enrichment set) so the rest of the app (docking, filter, export) can target the redundancy-reduced library.
Source code in src/amdockvs/diversity/api.py
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | |
molblock_for
¶
molblock_for(molecule_id: int) -> str | None
A 2-D-drawable molblock for one molecule (its stored structure), or None if there's no usable structure. Best-effort — used by the universe scatter's hover preview.
Source code in src/amdockvs/diversity/api.py
692 693 694 695 696 697 698 699 700 701 702 703 704 | |
save_clustering_result
¶
save_clustering_result(*, points: Iterable[tuple], cluster_stats: list[dict[str, Any]], evr: Iterable[float], method: str, threshold: float, scope_label: str, fp_radius: int = 2, fp_nbits: int = 2048, n_molecules: int | None = None, n_clusters: int | None = None, n_reps: int | None = None) -> str
Persist an applied clustering as a durable run: the graph points (x, y, molecule_id,
cluster_id, is_centroid) to a parquet sidecar, and a compact ClusteringRun row (metadata
+ counts + the sidecar path). Returns the run id. Only the PCA + cluster flags are stored —
fingerprints stay in their table, loaded by id if ever needed. Counts default to what the
points imply; the parallel path passes them explicitly (it saves no graph sidecar yet).
Source code in src/amdockvs/diversity/api.py
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | |
list_clustering_results
¶
list_clustering_results() -> list[dict[str, Any]]
Saved runs, newest first — for the results table.
Source code in src/amdockvs/diversity/api.py
757 758 759 760 761 762 763 764 765 766 767 | |
load_clustering_result
¶
load_clustering_result(run_id: str) -> dict[str, Any]
Everything needed to redraw a saved run (graph points + cluster stats + evr) — read the sidecar directly, no re-clustering or PCA recompute.
Source code in src/amdockvs/diversity/api.py
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | |
External tools¶
ToolAPI
dataclass
¶
ToolAPI(runtime: Any)
Methods:
| Name | Description |
|---|---|
status |
Return the current readiness of one managed tool, or every tool. |
install |
Install a tool if needed and return its verified status. |
uninstall |
Remove a managed tool from disk. |
repair |
Remove and reinstall a tool whose on-disk installation is suspect. |
status
¶
status(tool_id: str | None = None) -> ToolStatus | tuple[ToolStatus, ...]
Return the current readiness of one managed tool, or every tool.
Source code in src/amdockvs/integrations/api.py
22 23 24 25 26 | |
install
¶
install(tool_id: str) -> ToolStatus
Install a tool if needed and return its verified status.
Source code in src/amdockvs/integrations/api.py
28 29 30 31 32 33 34 35 36 | |
uninstall
¶
uninstall(tool_id: str) -> str
Remove a managed tool from disk.
Source code in src/amdockvs/integrations/api.py
38 39 40 | |
repair
¶
repair(tool_id: str) -> ToolStatus
Remove and reinstall a tool whose on-disk installation is suspect.
Source code in src/amdockvs/integrations/api.py
42 43 44 45 | |