rowan-python 2.1.4__py3-none-any.whl → 2.1.6__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/constants.py CHANGED
@@ -1 +1,3 @@
1
- API_URL = "https://api.rowansci.com"
1
+ import os
2
+
3
+ API_URL = os.getenv("ROWAN_API_URL", default="https://api.rowansci.com")
rowan/utils.py CHANGED
@@ -47,6 +47,7 @@ def api_client() -> Generator[httpx.Client, None, None]:
47
47
  with httpx.Client(
48
48
  base_url=API_URL,
49
49
  headers={"X-API-Key": get_api_key()},
50
+ timeout=30,
50
51
  ) as client:
51
52
  yield client
52
53
 
rowan/workflow.py CHANGED
@@ -860,8 +860,8 @@ def submit_macropka_workflow(
860
860
  max_pH: int = 14,
861
861
  min_charge: int = -2,
862
862
  max_charge: int = 2,
863
+ compute_solvation_energy: bool = False,
863
864
  compute_aqueous_solubility: bool = False,
864
- compute_solvation_energy: bool = True,
865
865
  name: str = "Macropka Workflow",
866
866
  folder_uuid: str | None = None,
867
867
  max_credits: int | None = None,
@@ -980,6 +980,8 @@ def submit_protein_cofolding_workflow(
980
980
  ligand_binding_affinity_index: int | None = None,
981
981
  use_msa_server: bool = True,
982
982
  use_potentials: bool = False,
983
+ compute_strain: bool = False,
984
+ do_pose_refinement: bool = False,
983
985
  name: str = "Cofolding Workflow",
984
986
  model: str = stjames.CofoldingModel.BOLTZ_2.value,
985
987
  folder_uuid: str | None = None,
@@ -993,6 +995,8 @@ def submit_protein_cofolding_workflow(
993
995
  :param ligand_binding_affinity_index: The index of the ligand for which to compute the binding affinity.
994
996
  :param use_msa_server: Whether to use the MSA server for the computation.
995
997
  :param use_potentials: Whether to use potentials for the computation.
998
+ :param do_pose_refinement: whether to optimize non-rotatable bonds in output poses
999
+ :param compute_strain: whether to compute the strain of the pose (if `pose_refinement` is enabled)
996
1000
  :param name: The name of the workflow.
997
1001
  :param model: The model to use for the computation.
998
1002
  :param folder_uuid: The UUID of the folder to store the workflow in.
@@ -1008,7 +1012,10 @@ def submit_protein_cofolding_workflow(
1008
1012
  ligand_binding_affinity_index=ligand_binding_affinity_index,
1009
1013
  initial_smiles_list=initial_smiles_list,
1010
1014
  initial_protein_sequences=initial_protein_sequences,
1015
+ do_pose_refinement=do_pose_refinement,
1016
+ compute_strain=compute_strain,
1011
1017
  )
1018
+
1012
1019
  data = {
1013
1020
  "name": name,
1014
1021
  "folder_uuid": folder_uuid,
@@ -1027,8 +1034,9 @@ def submit_docking_workflow(
1027
1034
  protein: str | Protein,
1028
1035
  pocket: list[list[float]],
1029
1036
  initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol | None = None,
1030
- do_csearch: bool = True,
1031
- do_optimization: bool = True,
1037
+ do_csearch: bool = False,
1038
+ do_optimization: bool = False,
1039
+ do_pose_refinement: bool = False,
1032
1040
  name: str = "Docking Workflow",
1033
1041
  folder_uuid: str | None = None,
1034
1042
  max_credits: int | None = None,
@@ -1040,6 +1048,7 @@ def submit_docking_workflow(
1040
1048
  :param initial_molecule: The initial molecule to be docked
1041
1049
  :param do_csearch: Whether to perform a conformational search on the ligand.
1042
1050
  :param do_optimization: Whether to perform an optimization on the ligand.
1051
+ :param do_pose_refinement: Whether or not to optimize output poses.
1043
1052
  :param name: The name of the workflow.
1044
1053
  :param folder_uuid: The UUID of the folder to place the workflow in.
1045
1054
  :param max_credits: The maximum number of credits to use for the workflow.
@@ -1061,6 +1070,7 @@ def submit_docking_workflow(
1061
1070
  pocket=pocket,
1062
1071
  do_csearch=do_csearch,
1063
1072
  do_optimization=do_optimization,
1073
+ do_pose_refinement=do_pose_refinement,
1064
1074
  )
1065
1075
 
1066
1076
  data = {
@@ -1076,3 +1086,146 @@ def submit_docking_workflow(
1076
1086
  response = client.post("/workflow", json=data)
1077
1087
  response.raise_for_status()
1078
1088
  return Workflow(**response.json())
1089
+
1090
+
1091
+ def submit_ion_mobility_workflow(
1092
+ initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol,
1093
+ temperature: float = 300,
1094
+ protonate: bool = False,
1095
+ do_csearch: bool = True,
1096
+ do_optimization: bool = True,
1097
+ name: str = "Ion-Mobility Workflow",
1098
+ folder_uuid: str | None = None,
1099
+ max_credits: int | None = None,
1100
+ ) -> Workflow:
1101
+ """
1102
+ Submits an ion-mobility workflow to the API.
1103
+
1104
+ :param initial_molecule: The molecule used in the scan.
1105
+ :param temperature: The temperature at which to predict CCS values.
1106
+ :param protonate: Whether or not to automatically detect protonation site.
1107
+ If `True`, every basic site will be protonated and values returned for the most stable.
1108
+ :param do_csearch: Whether to perform a conformational search on the molecule.
1109
+ :param do_optimization: Whether to perform an optimization on the molecule.
1110
+ :param name: The name of the workflow.
1111
+ :param folder_uuid: The UUID of the folder to store the workflow in.
1112
+ :param max_credits: The maximum number of credits to use for the workflow.
1113
+ :return: A Workflow object representing the submitted workflow.
1114
+ :raises requests.HTTPError: if the request to the API fails.
1115
+ """
1116
+ if isinstance(initial_molecule, StJamesMolecule):
1117
+ initial_molecule = initial_molecule.model_dump()
1118
+ elif isinstance(initial_molecule, RdkitMol):
1119
+ initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1120
+
1121
+ workflow = stjames.IonMobilityWorkflow(
1122
+ initial_molecule=initial_molecule,
1123
+ temperature=temperature,
1124
+ protonate=protonate,
1125
+ do_csearch=do_csearch,
1126
+ do_optimization=do_optimization,
1127
+ )
1128
+
1129
+ data = {
1130
+ "name": name,
1131
+ "folder_uuid": folder_uuid,
1132
+ "workflow_type": "ion_mobility",
1133
+ "workflow_data": workflow.model_dump(),
1134
+ "initial_molecule": initial_molecule,
1135
+ "max_credits": max_credits,
1136
+ }
1137
+
1138
+ with api_client() as client:
1139
+ response = client.post("/workflow", json=data)
1140
+ response.raise_for_status()
1141
+ return Workflow(**response.json())
1142
+
1143
+
1144
+ def submit_nmr_workflow(
1145
+ initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol,
1146
+ solvent: str | None = "chloroform",
1147
+ do_csearch: bool = True,
1148
+ do_optimization: bool = True,
1149
+ name: str = "NMR Workflow",
1150
+ folder_uuid: str | None = None,
1151
+ max_credits: int | None = None,
1152
+ ) -> Workflow:
1153
+ """
1154
+ Submits an NMR-prediction workflow to the API.
1155
+
1156
+ :param initial_molecule: The molecule used in the scan.
1157
+ :param solvent: The solvent in which to compute NMR spectra.
1158
+ :param do_csearch: Whether to perform a conformational search on the input structure.
1159
+ :param do_optimization: Whether to perform an optimization on the input structure.
1160
+ :param name: The name of the workflow.
1161
+ :param folder_uuid: The UUID of the folder to store the workflow in.
1162
+ :param max_credits: The maximum number of credits to use for the workflow.
1163
+ :return: A Workflow object representing the submitted workflow.
1164
+ :raises requests.HTTPError: if the request to the API fails.
1165
+ """
1166
+ if isinstance(initial_molecule, StJamesMolecule):
1167
+ initial_molecule = initial_molecule.model_dump()
1168
+ elif isinstance(initial_molecule, RdkitMol):
1169
+ initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1170
+
1171
+ workflow_data = {"initial_molecule": initial_molecule, "solvent": solvent}
1172
+
1173
+ if not do_csearch:
1174
+ workflow_data["conf_gen_settings"] = None
1175
+
1176
+ if not do_optimization:
1177
+ workflow_data["multistage_opt_settings"] = None
1178
+
1179
+ workflow = stjames.NMRSpectroscopyWorkflow.model_validate(workflow_data)
1180
+
1181
+ data = {
1182
+ "name": name,
1183
+ "folder_uuid": folder_uuid,
1184
+ "workflow_type": "nmr",
1185
+ "workflow_data": workflow.model_dump(serialize_as_any=True),
1186
+ "initial_molecule": initial_molecule,
1187
+ "max_credits": max_credits,
1188
+ }
1189
+
1190
+ with api_client() as client:
1191
+ response = client.post("/workflow", json=data)
1192
+ response.raise_for_status()
1193
+ return Workflow(**response.json())
1194
+
1195
+
1196
+ def submit_strain_workflow(
1197
+ initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol,
1198
+ name: str = "Strain Workflow",
1199
+ folder_uuid: str | None = None,
1200
+ max_credits: int | None = None,
1201
+ ) -> Workflow:
1202
+ """
1203
+ Submits a strain workflow to the API.
1204
+
1205
+ :param initial_molecule: The molecule used in the scan.
1206
+ :param name: The name of the workflow.
1207
+ :param folder_uuid: The UUID of the folder to store the workflow in.
1208
+ :param max_credits: The maximum number of credits to use for the workflow.
1209
+ :return: A Workflow object representing the submitted workflow.
1210
+ :raises requests.HTTPError: if the request to the API fails.
1211
+ """
1212
+ if isinstance(initial_molecule, StJamesMolecule):
1213
+ initial_molecule = initial_molecule.model_dump()
1214
+ elif isinstance(initial_molecule, RdkitMol):
1215
+ initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1216
+
1217
+ workflow = stjames.StrainWorkflow(initial_molecule=initial_molecule)
1218
+
1219
+ data = {
1220
+ "name": name,
1221
+ "folder_uuid": folder_uuid,
1222
+ "workflow_type": "strain",
1223
+ "workflow_data": workflow.model_dump(serialize_as_any=True),
1224
+ "initial_molecule": initial_molecule,
1225
+ "max_credits": max_credits,
1226
+ }
1227
+
1228
+ with api_client() as client:
1229
+ response = client.post("/workflow", json=data)
1230
+ response.raise_for_status()
1231
+ return Workflow(**response.json())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rowan-python
3
- Version: 2.1.4
3
+ Version: 2.1.6
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.83
14
+ Requires-Dist: stjames>=0.0.109
15
15
  Description-Content-Type: text/markdown
16
16
 
17
17
  # Rowan Python Library
@@ -1,15 +1,15 @@
1
1
  rowan/__init__.py,sha256=2rz6dW0l9DzawiFi6S0WSv8XlZq1CoTBKJrsJ1uesvk,171
2
- rowan/constants.py,sha256=ZZvv3L0b2y3dMGlWGeaRmx40J5tBrpxNxvJgjP1TNjg,37
2
+ rowan/constants.py,sha256=emCH4m9OL2Hm5E-6mJGM_FgzrK_JrZT-FiKJ6pMNQ4Y,84
3
3
  rowan/folder.py,sha256=n9WkjHMweQLtVcWUvCttOrmezvUdbFxam_eDEMzLF_A,6791
4
4
  rowan/project.py,sha256=ALPPkMa_cg7w5OkXno1cs6acCofw8AOUYRSeWgr3L0o,3774
5
5
  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
- rowan/utils.py,sha256=907lV0fEP6BnjOWyisd3Uh8Mk5JuQMOX9QEjGi_mdew,3314
9
- rowan/workflow.py,sha256=uFgI-yTSHW6JY5KulpnGPdM3Xrl0UGYtne9OnDIkzz8,40729
8
+ rowan/utils.py,sha256=64II-cPOe_SFJK302Bm8hP62d_3_CgnTVYCbn3zKT7U,3334
9
+ rowan/workflow.py,sha256=EGcqPv2K-CCt8t_FSVAGTaI7QCM4BJdY--kN4PHvhOo,46749
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.4.dist-info/METADATA,sha256=PJ8hu2ynkYFAQ1hpyKwE0nlKfmtQcAWCQf61NOIkoPU,1598
13
- rowan_python-2.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- rowan_python-2.1.4.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
15
- rowan_python-2.1.4.dist-info/RECORD,,
12
+ rowan_python-2.1.6.dist-info/METADATA,sha256=rNw5EUh2Dz3xfBKUtFHtIPykxSVegqydghdhhq-q3XI,1599
13
+ rowan_python-2.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ rowan_python-2.1.6.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
15
+ rowan_python-2.1.6.dist-info/RECORD,,