ProLIF icon indicating copy to clipboard operation
ProLIF copied to clipboard

How to list interaction lengths with Prolif?

Open Bio-Otto opened this issue 3 years ago • 2 comments

I've read Prolif's manual but haven't seen a function that lists the distances of the interactions found. I just saw that it lists "True-False" and atomic indices. Also, how can I do this in the most correct way? Thank you in advance for your help.

Bio-Otto avatar Jul 25 '22 18:07 Bio-Otto

Haven't figured out how to extract information like bond angle or distances from the prolif/interactions/Interactions class but you can pull this information from the fingerprint dataframe.

from rdkit import Geometry
df = fp.to_dataframe(return_atoms = True)
distances = []
for i, row in df.T.iterrows():
    lresid, presid, interaction = i
    lindex, pindex = row[0]
    lres = lmol[lresid]
    pres = pmol[presid]
    # get coordinates for both points of the interaction
    if interaction in ["PiStacking", "EdgeToFace", "FaceToFace", "PiCation"]:
        p1 = get_ring_centroid(lres, lindex)
    else:
        p1 = lres.GetConformer().GetAtomPosition(lindex)
    if interaction in ["PiStacking", "EdgeToFace", "FaceToFace", "CationPi"]:
        p2 = get_ring_centroid(pres, pindex)
    else:
        p2 = pres.GetConformer().GetAtomPosition(pindex)

     lres_xyz = Geometry.Point3D(*p1)
     pres_xyz = Geometry.Point3D(*p2)
     distances.append(lres_xyz.Distance(pres_xyz))
      

Haven't tested this but this should provide the blueprint of the tools you need.

noahharrison64 avatar Jul 28 '22 07:07 noahharrison64

There isn't currently a way to directly obtain that from the fingeprint calculation but I'll definitely consider adding some interactions metadata in the updates to come!

@noahharrison64 's script shows how to measure the distances based on the atomic indices, some of the functions used there come from the Visualisation tutorial so make sure to have a look there.

Thanks @noahharrison64 for the help!

cbouy avatar Jul 29 '22 00:07 cbouy