rowan-python 3.1.5__py3-none-any.whl → 3.1.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rowan/__init__.py +7 -5
- rowan/protein.py +2 -4
- rowan/test_utils.py +54 -0
- rowan/utils.py +40 -0
- rowan/workflows/__init__.py +5 -0
- rowan/workflows/analogue_docking.py +1 -0
- rowan/workflows/covalent_inhibitor_scan.py +129 -0
- rowan/workflows/docking.py +44 -16
- rowan/workflows/double_ended_ts_search.py +5 -4
- rowan/workflows/irc.py +42 -1
- rowan/workflows/protein_cofolding.py +3 -0
- {rowan_python-3.1.5.dist-info → rowan_python-3.1.7.dist-info}/METADATA +22 -4
- {rowan_python-3.1.5.dist-info → rowan_python-3.1.7.dist-info}/RECORD +15 -13
- {rowan_python-3.1.5.dist-info → rowan_python-3.1.7.dist-info}/WHEEL +1 -1
- {rowan_python-3.1.5.dist-info → rowan_python-3.1.7.dist-info}/licenses/LICENSE +0 -0
rowan/__init__.py
CHANGED
|
@@ -12,8 +12,11 @@ from stjames import (
|
|
|
12
12
|
ConformerClusteringSettings,
|
|
13
13
|
ConformerGenSettingsUnion,
|
|
14
14
|
Correction,
|
|
15
|
+
CovalentInhibitorScanSettings,
|
|
16
|
+
DockingSettings,
|
|
15
17
|
Engine,
|
|
16
18
|
ETKDGSettings,
|
|
19
|
+
GninaSettings,
|
|
17
20
|
GreedyClusteringSettings,
|
|
18
21
|
iMTDSettings,
|
|
19
22
|
KMeansClusteringSettings,
|
|
@@ -33,6 +36,7 @@ from stjames import (
|
|
|
33
36
|
SinglePointEnergySettings,
|
|
34
37
|
Task,
|
|
35
38
|
VibrationalMode,
|
|
39
|
+
VinaSettings,
|
|
36
40
|
)
|
|
37
41
|
from stjames.workflows.relative_binding_free_energy_perturbation import RBFEGraph, RBFEGraphEdge
|
|
38
42
|
from stjames.excited_state_settings import TDDFTSettings
|
|
@@ -44,11 +48,9 @@ from stjames.engine_compatibility import (
|
|
|
44
48
|
METHOD_ENGINES,
|
|
45
49
|
get_supported_corrections,
|
|
46
50
|
)
|
|
47
|
-
from stjames.optimization.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
FSMSettings,
|
|
51
|
-
)
|
|
51
|
+
from stjames.optimization.band_method import NEBSettings
|
|
52
|
+
from stjames.optimization.interpolation import Interpolation
|
|
53
|
+
from stjames.optimization.string_method import FSMSettings, StringMethodSettings
|
|
52
54
|
|
|
53
55
|
api_key: str | None = None
|
|
54
56
|
project_uuid: str | None = None
|
rowan/protein.py
CHANGED
|
@@ -400,22 +400,20 @@ def upload_protein(
|
|
|
400
400
|
if isinstance(project_uuid, Project):
|
|
401
401
|
project_uuid = project_uuid.uuid
|
|
402
402
|
with api_client() as client:
|
|
403
|
-
# Step 1: Read the file and post it to the conversion endpoint.
|
|
404
403
|
conversion_payload = {"name": name, "text": file_path.read_text()}
|
|
405
404
|
conversion_response = client.post("/convert/pdb_file_to_protein", json=conversion_payload)
|
|
405
|
+
conversion_response.raise_for_status()
|
|
406
406
|
|
|
407
|
-
# Extract the JSON data from the conversion response.
|
|
408
407
|
protein_data = conversion_response.json()
|
|
409
408
|
|
|
410
|
-
# Step 2: Use the converted data to create the final protein object.
|
|
411
409
|
creation_payload = {
|
|
412
410
|
"name": name,
|
|
413
411
|
"protein_data": protein_data,
|
|
414
412
|
"project_uuid": project_uuid,
|
|
415
413
|
}
|
|
416
414
|
final_response = client.post("/protein", json=creation_payload)
|
|
415
|
+
final_response.raise_for_status()
|
|
417
416
|
|
|
418
|
-
# Deserialize the final JSON response into a Protein object and return it.
|
|
419
417
|
return Protein(**final_response.json())
|
|
420
418
|
|
|
421
419
|
|
rowan/test_utils.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Tests for Rowan request utilities."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
|
|
5
|
+
from pytest import MonkeyPatch, raises
|
|
6
|
+
|
|
7
|
+
import rowan
|
|
8
|
+
from rowan.utils import api_credentials, get_api_key, get_project_uuid
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_api_credentials_override_global_configuration(monkeypatch: MonkeyPatch) -> None:
|
|
12
|
+
"""Prefer context-local credentials without changing global configuration."""
|
|
13
|
+
monkeypatch.setattr(rowan, "api_key", "global-key")
|
|
14
|
+
monkeypatch.setattr(rowan, "project_uuid", "global-project")
|
|
15
|
+
monkeypatch.setenv("ROWAN_API_KEY", "environment-key")
|
|
16
|
+
|
|
17
|
+
with api_credentials("context-key", project_uuid="context-project"):
|
|
18
|
+
assert get_api_key() == "context-key"
|
|
19
|
+
assert get_project_uuid() == "context-project"
|
|
20
|
+
|
|
21
|
+
assert get_api_key() == "global-key"
|
|
22
|
+
assert get_project_uuid() == "global-project"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_api_credentials_restore_nested_context() -> None:
|
|
26
|
+
"""Restore outer credentials after a nested context exits."""
|
|
27
|
+
with api_credentials("outer-key", project_uuid="outer-project"):
|
|
28
|
+
with api_credentials("inner-key"):
|
|
29
|
+
assert get_api_key() == "inner-key"
|
|
30
|
+
assert get_project_uuid() is None
|
|
31
|
+
|
|
32
|
+
assert get_api_key() == "outer-key"
|
|
33
|
+
assert get_project_uuid() == "outer-project"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_api_credentials_isolate_async_tasks() -> None:
|
|
37
|
+
"""Keep credentials isolated across concurrent asynchronous tasks."""
|
|
38
|
+
|
|
39
|
+
async def read_after_yield(api_key: str) -> str:
|
|
40
|
+
with api_credentials(api_key):
|
|
41
|
+
await asyncio.sleep(0)
|
|
42
|
+
return get_api_key()
|
|
43
|
+
|
|
44
|
+
async def run_workers() -> list[str]:
|
|
45
|
+
return list(await asyncio.gather(read_after_yield("first"), read_after_yield("second")))
|
|
46
|
+
|
|
47
|
+
assert asyncio.run(run_workers()) == ["first", "second"]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_api_credentials_reject_empty_key() -> None:
|
|
51
|
+
"""Reject empty context-local API keys."""
|
|
52
|
+
with raises(ValueError, match="cannot be empty"):
|
|
53
|
+
with api_credentials(""):
|
|
54
|
+
pass
|
rowan/utils.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
from contextlib import contextmanager
|
|
3
|
+
from contextvars import ContextVar
|
|
4
|
+
from dataclasses import dataclass
|
|
3
5
|
from typing import Generator
|
|
4
6
|
|
|
5
7
|
import httpx
|
|
@@ -10,6 +12,40 @@ import rowan
|
|
|
10
12
|
from .constants import API_URL
|
|
11
13
|
|
|
12
14
|
|
|
15
|
+
@dataclass(frozen=True, slots=True)
|
|
16
|
+
class _APIContext:
|
|
17
|
+
"""Store credentials isolated to the current execution context."""
|
|
18
|
+
|
|
19
|
+
api_key: str
|
|
20
|
+
project_uuid: str | None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
_api_context: ContextVar[_APIContext | None] = ContextVar("rowan_api_context", default=None)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@contextmanager
|
|
27
|
+
def api_credentials(api_key: str, project_uuid: str | None = None) -> Generator[None, None, None]:
|
|
28
|
+
"""Temporarily use Rowan credentials in the current execution context.
|
|
29
|
+
|
|
30
|
+
Context-local credentials take precedence over module-level and environment configuration.
|
|
31
|
+
Nested contexts restore the previous credentials when they exit, and concurrent threads or
|
|
32
|
+
asynchronous tasks remain isolated from one another.
|
|
33
|
+
|
|
34
|
+
:param api_key: Rowan API key
|
|
35
|
+
:param project_uuid: active project UUID, if any
|
|
36
|
+
:yields: control while the credentials are active
|
|
37
|
+
:raises ValueError: API key is empty
|
|
38
|
+
"""
|
|
39
|
+
if not api_key:
|
|
40
|
+
raise ValueError("API key cannot be empty.")
|
|
41
|
+
|
|
42
|
+
token = _api_context.set(_APIContext(api_key=api_key, project_uuid=project_uuid))
|
|
43
|
+
try:
|
|
44
|
+
yield
|
|
45
|
+
finally:
|
|
46
|
+
_api_context.reset(token)
|
|
47
|
+
|
|
48
|
+
|
|
13
49
|
def get_api_key() -> str:
|
|
14
50
|
"""
|
|
15
51
|
Get the API key from the environment variable ROWAN_API_KEY or the module-level attribute
|
|
@@ -19,6 +55,8 @@ def get_api_key() -> str:
|
|
|
19
55
|
|
|
20
56
|
:returns: API key.
|
|
21
57
|
"""
|
|
58
|
+
if (context := _api_context.get()) is not None:
|
|
59
|
+
return context.api_key
|
|
22
60
|
if hasattr(rowan, "api_key") and rowan.api_key:
|
|
23
61
|
return rowan.api_key
|
|
24
62
|
elif (api_key := os.environ.get("ROWAN_API_KEY")) is not None:
|
|
@@ -36,6 +74,8 @@ def get_project_uuid() -> str | None:
|
|
|
36
74
|
|
|
37
75
|
:returns: Project UUID string, or None if not set.
|
|
38
76
|
"""
|
|
77
|
+
if (context := _api_context.get()) is not None:
|
|
78
|
+
return context.project_uuid
|
|
39
79
|
if hasattr(rowan, "project_uuid") and rowan.project_uuid:
|
|
40
80
|
return rowan.project_uuid
|
|
41
81
|
return None
|
rowan/workflows/__init__.py
CHANGED
|
@@ -53,6 +53,11 @@ from .binding_affinity import (
|
|
|
53
53
|
submit_binding_affinity_workflow,
|
|
54
54
|
)
|
|
55
55
|
from .conformer_search import ConformerSearchResult, submit_conformer_search_workflow
|
|
56
|
+
from .covalent_inhibitor_scan import (
|
|
57
|
+
CovalentInhibitorScanPoint,
|
|
58
|
+
CovalentInhibitorScanResult,
|
|
59
|
+
submit_covalent_inhibitor_scan_workflow,
|
|
60
|
+
)
|
|
56
61
|
from .descriptors import DescriptorsResult, submit_descriptors_workflow
|
|
57
62
|
from .docking import DockingResult, DockingScore, submit_docking_workflow
|
|
58
63
|
from .double_ended_ts_search import (
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""Covalent inhibitor scan workflow - bond scan for a covalent inhibitor reaction."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
import stjames
|
|
6
|
+
|
|
7
|
+
from ..folder import Folder
|
|
8
|
+
from ..molecule import Molecule
|
|
9
|
+
from ..protein import Protein
|
|
10
|
+
from ..utils import api_client
|
|
11
|
+
from .base import Workflow, WorkflowResult, register_result
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True, slots=True)
|
|
15
|
+
class CovalentInhibitorScanPoint:
|
|
16
|
+
"""
|
|
17
|
+
A point along the covalent inhibitor bond scan.
|
|
18
|
+
|
|
19
|
+
:param index: index of the point along the scan
|
|
20
|
+
:param distance: scanned bond distance, in Å
|
|
21
|
+
:param molecule: Molecule at the point
|
|
22
|
+
:param energy: implicit-solvent single-point energy at this geometry, in Hartree
|
|
23
|
+
:param uuid: UUID of the scan-point calculation
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
index: int
|
|
27
|
+
distance: float
|
|
28
|
+
molecule: Molecule
|
|
29
|
+
energy: float | None
|
|
30
|
+
uuid: str | None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@register_result("covalent_inhibitor_scan")
|
|
34
|
+
class CovalentInhibitorScanResult(WorkflowResult):
|
|
35
|
+
"""Result from a covalent inhibitor scan workflow."""
|
|
36
|
+
|
|
37
|
+
_stjames_class = stjames.CovalentInhibitorScanWorkflow
|
|
38
|
+
|
|
39
|
+
def __repr__(self) -> str:
|
|
40
|
+
return f"<CovalentInhibitorScanResult points={len(self.scan_points)}>"
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def scan_points(self) -> list[CovalentInhibitorScanPoint]:
|
|
44
|
+
"""Points along the scan, ordered by scan index (scan_start to scan_stop)."""
|
|
45
|
+
return [
|
|
46
|
+
CovalentInhibitorScanPoint(
|
|
47
|
+
index=p.index,
|
|
48
|
+
distance=p.distance,
|
|
49
|
+
molecule=Molecule.from_stjames(p.molecule),
|
|
50
|
+
energy=p.energy,
|
|
51
|
+
uuid=p.uuid,
|
|
52
|
+
)
|
|
53
|
+
for p in self._workflow.scan_points
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
def get_energies(self) -> list[tuple[float, float | None]]:
|
|
57
|
+
"""
|
|
58
|
+
Get scan distances paired with single-point energies.
|
|
59
|
+
|
|
60
|
+
:returns: List of (distance, energy) tuples, in Å and Hartree respectively.
|
|
61
|
+
"""
|
|
62
|
+
return [(p.distance, p.energy) for p in self.scan_points]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def submit_covalent_inhibitor_scan_workflow(
|
|
66
|
+
protein: str | Protein,
|
|
67
|
+
protein_reactive_atom_index: int,
|
|
68
|
+
ligand_reactive_atom_index: int,
|
|
69
|
+
ligand_smiles: str,
|
|
70
|
+
settings: stjames.CovalentInhibitorScanSettings | None = None,
|
|
71
|
+
name: str = "Covalent Inhibitor Scan Workflow",
|
|
72
|
+
folder_uuid: str | None = None,
|
|
73
|
+
folder: Folder | None = None,
|
|
74
|
+
max_credits: int | None = None,
|
|
75
|
+
webhook_url: str | None = None,
|
|
76
|
+
is_draft: bool = False,
|
|
77
|
+
) -> Workflow:
|
|
78
|
+
"""
|
|
79
|
+
Submits a covalent inhibitor scan workflow to the API.
|
|
80
|
+
|
|
81
|
+
:param protein: covalently docked protein-ligand complex (protein plus the ligand as a
|
|
82
|
+
non-polymer residue). Can be a UUID or a Protein object.
|
|
83
|
+
:param protein_reactive_atom_index: 0-based index of the reacting protein atom, in PDB
|
|
84
|
+
record order.
|
|
85
|
+
:param ligand_reactive_atom_index: 0-based index of the reacting ligand atom, in PDB
|
|
86
|
+
record order.
|
|
87
|
+
:param ligand_smiles: SMILES of the ligand, whose net charge sets the ligand charge of the QM
|
|
88
|
+
cluster.
|
|
89
|
+
:param settings: settings controlling the scan. Defaults to
|
|
90
|
+
`stjames.CovalentInhibitorScanSettings()`.
|
|
91
|
+
:param name: name of the workflow.
|
|
92
|
+
:param folder_uuid: UUID of the folder to place the workflow in.
|
|
93
|
+
:param folder: Folder object to store the workflow in.
|
|
94
|
+
:param max_credits: maximum number of credits to use for the workflow.
|
|
95
|
+
:param webhook_url: URL that Rowan will POST to when the workflow completes.
|
|
96
|
+
:param is_draft: if True, submit the workflow as a draft without starting execution.
|
|
97
|
+
:returns: Workflow object representing the submitted workflow.
|
|
98
|
+
:raises requests.HTTPError: if the request to the API fails.
|
|
99
|
+
"""
|
|
100
|
+
if folder and folder_uuid:
|
|
101
|
+
raise ValueError("Provide either `folder` or `folder_uuid`, not both.")
|
|
102
|
+
if folder:
|
|
103
|
+
folder_uuid = folder.uuid
|
|
104
|
+
if isinstance(protein, Protein):
|
|
105
|
+
protein = protein.uuid
|
|
106
|
+
|
|
107
|
+
workflow = stjames.CovalentInhibitorScanWorkflow(
|
|
108
|
+
protein=protein,
|
|
109
|
+
protein_reactive_atom_index=protein_reactive_atom_index,
|
|
110
|
+
ligand_reactive_atom_index=ligand_reactive_atom_index,
|
|
111
|
+
initial_smiles=ligand_smiles,
|
|
112
|
+
settings=settings or stjames.CovalentInhibitorScanSettings(),
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
data = {
|
|
116
|
+
"workflow_type": "covalent_inhibitor_scan",
|
|
117
|
+
"workflow_data": workflow.model_dump(mode="json"),
|
|
118
|
+
"initial_smiles": ligand_smiles,
|
|
119
|
+
"name": name,
|
|
120
|
+
"folder_uuid": folder_uuid,
|
|
121
|
+
"max_credits": max_credits,
|
|
122
|
+
"webhook_url": webhook_url,
|
|
123
|
+
"is_draft": is_draft,
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
with api_client() as client:
|
|
127
|
+
response = client.post("/workflow", json=data)
|
|
128
|
+
response.raise_for_status()
|
|
129
|
+
return Workflow(**response.json())
|
rowan/workflows/docking.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Docking workflow - molecular docking to protein targets."""
|
|
2
2
|
|
|
3
|
+
import warnings
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
|
|
5
6
|
import stjames
|
|
@@ -21,7 +22,11 @@ from .base import (
|
|
|
21
22
|
|
|
22
23
|
@dataclass(frozen=True, slots=True)
|
|
23
24
|
class DockingScore:
|
|
24
|
-
"""A docking pose with its
|
|
25
|
+
"""A docking pose with its scores.
|
|
26
|
+
|
|
27
|
+
:param score: Docking score in kcal/mol.
|
|
28
|
+
:param mmgbsa_score: MM/GBSA binding free energy estimate in kcal/mol.
|
|
29
|
+
"""
|
|
25
30
|
|
|
26
31
|
score: float
|
|
27
32
|
pose: str | None = None
|
|
@@ -29,6 +34,7 @@ class DockingScore:
|
|
|
29
34
|
posebusters_valid: bool = False
|
|
30
35
|
strain: float | None = None
|
|
31
36
|
rmsd: float | None = None
|
|
37
|
+
mmgbsa_score: float | None = None
|
|
32
38
|
|
|
33
39
|
|
|
34
40
|
@register_result("docking")
|
|
@@ -59,6 +65,7 @@ class DockingResult(WorkflowResult):
|
|
|
59
65
|
posebusters_valid=s.posebusters_valid,
|
|
60
66
|
strain=s.strain,
|
|
61
67
|
rmsd=s.rmsd,
|
|
68
|
+
mmgbsa_score=s.mmgbsa_score,
|
|
62
69
|
)
|
|
63
70
|
for s in self._workflow.scores
|
|
64
71
|
]
|
|
@@ -146,10 +153,11 @@ def submit_docking_workflow(
|
|
|
146
153
|
protein: str | Protein,
|
|
147
154
|
pocket: list[list[float]],
|
|
148
155
|
initial_molecule: StructureInput,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
docking_settings: stjames.VinaSettings | stjames.GninaSettings | None = None,
|
|
157
|
+
executable: str | None = None,
|
|
158
|
+
scoring_function: str | None = None,
|
|
159
|
+
exhaustiveness: float | None = None,
|
|
160
|
+
max_poses: int | None = None,
|
|
153
161
|
do_csearch: bool = False,
|
|
154
162
|
do_optimization: bool = False,
|
|
155
163
|
do_pose_refinement: bool = True,
|
|
@@ -166,10 +174,17 @@ def submit_docking_workflow(
|
|
|
166
174
|
:param protein: Protein to dock. Can be input as a uuid or a Protein object.
|
|
167
175
|
:param pocket: Binding pocket as ``[[cx, cy, cz], [sx, sy, sz]]`` — center (Å) and box size (Å).
|
|
168
176
|
:param initial_molecule: Initial molecule to be docked.
|
|
169
|
-
:param
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
:param
|
|
177
|
+
:param docking_settings: Settings controlling the docking engine, e.g. ``VinaSettings`` or
|
|
178
|
+
``GninaSettings`` (for noncovalent or covalent gnina docking). If provided, the deprecated
|
|
179
|
+
``executable``, ``scoring_function``, ``exhaustiveness``, and ``max_poses`` are ignored.
|
|
180
|
+
:param executable: Deprecated, use `docking_settings=VinaSettings(executable=...)` instead.
|
|
181
|
+
Which Vina docking implementation to use.
|
|
182
|
+
:param scoring_function: Deprecated, use `docking_settings=VinaSettings(scoring_function=...)`
|
|
183
|
+
instead. Which Vina docking scoring function to use.
|
|
184
|
+
:param exhaustiveness: Deprecated, use `docking_settings=VinaSettings(exhaustiveness=...)`
|
|
185
|
+
instead. Which exhaustiveness to employ.
|
|
186
|
+
:param max_poses: Deprecated, use `docking_settings=VinaSettings(max_poses=...)` instead.
|
|
187
|
+
Maximum number of poses generated per input conformer.
|
|
173
188
|
:param do_csearch: Whether to perform a conformational search on the ligand.
|
|
174
189
|
:param do_optimization: Whether to perform an optimization on the ligand.
|
|
175
190
|
:param do_pose_refinement: Whether or not to optimize output poses.
|
|
@@ -192,12 +207,26 @@ def submit_docking_workflow(
|
|
|
192
207
|
if isinstance(protein, Protein):
|
|
193
208
|
protein = protein.uuid
|
|
194
209
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
210
|
+
legacy_vina_kwargs = {
|
|
211
|
+
k: v
|
|
212
|
+
for k, v in {
|
|
213
|
+
"executable": executable,
|
|
214
|
+
"exhaustiveness": exhaustiveness,
|
|
215
|
+
"max_poses": max_poses,
|
|
216
|
+
"scoring_function": scoring_function,
|
|
217
|
+
}.items()
|
|
218
|
+
if v is not None
|
|
219
|
+
}
|
|
220
|
+
if legacy_vina_kwargs:
|
|
221
|
+
warnings.warn(
|
|
222
|
+
"executable, scoring_function, exhaustiveness, and max_poses are deprecated; "
|
|
223
|
+
"pass docking_settings=VinaSettings(...) instead.",
|
|
224
|
+
DeprecationWarning,
|
|
225
|
+
stacklevel=2,
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
if docking_settings is None:
|
|
229
|
+
docking_settings = stjames.VinaSettings(**legacy_vina_kwargs)
|
|
201
230
|
|
|
202
231
|
workflow = stjames.DockingWorkflow(
|
|
203
232
|
initial_molecule=mol_dict,
|
|
@@ -210,7 +239,6 @@ def submit_docking_workflow(
|
|
|
210
239
|
)
|
|
211
240
|
|
|
212
241
|
workflow_data = workflow.model_dump(serialize_as_any=True, mode="json")
|
|
213
|
-
workflow_data["docking_settings"].setdefault("settings_type", "vina")
|
|
214
242
|
|
|
215
243
|
data = {
|
|
216
244
|
"workflow_type": "docking",
|
|
@@ -4,7 +4,8 @@ from dataclasses import dataclass
|
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
6
|
import stjames
|
|
7
|
-
from stjames.optimization.
|
|
7
|
+
from stjames.optimization.band_method import NEBSettings
|
|
8
|
+
from stjames.optimization.string_method import StringMethodSettings
|
|
8
9
|
|
|
9
10
|
from ..calculation import Calculation, retrieve_calculation
|
|
10
11
|
from ..folder import Folder
|
|
@@ -151,7 +152,7 @@ def submit_double_ended_ts_search_workflow(
|
|
|
151
152
|
reactant: StructureInput,
|
|
152
153
|
product: StructureInput,
|
|
153
154
|
calculation_settings: stjames.Settings | dict[str, Any] | None = None,
|
|
154
|
-
search_settings:
|
|
155
|
+
search_settings: StringMethodSettings | NEBSettings | dict[str, Any] | None = None,
|
|
155
156
|
optimize_inputs: bool = True,
|
|
156
157
|
optimize_ts: bool = True,
|
|
157
158
|
name: str = "Double-Ended TS Search Workflow",
|
|
@@ -167,7 +168,7 @@ def submit_double_ended_ts_search_workflow(
|
|
|
167
168
|
:param reactant: reactant Molecule.
|
|
168
169
|
:param product: product Molecule.
|
|
169
170
|
:param calculation_settings: Settings to use for calculations. Defaults to omol25_conserving_s.
|
|
170
|
-
:param search_settings: Settings for the transition state search
|
|
171
|
+
:param search_settings: Settings for the transition state search; resolves to FSM
|
|
171
172
|
:param optimize_inputs: Whether to optimize the reactant and product before the search.
|
|
172
173
|
:param optimize_ts: Whether to optimize the found transition state.
|
|
173
174
|
:param name: name of the workflow.
|
|
@@ -195,7 +196,7 @@ def submit_double_ended_ts_search_workflow(
|
|
|
195
196
|
reactant=reactant_dict,
|
|
196
197
|
product=product_dict,
|
|
197
198
|
calculation_settings=calculation_settings,
|
|
198
|
-
search_settings=search_settings or
|
|
199
|
+
search_settings=search_settings or StringMethodSettings(),
|
|
199
200
|
optimize_inputs=optimize_inputs,
|
|
200
201
|
optimize_ts=optimize_ts,
|
|
201
202
|
)
|
rowan/workflows/irc.py
CHANGED
|
@@ -165,6 +165,44 @@ class IRCResult(WorkflowResult):
|
|
|
165
165
|
energies: list[float] = [m.energy for m in self.backward_molecules if m.energy is not None]
|
|
166
166
|
return to_relative_kcal(energies) if relative else energies
|
|
167
167
|
|
|
168
|
+
@property
|
|
169
|
+
def forward_step_sizes(self) -> list[float]:
|
|
170
|
+
"""Actual step sizes taken along the forward IRC path (Å√amu)."""
|
|
171
|
+
return list(self._workflow.step_sizes_forward)
|
|
172
|
+
|
|
173
|
+
@property
|
|
174
|
+
def backward_step_sizes(self) -> list[float]:
|
|
175
|
+
"""Actual step sizes taken along the backward IRC path (Å√amu)."""
|
|
176
|
+
return list(self._workflow.step_sizes_backward)
|
|
177
|
+
|
|
178
|
+
@property
|
|
179
|
+
def forward_endpoint_calculation(self) -> Calculation | None:
|
|
180
|
+
"""Optimization of the forward endpoint (if ``optimize_endpoints=True``, lazily fetched)."""
|
|
181
|
+
if "forward_endpoint_calc" not in self._cache:
|
|
182
|
+
uuid = self._workflow.endpoint_opt_forward
|
|
183
|
+
self._cache["forward_endpoint_calc"] = retrieve_calculation(uuid) if uuid else None
|
|
184
|
+
return self._cache["forward_endpoint_calc"]
|
|
185
|
+
|
|
186
|
+
@property
|
|
187
|
+
def backward_endpoint_calculation(self) -> Calculation | None:
|
|
188
|
+
"""Optimization of backward endpoint (if ``optimize_endpoints=True``, lazily fetched)."""
|
|
189
|
+
if "backward_endpoint_calc" not in self._cache:
|
|
190
|
+
uuid = self._workflow.endpoint_opt_backward
|
|
191
|
+
self._cache["backward_endpoint_calc"] = retrieve_calculation(uuid) if uuid else None
|
|
192
|
+
return self._cache["backward_endpoint_calc"]
|
|
193
|
+
|
|
194
|
+
@property
|
|
195
|
+
def forward_endpoint_molecule(self) -> Molecule | None:
|
|
196
|
+
"""Optimized forward endpoint molecule (if ``optimize_endpoints=True``)."""
|
|
197
|
+
calc = self.forward_endpoint_calculation
|
|
198
|
+
return calc.molecule if calc else None
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
def backward_endpoint_molecule(self) -> Molecule | None:
|
|
202
|
+
"""Optimized backward endpoint molecule (if ``optimize_endpoints=True``)."""
|
|
203
|
+
calc = self.backward_endpoint_calculation
|
|
204
|
+
return calc.molecule if calc else None
|
|
205
|
+
|
|
168
206
|
|
|
169
207
|
def submit_irc_workflow(
|
|
170
208
|
initial_molecule: StructureInput,
|
|
@@ -177,6 +215,7 @@ def submit_irc_workflow(
|
|
|
177
215
|
preopt: bool = True,
|
|
178
216
|
step_size: float = 0.05,
|
|
179
217
|
max_irc_steps: int = 30,
|
|
218
|
+
optimize_endpoints: bool = False,
|
|
180
219
|
name: str = "IRC Workflow",
|
|
181
220
|
folder_uuid: str | None = None,
|
|
182
221
|
folder: Folder | None = None,
|
|
@@ -195,8 +234,9 @@ def submit_irc_workflow(
|
|
|
195
234
|
:param engine: Engine for the calculation (and optional preopt)
|
|
196
235
|
:param pbc_dft_settings: PBC DFT settings for the IRC (and optional preopt)
|
|
197
236
|
:param preopt: Whether to perform a pre-optimization of the TS guess
|
|
198
|
-
:param step_size: Step size for the IRC calculation
|
|
237
|
+
:param step_size: Step size for the IRC calculation (0.001-0.5 Å√amu)
|
|
199
238
|
:param max_irc_steps: Maximum number of IRC steps to perform
|
|
239
|
+
:param optimize_endpoints: Whether to optimize the endpoint geometries once the IRC completes
|
|
200
240
|
:param name: Name for the workflow
|
|
201
241
|
:param folder_uuid: UUID of the folder to place the workflow in
|
|
202
242
|
:param folder: Folder object to store the workflow in
|
|
@@ -244,6 +284,7 @@ def submit_irc_workflow(
|
|
|
244
284
|
preopt=preopt,
|
|
245
285
|
step_size=step_size,
|
|
246
286
|
max_irc_steps=max_irc_steps,
|
|
287
|
+
optimize_endpoints=optimize_endpoints,
|
|
247
288
|
)
|
|
248
289
|
|
|
249
290
|
data = {
|
|
@@ -80,6 +80,7 @@ class CofoldingResult:
|
|
|
80
80
|
:param scores: Confidence scores for the prediction.
|
|
81
81
|
:param affinity_score: Predicted binding affinity (if computed).
|
|
82
82
|
:param strain: Ligand strain energy (if computed).
|
|
83
|
+
:param mmgbsa_score: MM/GBSA binding free energy estimate in kcal/mol (if computed).
|
|
83
84
|
:param posebusters_valid: Whether the pose passes PoseBusters validation.
|
|
84
85
|
:param lddt: Per-residue LDDT confidence scores.
|
|
85
86
|
:param pose_uuid: UUID of the pose.
|
|
@@ -90,6 +91,7 @@ class CofoldingResult:
|
|
|
90
91
|
scores: CofoldingScores | None = None
|
|
91
92
|
affinity_score: AffinityScore | None = None
|
|
92
93
|
strain: float | None = None
|
|
94
|
+
mmgbsa_score: float | None = None
|
|
93
95
|
posebusters_valid: bool | None = None
|
|
94
96
|
lddt: list[float] | None = None
|
|
95
97
|
pose_uuid: str | None = None
|
|
@@ -197,6 +199,7 @@ class ProteinCofoldingResult(WorkflowResult):
|
|
|
197
199
|
scores=scores,
|
|
198
200
|
affinity_score=affinity_score,
|
|
199
201
|
strain=getattr(r, "strain", None),
|
|
202
|
+
mmgbsa_score=getattr(r, "mmgbsa_score", None),
|
|
200
203
|
posebusters_valid=getattr(r, "posebusters_valid", None),
|
|
201
204
|
lddt=list(lddt) if lddt else None,
|
|
202
205
|
pose_uuid=getattr(r, "pose", None),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rowan-python
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.7
|
|
4
4
|
Summary: Rowan Python Library
|
|
5
5
|
Project-URL: Homepage, https://github.com/rowansci/rowan-client
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/rowansci/rowan-client/issues
|
|
@@ -11,7 +11,7 @@ Requires-Dist: httpx
|
|
|
11
11
|
Requires-Dist: nest-asyncio
|
|
12
12
|
Requires-Dist: rdkit
|
|
13
13
|
Requires-Dist: setuptools
|
|
14
|
-
Requires-Dist: stjames>=0.0.
|
|
14
|
+
Requires-Dist: stjames>=0.0.228
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
|
|
17
17
|
# Rowan Python Library
|
|
@@ -30,9 +30,27 @@ The documentation is available [here](https://docs.rowansci.com/python-api).
|
|
|
30
30
|
|
|
31
31
|
## Agent skill
|
|
32
32
|
|
|
33
|
-
Ships with a [skill](skills/computational-chemistry-and-biology/)
|
|
33
|
+
Ships with a [computational chemistry and biology skill](skills/computational-chemistry-and-biology/)
|
|
34
|
+
that helps coding agents choose and run Rowan workflows through either Rowan MCP tools or the
|
|
35
|
+
Rowan Python SDK.
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
### Claude Code
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
claude plugin marketplace add https://github.com/rowansci/rowan-python.git
|
|
41
|
+
claude plugin install computational-chemistry-and-biology@rowan
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Codex
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
codex plugin marketplace add rowansci/rowan-python --ref master
|
|
48
|
+
codex plugin add computational-chemistry-and-biology@rowan
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Start a new Claude Code or Codex session after installation. For manual installation, download the
|
|
52
|
+
[latest skill ZIP](https://github.com/rowansci/rowan-python/releases/download/skill-latest/computational-chemistry-and-biology-skill.zip)
|
|
53
|
+
and extract it into your agent's skills directory.
|
|
36
54
|
|
|
37
55
|
## Running examples
|
|
38
56
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
rowan/__init__.py,sha256=
|
|
1
|
+
rowan/__init__.py,sha256=95VjN9XTgEICFLCcB4oUbT_nsU_EvulDqMDJjBuSTI8,1714
|
|
2
2
|
rowan/api_keys.py,sha256=TvG5l5MmQ3Qt8Z3Y7jCA_lcrwEHuI7xHy-KLbIdQ8_A,4793
|
|
3
3
|
rowan/calculation.py,sha256=nuUtLTtn9D-FCM9TJl3h5euBgIYqa5fr5r_PSNBS7Xo,3809
|
|
4
4
|
rowan/config.py,sha256=TejQKSxnzNKKTNL9-2bCLq6RvAh54oVA5Ivl1p_ZT8Q,20899
|
|
@@ -6,14 +6,15 @@ rowan/constants.py,sha256=emCH4m9OL2Hm5E-6mJGM_FgzrK_JrZT-FiKJ6pMNQ4Y,84
|
|
|
6
6
|
rowan/folder.py,sha256=RRg68dObluJ2RCTKX3rb7RxziOXOQUYxkfQSU2R5VMk,13708
|
|
7
7
|
rowan/molecule.py,sha256=1l-3YCN_A75Uz_Q-dMWuhkeF8rhD1z2JQM7AENyjKYM,15512
|
|
8
8
|
rowan/project.py,sha256=RtxYE9jv3Yz6fH5I56iDGRG5EbwlOHiSK-HF1uxc0d4,4582
|
|
9
|
-
rowan/protein.py,sha256=
|
|
9
|
+
rowan/protein.py,sha256=uFMF2BXgIvn6KOw3cdE-LDvZPPbjAxqqwgxakLd85XA,17763
|
|
10
10
|
rowan/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
rowan/test_utils.py,sha256=DTuZqftx6ycIatajAxSGWgDaGglLvTw2TYnVJHiiNdo,1936
|
|
11
12
|
rowan/types.py,sha256=MvcYvEYr6N9RXLal44MqsnMxoWfcBa-VLD_rGsW4HOc,591
|
|
12
13
|
rowan/user.py,sha256=rOCYVhSoRY71fCG_OCSD7cLAWWnAMANWGitF3ogfq30,6212
|
|
13
|
-
rowan/utils.py,sha256=
|
|
14
|
-
rowan/workflows/__init__.py,sha256=
|
|
14
|
+
rowan/utils.py,sha256=J-3o9_ZlOrl4_ZuuC1yjEOPdD1IkKO0BOXBncV3Ij7c,5670
|
|
15
|
+
rowan/workflows/__init__.py,sha256=pkmAl8aPDznu15bSuRW0j8id-B7Xmzy_tq3LgZfQ7NQ,4786
|
|
15
16
|
rowan/workflows/admet.py,sha256=jDx1Kkgmp0XaeojPzaCFY_yUwvqtSM7Cezps-93cqPw,2865
|
|
16
|
-
rowan/workflows/analogue_docking.py,sha256=
|
|
17
|
+
rowan/workflows/analogue_docking.py,sha256=TshOw71RmK5XaaTIHz_Q1opiDU9x1L38tXwxoYUZaxY,9756
|
|
17
18
|
rowan/workflows/base.py,sha256=k858otXLuorw4MZ1hvqZI_m0n_38htC7Hy3OMCX1TOA,32961
|
|
18
19
|
rowan/workflows/basic_calculation.py,sha256=EovymT6fV6mxmt4G4kRtiskSPGB7w7KAHqBaGtgQI2Q,12941
|
|
19
20
|
rowan/workflows/batch_docking.py,sha256=ePnb1hcsmnUfffl1-k9HNkOC09RjY9bZS9XcqAGNeFs,3621
|
|
@@ -21,15 +22,16 @@ rowan/workflows/bde.py,sha256=1ieYUeu-5Lg637eSjhbRr_6qSIiIcjhsLOzaA4zbg3o,6681
|
|
|
21
22
|
rowan/workflows/binding_affinity.py,sha256=Pengz5gmhYvRd3P6yTe1p7nLZnDENp_gwDJo2q5kiEg,5089
|
|
22
23
|
rowan/workflows/conformer_search.py,sha256=9_DpRfmeNWIVm68Y95zcHCK5Q0yt9le6W70rMeIQndY,15467
|
|
23
24
|
rowan/workflows/constants.py,sha256=el8jWE9gnGTLNWn5_n_V0H362vIRneOqgy7BOQ8CScg,575
|
|
25
|
+
rowan/workflows/covalent_inhibitor_scan.py,sha256=BNqGLE2CjSlkOlXj_7KcsX9GEstMD3Ts-v2qIlRWK48,4717
|
|
24
26
|
rowan/workflows/descriptors.py,sha256=QjjpzPDpAO_EhPOK--gle6sGpVHMpdAs_yrvC0oiseY,3092
|
|
25
|
-
rowan/workflows/docking.py,sha256=
|
|
26
|
-
rowan/workflows/double_ended_ts_search.py,sha256=
|
|
27
|
+
rowan/workflows/docking.py,sha256=SfFzZER-fYGPn9OZyEE9BSAestjCbbUaP4z9OapA1ko,9391
|
|
28
|
+
rowan/workflows/double_ended_ts_search.py,sha256=nse7oK-8R5h_FtpZZAzes0TQCs2XOdEbdyZFOECK8B0,8193
|
|
27
29
|
rowan/workflows/electronic_properties.py,sha256=MXbsI4OHyXWt3f4Qc5g7-SNjyyEoYzocWVdcP1H06sY,8436
|
|
28
30
|
rowan/workflows/fukui.py,sha256=Lyx3FgSdidzPMj-PpSzOb9uXCZj2S_52p8zBYxBbprg,4412
|
|
29
31
|
rowan/workflows/hydrogen_bond_donor_acceptor_strength.py,sha256=xgFFemIZpIOkgkiYx20TmCexWNxNgRZl4H4t-zfQqUE,5254
|
|
30
32
|
rowan/workflows/interaction_energy_decomposition.py,sha256=wK9Mc9uGmFBG8H03LRRRz3nZzM6p7Z2ol1yiZbUB5ec,6176
|
|
31
33
|
rowan/workflows/ion_mobility.py,sha256=GqVVPRffaBJvygB3mwbMJq2aW7y19J3AnkDx_ZMIRss,4021
|
|
32
|
-
rowan/workflows/irc.py,sha256=
|
|
34
|
+
rowan/workflows/irc.py,sha256=qA8rLvhSkyOBBDtUw8Yq1iaRHiCUil0pI_HsMhVcuEQ,12069
|
|
33
35
|
rowan/workflows/macropka.py,sha256=IxGwr9LziIwj_x6pXEhJN6SywS_KULziuYoETNqM370,5684
|
|
34
36
|
rowan/workflows/membrane_permeability.py,sha256=wHZ1IPlXwBB343uVAm7EuhedcMPd-Uy4jMqHfXRHwqY,4680
|
|
35
37
|
rowan/workflows/msa.py,sha256=k_FlxxtdgvmxDN3LyLDEQeFfI8_lyBJz1KFtz3S4oNo,4816
|
|
@@ -39,7 +41,7 @@ rowan/workflows/pka.py,sha256=NZ-3i-cH_b7YOHj2iq0roXEcZmC8SYapmzMOX6ObRqw,8546
|
|
|
39
41
|
rowan/workflows/pocket_detection.py,sha256=aGHY0puxekp4c4nsNYHcvKCe1fsetygL04BcSvNFvE8,3864
|
|
40
42
|
rowan/workflows/pose_analysis_md.py,sha256=5TRsCBFD0QObE5tpmCOxi137xsKMfQrRO6ef8TLrnkk,11767
|
|
41
43
|
rowan/workflows/protein_binder_design.py,sha256=pgywTQDuXHplZYka-61_S6CC4WTPDCwJrbupp825eC4,9281
|
|
42
|
-
rowan/workflows/protein_cofolding.py,sha256=
|
|
44
|
+
rowan/workflows/protein_cofolding.py,sha256=haT0liJorxyHgO02WX8WslqAu7Dc7QOSs6VbE9ZJwuw,16433
|
|
43
45
|
rowan/workflows/protein_md.py,sha256=zqKEtL514uchgbxsyO4vhokzTU-X4lTFA1BM5O8HvTU,10117
|
|
44
46
|
rowan/workflows/rbfe_graph.py,sha256=0eMfvwtQhyajUC8T-bhdcYNKi6Pkja6x6dHjCnEwxPw,8081
|
|
45
47
|
rowan/workflows/redox_potential.py,sha256=bBeT1K9XGVpjCFZeeuv7Vtr3EYHN2okJ4LqYc3gMV04,5427
|
|
@@ -50,7 +52,7 @@ rowan/workflows/solvent_dependent_conformers.py,sha256=Z2xESmcM8WcTsR2TSTUa--Rrh
|
|
|
50
52
|
rowan/workflows/spin_states.py,sha256=rjkgie2-XVNIN7O6P93yn6EPv9Ogjy8iTj3ufZIsUgY,9331
|
|
51
53
|
rowan/workflows/strain.py,sha256=kCW_BlX__sdQG1JVbFZuB-57rkpnxa_JCw3h4uKdGDk,6425
|
|
52
54
|
rowan/workflows/tautomer_search.py,sha256=mbRl0ZJ7wibueRF8c8_idhXJ1rtwg7LBt--5QwQ_Cck,5767
|
|
53
|
-
rowan_python-3.1.
|
|
54
|
-
rowan_python-3.1.
|
|
55
|
-
rowan_python-3.1.
|
|
56
|
-
rowan_python-3.1.
|
|
55
|
+
rowan_python-3.1.7.dist-info/METADATA,sha256=mCUORIhOBiBBn69iu-_EXm3QUnUuv6wwDKKK84cio3o,2436
|
|
56
|
+
rowan_python-3.1.7.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
57
|
+
rowan_python-3.1.7.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
|
|
58
|
+
rowan_python-3.1.7.dist-info/RECORD,,
|
|
File without changes
|