rowan-python 2.1.12__py3-none-any.whl → 2.1.13__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
@@ -312,11 +312,13 @@ def submit_workflow(
312
312
  if initial_smiles is not None:
313
313
  data["initial_smiles"] = initial_smiles
314
314
  elif isinstance(initial_molecule, StJamesMolecule):
315
- data["initial_molecule"] = initial_molecule.model_dump()
315
+ data["initial_molecule"] = initial_molecule.model_dump(mode="json")
316
316
  elif isinstance(initial_molecule, dict):
317
317
  data["initial_molecule"] = initial_molecule
318
318
  elif isinstance(initial_molecule, RdkitMol):
319
- data["initial_molecule"] = StJamesMolecule.from_rdkit(initial_molecule, cid=0).model_dump()
319
+ data["initial_molecule"] = StJamesMolecule.from_rdkit(initial_molecule, cid=0).model_dump(
320
+ mode="json"
321
+ )
320
322
  else:
321
323
  raise ValueError("You must provide either `initial_smiles` or a valid `initial_molecule`.")
322
324
 
@@ -538,7 +540,7 @@ def submit_basic_calculation_workflow(
538
540
  tasks = ["optimize"]
539
541
 
540
542
  if isinstance(initial_molecule, StJamesMolecule):
541
- initial_molecule = initial_molecule.model_dump()
543
+ initial_molecule = initial_molecule.model_dump(mode="json")
542
544
  elif isinstance(initial_molecule, RdkitMol):
543
545
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
544
546
 
@@ -560,7 +562,7 @@ def submit_basic_calculation_workflow(
560
562
  "name": name,
561
563
  "folder_uuid": folder_uuid,
562
564
  "workflow_type": "basic_calculation",
563
- "workflow_data": workflow.model_dump(),
565
+ "workflow_data": workflow.model_dump(mode="json"),
564
566
  "initial_molecule": initial_molecule,
565
567
  "max_credits": max_credits,
566
568
  }
@@ -601,7 +603,7 @@ def submit_conformer_search_workflow(
601
603
  :raises requests.HTTPError: if the request to the API fails.
602
604
  """
603
605
  if isinstance(initial_molecule, StJamesMolecule):
604
- initial_molecule = initial_molecule.model_dump()
606
+ initial_molecule = initial_molecule.model_dump(mode="json")
605
607
  elif isinstance(initial_molecule, RdkitMol):
606
608
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
607
609
 
@@ -639,7 +641,7 @@ def submit_conformer_search_workflow(
639
641
  "name": name,
640
642
  "folder_uuid": folder_uuid,
641
643
  "workflow_type": "conformer_search",
642
- "workflow_data": workflow.model_dump(),
644
+ "workflow_data": workflow.model_dump(mode="json"),
643
645
  "initial_molecule": initial_molecule,
644
646
  "max_credits": max_credits,
645
647
  }
@@ -690,7 +692,7 @@ def submit_solubility_workflow(
690
692
  "name": name,
691
693
  "folder_uuid": folder_uuid,
692
694
  "workflow_type": "solubility",
693
- "workflow_data": workflow.model_dump(),
695
+ "workflow_data": workflow.model_dump(mode="json"),
694
696
  "initial_smiles": initial_smiles,
695
697
  "max_credits": max_credits,
696
698
  }
@@ -762,8 +764,10 @@ def submit_pka_workflow(
762
764
  "name": name,
763
765
  "folder_uuid": folder_uuid,
764
766
  "workflow_type": "pka",
765
- "workflow_data": workflow.model_dump(),
766
- "initial_molecule": initial_stjames_mol.model_dump() if initial_stjames_mol else None,
767
+ "workflow_data": workflow.model_dump(mode="json"),
768
+ "initial_molecule": initial_stjames_mol.model_dump(mode="json")
769
+ if initial_stjames_mol
770
+ else None,
767
771
  "initial_smiles": initial_smiles,
768
772
  "max_credits": max_credits,
769
773
  }
@@ -799,7 +803,7 @@ def submit_redox_potential_workflow(
799
803
  :raises requests.HTTPError: if the request to the API fails.
800
804
  """
801
805
  if isinstance(initial_molecule, StJamesMolecule):
802
- initial_molecule = initial_molecule.model_dump()
806
+ initial_molecule = initial_molecule.model_dump(mode="json")
803
807
  elif isinstance(initial_molecule, RdkitMol):
804
808
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
805
809
 
@@ -814,7 +818,7 @@ def submit_redox_potential_workflow(
814
818
  "name": name,
815
819
  "folder_uuid": folder_uuid,
816
820
  "workflow_type": "redox_potential",
817
- "workflow_data": workflow.model_dump(),
821
+ "workflow_data": workflow.model_dump(mode="json"),
818
822
  "initial_molecule": initial_molecule,
819
823
  "max_credits": max_credits,
820
824
  }
@@ -848,7 +852,7 @@ def submit_fukui_workflow(
848
852
  :raises requests.HTTPError: if the request to the API fails.
849
853
  """
850
854
  if isinstance(initial_molecule, StJamesMolecule):
851
- initial_molecule = initial_molecule.model_dump()
855
+ initial_molecule = initial_molecule.model_dump(mode="json")
852
856
  elif isinstance(initial_molecule, RdkitMol):
853
857
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
854
858
 
@@ -862,9 +866,9 @@ def submit_fukui_workflow(
862
866
  )
863
867
 
864
868
  workflow_data = {
865
- "opt_settings": optimization_settings.model_dump(),
869
+ "opt_settings": optimization_settings.model_dump(mode="json"),
866
870
  "opt_engine": stjames.Method(optimization_method).default_engine(),
867
- "fukui_settings": fukui_settings.model_dump(),
871
+ "fukui_settings": fukui_settings.model_dump(mode="json"),
868
872
  "fukui_engine": stjames.Method(fukui_method).default_engine(),
869
873
  }
870
874
 
@@ -904,7 +908,7 @@ def submit_tautomer_search_workflow(
904
908
  :raises requests.HTTPError: if the request to the API fails.
905
909
  """
906
910
  if isinstance(initial_molecule, StJamesMolecule):
907
- initial_molecule = initial_molecule.model_dump()
911
+ initial_molecule = initial_molecule.model_dump(mode="json")
908
912
  elif isinstance(initial_molecule, RdkitMol):
909
913
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
910
914
 
@@ -917,7 +921,7 @@ def submit_tautomer_search_workflow(
917
921
  "name": name,
918
922
  "folder_uuid": folder_uuid,
919
923
  "workflow_type": "tautomers",
920
- "workflow_data": workflow.model_dump(),
924
+ "workflow_data": workflow.model_dump(mode="json"),
921
925
  "initial_molecule": initial_molecule,
922
926
  "max_credits": max_credits,
923
927
  }
@@ -945,7 +949,7 @@ def submit_descriptors_workflow(
945
949
  :raises requests.HTTPError: if the request to the API fails.
946
950
  """
947
951
  if isinstance(initial_molecule, StJamesMolecule):
948
- initial_molecule = initial_molecule.model_dump()
952
+ initial_molecule = initial_molecule.model_dump(mode="json")
949
953
  elif isinstance(initial_molecule, RdkitMol):
950
954
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
951
955
 
@@ -991,7 +995,7 @@ def submit_scan_workflow(
991
995
  :raises requests.HTTPError: if the request to the API fails.
992
996
  """
993
997
  if isinstance(initial_molecule, StJamesMolecule):
994
- initial_molecule = initial_molecule.model_dump()
998
+ initial_molecule = initial_molecule.model_dump(mode="json")
995
999
  elif isinstance(initial_molecule, RdkitMol):
996
1000
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
997
1001
 
@@ -1018,7 +1022,7 @@ def submit_scan_workflow(
1018
1022
  "name": name,
1019
1023
  "folder_uuid": folder_uuid,
1020
1024
  "workflow_type": "scan",
1021
- "workflow_data": workflow.model_dump(),
1025
+ "workflow_data": workflow.model_dump(mode="json"),
1022
1026
  "initial_molecule": initial_molecule,
1023
1027
  "max_credits": max_credits,
1024
1028
  }
@@ -1072,7 +1076,7 @@ def submit_macropka_workflow(
1072
1076
  "name": name,
1073
1077
  "folder_uuid": folder_uuid,
1074
1078
  "workflow_type": "macropka",
1075
- "workflow_data": workflow.model_dump(),
1079
+ "workflow_data": workflow.model_dump(mode="json"),
1076
1080
  "initial_smiles": initial_smiles,
1077
1081
  "max_credits": max_credits,
1078
1082
  }
@@ -1111,7 +1115,7 @@ def submit_irc_workflow(
1111
1115
  """
1112
1116
 
1113
1117
  if isinstance(initial_molecule, StJamesMolecule):
1114
- initial_molecule = initial_molecule.model_dump()
1118
+ initial_molecule = initial_molecule.model_dump(mode="json")
1115
1119
  elif isinstance(initial_molecule, RdkitMol):
1116
1120
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1117
1121
 
@@ -1136,7 +1140,7 @@ def submit_irc_workflow(
1136
1140
  "name": name,
1137
1141
  "folder_uuid": folder_uuid,
1138
1142
  "workflow_type": "irc",
1139
- "workflow_data": workflow.model_dump(),
1143
+ "workflow_data": workflow.model_dump(mode="json"),
1140
1144
  "initial_molecule": initial_molecule,
1141
1145
  "max_credits": max_credits,
1142
1146
  }
@@ -1193,7 +1197,7 @@ def submit_protein_cofolding_workflow(
1193
1197
  "name": name,
1194
1198
  "folder_uuid": folder_uuid,
1195
1199
  "workflow_type": "protein_cofolding",
1196
- "workflow_data": workflow.model_dump(),
1200
+ "workflow_data": workflow.model_dump(mode="json"),
1197
1201
  "max_credits": max_credits,
1198
1202
  }
1199
1203
 
@@ -1236,7 +1240,7 @@ def submit_docking_workflow(
1236
1240
  """
1237
1241
 
1238
1242
  if isinstance(initial_molecule, StJamesMolecule):
1239
- initial_molecule = initial_molecule.model_dump()
1243
+ initial_molecule = initial_molecule.model_dump(mode="json")
1240
1244
  elif isinstance(initial_molecule, RdkitMol):
1241
1245
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1242
1246
 
@@ -1263,7 +1267,7 @@ def submit_docking_workflow(
1263
1267
  "name": name,
1264
1268
  "folder_uuid": folder_uuid,
1265
1269
  "workflow_type": "docking",
1266
- "workflow_data": workflow.model_dump(),
1270
+ "workflow_data": workflow.model_dump(mode="json"),
1267
1271
  "initial_molecule": initial_molecule,
1268
1272
  "max_credits": max_credits,
1269
1273
  }
@@ -1300,7 +1304,7 @@ def submit_ion_mobility_workflow(
1300
1304
  :raises requests.HTTPError: if the request to the API fails.
1301
1305
  """
1302
1306
  if isinstance(initial_molecule, StJamesMolecule):
1303
- initial_molecule = initial_molecule.model_dump()
1307
+ initial_molecule = initial_molecule.model_dump(mode="json")
1304
1308
  elif isinstance(initial_molecule, RdkitMol):
1305
1309
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1306
1310
 
@@ -1316,7 +1320,7 @@ def submit_ion_mobility_workflow(
1316
1320
  "name": name,
1317
1321
  "folder_uuid": folder_uuid,
1318
1322
  "workflow_type": "ion_mobility",
1319
- "workflow_data": workflow.model_dump(),
1323
+ "workflow_data": workflow.model_dump(mode="json"),
1320
1324
  "initial_molecule": initial_molecule,
1321
1325
  "max_credits": max_credits,
1322
1326
  }
@@ -1350,7 +1354,7 @@ def submit_nmr_workflow(
1350
1354
  :raises requests.HTTPError: if the request to the API fails.
1351
1355
  """
1352
1356
  if isinstance(initial_molecule, StJamesMolecule):
1353
- initial_molecule = initial_molecule.model_dump()
1357
+ initial_molecule = initial_molecule.model_dump(mode="json")
1354
1358
  elif isinstance(initial_molecule, RdkitMol):
1355
1359
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1356
1360
 
@@ -1368,7 +1372,7 @@ def submit_nmr_workflow(
1368
1372
  "name": name,
1369
1373
  "folder_uuid": folder_uuid,
1370
1374
  "workflow_type": "nmr",
1371
- "workflow_data": workflow.model_dump(serialize_as_any=True),
1375
+ "workflow_data": workflow.model_dump(serialize_as_any=True, mode="json"),
1372
1376
  "initial_molecule": initial_molecule,
1373
1377
  "max_credits": max_credits,
1374
1378
  }
@@ -1396,7 +1400,7 @@ def submit_strain_workflow(
1396
1400
  :raises requests.HTTPError: if the request to the API fails.
1397
1401
  """
1398
1402
  if isinstance(initial_molecule, StJamesMolecule):
1399
- initial_molecule = initial_molecule.model_dump()
1403
+ initial_molecule = initial_molecule.model_dump(mode="json")
1400
1404
  elif isinstance(initial_molecule, RdkitMol):
1401
1405
  initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0)
1402
1406
 
@@ -1406,7 +1410,7 @@ def submit_strain_workflow(
1406
1410
  "name": name,
1407
1411
  "folder_uuid": folder_uuid,
1408
1412
  "workflow_type": "strain",
1409
- "workflow_data": workflow.model_dump(serialize_as_any=True),
1413
+ "workflow_data": workflow.model_dump(serialize_as_any=True, mode="json"),
1410
1414
  "initial_molecule": initial_molecule,
1411
1415
  "max_credits": max_credits,
1412
1416
  }
@@ -1454,8 +1458,10 @@ def submit_double_ended_ts_search_workflow(
1454
1458
  "name": name,
1455
1459
  "folder_uuid": folder_uuid,
1456
1460
  "workflow_type": "double_ended_ts_search",
1457
- "workflow_data": workflow.model_dump(),
1458
- "initial_molecule": reactant if isinstance(reactant, dict) else reactant.model_dump(),
1461
+ "workflow_data": workflow.model_dump(mode="json"),
1462
+ "initial_molecule": reactant
1463
+ if isinstance(reactant, dict)
1464
+ else reactant.model_dump(mode="json"),
1459
1465
  "max_credits": max_credits,
1460
1466
  }
1461
1467
 
@@ -1506,7 +1512,7 @@ def submit_pose_analysis_md_workflow(
1506
1512
  "name": name,
1507
1513
  "folder_uuid": folder_uuid,
1508
1514
  "workflow_type": "pose_analysis_md",
1509
- "workflow_data": workflow.model_dump(serialize_as_any=True),
1515
+ "workflow_data": workflow.model_dump(serialize_as_any=True, mode="json"),
1510
1516
  "initial_smiles": initial_smiles,
1511
1517
  "max_credits": max_credits,
1512
1518
  }
@@ -1560,7 +1566,7 @@ def submit_batch_docking_workflow(
1560
1566
  "name": name,
1561
1567
  "folder_uuid": folder_uuid,
1562
1568
  "workflow_type": "batch_docking",
1563
- "workflow_data": workflow.model_dump(serialize_as_any=True),
1569
+ "workflow_data": workflow.model_dump(serialize_as_any=True, mode="json"),
1564
1570
  "max_credits": max_credits,
1565
1571
  }
1566
1572
 
@@ -1598,7 +1604,7 @@ def submit_msa_workflow(
1598
1604
  "name": name,
1599
1605
  "folder_uuid": folder_uuid,
1600
1606
  "workflow_type": "msa",
1601
- "workflow_data": workflow.model_dump(serialize_as_any=True),
1607
+ "workflow_data": workflow.model_dump(serialize_as_any=True, mode="json"),
1602
1608
  "max_credits": max_credits,
1603
1609
  }
1604
1610
 
@@ -1631,7 +1637,7 @@ def submit_admet_workflow(
1631
1637
  "name": name,
1632
1638
  "folder_uuid": folder_uuid,
1633
1639
  "workflow_type": "admet",
1634
- "workflow_data": workflow.model_dump(),
1640
+ "workflow_data": workflow.model_dump(mode="json"),
1635
1641
  "initial_smiles": initial_smiles,
1636
1642
  "max_credits": max_credits,
1637
1643
  }
@@ -1643,7 +1649,8 @@ def submit_admet_workflow(
1643
1649
 
1644
1650
 
1645
1651
  def submit_membrane_permeability_workflow(
1646
- initial_smiles: str,
1652
+ initial_molecule: dict[str, Any] | StJamesMolecule | RdkitMol | str,
1653
+ method: Literal["gnn-mtl", "pypermm"] = "gnn-mtl",
1647
1654
  name: str = "ADMET Workflow",
1648
1655
  folder_uuid: str | None = None,
1649
1656
  max_credits: int | None = None,
@@ -1651,7 +1658,8 @@ def submit_membrane_permeability_workflow(
1651
1658
  """
1652
1659
  Submits a membrane permeability workflow to the API.
1653
1660
 
1654
- :param initial_smiles: The molecule used in the workflow.
1661
+ :param initial_molecule: The molecule used in the workflow.
1662
+ :param method: The method used to compute membrane permeability.
1655
1663
  :param name: The name of the workflow.
1656
1664
  :param folder_uuid: The UUID of the folder to store the workflow in.
1657
1665
  :param max_credits: The maximum number of credits to use for the workflow.
@@ -1659,17 +1667,45 @@ def submit_membrane_permeability_workflow(
1659
1667
  :raises requests.HTTPError: if the request to the API fails.
1660
1668
  """
1661
1669
 
1662
- workflow = stjames.MembranePermeabilityWorkflow(initial_smiles=initial_smiles)
1663
-
1664
- data = {
1670
+ data: dict[str, Any] = {
1665
1671
  "name": name,
1666
1672
  "folder_uuid": folder_uuid,
1667
1673
  "workflow_type": "membrane_permeability",
1668
- "workflow_data": workflow.model_dump(),
1669
- "initial_smiles": initial_smiles,
1670
1674
  "max_credits": max_credits,
1671
1675
  }
1672
1676
 
1677
+ match method:
1678
+ case "gnn-mtl":
1679
+ assert isinstance(initial_molecule, str)
1680
+ workflow = stjames.MembranePermeabilityWorkflow(
1681
+ initial_smiles=initial_molecule,
1682
+ membrane_permeability_method="chemprop_ohlsson2025",
1683
+ )
1684
+
1685
+ data["initial_smiles"] = initial_molecule
1686
+
1687
+ case "pypermm":
1688
+ if isinstance(initial_molecule, str):
1689
+ raise ValueError("Cannot specify molecule as SMILES for PyPermm")
1690
+ elif isinstance(initial_molecule, StJamesMolecule):
1691
+ initial_molecule = initial_molecule.model_dump(mode="json")
1692
+ elif isinstance(initial_molecule, RdkitMol):
1693
+ initial_molecule = StJamesMolecule.from_rdkit(initial_molecule, cid=0).model_dump(
1694
+ mode="json"
1695
+ )
1696
+
1697
+ workflow = stjames.MembranePermeabilityWorkflow(
1698
+ initial_molecule=initial_molecule,
1699
+ membrane_permeability_method="pypermm",
1700
+ )
1701
+
1702
+ data["initial_molecule"] = initial_molecule
1703
+
1704
+ case _:
1705
+ raise ValueError(f"Unexpected {method=}")
1706
+
1707
+ data["workflow_data"] = workflow.model_dump(mode="json")
1708
+
1673
1709
  with api_client() as client:
1674
1710
  response = client.post("/workflow", json=data)
1675
1711
  response.raise_for_status()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rowan-python
3
- Version: 2.1.12
3
+ Version: 2.1.13
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.137
14
+ Requires-Dist: stjames>=0.0.144
15
15
  Description-Content-Type: text/markdown
16
16
 
17
17
  # Rowan Python Library
@@ -6,10 +6,10 @@ rowan/protein.py,sha256=mFSVCr-08bSikXBUtJtSWzjKcVAuBmTeRckn7JUHYSE,8810
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=Y9H1qXCjTd-E-LehtlbpEp5l7a0__TKE7nYqY5XwUI8,63669
9
+ rowan/workflow.py,sha256=hsRh0J6bdNs78eByuL5G3_k1CrNQg2szR5sPPalWTMA,65376
10
10
  rowan/rowan_rdkit/__init__.py,sha256=EATX2VRzywzKxqkpCUMTf7RNQLkWsfi5VcCNDW6EIiw,503
11
11
  rowan/rowan_rdkit/chem_utils.py,sha256=sKCzul2e0ldVYTBImhTwso7ddNgPKmvS-OmvCEjVJH0,34788
12
- rowan_python-2.1.12.dist-info/METADATA,sha256=IdwxdzM7GqpuqU9lF9_69NKeGldpBq-FOW00C4tZaqg,1601
13
- rowan_python-2.1.12.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
- rowan_python-2.1.12.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
15
- rowan_python-2.1.12.dist-info/RECORD,,
12
+ rowan_python-2.1.13.dist-info/METADATA,sha256=3zsPCrGRWTd9snLuYFsleM0iDWkChWQaOEaiGExtLbY,1601
13
+ rowan_python-2.1.13.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
+ rowan_python-2.1.13.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
15
+ rowan_python-2.1.13.dist-info/RECORD,,