Skip to content

Incorrect Saltbridge identification on Disaccharides #197

@ct-jcabot

Description

@ct-jcabot

Describe the bug
plip.structure.preparation.py identifies as carboxylates substructures that it shouldn't

To Reproduce
By running plip -i 2rfy -yv we can see that plip caractherizes as negatively charged substructures that it shouldn't (R-O-C-O-R and R-O-C-O-H groups)

Expected behavior
These groups shouldn't be negatively charged and therefore no Saltbridges should be identified in this case

Screenshots
Image

As for my tests the problem arrises in lines 770-772 of preparation.py, where the simple Carbon bound to two Oxygens check is not robust enough, i have fixed the issue locally with this code as replacement

if group == 'carboxylate':

  carboxyl_smarts = pybel.Smarts("[CX3](=[OX1])[OX1-,OX2H1]")

  mol = pybel.Molecule(atom.OBAtom.GetParent())

   if any(match[0] == atom.idx for match in carboxyl_smarts.findall(mol)):
        return True
   else:
        return False

I've seen that instead of SMARTS this code uses other rules to define functional groups so a different approach may be better suited for this codebase

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions