Skip to content

Commit 739d26e

Browse files
committed
sync internal updates
1 parent 214665b commit 739d26e

3 files changed

Lines changed: 14 additions & 20 deletions

File tree

docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Miscellaneous
113113
get_contact_residues
114114
find_atoms_by_pattern
115115
estimate_formal_charges
116-
find_charged_atoms_in_resonance_structures
116+
find_resonance_charges
117117
MatchWarning
118118
EvaluationWarning
119119
NoContactError

src/peppr/contacts.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__all__ = [
22
"ContactMeasurement",
33
"find_atoms_by_pattern",
4-
"find_charged_atoms_in_resonance_structures",
4+
"find_resonance_charges",
55
]
66

77
from enum import IntEnum
@@ -284,13 +284,13 @@ def find_salt_bridges(
284284
When ``use_resonance=True``, Both oxygen atoms would be checked.
285285
"""
286286
if use_resonance:
287-
pos_mask, neg_mask, binding_site_conjugated_groups = (
288-
find_charged_atoms_in_resonance_structures(self._binding_site_mol)
287+
pos_mask, neg_mask, binding_site_conjugated_groups = find_resonance_charges(
288+
self._binding_site_mol
289289
)
290290
binding_site_pos_indices = np.where(pos_mask)[0]
291291
binding_site_neg_indices = np.where(neg_mask)[0]
292-
pos_mask, neg_mask, ligand_conjugated_groups = (
293-
find_charged_atoms_in_resonance_structures(self._ligand_mol)
292+
pos_mask, neg_mask, ligand_conjugated_groups = find_resonance_charges(
293+
self._ligand_mol
294294
)
295295
ligand_pos_indices = np.where(pos_mask)[0]
296296
ligand_neg_indices = np.where(neg_mask)[0]
@@ -584,7 +584,7 @@ def _acceptable_angle(
584584
return abs(angle - ref_angle) <= tolerance
585585

586586

587-
def find_charged_atoms_in_resonance_structures(
587+
def find_resonance_charges(
588588
mol: Chem.Mol,
589589
) -> tuple[NDArray[np.bool_], NDArray[np.bool_], NDArray[np.int_]]:
590590
"""

tests/test_contacts.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -304,19 +304,13 @@ def test_no_bonds(contact_method):
304304
contact_method(contact_measurement)
305305

306306

307-
def test_find_charged_atoms_in_resonance_structures():
307+
def test_find_resonance_charges():
308308
"""
309309
Test finding charged atoms in resonance structures using a real ligand from a PDB file.
310310
"""
311-
pdbx_file = pdbx.CIFFile.read(Path(__file__).parent / "data" / "pdb" / "3eca.cif")
312-
structure = pdbx.get_structure(
313-
pdbx_file,
314-
model=1,
315-
include_bonds=True,
316-
)
317-
structure = peppr.standardize(structure)
318-
structure = structure[structure.chain_id == "A"]
319-
ligand = structure[structure.hetero]
311+
ligand = info.residue("ASP")
312+
# standardize removes hydrogens - needed to estimate formal charges
313+
ligand = peppr.standardize(ligand)
320314

321315
# set annotations for the benefit of finding charged atoms
322316
ligand.set_annotation("charge", peppr.estimate_formal_charges(ligand, 7.4))
@@ -330,11 +324,11 @@ def test_find_charged_atoms_in_resonance_structures():
330324
assert np.equal(ligand_charged_atoms, [0, 7, 8]).all()
331325

332326
# get charged atoms and their resonance groups
333-
pos_mask, neg_mask, ligand_conjugated_groups = (
334-
peppr.find_charged_atoms_in_resonance_structures(ligand_mol)
327+
pos_mask, neg_mask, ligand_conjugated_groups = peppr.find_resonance_charges(
328+
ligand_mol
335329
)
336330
assert len(set(ligand_conjugated_groups)) < len(ligand_conjugated_groups), (
337-
"Some atoms are in the same conjugated group"
331+
"Number of groups expected less than number of atoms as some are conjugated"
338332
)
339333
charged_atom_mask = pos_mask | neg_mask
340334
ligand_charged_in_resonance_atoms = np.where(charged_atom_mask)[0]

0 commit comments

Comments
 (0)