rowan-python 3.2.1__py3-none-any.whl → 3.2.3__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 +3 -0
- rowan/project.py +8 -1
- rowan/spectra.py +68 -0
- rowan/utils.py +63 -14
- rowan/workflows/_molecular_dynamics.py +27 -2
- rowan/workflows/binding_affinity.py +7 -1
- rowan/workflows/conformer_search.py +62 -10
- rowan/workflows/protein_md.py +3 -3
- rowan/workflows/relative_binding_free_energy_perturbation.py +67 -2
- {rowan_python-3.2.1.dist-info → rowan_python-3.2.3.dist-info}/METADATA +2 -2
- {rowan_python-3.2.1.dist-info → rowan_python-3.2.3.dist-info}/RECORD +13 -12
- {rowan_python-3.2.1.dist-info → rowan_python-3.2.3.dist-info}/WHEEL +0 -0
- {rowan_python-3.2.1.dist-info → rowan_python-3.2.3.dist-info}/licenses/LICENSE +0 -0
rowan/__init__.py
CHANGED
|
@@ -15,6 +15,7 @@ from stjames import (
|
|
|
15
15
|
Constraint,
|
|
16
16
|
ConstraintType,
|
|
17
17
|
ConformerClusteringSettings,
|
|
18
|
+
ConformerProperties,
|
|
18
19
|
ConformerGenSettingsUnion,
|
|
19
20
|
Correction,
|
|
20
21
|
DNASequence,
|
|
@@ -67,6 +68,7 @@ from stjames.engine_compatibility import (
|
|
|
67
68
|
METHOD_ENGINES,
|
|
68
69
|
get_supported_corrections,
|
|
69
70
|
)
|
|
71
|
+
from stjames.pdb import ResidueRef
|
|
70
72
|
from stjames.optimization.band_method import NEBSettings
|
|
71
73
|
from stjames.optimization.interpolation import Interpolation
|
|
72
74
|
from stjames.optimization.string_method import FSMSettings, StringMethodSettings
|
|
@@ -82,5 +84,6 @@ from .types import ProteinUUID, RdkitMol, SMILES, StJamesMolecule, StructureInpu
|
|
|
82
84
|
from .workflows import *
|
|
83
85
|
from .project import *
|
|
84
86
|
from .protein import *
|
|
87
|
+
from .spectra import HARTREE_TO_EV, broaden_spectrum
|
|
85
88
|
from .user import *
|
|
86
89
|
from .utils import *
|
rowan/project.py
CHANGED
|
@@ -197,8 +197,15 @@ def default_project() -> Project:
|
|
|
197
197
|
|
|
198
198
|
Raises:
|
|
199
199
|
httpx.HTTPStatusError: API request fails
|
|
200
|
+
ValueError: user has no default project in the API key's organization
|
|
200
201
|
"""
|
|
201
202
|
with api_client() as client:
|
|
202
203
|
response = client.get("/user/me/default_project")
|
|
203
204
|
response.raise_for_status()
|
|
204
|
-
|
|
205
|
+
project = response.json()
|
|
206
|
+
if project is None:
|
|
207
|
+
raise ValueError(
|
|
208
|
+
"You have no default project in this organization. "
|
|
209
|
+
"Set a default project, or pass a folder or project."
|
|
210
|
+
)
|
|
211
|
+
return Project(**project)
|
rowan/spectra.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Broaden stick spectra into continuous line shapes."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
from collections.abc import Sequence
|
|
5
|
+
from typing import Literal
|
|
6
|
+
|
|
7
|
+
HARTREE_TO_EV = 27.211386245988
|
|
8
|
+
|
|
9
|
+
_GAUSSIAN_FWHM_TO_SIGMA = 1 / (2 * math.sqrt(2 * math.log(2)))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def broaden_spectrum(
|
|
13
|
+
positions: Sequence[float],
|
|
14
|
+
intensities: Sequence[float],
|
|
15
|
+
grid: Sequence[float],
|
|
16
|
+
fwhm: float,
|
|
17
|
+
lineshape: Literal["gaussian", "lorentzian"] = "gaussian",
|
|
18
|
+
) -> list[float]:
|
|
19
|
+
"""Sum line shapes centered on each stick, each with area equal to its intensity.
|
|
20
|
+
|
|
21
|
+
Use it on the stick spectra of `ConformerSearchResult.ensemble_properties`, for
|
|
22
|
+
example excitation energies with oscillator or rotatory strengths for UV-vis or ECD,
|
|
23
|
+
or vibrational frequencies with IR intensities. `grid` and `fwhm` share the units of
|
|
24
|
+
`positions`; convert excitation energies from Hartree with `HARTREE_TO_EV` first to
|
|
25
|
+
broaden in eV.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
positions: line positions
|
|
29
|
+
intensities: line intensities, parallel to `positions`
|
|
30
|
+
grid: points at which to evaluate the spectrum
|
|
31
|
+
fwhm: full width at half maximum of each line
|
|
32
|
+
lineshape: line shape of each stick
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
spectrum at each point of `grid`
|
|
36
|
+
|
|
37
|
+
Raises:
|
|
38
|
+
ValueError: `fwhm` is not positive or `intensities` differs in length from `positions`
|
|
39
|
+
|
|
40
|
+
>>> [round(y, 4) for y in broaden_spectrum([0.0], [1.0], [0.0, 0.5], fwhm=1.0)]
|
|
41
|
+
[0.9394, 0.4697]
|
|
42
|
+
>>> [round(y, 4) for y in broaden_spectrum([0.0], [2.0], [0.0], 1.0, "lorentzian")]
|
|
43
|
+
[1.2732]
|
|
44
|
+
"""
|
|
45
|
+
if fwhm <= 0:
|
|
46
|
+
raise ValueError(f"fwhm must be positive, got {fwhm}")
|
|
47
|
+
if len(positions) != len(intensities):
|
|
48
|
+
raise ValueError(
|
|
49
|
+
f"positions ({len(positions)}) and intensities ({len(intensities)}) "
|
|
50
|
+
"must have the same length"
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if lineshape == "gaussian":
|
|
54
|
+
sigma = fwhm * _GAUSSIAN_FWHM_TO_SIGMA
|
|
55
|
+
norm = 1 / (sigma * math.sqrt(2 * math.pi))
|
|
56
|
+
|
|
57
|
+
def shape(dx: float) -> float:
|
|
58
|
+
return norm * math.exp(-0.5 * (dx / sigma) ** 2)
|
|
59
|
+
|
|
60
|
+
else:
|
|
61
|
+
gamma = fwhm / 2
|
|
62
|
+
|
|
63
|
+
def shape(dx: float) -> float:
|
|
64
|
+
return gamma / (math.pi * (dx**2 + gamma**2))
|
|
65
|
+
|
|
66
|
+
return [
|
|
67
|
+
sum(i * shape(x - p) for p, i in zip(positions, intensities, strict=True)) for x in grid
|
|
68
|
+
]
|
rowan/utils.py
CHANGED
|
@@ -4,7 +4,7 @@ from contextvars import ContextVar
|
|
|
4
4
|
from dataclasses import dataclass
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from tempfile import NamedTemporaryFile
|
|
7
|
-
from typing import Any, Generator, Literal
|
|
7
|
+
from typing import Any, Callable, ContextManager, Generator, Literal
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
import stjames
|
|
@@ -167,24 +167,14 @@ def api_client() -> Generator[httpx.Client, None, None]:
|
|
|
167
167
|
yield client
|
|
168
168
|
|
|
169
169
|
|
|
170
|
-
def
|
|
171
|
-
|
|
172
|
-
method: Literal["GET", "POST"],
|
|
173
|
-
url: str,
|
|
174
|
-
*,
|
|
175
|
-
params: dict[str, Any] | None = None,
|
|
176
|
-
json: Any = None,
|
|
177
|
-
) -> Path:
|
|
178
|
-
"""Stream an authenticated API response into one local file atomically."""
|
|
170
|
+
def _stream_to_file(path: Path, stream: Callable[[], ContextManager[httpx.Response]]) -> Path:
|
|
171
|
+
"""Write a streamed response into one local file atomically."""
|
|
179
172
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
180
173
|
temporary_path: Path | None = None
|
|
181
174
|
try:
|
|
182
175
|
with NamedTemporaryFile(dir=path.parent, prefix=f".{path.name}.", delete=False) as output:
|
|
183
176
|
temporary_path = Path(output.name)
|
|
184
|
-
with (
|
|
185
|
-
api_client() as client,
|
|
186
|
-
client.stream(method, url, params=params, json=json) as response,
|
|
187
|
-
):
|
|
177
|
+
with stream() as response:
|
|
188
178
|
response.raise_for_status()
|
|
189
179
|
for chunk in response.iter_bytes():
|
|
190
180
|
output.write(chunk)
|
|
@@ -196,6 +186,65 @@ def download_file(
|
|
|
196
186
|
return path
|
|
197
187
|
|
|
198
188
|
|
|
189
|
+
def download_file(
|
|
190
|
+
path: Path,
|
|
191
|
+
method: Literal["GET", "POST"],
|
|
192
|
+
url: str,
|
|
193
|
+
*,
|
|
194
|
+
params: dict[str, Any] | None = None,
|
|
195
|
+
json: Any = None,
|
|
196
|
+
) -> Path:
|
|
197
|
+
"""Stream an authenticated API response into one local file atomically."""
|
|
198
|
+
|
|
199
|
+
@contextmanager
|
|
200
|
+
def stream() -> Generator[httpx.Response, None, None]:
|
|
201
|
+
with (
|
|
202
|
+
api_client() as client,
|
|
203
|
+
client.stream(method, url, params=params, json=json) as response,
|
|
204
|
+
):
|
|
205
|
+
yield response
|
|
206
|
+
|
|
207
|
+
return _stream_to_file(path, stream)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def download_presigned_files(
|
|
211
|
+
directory: Path,
|
|
212
|
+
url: str,
|
|
213
|
+
*,
|
|
214
|
+
params: dict[str, Any] | None = None,
|
|
215
|
+
json: Any = None,
|
|
216
|
+
) -> list[Path]:
|
|
217
|
+
"""Fetch presigned download links from the API and stream each file into `directory`.
|
|
218
|
+
|
|
219
|
+
Links are short-lived, so an expired one is refreshed once before giving up.
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
def fetch_links() -> list[dict[str, str]]:
|
|
223
|
+
with api_client() as client:
|
|
224
|
+
return client.post(url, params=params, json=json).json()
|
|
225
|
+
|
|
226
|
+
def download(link: dict[str, str]) -> Path:
|
|
227
|
+
# Plain client: the API key must never be sent to S3.
|
|
228
|
+
@contextmanager
|
|
229
|
+
def stream() -> Generator[httpx.Response, None, None]:
|
|
230
|
+
with httpx.Client(timeout=httpx.Timeout(120, read=None)) as client:
|
|
231
|
+
with client.stream("GET", link["url"]) as response:
|
|
232
|
+
yield response
|
|
233
|
+
|
|
234
|
+
return _stream_to_file(directory / Path(link["filename"]).name, stream)
|
|
235
|
+
|
|
236
|
+
links = fetch_links()
|
|
237
|
+
paths = []
|
|
238
|
+
for i, link in enumerate(links):
|
|
239
|
+
try:
|
|
240
|
+
paths.append(download(link))
|
|
241
|
+
except httpx.HTTPStatusError as error:
|
|
242
|
+
if error.response.status_code != 403:
|
|
243
|
+
raise
|
|
244
|
+
paths.append(download(fetch_links()[i]))
|
|
245
|
+
return paths
|
|
246
|
+
|
|
247
|
+
|
|
199
248
|
ATOMIC_NUMBER_TO_ATOMIC_SYMBOL = {
|
|
200
249
|
"1": "H",
|
|
201
250
|
"2": "He",
|
|
@@ -8,7 +8,7 @@ from typing import Literal, Protocol
|
|
|
8
8
|
from stjames.pdb import PDB
|
|
9
9
|
|
|
10
10
|
from rowan.protein import Protein, retrieve_protein
|
|
11
|
-
from rowan.utils import api_client, download_file
|
|
11
|
+
from rowan.utils import api_client, download_file, download_presigned_files
|
|
12
12
|
|
|
13
13
|
from .base import WorkflowResult
|
|
14
14
|
|
|
@@ -222,7 +222,9 @@ class _MolecularDynamicsResult(WorkflowResult):
|
|
|
222
222
|
name: str | None = None,
|
|
223
223
|
path: Path | str | None = None,
|
|
224
224
|
) -> Path:
|
|
225
|
-
"""Download DCD trajectory files for selected replicates.
|
|
225
|
+
"""Download DCD trajectory files for selected replicates as one `.tar.gz` archive.
|
|
226
|
+
|
|
227
|
+
Long trajectories can time out; use `download_trajectory_files` for those.
|
|
226
228
|
|
|
227
229
|
Args:
|
|
228
230
|
replicates: zero-based replicate indices
|
|
@@ -244,6 +246,29 @@ class _MolecularDynamicsResult(WorkflowResult):
|
|
|
244
246
|
json=replicates,
|
|
245
247
|
)
|
|
246
248
|
|
|
249
|
+
def download_trajectory_files(
|
|
250
|
+
self,
|
|
251
|
+
replicates: list[int],
|
|
252
|
+
path: Path | str | None = None,
|
|
253
|
+
) -> list[Path]:
|
|
254
|
+
"""Download each selected replicate's DCD file directly from storage.
|
|
255
|
+
|
|
256
|
+
Args:
|
|
257
|
+
replicates: zero-based replicate indices
|
|
258
|
+
path: output directory; defaults to the current directory
|
|
259
|
+
|
|
260
|
+
Returns:
|
|
261
|
+
paths to the downloaded `.dcd` files, one per replicate
|
|
262
|
+
|
|
263
|
+
Raises:
|
|
264
|
+
httpx.HTTPStatusError: API or storage request fails
|
|
265
|
+
"""
|
|
266
|
+
return download_presigned_files(
|
|
267
|
+
Path(path) if path is not None else Path.cwd(),
|
|
268
|
+
f"/trajectory/{self.workflow_uuid}/trajectory_dcd_urls",
|
|
269
|
+
json=replicates,
|
|
270
|
+
)
|
|
271
|
+
|
|
247
272
|
def _trajectory(self, replicate: int) -> _MolecularDynamicsTrajectory:
|
|
248
273
|
"""Return one trajectory with a consistent bounds error."""
|
|
249
274
|
trajectories = self.trajectories
|
|
@@ -153,9 +153,15 @@ def submit_binding_affinity_workflow(
|
|
|
153
153
|
binding_affinity_settings=binding_affinity_settings or SinglePointEnergySettings(),
|
|
154
154
|
)
|
|
155
155
|
|
|
156
|
+
workflow_data = workflow.model_dump(serialize_as_any=True, mode="json")
|
|
157
|
+
if isinstance(workflow.binding_affinity_settings, SinglePointEnergySettings):
|
|
158
|
+
workflow_data["binding_affinity_settings"]["truncation_radius"] = (
|
|
159
|
+
workflow.binding_affinity_settings.truncation_radius
|
|
160
|
+
)
|
|
161
|
+
|
|
156
162
|
data = {
|
|
157
163
|
"workflow_type": "binding_affinity",
|
|
158
|
-
"workflow_data":
|
|
164
|
+
"workflow_data": workflow_data,
|
|
159
165
|
"name": name,
|
|
160
166
|
"folder_uuid": folder_uuid,
|
|
161
167
|
"max_credits": max_credits,
|
|
@@ -31,6 +31,8 @@ from .base import (
|
|
|
31
31
|
)
|
|
32
32
|
from .constants import to_relative_kcal
|
|
33
33
|
|
|
34
|
+
ConformerProperties = stjames.ConformerProperties
|
|
35
|
+
|
|
34
36
|
|
|
35
37
|
@register_result("conformer_search")
|
|
36
38
|
class ConformerSearchResult(WorkflowResult):
|
|
@@ -72,22 +74,59 @@ class ConformerSearchResult(WorkflowResult):
|
|
|
72
74
|
return to_relative_kcal(energies) if relative else energies
|
|
73
75
|
|
|
74
76
|
@property
|
|
75
|
-
def radii_of_gyration(self) -> list[float]:
|
|
76
|
-
"""Radius of gyration for each conformer (A)."""
|
|
77
|
+
def radii_of_gyration(self) -> list[float | None]:
|
|
78
|
+
"""Radius of gyration for each conformer (A), None where it failed."""
|
|
77
79
|
return [p.radius_of_gyration for p in self._workflow.conformer_properties]
|
|
78
80
|
|
|
79
81
|
@property
|
|
80
|
-
def sasa(self) -> list[float]:
|
|
81
|
-
"""Solvent accessible surface area for each conformer (A^2)."""
|
|
82
|
+
def sasa(self) -> list[float | None]:
|
|
83
|
+
"""Solvent accessible surface area for each conformer (A^2), None where it failed."""
|
|
82
84
|
return [p.solvent_accessible_surface_area for p in self._workflow.conformer_properties]
|
|
83
85
|
|
|
84
86
|
@property
|
|
85
|
-
def polar_sasa(self) -> list[float]:
|
|
86
|
-
"""Polar solvent accessible surface area for each conformer (A^2)."""
|
|
87
|
+
def polar_sasa(self) -> list[float | None]:
|
|
88
|
+
"""Polar solvent accessible surface area for each conformer (A^2), None where it failed."""
|
|
87
89
|
return [
|
|
88
90
|
p.polar_solvent_accessible_surface_area for p in self._workflow.conformer_properties
|
|
89
91
|
]
|
|
90
92
|
|
|
93
|
+
@property
|
|
94
|
+
def dipoles(self) -> list[float | None]:
|
|
95
|
+
"""Dipole moment magnitude about the center of mass for each conformer (Debye).
|
|
96
|
+
|
|
97
|
+
None where the method reports no dipole.
|
|
98
|
+
"""
|
|
99
|
+
return [p.dipole for p in self._workflow.conformer_properties]
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def ensemble_properties(self) -> ConformerProperties | None:
|
|
103
|
+
"""Ensemble properties weighted by `boltzmann_weights`.
|
|
104
|
+
|
|
105
|
+
Each property is averaged over the conformers that have it: SASA, polar SASA, Rg,
|
|
106
|
+
the root-mean-square dipole (Debye), and per-atom Mulliken charges. When the run
|
|
107
|
+
computed them, it also holds stick spectra with every conformer's lines, each
|
|
108
|
+
intensity scaled by its conformer's population: `excitation_energies` (Hartree) with
|
|
109
|
+
`oscillator_strengths` (UV-vis) and `rotatory_strengths` (ECD), and
|
|
110
|
+
`vibrational_frequencies` (cm^-1) with `ir_intensities` (km/mol). Pass them to
|
|
111
|
+
`rowan.broaden_spectrum` for the spectrum. Rotatory strengths are omitted when the
|
|
112
|
+
conformers differ in stereochemistry, since mixing enantiomers cancels the ECD signal.
|
|
113
|
+
"""
|
|
114
|
+
return self._workflow.ensemble_properties
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def boltzmann_weights(self) -> list[float]:
|
|
118
|
+
"""Population of each conformer at the weighting temperature (sum to 1.0).
|
|
119
|
+
|
|
120
|
+
From free energies when every conformer has frequencies, else from ground-state
|
|
121
|
+
energies. Empty for workflows run before weights were reported.
|
|
122
|
+
"""
|
|
123
|
+
return list(self._workflow.boltzmann_weights)
|
|
124
|
+
|
|
125
|
+
@property
|
|
126
|
+
def weighting_temperature(self) -> float:
|
|
127
|
+
"""Temperature of `boltzmann_weights` and `ensemble_properties` (K)."""
|
|
128
|
+
return self._workflow.weighting_temperature
|
|
129
|
+
|
|
91
130
|
def get_conformers(self, n: int | None = None) -> list[Molecule]:
|
|
92
131
|
"""Fetch conformer molecules.
|
|
93
132
|
|
|
@@ -156,6 +195,7 @@ def _mso_for_final_method(
|
|
|
156
195
|
final_method: Method,
|
|
157
196
|
solvent: SolventInput = None,
|
|
158
197
|
transition_state: bool = False,
|
|
198
|
+
frequencies: bool = False,
|
|
159
199
|
) -> MultiStageOptSettings:
|
|
160
200
|
"""Build optimization settings for the final method.
|
|
161
201
|
|
|
@@ -163,9 +203,9 @@ def _mso_for_final_method(
|
|
|
163
203
|
without a named preset.
|
|
164
204
|
|
|
165
205
|
`solvent` and `transition_state` are merged into each stage's `Settings`
|
|
166
|
-
when supplied
|
|
167
|
-
|
|
168
|
-
toggles).
|
|
206
|
+
when supplied, and `frequencies` runs on the optimization stage; the named
|
|
207
|
+
preset itself is independent of them (mirrors how tinbergen's form keeps the
|
|
208
|
+
preset dropdown separate from the solvent / TS toggles).
|
|
169
209
|
"""
|
|
170
210
|
opt_method, sp_method = _FINAL_METHOD_TO_MSO_RECIPE.get(final_method, (final_method, None))
|
|
171
211
|
|
|
@@ -196,6 +236,7 @@ def _mso_for_final_method(
|
|
|
196
236
|
return MultiStageOptSettings(
|
|
197
237
|
optimization_settings=[opt_stage],
|
|
198
238
|
singlepoint_settings=sp_stage,
|
|
239
|
+
frequencies=frequencies,
|
|
199
240
|
)
|
|
200
241
|
|
|
201
242
|
|
|
@@ -224,6 +265,8 @@ def submit_conformer_search_workflow(
|
|
|
224
265
|
final_method: Method | str = "aimnet2_wb97md3",
|
|
225
266
|
solvent: SolventInput = None,
|
|
226
267
|
transition_state: bool = False,
|
|
268
|
+
frequencies: bool = False,
|
|
269
|
+
weighting_temperature: float = 298.15,
|
|
227
270
|
multistage_opt_settings: MultiStageOptSettings | None = None,
|
|
228
271
|
conformer_clustering_settings: ConformerClusteringSettings | None = None,
|
|
229
272
|
initial_conformers: Sequence[StructureInput] | None = None,
|
|
@@ -264,6 +307,11 @@ def submit_conformer_search_workflow(
|
|
|
264
307
|
`multistage_opt_settings` is provided
|
|
265
308
|
transition_state: whether to optimize the transition state. Ignored
|
|
266
309
|
if `multistage_opt_settings` is provided
|
|
310
|
+
frequencies: compute vibrational frequencies of each conformer at the optimization
|
|
311
|
+
level, for the ensemble IR spectrum. Ignored if `multistage_opt_settings` is
|
|
312
|
+
provided; set its `frequencies` instead
|
|
313
|
+
weighting_temperature: temperature for the conformer populations, in Kelvin. With
|
|
314
|
+
frequencies, populations use free energies at this temperature
|
|
267
315
|
multistage_opt_settings: optimization stages and singlepoint settings
|
|
268
316
|
for ranking conformers. When provided, takes precedence over
|
|
269
317
|
`final_method` / `solvent` / `transition_state`. When omitted, an MSO is
|
|
@@ -359,7 +407,10 @@ def submit_conformer_search_workflow(
|
|
|
359
407
|
if isinstance(final_method, str):
|
|
360
408
|
final_method = Method(final_method)
|
|
361
409
|
multistage_opt_settings = _mso_for_final_method(
|
|
362
|
-
final_method,
|
|
410
|
+
final_method,
|
|
411
|
+
solvent=solvent,
|
|
412
|
+
transition_state=transition_state,
|
|
413
|
+
frequencies=frequencies,
|
|
363
414
|
)
|
|
364
415
|
multistage_opt_settings = _release_ts_optimization_constraints(multistage_opt_settings)
|
|
365
416
|
|
|
@@ -370,6 +421,7 @@ def submit_conformer_search_workflow(
|
|
|
370
421
|
multistage_opt_settings=multistage_opt_settings,
|
|
371
422
|
conf_gen_settings=conf_gen_settings,
|
|
372
423
|
conformer_clustering_settings=conformer_clustering_settings,
|
|
424
|
+
weighting_temperature=weighting_temperature,
|
|
373
425
|
)
|
|
374
426
|
|
|
375
427
|
workflow_data = workflow.model_dump(serialize_as_any=True, mode="json")
|
rowan/workflows/protein_md.py
CHANGED
|
@@ -149,7 +149,7 @@ def submit_protein_md_workflow(
|
|
|
149
149
|
binder: Binder | None = None,
|
|
150
150
|
protein_restraint_cutoff: float | None = None,
|
|
151
151
|
protein_restraint_constant: float = 100,
|
|
152
|
-
analysis_interval_ps: float | None =
|
|
152
|
+
analysis_interval_ps: float | None = 100,
|
|
153
153
|
clustering: KMeansClusteringSettings | GreedyClusteringSettings | None = None,
|
|
154
154
|
validate_forcefield: bool = True,
|
|
155
155
|
name: str = "Protein MD Workflow",
|
|
@@ -194,8 +194,8 @@ def submit_protein_md_workflow(
|
|
|
194
194
|
protein_restraint_cutoff: cutoff distance from the binder past which Cα atoms are
|
|
195
195
|
harmonically restrained, in Å; None disables restraints
|
|
196
196
|
protein_restraint_constant: force constant for Cα backbone restraints, in kcal/mol/Ų
|
|
197
|
-
analysis_interval_ps: interval at which to compute per-frame SASA and polar SASA
|
|
198
|
-
None disables those analyses
|
|
197
|
+
analysis_interval_ps: interval at which to compute per-frame SASA and polar SASA
|
|
198
|
+
(default 100), in ps. None disables those analyses
|
|
199
199
|
clustering: how to cluster trajectory frames. None disables clustering; pass a
|
|
200
200
|
KMeansClusteringSettings (num_clusters) or GreedyClusteringSettings (cutoff_angstrom)
|
|
201
201
|
validate_forcefield: validate the protein forcefield
|
|
@@ -12,7 +12,7 @@ from rowan.folder import Folder
|
|
|
12
12
|
from rowan.molecule import Molecule
|
|
13
13
|
from rowan.protein import Protein
|
|
14
14
|
from rowan.types import ProteinUUID
|
|
15
|
-
from rowan.utils import api_client, download_file
|
|
15
|
+
from rowan.utils import api_client, download_file, download_presigned_files
|
|
16
16
|
|
|
17
17
|
from .base import Workflow, WorkflowResult, molecule_to_dict, register_result
|
|
18
18
|
from .rbfe_graph import RelativeBindingFreeEnergyGraphEdge, RelativeBindingFreeEnergyGraphResult
|
|
@@ -143,7 +143,9 @@ class RelativeBindingFreeEnergyPerturbationResult(WorkflowResult):
|
|
|
143
143
|
*,
|
|
144
144
|
leg: Literal["complex", "solvent"] = "complex",
|
|
145
145
|
) -> Path:
|
|
146
|
-
"""Download DCD trajectory files for a specific perturbation edge.
|
|
146
|
+
"""Download DCD trajectory files for a specific perturbation edge as one `.tar.gz` archive.
|
|
147
|
+
|
|
148
|
+
Long trajectories can time out; use `download_edge_trajectory_files` for those.
|
|
147
149
|
|
|
148
150
|
Args:
|
|
149
151
|
edge_index: index of the edge (0-based, matching `edges` order)
|
|
@@ -183,6 +185,40 @@ class RelativeBindingFreeEnergyPerturbationResult(WorkflowResult):
|
|
|
183
185
|
json=lambda_vals,
|
|
184
186
|
)
|
|
185
187
|
|
|
188
|
+
def download_edge_trajectory_files(
|
|
189
|
+
self,
|
|
190
|
+
edge_index: int,
|
|
191
|
+
lambda_vals: list[float] | None = None,
|
|
192
|
+
path: Path | str | None = None,
|
|
193
|
+
*,
|
|
194
|
+
leg: Literal["complex", "solvent"] = "complex",
|
|
195
|
+
) -> list[Path]:
|
|
196
|
+
"""Download each lambda window's DCD file for one edge directly from storage.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
edge_index: index of the edge (0-based, matching `edges` order)
|
|
200
|
+
lambda_vals: lambda values to download. Defaults to all windows
|
|
201
|
+
path: directory to save the files to. Defaults to current directory
|
|
202
|
+
leg: thermodynamic leg whose trajectories should be downloaded
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
paths to the downloaded `.dcd` files, one per lambda window
|
|
206
|
+
|
|
207
|
+
Raises:
|
|
208
|
+
IndexError: edge_index is out of range
|
|
209
|
+
httpx.HTTPStatusError: API or storage request fails
|
|
210
|
+
"""
|
|
211
|
+
edges = self.edges
|
|
212
|
+
if edge_index < 0 or edge_index >= len(edges):
|
|
213
|
+
raise IndexError(f"Edge index {edge_index} out of range (0-{len(edges) - 1})")
|
|
214
|
+
|
|
215
|
+
return download_presigned_files(
|
|
216
|
+
Path(path) if path is not None else Path.cwd(),
|
|
217
|
+
f"/trajectory/{self.workflow_uuid}/rbfe_trajectory_dcd_urls",
|
|
218
|
+
params={"edge_index": edge_index, "leg": leg},
|
|
219
|
+
json=lambda_vals,
|
|
220
|
+
)
|
|
221
|
+
|
|
186
222
|
def download_all_trajectories(
|
|
187
223
|
self,
|
|
188
224
|
path: Path | str | None = None,
|
|
@@ -205,6 +241,35 @@ class RelativeBindingFreeEnergyPerturbationResult(WorkflowResult):
|
|
|
205
241
|
self.download_edge_trajectories(i, path=path, leg=leg) for i in range(len(self.edges))
|
|
206
242
|
]
|
|
207
243
|
|
|
244
|
+
def download_all_trajectory_files(
|
|
245
|
+
self,
|
|
246
|
+
path: Path | str | None = None,
|
|
247
|
+
*,
|
|
248
|
+
leg: Literal["complex", "solvent"] = "complex",
|
|
249
|
+
) -> list[Path]:
|
|
250
|
+
"""Download every edge's DCD files directly from storage.
|
|
251
|
+
|
|
252
|
+
Files for each edge go in an `edge_<index>` subdirectory of `path`.
|
|
253
|
+
|
|
254
|
+
Args:
|
|
255
|
+
path: directory to save the files to. Defaults to current directory
|
|
256
|
+
leg: thermodynamic leg whose trajectories should be downloaded
|
|
257
|
+
|
|
258
|
+
Returns:
|
|
259
|
+
paths to all downloaded `.dcd` files, in edge order
|
|
260
|
+
|
|
261
|
+
Raises:
|
|
262
|
+
httpx.HTTPStatusError: any API or storage request fails
|
|
263
|
+
"""
|
|
264
|
+
directory = Path(path) if path is not None else Path.cwd()
|
|
265
|
+
return [
|
|
266
|
+
file
|
|
267
|
+
for i in range(len(self.edges))
|
|
268
|
+
for file in self.download_edge_trajectory_files(
|
|
269
|
+
i, path=directory / f"edge_{i}", leg=leg
|
|
270
|
+
)
|
|
271
|
+
]
|
|
272
|
+
|
|
208
273
|
@property
|
|
209
274
|
def ligand_dg_results(self) -> dict[str, RelativeBindingFreeEnergyResult] | None:
|
|
210
275
|
"""Per-ligand binding free energy results, or None if not yet computed."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: rowan-python
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.3
|
|
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
|
|
@@ -12,7 +12,7 @@ Requires-Dist: httpx
|
|
|
12
12
|
Requires-Dist: nest-asyncio
|
|
13
13
|
Requires-Dist: rdkit
|
|
14
14
|
Requires-Dist: setuptools
|
|
15
|
-
Requires-Dist: stjames>=0.0.
|
|
15
|
+
Requires-Dist: stjames>=0.0.289
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
|
|
18
18
|
# Rowan Python Library
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
rowan/__init__.py,sha256=
|
|
1
|
+
rowan/__init__.py,sha256=pXnVxfLHs7s7AZZJmcaMk8CjTYz-g-IhMxjIV0B7i8Y,2224
|
|
2
2
|
rowan/api_keys.py,sha256=ms8NAkLreFQcaEUPCf8lSf7T0x2OmrWCAT44N1cgocE,6955
|
|
3
3
|
rowan/calculation.py,sha256=E1dAox4ScE3NHJXiKFZ3Lpmw2h7DKCVzcwRvGZ2H2cQ,3802
|
|
4
4
|
rowan/config.py,sha256=ay6UxKLE9bbTxHFXxDfUXGRVJWJ1T-eS2_L4HF8mb_E,20927
|
|
5
5
|
rowan/constants.py,sha256=emCH4m9OL2Hm5E-6mJGM_FgzrK_JrZT-FiKJ6pMNQ4Y,84
|
|
6
6
|
rowan/folder.py,sha256=8Gb60oes78G7QTGm0EX-ofkmQEggv5cwseA7dRBIhok,13883
|
|
7
7
|
rowan/molecule.py,sha256=1ueC_M2Yaubkt5eQlONCagShWPnoJfNNXgd0s7sslPM,15826
|
|
8
|
-
rowan/project.py,sha256=
|
|
8
|
+
rowan/project.py,sha256=R5uwpzg7GOaGQ_ebCvTysYvkUHE_hHxWAhujp7CBqU0,5770
|
|
9
9
|
rowan/protein.py,sha256=AGHarvWfciSwWXfHnVjdUW47FML7vI4Kk4dYTeFfKAQ,19322
|
|
10
10
|
rowan/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
rowan/spectra.py,sha256=dNmE5th6wpTVAfvZZNDkg2jlBRAmPtFT6yDtxex8APw,2307
|
|
11
12
|
rowan/types.py,sha256=D0d6MW6MvLMs6UtNgGKlapFGOnPlzqFTk9EAgB9dwks,636
|
|
12
13
|
rowan/user.py,sha256=wGwyp0uzifzJeC88yCC7pgxMhxuZ-LLWHfCcuPXcx44,6199
|
|
13
|
-
rowan/utils.py,sha256=
|
|
14
|
+
rowan/utils.py,sha256=n82jhtMrHwIPXjEX4i2JFuQTLsanwixk5HfOfzPpKko,9656
|
|
14
15
|
rowan/workflows/__init__.py,sha256=1JBuqs3KlizJEFhidvGCG7KtTdLOQKI2kspn0SK_KHw,5161
|
|
15
|
-
rowan/workflows/_molecular_dynamics.py,sha256=
|
|
16
|
+
rowan/workflows/_molecular_dynamics.py,sha256=fDQVAZam6Ic_Au1yz41bVWg2_NBfkPX2ZFJNDIbw55U,10204
|
|
16
17
|
rowan/workflows/admet.py,sha256=92jEbZr9OuN0FzJtWmE4EdARzs6r0uiRwq3-kSPV7nE,2531
|
|
17
18
|
rowan/workflows/analogue_docking.py,sha256=NZa-2rNzuyfVE_5WZm4pQspdtWFy8tEhxbqwOrXWGnU,10881
|
|
18
19
|
rowan/workflows/base.py,sha256=DR2k5VFMmv2sa9v4hYU_Fvzf8k2unp5nhPqvOd7NX64,39520
|
|
19
20
|
rowan/workflows/basic_calculation.py,sha256=7o9jxEpDMiong2k3Ke1WCLwaSWZvKY5tqhbixnbQWbo,12945
|
|
20
21
|
rowan/workflows/batch_docking.py,sha256=AtCp2-D_LOVxzSPmQ144zYIz5kft9NeRljELdRDU6vY,4941
|
|
21
22
|
rowan/workflows/bde.py,sha256=4Yw27U2RPsuUDf9tw-7wPbw_4gaUcvDlQP8je7VJktU,7099
|
|
22
|
-
rowan/workflows/binding_affinity.py,sha256=
|
|
23
|
-
rowan/workflows/conformer_search.py,sha256=
|
|
23
|
+
rowan/workflows/binding_affinity.py,sha256=CP5rsWNMhsdLGzLdPBIs89wZDW6sa8YwGEkqep0ls1Q,6821
|
|
24
|
+
rowan/workflows/conformer_search.py,sha256=PSufIThwh2LoqgP6x5gjFxuNW5DP5ClJ5caBCuJoDKU,18910
|
|
24
25
|
rowan/workflows/constants.py,sha256=iM9-6DyIe0N2ydyq-lRYP7VDufFmMrN5tDjnpUSlxF8,588
|
|
25
26
|
rowan/workflows/covalent_inhibitor_scan.py,sha256=VcZhwW3HRuFuGZNedMPZBWbzuhGvz_B5pNJSIPyi9Kw,6721
|
|
26
27
|
rowan/workflows/descriptors.py,sha256=mLo_VnqVrnEbiMHT1-SrbKhy_Dk5jpIM4btNGrlmNio,3041
|
|
@@ -43,18 +44,18 @@ rowan/workflows/pocket_detection.py,sha256=dFeCLB59v5-Izf54blrRzJhwUtBQX2SJyVKT_
|
|
|
43
44
|
rowan/workflows/pose_analysis_md.py,sha256=ndfGS8oP8oQ3EXe83Wgbx1H8ZFURlm8IJZN34aDpqeE,10599
|
|
44
45
|
rowan/workflows/protein_binder_design.py,sha256=ee3qYGzTzQsca9otnRz9Qjwj1X66LTCKqtTQ5EOzBHk,9181
|
|
45
46
|
rowan/workflows/protein_cofolding.py,sha256=s4bLxlix4kAO_NzS75tc2wiEYqUxpFofxziUnxI2iUY,17422
|
|
46
|
-
rowan/workflows/protein_md.py,sha256=
|
|
47
|
+
rowan/workflows/protein_md.py,sha256=iDeKW0ONY3ZPKPsjmZVQhbFQbo0vmOp5M8ko2Hfc16U,12277
|
|
47
48
|
rowan/workflows/protein_preparation.py,sha256=8C04rhR4AiGiYJWZ8V06O4kpV443tGihcTk8rnNgscE,5325
|
|
48
49
|
rowan/workflows/rbfe_graph.py,sha256=DBNxtmgw7BNSwOXFLpHDxJtfpheTpDPs8U3SYB2MXdE,8070
|
|
49
50
|
rowan/workflows/redox_potential.py,sha256=0AV2nKTngEFw7VDDpDQvdeBo5u03Aklc2ak4bDWxUz0,5366
|
|
50
|
-
rowan/workflows/relative_binding_free_energy_perturbation.py,sha256=
|
|
51
|
+
rowan/workflows/relative_binding_free_energy_perturbation.py,sha256=KDVSKBqHQcL4zsjad8abmcT1Y-viXdmHedhVW2Xg55M,18319
|
|
51
52
|
rowan/workflows/scan.py,sha256=MqV0NcjfInwxGlegOyWvAt8pwN0BdpsKvgCgTRkzdzU,7440
|
|
52
53
|
rowan/workflows/solubility.py,sha256=Lws0lk4ifmtj84W_jyeOuaTpt8KM8-fceOggHrEYnmc,11211
|
|
53
54
|
rowan/workflows/solvent_dependent_conformers.py,sha256=1dYf8UBVMRFELdwHzv3MI0pe12qoCAfohkaMiW3ak50,7460
|
|
54
55
|
rowan/workflows/spin_states.py,sha256=C3hJEY4hccE1fCW4UjI4nIqGZLw9l2C2VKWCLiopSlY,9044
|
|
55
56
|
rowan/workflows/strain.py,sha256=hq0dOlxnN72V4Sohr3qNFbOrjGmV01tc5zcF0HrL2-Y,6372
|
|
56
57
|
rowan/workflows/tautomer_search.py,sha256=o5iFXHfcb6DvvWH7itA05hvWIrzxrc3a_9IDikYftiM,6351
|
|
57
|
-
rowan_python-3.2.
|
|
58
|
-
rowan_python-3.2.
|
|
59
|
-
rowan_python-3.2.
|
|
60
|
-
rowan_python-3.2.
|
|
58
|
+
rowan_python-3.2.3.dist-info/METADATA,sha256=5zYnTTmtF9VpgtLBN_VPLY2RCU_v42bNunjmoWaqr_U,3934
|
|
59
|
+
rowan_python-3.2.3.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
60
|
+
rowan_python-3.2.3.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
|
|
61
|
+
rowan_python-3.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|