Saving position of ligand interactor on metadata
jparcon opened this issue · 2 comments
I guess this is out of the scope of fingerprinting molecular interactions, but maybe it is useful to extend the capabilities of the software.
Would it be feasible for future releases to save the 3D coordinates in space of the ligand atomic interactors on the ifp metadata?
I'm thinking on results from docking, and getting interaction "hot spots" on ligand positions by clustering in space ligand interactors of the same type that arise on multiple different ligands.
It's a relatively easy post-processing step to do once you've generated the IFP metadata which contains atom indices, from there you just have to extract the coordinates from the corresponding molecules.
While I agree that it can be useful it's a bit too far from the "fingerprint" scope, so I'd say it's quite unlikely to happen.
Ok.
I just post a simple code to extract ligand atomic positions for each interaction:
for i, frame_ifp in fp.ifp.items():
print("pose =", i)
for (ligres, protres), residue_ifp in frame_ifp.items():
for int_name, metadata_tuple in residue_ifp.items():
for metadata in metadata_tuple:
prot_atoms = ",".join([protein_mol.GetAtomWithIdx(x).GetMonomerInfo().GetName()
for x in metadata["parent_indices"]["protein"]])
print(" interaction =", (str(protres), int_name, prot_atoms.replace(" ", "")))
lig_atom_ids = [x for x in metadata["parent_indices"]["ligand"]]
for lig_atom_id in lig_atom_ids:
lig_atom_name = pose_iterable[i].GetAtomWithIdx(lig_atom_id).GetMonomerInfo().GetName()
pos = pose_iterable[i].GetConformer().GetAtomPosition(lig_atom_id)
print(" lig atom =", lig_atom_name, lig_atom_id, (pos.x, pos.y, pos.z))