@@ -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