rowan-python 2.1.5__py3-none-any.whl → 2.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/workflow.py CHANGED
@@ -5,6 +5,7 @@ from typing import Any, Literal, Self, TypeAlias
5
5
  import stjames
6
6
  from pydantic import BaseModel, Field
7
7
  from rdkit import Chem
8
+ from stjames.optimization.freezing_string_method import FSMSettings
8
9
 
9
10
  from .protein import Protein
10
11
  from .utils import api_client
@@ -285,16 +286,21 @@ def retrieve_workflow(uuid: str) -> Workflow:
285
286
  return Workflow(**response.json())
286
287
 
287
288
 
288
- def retrieve_calculation_molecules(uuid: str) -> list[dict[str, Any]]:
289
+ def retrieve_calculation_molecules(
290
+ uuid: str, return_frequencies: bool = False
291
+ ) -> list[dict[str, Any]]:
289
292
  """
290
293
  Retrieves a list of molecules from a calculation.
291
294
 
292
295
  :param uuid: The UUID of the calculation to retrieve molecules from.
296
+ :param return_frequencies: Whether to return the frequencies of the molecules.
293
297
  :return: A list of dictionaries representing the molecules in the calculation.
294
298
  :raises HTTPError: If the API request fails.
295
299
  """
296
300
  with api_client() as client:
297
- response = client.get(f"/calculation/{uuid}/molecules")
301
+ response = client.get(
302
+ f"/calculation/{uuid}/molecules", params={"return_frequencies": return_frequencies}
303
+ )
298
304
  response.raise_for_status()
299
305
  return response.json()
300
306
 
