helmkit 0.5.1__tar.gz → 0.5.2__tar.gz
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.
- {helmkit-0.5.1 → helmkit-0.5.2}/PKG-INFO +1 -1
- {helmkit-0.5.1 → helmkit-0.5.2}/pyproject.toml +1 -1
- {helmkit-0.5.1 → helmkit-0.5.2}/src/helmkit/molecule.py +23 -2
- {helmkit-0.5.1 → helmkit-0.5.2}/uv.lock +1 -1
- {helmkit-0.5.1 → helmkit-0.5.2}/.gitignore +0 -0
- {helmkit-0.5.1 → helmkit-0.5.2}/.python-version +0 -0
- {helmkit-0.5.1 → helmkit-0.5.2}/LICENSE +0 -0
- {helmkit-0.5.1 → helmkit-0.5.2}/README.md +0 -0
- {helmkit-0.5.1 → helmkit-0.5.2}/src/helmkit/__init__.py +0 -0
- {helmkit-0.5.1 → helmkit-0.5.2}/src/helmkit/data/monomers.sdf +0 -0
- {helmkit-0.5.1 → helmkit-0.5.2}/src/helmkit/py.typed +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import bisect
|
|
1
2
|
import multiprocessing
|
|
2
3
|
import re
|
|
3
4
|
import warnings
|
|
@@ -739,11 +740,24 @@ class Molecule:
|
|
|
739
740
|
matches = self.mol.GetSubstructMatches(pattern)
|
|
740
741
|
atoms_to_delete = sorted({idx for match in matches for idx in match})
|
|
741
742
|
self.mol = Chem.DeleteSubstructs(self.mol, pattern)
|
|
743
|
+
|
|
744
|
+
def correction(offset: int, idx: int) -> int:
|
|
745
|
+
return bisect.bisect_left(atoms_to_delete, idx) - bisect.bisect_left(
|
|
746
|
+
atoms_to_delete, offset
|
|
747
|
+
)
|
|
748
|
+
|
|
749
|
+
for i, (m1, a1, m2, a2) in enumerate(self.bondlist):
|
|
750
|
+
offset1 = self.offset[m1]
|
|
751
|
+
offset2 = self.offset[m2]
|
|
752
|
+
self.bondlist[i][1] -= correction(offset1, offset1 + a1)
|
|
753
|
+
self.bondlist[i][3] -= correction(offset2, offset2 + a2)
|
|
754
|
+
|
|
742
755
|
self.offset = [
|
|
743
|
-
offset - sum(d
|
|
756
|
+
offset - sum(d < offset for d in atoms_to_delete) for offset in self.offset
|
|
744
757
|
]
|
|
745
758
|
|
|
746
|
-
|
|
759
|
+
@property
|
|
760
|
+
def bond_indices(self) -> List[int]:
|
|
747
761
|
return [
|
|
748
762
|
self.mol.GetBondBetweenAtoms(
|
|
749
763
|
self.offset[monomer1_idx] + atom1_idx,
|
|
@@ -752,6 +766,13 @@ class Molecule:
|
|
|
752
766
|
for monomer1_idx, atom1_idx, monomer2_idx, atom2_idx in self.bondlist
|
|
753
767
|
]
|
|
754
768
|
|
|
769
|
+
@property
|
|
770
|
+
def monomer_indices(self) -> List[int]:
|
|
771
|
+
return [
|
|
772
|
+
bisect.bisect_right(self.offset, i) - 1
|
|
773
|
+
for i in range(self.mol.GetNumAtoms())
|
|
774
|
+
]
|
|
775
|
+
|
|
755
776
|
|
|
756
777
|
def _init_pool(monomer_df: MonomerLibrary):
|
|
757
778
|
global _monomer_df
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|