Case 2: Compare structures using ImplicitHBDonor and ImplicitHBAcceptor#
In this example, you will learn how to compare the hydrogen bond interactions between experimental and computational structures without adding explicit hydrogens.
Here, we explore the hydrogen bond interactions between RNA and protein.
Import required packages and protein helper#
import gemmi
import MDAnalysis as mda
import prolif as plf
from MDAnalysis.analysis import align
from prolif.io.cif import cif_template_reader
from prolif.io.protein_helper import ProteinHelper
/home/yuyang/Project_local/GSoC2025_Hbond_PM/.venv/lib/python3.11/site-packages/MDAnalysis/topology/tables.py:52: DeprecationWarning: Deprecated in version 2.8.0
MDAnalysis.topology.tables has been moved to MDAnalysis.guesser.tables. This import point will be removed in MDAnalysis version 3.0.0
warnings.warn(wmsg, category=DeprecationWarning)
Besides using SMILES string, we provide an alternative way (cif format) to load the templates.
protein_helper = ProteinHelper(
[
{"ZN": {"SMILES": "[Zn++]"}},
cif_template_reader("./test_data/templates/A.cif"),
cif_template_reader("./test_data/templates/U.cif"),
cif_template_reader("./test_data/templates/C.cif"),
cif_template_reader("./test_data/templates/G.cif"),
]
)
Experimental structure#
Let’s split our system. We group protein and waters together as our “protein” and the rest of molecules as our “ligand”.
u = mda.Universe("./test_data/8aw3.pdb")
u.select_atoms("protein or water").write("./test_data/8aw3_protein.pdb")
u.select_atoms("not protein and not water").write("./test_data/8aw3_ligand.pdb")
/home/yuyang/Project_local/GSoC2025_Hbond_PM/.venv/lib/python3.11/site-packages/MDAnalysis/coordinates/PDB.py:453: UserWarning: 1 A^3 CRYST1 record, this is usually a placeholder. Unit cell dimensions will be set to None.
warnings.warn("1 A^3 CRYST1 record,"
/home/yuyang/Project_local/GSoC2025_Hbond_PM/.venv/lib/python3.11/site-packages/MDAnalysis/coordinates/PDB.py:777: UserWarning: Unit cell dimensions not found. CRYST1 record set to unitary values.
warnings.warn("Unit cell dimensions not found. "
/home/yuyang/Project_local/GSoC2025_Hbond_PM/.venv/lib/python3.11/site-packages/MDAnalysis/coordinates/PDB.py:1154: UserWarning: Found no information for attr: 'formalcharges' Using default value of '0'
warnings.warn("Found no information for attr: '{}'"
Then, we use ProteinHelper to read the pdb file. Now, more warnings are generated due to some atoms missing in the topology. It sometimes happens in the experimental structure because of low resolution for some regions. If those residues are not close to the ligand-binding site, it should be fine.
protein_mol = protein_helper.standardize_protein("./test_data/8aw3_protein.pdb")
/home/yuyang/Project_local/GSoC2025_Hbond_PM/.venv/lib/python3.11/site-packages/prolif/io/protein_helper.py:161: UserWarning: Could not guess the forcefield based on the residue names. CYS is assigned to neutral CYS (charge = 0).
standardized_resname = self.convert_to_standard_resname(
/tmp/ipykernel_2402188/3138374702.py:1: UserWarning: Residue ARG217.2 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
protein_mol = protein_helper.standardize_protein("./test_data/8aw3_protein.pdb")
/tmp/ipykernel_2402188/3138374702.py:1: UserWarning: Residue ARG219.2 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
protein_mol = protein_helper.standardize_protein("./test_data/8aw3_protein.pdb")
/tmp/ipykernel_2402188/3138374702.py:1: UserWarning: Residue ASP221.2 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
protein_mol = protein_helper.standardize_protein("./test_data/8aw3_protein.pdb")
/tmp/ipykernel_2402188/3138374702.py:1: UserWarning: Residue CYS242.3 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
protein_mol = protein_helper.standardize_protein("./test_data/8aw3_protein.pdb")
/tmp/ipykernel_2402188/3138374702.py:1: UserWarning: Residue ARG243.3 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
protein_mol = protein_helper.standardize_protein("./test_data/8aw3_protein.pdb")
/tmp/ipykernel_2402188/3138374702.py:1: UserWarning: Residue LYS244.3 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
protein_mol = protein_helper.standardize_protein("./test_data/8aw3_protein.pdb")
/tmp/ipykernel_2402188/3138374702.py:1: UserWarning: Residue PHE310.3 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
protein_mol = protein_helper.standardize_protein("./test_data/8aw3_protein.pdb")
protein_mol.residues.__len__() # a check for the length of residues
456
A check for the residues’ bond orders.
plf.display_residues(protein_mol, slice(0, 20), sanitize=False)
Similar method to read the ligand. Some similar warnings are triggered.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G2.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C3.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C4.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G5.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C6.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U7.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U8.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A9.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G10.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C11.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A12.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C13.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A14.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G15.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U16.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G18.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G19.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C20.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A21.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G22.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U23.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G24.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C25.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A26.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C27.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C28.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A29.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C30.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U31.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C32.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U33.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C34.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G35.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U36.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A37.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A38.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A39.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G40.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U41.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G42.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G43.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G44.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G45.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G46.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U47.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C48.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G49.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C50.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G51.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A52.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G53.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U54.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U55.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C56.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G57.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A58.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U59.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U60.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C61.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U62.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C63.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G64.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C65.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue A66.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G67.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U68.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G69.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue G70.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C71.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C72.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue U73.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
/tmp/ipykernel_2402188/2173832818.py:1: UserWarning: Residue C74.1 has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand = protein_helper.standardize_protein("./test_data/8aw3_ligand.pdb")
A check with your ligand’s residues (here, for RNA: A, U, C, G).
plf.display_residues(ligand, slice(0, 12), sanitize=False)
Let’s calculate the hydrogen bond interactions.
fp = plf.Fingerprint(["ImplicitHBDonor", "ImplicitHBAcceptor"], count=True)
fp.run_from_iterable([ligand], protein_mol, progress=False)
df = fp.to_dataframe().T
df
| Frame | 0 | ||
|---|---|---|---|
| ligand | protein | interaction | |
| C30.1 | LYS218.2 | ImplicitHBAcceptor | 1 |
| C32.1 | ARG159.2 | ImplicitHBAcceptor | 1 |
| U33.1 | CYS155.2 | ImplicitHBAcceptor | 1 |
| ASN157.2 | ImplicitHBDonor | 2 | |
| ImplicitHBAcceptor | 1 | ||
| GLN202.2 | ImplicitHBAcceptor | 1 | |
| C34.1 | GLU134.2 | ImplicitHBDonor | 1 |
| ASN157.2 | ImplicitHBDonor | 1 | |
| ImplicitHBAcceptor | 1 | ||
| TYR205.2 | ImplicitHBAcceptor | 1 | |
| G35.1 | ARG207.2 | ImplicitHBDonor | 1 |
| U36.1 | ARG302.3 | ImplicitHBAcceptor | 1 |
| A37.1 | ASN211.2 | ImplicitHBDonor | 1 |
Here is the 3D visualization.
view = fp.plot_3d(ligand, protein_mol, frame=0, display_all=True)
view.setStyle(
{
"resn": "HOH",
},
{"sphere": {"radius": 0.5, "color": "red"}},
)
view
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
<prolif.plotting.complex3d.Complex3D at 0x7f51b4c18410>
Computational structure#
Next, we move to the AlphaFold-predicted structure (by AlphaFold3). It is noted that the computational structure is in cif format, which is not supported by MDAnalysis 2.9.0 (could be supported in the future version). Thus, we currently read it via gemmi and converted it into pdb format.
structure = gemmi.read_structure("./test_data/examplefold_pdb_8aw3_model_0.cif")
structure.write_pdb("./test_data/examplefold_pdb_8aw3_model_0.pdb")
Then, we read the file with MDAnalysis and split into “protein” and “ligand”. We align the computational structure with the experimental structure, which is optional. We do this for better comparison when using 3D plot.
u_comp = mda.Universe("./test_data/examplefold_pdb_8aw3_model_0.pdb")
# align the structure to the reference using MDAnalysis
# (not affect the calculation of fingerprint)
align.alignto(u_comp, u, select="backbone and name CA and resid 183-221")
u_comp.select_atoms("protein or water").write(
"./test_data/examplefold_pdb_8aw3_model_0_protein.pdb"
)
u_comp.select_atoms("not protein and not water").write(
"./test_data/examplefold_pdb_8aw3_model_0_ligand.pdb"
)
Next, read it with ProteinHelper.
protein_mol_comp = protein_helper.standardize_protein(
"./test_data/examplefold_pdb_8aw3_model_0_protein.pdb"
)
ligand_comp = protein_helper.standardize_protein(
"./test_data/examplefold_pdb_8aw3_model_0_ligand.pdb"
)
/home/yuyang/Project_local/GSoC2025_Hbond_PM/.venv/lib/python3.11/site-packages/prolif/io/protein_helper.py:161: UserWarning: Could not guess the forcefield based on the residue names. CYS is assigned to neutral CYS (charge = 0).
standardized_resname = self.convert_to_standard_resname(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G2.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C3.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C4.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G5.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C6.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U7.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U8.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A9.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G10.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C11.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A12.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C13.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A14.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G15.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U16.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G17.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G18.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C19.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A20.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G21.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U22.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G23.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C24.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A25.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C26.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C27.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A28.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C29.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U30.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C31.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U32.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C33.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G34.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U35.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A36.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A37.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A38.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G39.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U40.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G41.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G42.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G43.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G44.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G45.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U46.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C47.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G48.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C49.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G50.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A51.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G52.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U53.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U54.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C55.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G56.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A57.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U58.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U59.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C60.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U61.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C62.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G63.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C64.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A65.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G66.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U67.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G68.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue G69.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C70.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C71.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue U72.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C73.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue C74.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
/tmp/ipykernel_2342266/4063688772.py:4: UserWarning: Residue A75.E has a different number of heavy atoms than the standard residue. This may affect H-bond detection.
ligand_comp = protein_helper.standardize_protein(
A check for the “protein”.
plf.display_residues(protein_mol_comp, slice(0, 12), sanitize=False)
A check for the “ligand”.
plf.display_residues(ligand_comp, slice(0, 12), sanitize=False)
Finally, we calculate the hydrogen bond interactions for the computational structure.
fp_comp = plf.Fingerprint(["ImplicitHBDonor", "ImplicitHBAcceptor"], count=True)
fp_comp.run_from_iterable([ligand_comp], protein_mol_comp, progress=False)
df_comp = fp_comp.to_dataframe().T
The results are shown below.
df_comp
| Frame | 0 | ||
|---|---|---|---|
| ligand | protein | interaction | |
| U32.E | TYR205.A | ImplicitHBDonor | 1 |
| G34.E | ASN82.A | ImplicitHBAcceptor | 1 |
| GLU208.A | ImplicitHBDonor | 1 | |
| ASN209.A | ImplicitHBDonor | 2 | |
| A37.E | LYS216.A | ImplicitHBAcceptor | 1 |
| ASN335.B | ImplicitHBDonor | 1 | |
| HIS336.B | ImplicitHBAcceptor | 1 |
view_comp = fp_comp.plot_3d(ligand_comp, protein_mol_comp, frame=0, display_all=True)
view_comp.setStyle(
{
"resn": "HOH",
},
{"sphere": {"radius": 0.5, "color": "red"}},
)
view_comp
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
<prolif.plotting.complex3d.Complex3D at 0x7fe0c9ed5f90>
Comparison#
After the calculation, we now can compare two structures together. The easiest way is to create two Complex3D objects and visualize them at the same time.
# create Complex3D objects
comp3D = fp.plot_3d(ligand, protein_mol, frame=0)
other_comp3D = fp_comp.plot_3d(ligand_comp, protein_mol_comp, frame=0)
# compare the two Complex3D objects
view = comp3D.compare(other_comp3D, display_all=True, remove_hydrogens=False)
view
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
<prolif.plotting.complex3d.Complex3D at 0x7fe0c9e51f90>