@@ -352,9 +358,10 @@ def list_workflows(
352
358
  def submit_basic_calculation_workflow(
353
359
  initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol,
354
360
  method: stjames.Method | str = "uma_m_omol",
361
+ basis_set: stjames.BasisSet | str | None = None,
355
362
  tasks: list[str] | None = None,
356
363
  mode: str = "auto",
357
- engine: str = "omol25",
364
+ engine: str | None = None,
358
365
  name: str = "Basic Calculation Workflow",
359
366
  folder_uuid: str | None = None,
360
367
  max_credits: int | None = None,
@@ -364,7 +371,7 @@ def submit_basic_calculation_workflow(
364
371
 
365
372
  :param initial_molecule: The molecule to perform the calculation on.
366
373
  :param method: The method to use for the calculation.
367
- See [list of available methods](https://github.com/rowansci/stjames-public/blob/master/stjames/method.py)
374
+ :param basis_set: The basis_set to use (if any).
368
375
  for options.
369
376
  :param tasks: A list of tasks to perform for the calculation.
370
377
  :param mode: The mode to run the calculation in. See [list of available modes](https://github.com/rowansci/stjames-public/blob/master/stjames/mode.py)
@@ -391,6 +398,7 @@ def submit_basic_calculation_workflow(
391
398
  initial_molecule=initial_molecule,
392
399
  settings=stjames.Settings(
393
400
  method=method,
401
+ basis_set=basis_set,
394
402
  tasks=tasks,
395
403
  mode=mode,
396
404
  ),
@@ -792,7 +800,7 @@ def submit_descriptors_workflow(
792
800
  def submit_scan_workflow(
793
801
  initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol,
794
802
  scan_settings: stjames.ScanSettings | dict[str, Any] | None = None,
795
- calculation_engine: str = "omol25",
803
+ calculation_engine: str | None = None,
796
804
  calculation_method: stjames.Method | str = "uma_m_omol",
797
805
  wavefront_propagation: bool = True,
798
806
  name: str = "Scan Workflow",
@@ -835,7 +843,7 @@ def submit_scan_workflow(
835
843
  initial_molecule=initial_molecule,
836
844
  scan_settings=scan_settings,
837
845
  calc_settings=calc_settings,
838
- calc_engine=calculation_engine,
846
+ calc_engine=calculation_engine or calculation_method.default_engine(),
839
847
  wavefront_propagation=wavefront_propagation,
840
848
  )
841
849
 
@@ -911,7 +919,6 @@ def submit_macropka_workflow(
911
919
  def submit_irc_workflow(
912
920
  initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol | None = None,
913
921
  method: stjames.Method | str = "uma_m_omol",
914
- engine: str = "omol25",
915
922
  preopt: bool = True,
916
923
  step_size: float = 0.05,
917
924
  max_irc_steps: int = 30,
@@ -926,7 +933,6 @@ def submit_irc_workflow(
926
933
  :param method: The computational method to use for the IRC calculation.
927
934
  See [list of available methods](https://github.com/rowansci/stjames-public/blob/master/stjames/method.py)
928
935
  for options.
929
- :param engine: The computational engine to use for the calculation. See [list of available engines](https://github.com/rowansci/stjames-public/blob/master/stjames/engine.py)
930
936
  :param preopt: Whether to perform a pre-optimization of the molecule.
931
937
  :param step_size: The step size to use for the IRC calculation.
932
938
  :param max_irc_steps: The maximum number of IRC steps to perform.
@@ -953,12 +959,12 @@ def submit_irc_workflow(
953
959
  corrections=[],
954
960
  mode="auto",
955
961
  ),
956
- engine=engine,
957
962
  preopt=preopt,
958
963
  step_size=step_size,
959
964
  max_irc_steps=max_irc_steps,
960
965
  mode="manual",
961
966
  )
967
+
962
968
  data = {
963
969
  "name": name,
964
970
  "folder_uuid": folder_uuid,
@@ -980,6 +986,8 @@ def submit_protein_cofolding_workflow(
980
986
  ligand_binding_affinity_index: int | None = None,
981
987
  use_msa_server: bool = True,
982
988
  use_potentials: bool = False,
989
+ compute_strain: bool = False,
990
+ do_pose_refinement: bool = False,
983
991
  name: str = "Cofolding Workflow",
984
992
  model: str = stjames.CofoldingModel.BOLTZ_2.value,
985
993
  folder_uuid: str | None = None,
@@ -993,6 +1001,8 @@ def submit_protein_cofolding_workflow(
993
1001
  :param ligand_binding_affinity_index: The index of the ligand for which to compute the binding affinity.
994
1002
  :param use_msa_server: Whether to use the MSA server for the computation.
995
1003
  :param use_potentials: Whether to use potentials for the computation.
1004
+ :param do_pose_refinement: whether to optimize non-rotatable bonds in output poses
1005
+ :param compute_strain: whether to compute the strain of the pose (if `pose_refinement` is enabled)
996
1006
  :param name: The name of the workflow.
997
1007
  :param model: The model to use for the computation.
998
1008
  :param folder_uuid: The UUID of the folder to store the workflow in.
@@ -1008,7 +1018,10 @@ def submit_protein_cofolding_workflow(
1008
1018
  ligand_binding_affinity_index=ligand_binding_affinity_index,
1009
1019
  initial_smiles_list=initial_smiles_list,
1010
1020
  initial_protein_sequences=initial_protein_sequences,
1021
+ do_pose_refinement=do_pose_refinement,
1022
+ compute_strain=compute_strain,
1011
1023
  )
1024
+
1012
1025
  data = {
1013
1026
  "name": name,
1014
1027
  "folder_uuid": folder_uuid,
@@ -1063,7 +1076,7 @@ def submit_docking_workflow(
1063
1076
  pocket=pocket,
1064
1077
  do_csearch=do_csearch,
1065
1078
  do_optimization=do_optimization,
1066
- do_pose_refinement=do_pose_refinement
1079
+ do_pose_refinement=do_pose_refinement,
1067
1080
  )
1068
1081
 
1069
1082
  data = {
@@ -1184,3 +1197,89 @@ def submit_nmr_workflow(
1184
1197
  response = client.post("/workflow", json=data)
1185
1198
  response.raise_for_status()
1186
1199
  return Workflow(**response.json())
1200
+
1201
+
1202
+ def submit_strain_workflow(
1203
+ initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol,
1204
+ name: str = "Strain Workflow",
1205
+ folder_uuid: str | None = None,
1206
+ max_credits: int | None = None,
1207
+ ) -> Workflow:
1208
+ """
1209
+ Submits a strain workflow to the API.
1210
+
1211
+ :param initial_molecule: The molecule used in the scan.
1212
+ :param name: The name of the workflow.
1213
+ :param folder_uuid: The UUID of the folder to store the workflow in.
1214
+ :param max_credits: The maximum number of credits to use for the workflow.
1215
+ :return: A Workflow object representing the submitted workflow.
1216
+ :raises requests.HTTPError: if the request to the API fails.
1217
+ """
1218
+ if isinstance(initial_molecule, StJamesMolecule):
1219
+ initial_molecule = initial_molecule.model_dump()
1220
+ elif isinstance(initial_molecule, RdkitMol):
1221
+ initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1222
+
1223
+ workflow = stjames.StrainWorkflow(initial_molecule=initial_molecule)
1224
+
1225
+ data = {
1226
+ "name": name,
1227
+ "folder_uuid": folder_uuid,
1228
+ "workflow_type": "strain",
1229
+ "workflow_data": workflow.model_dump(serialize_as_any=True),
1230
+ "initial_molecule": initial_molecule,
1231
+ "max_credits": max_credits,
1232
+ }
1233
+
1234
+ with api_client() as client:
1235
+ response = client.post("/workflow", json=data)
1236
+ response.raise_for_status()
1237
+ return Workflow(**response.json())
1238
+
1239
+
1240
+ def submit_double_ended_ts_search_workflow(
1241
+ reactant: dict[str, Any] | StJamesMolecule,
1242
+ product: dict[str, Any] | StJamesMolecule,
1243
+ calculation_settings: stjames.Settings | dict[str, Any] | None = None,
1244
+ search_settings: FSMSettings | dict[str, Any] | None = None,
1245
+ optimize_inputs: bool = False,
1246
+ optimize_ts: bool = True,
1247
+ name: str = "Double-Ended TS Search Workflow",
1248
+ folder_uuid: str | None = None,
1249
+ max_credits: int | None = None,
1250
+ ) -> Workflow:
1251
+ """
1252
+ Submits a double-ended transition state search workflow to the API.
1253
+
1254
+ :param reactant: reactant Molecule.
1255
+ :param product: product Molecule.
1256
+ :param calculation_settings: Settings to use for calculations.
1257
+ :param search_settings: settings to use for the transition state search.
1258
+ :param optimize_inputs: Whether to optimize the reactant and product before the search.
1259
+ :param optimize_ts: Whether to optimize the found transition state.
1260
+ :param name: name of the workflow.
1261
+ :param folder_uuid: The UUID of the folder to place the workflow in.
1262
+ :param max_credits: The maximum number of credits to use for the workflow.
1263
+ :return: Workflow object representing the submitted workflow.
1264
+ """
1265
+ workflow = stjames.DoubleEndedTSSearchWorkflow(
1266
+ reactant=reactant,
1267
+ product=product,
1268
+ calculation_settings=calculation_settings,
1269
+ search_settings=search_settings,
1270
+ optimize_inputs=optimize_inputs,
1271
+ optimize_ts=optimize_ts,
1272
+ )
1273
+ data = {
1274
+ "name": name,
1275
+ "folder_uuid": folder_uuid,
1276
+ "workflow_type": "double_ended_ts_search",
1277
+ "workflow_data": workflow.model_dump(),
1278
+ "initial_molecule": reactant if isinstance(reactant, dict) else reactant.model_dump(),
1279
+ "max_credits": max_credits,
1280
+ }
1281
+
1282
+ with api_client() as client:
1283
+ response = client.post("/workflow", json=data)
1284
+ response.raise_for_status()
1285
+ return Workflow(**response.json())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rowan-python
3
- Version: 2.1.5
3
+ Version: 2.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.104
14
+ Requires-Dist: stjames>=0.0.109
15
15
  Description-Content-Type: text/markdown
16
16
 
17
17
  # Rowan Python Library
@@ -6,10 +6,10 @@ rowan/protein.py,sha256=bMemvLZua_pnTrYOxHFZ4jFlRH9KgpYvtjj5M2__28k,8026
6
6
  rowan/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  rowan/user.py,sha256=Dl--NPUPATKCs2VmILsW8HnLiunG0Lxr0n6mKuHm21U,3891
8
8
  rowan/utils.py,sha256=64II-cPOe_SFJK302Bm8hP62d_3_CgnTVYCbn3zKT7U,3334
9
- rowan/workflow.py,sha256=y5Jn-MuWYSNPimyrz4X5D2h7IJqeVViezrnLtuDmk0U,44988
9
+ rowan/workflow.py,sha256=ec4ygHqsyldHn6-gpyPwzHfsGcQXRZOauIjdHtdzJuE,48826
10
10
  rowan/rowan_rdkit/__init__.py,sha256=EATX2VRzywzKxqkpCUMTf7RNQLkWsfi5VcCNDW6EIiw,503
11
11
  rowan/rowan_rdkit/chem_utils.py,sha256=i7-EmAcmvHYtc9NiZblLY_k2DoQKofAZo5KT2qtkUCI,34775
12
- rowan_python-2.1.5.dist-info/METADATA,sha256=iJPuEi74RV_XDnSZ2yWSQv5eY1mGzWEI5Oh0CmIgHwA,1599
13
- rowan_python-2.1.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- rowan_python-2.1.5.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
15
- rowan_python-2.1.5.dist-info/RECORD,,
12
+ rowan_python-2.1.7.dist-info/METADATA,sha256=XWltMwFRX9VyDOTy7rUE86IDXL8xBakq-SCcJpDBOPo,1599
13
+ rowan_python-2.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ rowan_python-2.1.7.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
15
+ rowan_python-2.1.7.dist-info/RECORD,,