stjames 0.0.59__py3-none-any.whl → 0.0.61__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.

Potentially problematic release.


This version of stjames might be problematic. Click here for more details.

@@ -1,8 +1,8 @@
1
1
  """Docking workflow."""
2
2
 
3
- from typing import Annotated
3
+ from typing import Annotated, Self
4
4
 
5
- from pydantic import AfterValidator, ConfigDict, field_validator
5
+ from pydantic import AfterValidator, ConfigDict, field_validator, model_validator
6
6
 
7
7
  from ..base import Base, round_float
8
8
  from ..pdb import PDB
@@ -26,6 +26,10 @@ class DockingWorkflow(Workflow):
26
26
  """
27
27
  Docking workflow.
28
28
 
29
+ Note that the protein can be supplied either by UUID or raw PDB object.
30
+ We anticipate that the former will dominate deployed usage, but the latter is handy for isolated testing.
31
+ If, for whatever reason, the workflow is initialized with both a `target_uuid` and a `target`, the UUID will be ignored.
32
+
29
33
  Inherited:
30
34
  :param initial_molecule: Molecule of interest
31
35
  :param mode: Mode for workflow (currently unused)
@@ -36,7 +40,8 @@ class DockingWorkflow(Workflow):
36
40
  :param do_csearch: whether to csearch starting structures
37
41
  :param do_optimization: whether to optimize starting structures
38
42
  :param conformers: UUIDs of optimized conformers
39
- :param target: PDB of the protein
43
+ :param target: PDB of the protein.
44
+ :param target_uuid: UUID of the protein.
40
45
  :param pocket: center (x, y, z) and size (x, y, z) of the pocket
41
46
 
42
47
  Results:
@@ -49,7 +54,8 @@ class DockingWorkflow(Workflow):
49
54
  do_optimization: bool = True
50
55
  conformers: list[UUID] = []
51
56
 
52
- target: PDB
57
+ target: PDB | None = None
58
+ target_uuid: UUID | None = None
53
59
  pocket: tuple[Vector3D, Vector3D]
54
60
 
55
61
  do_pose_hydrogen_refinement: bool = True
@@ -60,16 +66,25 @@ class DockingWorkflow(Workflow):
60
66
 
61
67
  def __repr__(self) -> str:
62
68
  """Return a string representation of the Docking workflow."""
63
- desc = self.target.description
64
- target = desc.code or desc.title
65
- ligand = "".join(atom.atomic_symbol for atom in self.initial_molecule.atoms)
69
+ if self.target is not None:
70
+ desc = self.target.description
71
+ target = desc.code or desc.title
72
+ else:
73
+ target = ""
66
74
 
75
+ ligand = "".join(atom.atomic_symbol for atom in self.initial_molecule.atoms)
67
76
  return f"<{type(self).__name__} {target} {ligand}>"
68
77
 
78
+ @model_validator(mode="after")
79
+ def check_protein(self) -> Self:
80
+ """Check if protein is provided."""
81
+ if not self.target and not self.target_uuid:
82
+ raise ValueError("Must provide either molecules or smiles")
83
+ return self
84
+
69
85
  @field_validator("pocket", mode="after")
70
86
  def validate_pocket(cls, pocket: tuple[Vector3D, Vector3D]) -> tuple[Vector3D, Vector3D]:
71
87
  center, size = pocket
72
88
  if any(q <= 0 for q in size):
73
89
  raise ValueError(f"Pocket size must be positive, got: {size}")
74
-
75
90
  return pocket
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: stjames
3
- Version: 0.0.59
3
+ Version: 0.0.61
4
4
  Summary: standardized JSON atom/molecule encoding scheme
5
5
  Author-email: Corin Wagen <corin@rowansci.com>
6
6
  Project-URL: Homepage, https://github.com/rowansci/stjames
@@ -44,7 +44,7 @@ stjames/workflows/bde.py,sha256=cWsZNiNdUy5DGvu8o6bBepLZIB5ohiAD6RKoK3YSq1I,9786
44
44
  stjames/workflows/conformer.py,sha256=LnpvH5HmLCn-ddH3r1WhEYONUMX5ohZswdESEPCR6o4,2907
45
45
  stjames/workflows/conformer_search.py,sha256=ZQ3VxQoaR_aZ-KSblXooAnGMTFbvOj4IQnM70K0OXhc,13497
46
46
  stjames/workflows/descriptors.py,sha256=lRRCsGzad3nIg0wI1090ffaXB0FVh0nRRb2lNxCY0kI,281
47
- stjames/workflows/docking.py,sha256=K6zy4lo1XfrrMd7ZmKAe_Fd9wvKhtCMoK66gp-TsuJA,2158
47
+ stjames/workflows/docking.py,sha256=boetrhWyF-JAi8DAyiZrH_dFLs4yIe8P6C-ZR73AJgk,2932
48
48
  stjames/workflows/electronic_properties.py,sha256=uAIcGKKLhqoHyDgcOZulEXwTU2EjidyvOndZDYyeJEk,4003
49
49
  stjames/workflows/fukui.py,sha256=2J23RjkSOZ-40AM3AdnbJkRBGaCevkjkhnV3pVfa6lo,738
50
50
  stjames/workflows/hydrogen_bond_basicity.py,sha256=Luvov2DlDvZN06W-mU6YaN7wcIrTLwzdoWww-jNE3x4,517
@@ -57,8 +57,8 @@ stjames/workflows/scan.py,sha256=uNSuUmVMAV4exNvcv1viVe7930i7GZMn7RtEimnwEE8,100
57
57
  stjames/workflows/spin_states.py,sha256=b-uCf-pHjF_JHbExeb5GdRToE0pIxP0JTd50U130ckI,4693
58
58
  stjames/workflows/tautomer.py,sha256=x3TC8hkMs87ZUodLyhce5EUzYoV276ePfPMi7ISWyNU,651
59
59
  stjames/workflows/workflow.py,sha256=tIu5naADYgYS7kdW8quvGEWHWosBcrIdcD7L86v-uMQ,976
60
- stjames-0.0.59.dist-info/LICENSE,sha256=i7ehYBS-6gGmbTcgU4mgk28pyOx2kScJ0kcx8n7bWLM,1084
61
- stjames-0.0.59.dist-info/METADATA,sha256=SDY-2LM12v5-wk8e25U1-U6L9ylteTXnMbm1FLkdohc,1713
62
- stjames-0.0.59.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
63
- stjames-0.0.59.dist-info/top_level.txt,sha256=FYCwxl6quhYOAgG-mnPQcCK8vsVM7B8rIUrO-WrQ_PI,8
64
- stjames-0.0.59.dist-info/RECORD,,
60
+ stjames-0.0.61.dist-info/LICENSE,sha256=i7ehYBS-6gGmbTcgU4mgk28pyOx2kScJ0kcx8n7bWLM,1084
61
+ stjames-0.0.61.dist-info/METADATA,sha256=kUkOkCULcbndmuv-hy5nCtBVAIJDNFy6MEI53KNIMDA,1713
62
+ stjames-0.0.61.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
63
+ stjames-0.0.61.dist-info/top_level.txt,sha256=FYCwxl6quhYOAgG-mnPQcCK8vsVM7B8rIUrO-WrQ_PI,8
64
+ stjames-0.0.61.dist-info/RECORD,,