diff --git a/modules/mol/alg/pymod/ligand_scoring.py b/modules/mol/alg/pymod/ligand_scoring.py index 3ff13d926a2733cd103f7f71c9dcc6e7a109aab8..5fd5aa78db6a14f62cc5d106633e22856cdd9f8a 100644 --- a/modules/mol/alg/pymod/ligand_scoring.py +++ b/modules/mol/alg/pymod/ligand_scoring.py @@ -738,12 +738,12 @@ def ResidueToGraph(residue, by_atom_index=False): :type by_atom_index: :class:`bool` :rtype: :class:`~networkx.classes.graph.Graph` - Nodes are labeled with the Atom's :attr:`~ost.mol.AtomHandle.element`. + Nodes are labeled with the Atom's :attr:`~ost.mol.AtomHandle.mass`. """ nxg = networkx.Graph() for atom in residue.atoms: - nxg.add_node(atom.name, element=atom.element) + nxg.add_node(atom.name, element=atom.mass) # This will list all edges twice - once for every atom of the pair. # But as of NetworkX 3.0 adding the same edge twice has no effect, so we're good. diff --git a/modules/mol/alg/tests/test_ligand_scoring.py b/modules/mol/alg/tests/test_ligand_scoring.py index 335242008f4a31671a561bffae1f4a6e07a2f4cf..1546ae688068a378eba223a694e3d6261a85b0ed 100644 --- a/modules/mol/alg/tests/test_ligand_scoring.py +++ b/modules/mol/alg/tests/test_ligand_scoring.py @@ -167,6 +167,11 @@ class TestLigandScoring(unittest.TestCase): sym = ost.mol.alg.ligand_scoring._ComputeSymmetries(mdl_g3d, trg_g3d1, by_atom_index=True) assert len(sym) == 72 + # Test that we can match ions read from SDF + sdf_lig = io.LoadEntity(os.path.join('testfiles', "1r8q_ligand_0.sdf")) + sym = ost.mol.alg.ligand_scoring._ComputeSymmetries(trg_mg1, sdf_lig.residues[0], by_atom_index=True) + assert len(sym) == 1 + # Test that it works with views and only consider atoms in the view # Skip PA, PB and O[1-3]A and O[1-3]B in target and model # We assume atom index are fixed and won't change