LigNetwork for molecules with more than 1 residue
I'm trying to visualize the interactions between a peptide ligand and a protein receptor with LigNetwork, but get "ValueError: No ring containing this atom index was found in the given molecule" when it's trying to find an atomindex in self._ring_info.AtomRings(). I think the issue is that _get_ring_centroid expects a "global" atom index, but _make_interactions gives a "local"/"residue" atom index. If i get rid of the residue name,-ids in the peptide ligand (w/ the 2 lines below l = u.atoms.select_atoms("segid B")) the code runs.
from prolif.plotting.network import LigNetwork import prolif as plf import MDAnalysis as mda from MDAnalysis.topology.guessers import guess_types
tp = 'AT1R-TRV026_from_TRV026-crystal_dh125.psf' tj = 'F1.nc'
u = mda.Universe(tp, tj) if not hasattr(u, "elements"): guessed_elements = guess_types(u.atoms.names) u.add_TopologyAttr('elements', guessed_elements)
l = u.atoms.select_atoms("segid B") #l.residues.resnames = np.array(["lig"]*len(l.residues.resnames)) #l.residues.resids = np.array([1]*len(l.residues.resids)) p = u.atoms.select_atoms("segid A") fp = plf.Fingerprint() fp.run(u.trajectory[::100], l, p) df = fp.to_dataframe(return_atoms=True)
lmol = plf.Molecule.from_mda(l)
pmol = plf.Molecule.from_mda(p)
net = LigNetwork.from_ifp(df, lmol,
kind="aggregate", threshold=.3,
rotation=270)
net.display()
100%|██████████| 6/6 [00:10<00:00, 1.67s/it]
/home/miska/anaconda3/envs/at2rt1/lib/python3.9/site-packages/pandas/core/algorithms.py:798: FutureWarning: In a future version, the Index constructor will not infer numeric dtypes when passed object-dtype sequences (matching Series behavior)
uniques = Index(uniques)
Traceback (most recent call last):
File "/home/miska/anaconda3/envs/at2rt1/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3369, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "
Ah yes, the LigNetwork plot was initially designed with ligands containing a single residue in mind, so the only way to make it work for peptides is indeed to regroup all the residues as a single one.
Will be fixed in release 2.0.0 coming soon