rowan-python 3.1.0__py3-none-any.whl → 3.1.2__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 CHANGED
@@ -24,6 +24,7 @@ from stjames import (
24
24
  SolventSettings,
25
25
  Task,
26
26
  )
27
+ from stjames.workflows.relative_binding_free_energy_perturbation import RBFEGraph, RBFEGraphEdge
27
28
  from stjames.excited_state_settings import TDDFTSettings
28
29
  from stjames.pbc_dft_settings import PBCDFTSmearing
29
30
  from stjames.engine_compatibility import (
@@ -23,10 +23,10 @@ class CofoldingScores:
23
23
  """
24
24
  Confidence scores for a cofolding prediction.
25
25
 
26
- :param ptm: Predicted TM-score (0-1, higher is better).
27
- :param iptm: Interface predicted TM-score (0-1, higher is better).
28
- :param avg_lddt: Average per-residue LDDT confidence (0-1).
29
- :param confidence_score: Overall confidence score (0-1).
26
+ :param ptm: Predicted TM-score, overall structure confidence (0-1, higher is better).
27
+ :param iptm: Interface pTM, inter-chain packing confidence (0-1, higher is better).
28
+ :param avg_lddt: Mean per-residue pLDDT, local atomic accuracy (0-1, higher is better).
29
+ :param confidence_score: Overall aggregate confidence in the prediction (0-1, higher is better).
30
30
  """
31
31
 
32
32
  ptm: float | None = None
@@ -40,12 +40,26 @@ class AffinityScore:
40
40
  """
41
41
  Predicted binding affinity scores.
42
42
 
43
- :param pred_value: Predicted binding affinity (ensemble average).
44
- :param pred_value1: Predicted binding affinity (model 1).
45
- :param pred_value2: Predicted binding affinity (model 2).
46
- :param probability_binary: Probability of binding (ensemble average, 0-1).
47
- :param probability_binary1: Probability of binding (model 1, 0-1).
48
- :param probability_binary2: Probability of binding (model 2, 0-1).
43
+ Every field is optional; which ones a given run populates depends on the
44
+ cofolding model. In current runs Boltz-2 fills the pred_value and
45
+ probability_binary fields while Boltz-2.1 fills binding_confidence and
46
+ optimization_score, but the schema does not guarantee this split.
47
+
48
+ :param pred_value: Predicted pIC50, -log10(IC50 in M); higher means stronger
49
+ binding (ensemble average of the two affinity heads).
50
+ :param pred_value1: Predicted pIC50 from affinity head 1.
51
+ :param pred_value2: Predicted pIC50 from affinity head 2.
52
+ :param probability_binary: Predicted probability (0-1) that the ligand binds
53
+ its target; higher is better (ensemble average of the two affinity heads).
54
+ :param probability_binary1: Binding probability (0-1) from affinity head 1.
55
+ :param probability_binary2: Binding probability (0-1) from affinity head 2.
56
+ :param binding_confidence: Predicted probability (0-1, higher is better) that
57
+ the molecule or binder is a true binder rather than a decoy. Primary metric
58
+ for hit discovery (computed when binding is requested).
59
+ :param optimization_score: Binding-strength ranking derived from the model's
60
+ predicted log(IC50) affinity; higher means stronger predicted binding. Use
61
+ to rank-order likely binders during lead optimization (computed when binding
62
+ is requested).
49
63
  """
50
64
 
51
65
  pred_value: float | None = None
@@ -54,6 +68,8 @@ class AffinityScore:
54
68
  probability_binary: float | None = None
55
69
  probability_binary1: float | None = None
56
70
  probability_binary2: float | None = None
71
+ binding_confidence: float | None = None
72
+ optimization_score: float | None = None
57
73
 
58
74
 
59
75
  @dataclass(frozen=True, slots=True)
@@ -230,6 +246,8 @@ class ProteinCofoldingResult(WorkflowResult):
230
246
  probability_binary=a.get("probability_binary"),
231
247
  probability_binary1=a.get("probability_binary1"),
232
248
  probability_binary2=a.get("probability_binary2"),
249
+ binding_confidence=a.get("binding_confidence"),
250
+ optimization_score=a.get("optimization_score"),
233
251
  )
234
252
  return AffinityScore(
235
253
  pred_value=a.pred_value,
@@ -238,6 +256,8 @@ class ProteinCofoldingResult(WorkflowResult):
238
256
  probability_binary=a.probability_binary,
239
257
  probability_binary1=a.probability_binary1,
240
258
  probability_binary2=a.probability_binary2,
259
+ binding_confidence=getattr(a, "binding_confidence", None),
260
+ optimization_score=getattr(a, "optimization_score", None),
241
261
  )
