chemosim-lab / ProLIF

Interaction Fingerprints for protein-ligand complexes and more
https://prolif.readthedocs.io
Apache License 2.0
361 stars 68 forks source link

The `elements` attribute is required for the RDKitConverter but is not present in this AtomGroup. Please refer to the documentation to guess elements from other attributes or type `help(MDAnalysis.topology.guessers)` #101

Closed vvithurshan closed 1 year ago

vvithurshan commented 1 year ago

getting an error while executing the following code fp = plf.Fingerprint() fp.run(u.trajectory[::10], lig, prot) df = fp.to_dataframe(return_atoms=True)

The elements attribute is required for the RDKitConverter but is not present in this AtomGroup. Please refer to the documentation to guess elements from other attributes or type help(MDAnalysis.topology.guessers)

cbouy commented 1 year ago

Hi,

Have you tried typing the command shown in the error message? help(mda.topology.guessers)

In your case the solution probably looks something like inserting the following piece of code before generating the fingerprint:

elements = [
    mda.topology.guessers.guess_atom_element(x)
    for x in u.atoms.names
]
u.add_TopologyAttr("elements", elements)
vvithurshan commented 1 year ago

Hi, Have you tried typing the command shown in the error message? help(mda.topology.guessers) In your case the solution probably looks something like inserting the following piece of code before generating the fingerprint: python elements = [ mda.topology.guessers.guess_atom_element(x) for x in u.atoms.names ] u.add_TopologyAttr("elements", elements)

Thank you, it worked