Hide an interaction/specific residue inclusively? #176
-
I found this as part of the protein-ligand tutorial but it's for the dataframe
Is there a way to not include an interaction that's part of 2 separate categories such as hide all VDW interactions between ligand and residue 209? Still show other types of interaction with 209 and other VDW interactions with other residues. I was just wondering if there's a way to implement this in pandas and the 2D/3D lignetwork. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
For the dataframe only you can pass a list of tuples of columns to drop e.g. df.drop([("LIG1", "ALA209", "VdWContact")], axis=1) So you need to specify the 3 levels (ligand, protein residue, and interaction type) for each residue and interaction that you want to hide. For the lignetwork, there's no direct way of doing that, but you can directly play with the # save
fp.to_pickle("fingerprint.pkl")
# setup things to clean
to_cleanup = [
("LIG1.G", "TYR38.A", "Hydrophobic"),
("LIG1.G", "TYR38.A", "VdWContact"),
]
# start cleanup
df = fp.to_dataframe()
for lig, residue, interaction in to_cleanup:
# locate all frames with this combination
frames = df.index[df.loc[:, (lig, residue, interaction)]]
for frame in frames:
# delete interaction from registry
del fp.ifp[frame][(lig, residue)][interaction] It will affect both |
Beta Was this translation helpful? Give feedback.
For the dataframe only you can pass a list of tuples of columns to drop e.g.
So you need to specify the 3 levels (ligand, protein residue, and interaction type) for each residue and interaction that you want to hide.
For the lignetwork, there's no direct way of doing that, but you can directly play with the
fp.ifp
object which stores the data (make sure to save the fingerprint as a pickle file first):