242
262
 
243
263
 
@@ -271,7 +291,7 @@ def submit_protein_cofolding_workflow(
271
291
 
272
292
  See `examples/protein_cofolding_with_constraints.py` for a worked example
273
293
  of using `ConstraintTarget`, `ContactConstraint`, and `PocketConstraint`
274
- (Boltz-2 only).
294
+ (Boltz models only).
275
295
 
276
296
  :param initial_protein_sequences: Protein sequences to be cofolded.
277
297
  :param initial_dna_sequences: DNA sequences to be cofolded.
@@ -283,13 +303,15 @@ def submit_protein_cofolding_workflow(
283
303
  :param use_potentials: Whether to use potentials (inference-time steering) with Boltz.
284
304
  :param contact_constraints: Boltz contact constraints between two tokens.
285
305
  :param pocket_constraints: Boltz pocket constraints between a binder and contact tokens.
286
- :param templates: Structural templates to guide prediction (Boltz-2 or OpenFold-3 only).
306
+ :param templates: Structural templates to guide prediction (Boltz-2/2.1 or OpenFold-3 only).
287
307
  :param num_samples: Number of diffusion samples to generate. If None, uses the model default.
288
308
  :param compute_strain: Whether to compute the strain of the pose. Requires do_pose_refinement.
289
309
  (if `pose_refinement` is enabled).
290
310
  :param do_pose_refinement: Whether to optimize non-rotatable bonds in output poses.
291
311
  :param name: Name of the workflow.
292
- :param model: Model to use for the computation.
312
+ :param model: Model to use for the computation. Boltz-2.1 runs via Boltz's
313
+ hosted API (slower than the locally-run models) and reports a different
314
+ set of affinity metrics than Boltz-2 (see `AffinityScore`).
293
315
  :param folder_uuid: UUID of the folder to store the workflow in.
294
316
  :param folder: Folder object to store the workflow in.
295
317
  :param max_credits: Maximum number of credits to use for the workflow.
@@ -4,6 +4,7 @@ from dataclasses import dataclass
4
4
  from typing import Literal
5
5
 
6
6
  import stjames
7
+ from stjames.workflows.relative_binding_free_energy_perturbation import RBFEGraph
7
8
 
8
9
  from ..folder import Folder
9
10
  from ..molecule import Molecule
@@ -57,13 +58,9 @@ class RelativeBindingFreeEnergyGraphResult(WorkflowResult):
57
58
  return {k: Molecule.from_stjames(v) for k, v in self._workflow.ligands.items()}
58
59
 
59
60
  @property
60
- def graph(self) -> dict | None:
61
- """
62
- The constructed RBFE perturbation graph as a dict, or None if not yet computed.
63
-
64
- Pass directly to ``submit_rbfe_perturbation_workflow(graph=...)``.
65
- """
66
- return g.model_dump(mode="json") if (g := self._workflow.graph) else None
61
+ def graph(self) -> RBFEGraph | None:
62
+ """The constructed RBFE graph, or None if not yet computed."""
63
+ return self._workflow.graph
67
64
 
68
65
  @property
69
66
  def edges(self) -> list[RelativeBindingFreeEnergyGraphEdge]:
@@ -99,6 +96,7 @@ def submit_relative_binding_free_energy_graph_workflow(
99
96
  greedy_scoring: Literal["best", "jaccard", "dummy_atoms"] = "best",
100
97
  greedy_k_min_cut: int = 3,
101
98
  refine_cutoff: float | None = None,
99
+ seed_graph: RBFEGraph | None = None,
102
100
  name: str = "RBFE Graph",
103
101
  folder_uuid: str | None = None,
104
102
  folder: Folder | None = None,
@@ -119,6 +117,9 @@ def submit_relative_binding_free_energy_graph_workflow(
119
117
  ``"best"``, ``"jaccard"``, or ``"dummy_atoms"``.
120
118
  :param greedy_k_min_cut: Target edge-connectivity for greedy augmentation. Must be > 0.
121
119
  :param refine_cutoff: Optional MCS similarity cutoff for graph refinement.
120
+ :param seed_graph: RBFE graph from a prior run to extend, as returned by a
121
+ completed result's ``graph``. Its existing edges (and any computed results)
122
+ are preserved, and only edges for newly added ligands are built.
122
123
  :param name: Name of the workflow.
123
124
  :param folder_uuid: UUID of the folder to place the workflow in.
124
125
  :param folder: Folder object to store the workflow in.
@@ -126,7 +127,8 @@ def submit_relative_binding_free_energy_graph_workflow(
126
127
  :param webhook_url: URL that Rowan will POST to when the workflow completes.
127
128
  :param is_draft: If True, submit the workflow as a draft without starting execution.
128
129
  :returns: Workflow object representing the submitted workflow.
129
- :raises ValueError: If both folder and folder_uuid are provided.
130
+ :raises ValueError: If both folder and folder_uuid are provided, if any ligand has
131
+ no defined charge, or if the ligands do not all share the same formal charge.
130
132
  :raises requests.HTTPError: if the request to the API fails.
131
133
  """
132
134
  if folder and folder_uuid:
@@ -138,6 +140,27 @@ def submit_relative_binding_free_energy_graph_workflow(
138
140
  require_coordinates(ligand)
139
141
  ligands_dict = {k: molecule_to_dict(v) for k, v in ligands.items()}
140
142
 
143
+ charges = {name: mol.get("charge") for name, mol in ligands_dict.items()}
144
+ missing_charge = sorted(name for name, charge in charges.items() if charge is None)
145
+ if missing_charge:
146
+ raise ValueError(
147
+ "Cannot verify charge consistency: no charge found for ligand(s) "
148
+ f"{', '.join(missing_charge)}. Provide ligands with a defined formal charge."
149
+ )
150
+ distinct_charges = {charge for charge in charges.values() if charge is not None}
151
+ if len(distinct_charges) > 1:
152
+ groups = {
153
+ charge: sorted(name for name, c in charges.items() if c == charge)
154
+ for charge in sorted(distinct_charges)
155
+ }
156
+ summary = "; ".join(
157
+ f"charge {charge}: {', '.join(names)}" for charge, names in groups.items()
158
+ )
159
+ raise ValueError(
160
+ "All RBFE ligands must share the same formal charge - charge-changing "
161
+ f"perturbations are not supported. Found multiple charge states ({summary})."
162
+ )
163
+
141
164
  workflow = stjames.RBFEGraphWorkflow(
142
165
  ligands=ligands_dict,
143
166
  mode=mode,
@@ -145,6 +168,7 @@ def submit_relative_binding_free_energy_graph_workflow(
145
168
  greedy_scoring=greedy_scoring,
146
169
  greedy_k_min_cut=greedy_k_min_cut,
147
170
  refine_cutoff=refine_cutoff,
171
+ seed_graph=seed_graph,
148
172
  )
149
173
 
150
174
  data = {
@@ -5,7 +5,7 @@ from pathlib import Path
5
5
  from typing import Literal
6
6
 
7
7
  import stjames
8
- from stjames.workflows.relative_binding_free_energy_perturbation import TMDRBFESettings
8
+ from stjames.workflows.relative_binding_free_energy_perturbation import RBFEGraph, TMDRBFESettings
9
9
 
10
10
  from ..folder import Folder
11
11
  from ..molecule import Molecule
@@ -86,6 +86,16 @@ class RelativeBindingFreeEnergyPerturbationResult(WorkflowResult):
86
86
  """Ligand molecules keyed by identifier."""
87
87
  return {k: Molecule.from_stjames(v) for k, v in self._workflow.ligands.items()}
88
88
 
89
+ @property
90
+ def protein(self) -> Protein:
91
+ """Prepared protein structure used as the simulation target."""
92
+ return Protein(uuid=str(self._workflow.protein))
93
+
94
+ @property
95
+ def graph(self) -> RBFEGraph | None:
96
+ """The RBFE graph with per-edge results, or None if not constructed."""
97
+ return self._workflow.graph
98
+
89
99
  @property
90
100
  def edges(self) -> list[RelativeBindingFreeEnergyGraphEdge]:
91
101
  """Graph edges with per-edge FEP results."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rowan-python
3
- Version: 3.1.0
3
+ Version: 3.1.2
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.204
14
+ Requires-Dist: stjames>=0.0.208
15
15
  Description-Content-Type: text/markdown
16
16
 
17
17
  # Rowan Python Library
@@ -32,6 +32,8 @@ The documentation is available [here](https://docs.rowansci.com/python-api).
32
32
 
33
33
  Ships with a [skill](skills/computational-chemistry-and-biology/) that makes it easy for coding agents to use Rowan's tools to power chemistry and biology tasks. To use it, copy the directory into your agent's skills folder.
34
34
 
35
+ Download the latest skill as a zip [here](https://github.com/rowansci/rowan-python/releases/download/skill-latest/computational-chemistry-and-biology-skill.zip), then unzip it into your agent's skills folder.
36
+
35
37
  ## Running examples
36
38
 
37
39
  To run the examples, you will need to set your ROWAN_API_KEY environment variable or set it directly in the script.
@@ -1,4 +1,4 @@
1
- rowan/__init__.py,sha256=tyL1rh1lEZ1u9-E5Li3z20ymEFzO032ALyrATc-6zMw,1234
1
+ rowan/__init__.py,sha256=UhyjCkQh7YDTtemmetfelGD1d36WSJ6oaWct7CP2eyQ,1331
2
2
  rowan/api_keys.py,sha256=TvG5l5MmQ3Qt8Z3Y7jCA_lcrwEHuI7xHy-KLbIdQ8_A,4793
3
3
  rowan/calculation.py,sha256=lZZ52DxPsuJWCTzFZXjhauHK6dV0KCUwzoxtmoxSY48,3442
4
4
  rowan/config.py,sha256=TejQKSxnzNKKTNL9-2bCLq6RvAh54oVA5Ivl1p_ZT8Q,20899
@@ -38,18 +38,18 @@ rowan/workflows/pka.py,sha256=xQPaOHxPQqCY_zi97LW9brpXPn3xjyeF9RDE1Rz8HQk,8772
38
38
  rowan/workflows/pocket_detection.py,sha256=aGHY0puxekp4c4nsNYHcvKCe1fsetygL04BcSvNFvE8,3864
39
39
  rowan/workflows/pose_analysis_md.py,sha256=XJIfvn-H7GA6lVtw9uKjlgznVSSsr9bJiDt_PjKlPbA,11572
40
40
  rowan/workflows/protein_binder_design.py,sha256=pgywTQDuXHplZYka-61_S6CC4WTPDCwJrbupp825eC4,9281
41
- rowan/workflows/protein_cofolding.py,sha256=Hp0A7nP5svMak1jITXUydGWZRMazBF3xnkwal2I66As,14611
41
+ rowan/workflows/protein_cofolding.py,sha256=CV13VUHC0NLDDaS1-GGTQ3RySkzEE30xzu1_4oPu6lo,16239
42
42
  rowan/workflows/protein_md.py,sha256=41S-GIHP91ahW5mIVxjAkpZbxept98IgausM5JoeckA,9276
43
- rowan/workflows/rbfe_graph.py,sha256=LcVu3nFGZ5NTSdeojb-DeRfwEDh3gBTRkVF_jOrzVtQ,5893
43
+ rowan/workflows/rbfe_graph.py,sha256=7UJA3ZBbvtaB9l1KQi9279Pc89moVnBHO-XJpxEr5uQ,7238
44
44
  rowan/workflows/redox_potential.py,sha256=bBeT1K9XGVpjCFZeeuv7Vtr3EYHN2okJ4LqYc3gMV04,5427
45
- rowan/workflows/relative_binding_free_energy_perturbation.py,sha256=uxC3Rr63U6GjNa9u2Hurahu48l4rYEz5RQX4hV0D250,13456
45
+ rowan/workflows/relative_binding_free_energy_perturbation.py,sha256=vi5Qj5aDAERtjcHDsgzI6vRV_BZJnJ8boOj5aG6GXzo,13817
46
46
  rowan/workflows/scan.py,sha256=R5Y6Md3ohPoFVJ4NYvx3_k3JNwMnVw1CDsNPD9S8sr4,7518
47
47
  rowan/workflows/solubility.py,sha256=ulZwdG8JRl0RCwWPatYUZGMhlAZeb6wqjVbvzQYFKmE,8555
48
48
  rowan/workflows/solvent_dependent_conformers.py,sha256=Z2xESmcM8WcTsR2TSTUa--RrhrQ-5ri_WagD9wJeVwc,6812
49
49
  rowan/workflows/spin_states.py,sha256=rjkgie2-XVNIN7O6P93yn6EPv9Ogjy8iTj3ufZIsUgY,9331
50
50
  rowan/workflows/strain.py,sha256=kCW_BlX__sdQG1JVbFZuB-57rkpnxa_JCw3h4uKdGDk,6425
51
51
  rowan/workflows/tautomer_search.py,sha256=mbRl0ZJ7wibueRF8c8_idhXJ1rtwg7LBt--5QwQ_Cck,5767
52
- rowan_python-3.1.0.dist-info/METADATA,sha256=IR_vmRm6QdxoIbOMiHZgl3SGtkS-VQR7vh6_AioBNX0,1842
53
- rowan_python-3.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
54
- rowan_python-3.1.0.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
55
- rowan_python-3.1.0.dist-info/RECORD,,
52
+ rowan_python-3.1.2.dist-info/METADATA,sha256=poPK5z_485P_QgH_M-RVS8GkqGUhlojTCR5BlZW-iC0,2052
53
+ rowan_python-3.1.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
54
+ rowan_python-3.1.2.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
55
+ rowan_python-3.1.2.dist-info/RECORD,,