Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/RDKit.py:990: UserWarning: The standardization could not be completed within a reasonable number of iterations #132

Closed
H-EKE opened this issue Jun 21, 2023 · 2 comments

Comments

@H-EKE
Copy link

H-EKE commented Jun 21, 2023

Hi,

I'm trying to follow this tutorial (https://prolif.readthedocs.io/en/stable/notebooks/protein-protein_interactions.html)
When I run this script

import MDAnalysis as mda
import prolif as plf
from rdkit import Chem
from rdkit.Chem import AllChem
from tqdm.auto import tqdm
from MDAnalysis.topology.guessers import guess_types

u = mda.Universe('structure.psf', 'production1/centered_clean.xtc')
guessed_elements = guess_types(u.atoms.names)
u.add_TopologyAttr('elements', guessed_elements)

tm3 = u.select_atoms("protein and segid D")
prot = u.select_atoms("protein and segid A")


tm3,prot

fp = plf.Fingerprint(
    [
        "HBDonor",
        "HBAcceptor",
        "PiStacking",
        "PiCation",
        "CationPi",
        "Anionic",
        "Cationic",
    ]
)
fp.run(u.trajectory[::10], tm3, prot)

df = fp.to_dataframe()
df.to_csv('data.csv', index=False)


I got this error

Warning: importing 'simtk.openmm' is deprecated. Import 'openmm' instead.
0%| | 0/250 [00:00<?, ?it/s]
/python3.8/site-packages/MDAnalysis/converters/RDKit.py:990: UserWarning: The standardization could not be completed within a reasonable number of iterations
warnings.warn("The standardization could not be completed within a "
/python3.8/site-packages/MDAnalysis/converters/RDKit.py:990: UserWarning: The standardization could not be completed within a reasonable number of iterations

Has anyone experienced this error before? My trajectory was generated with OpenMM

Thanks!

@cbouy
Copy link
Member

cbouy commented Jun 21, 2023

Hi @H-EKE , that's not an error, just a warning that can happen when the MDAnalysis AtomGroup selections that you made are converted to RDKit molecules under the hood by ProLIF, either because something seem to have gone wrong during this process, but it can also be a false positive due to the molecule (here an entire protein segment) being quite large.

I presume you're in the latter case, but if you want to be sure you could have a look at each residue individually using this script:

import MDAnalysis as mda
import prolif as plf
from MDAnalysis.topology.guessers import guess_types
from rdkit import Chem
from rdkit.Chem import Draw

u = mda.Universe("structure.psf", "production1/centered_clean.xtc")
guessed_elements = guess_types(u.atoms.names)
u.add_TopologyAttr("elements", guessed_elements)

segment_d = u.select_atoms("protein and segid D")
segment_a = u.select_atoms("protein and segid A")


def save_residues_image(selection, image_path):
    pmol = plf.Molecule.from_mda(selection)
    frags = []
    for res in pmol:
        mol = Chem.RemoveHs(res)
        mol.RemoveAllConformers()
        frags.append(mol)
    img = Draw.MolsToGridImage(frags, legends=[str(res.resid) for res in pmol])
    img.save(image_path)


save_residues_image(segment_a, "segment_a.png")
save_residues_image(segment_d, "segment_d.png")

It will save 2 PNG images (segment_a.png and segment_d.png) in your current working directory which you can inspect to look for any incorrectly assigned charge or bond orders on the residues.

Hope this helps,
Cédric

@H-EKE
Copy link
Author

H-EKE commented Jun 25, 2023

Thank you so much for your fast reply! @cbouy
It helped a lot!

@H-EKE H-EKE closed this as completed Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants