Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

3D visualization issue (occasionally happen) after using protein helper function #304

Copy link
Copy link
@yuyuan871111

Description

@yuyuan871111
Issue body actions

Hi

I tried to use the protein helper function and found this.
I have two options for reading protein with a protein helper. Both work for fingerprint calculation and 2D visualization, yielding identical results. However, I can only visualize the results from "option 1" in a 3D plot. The other will lead to an error "unkekulize mol".

The test data is here: https://github.com/yuyuan871111/GSoC2025_Hbond_PM/tree/main/test_data/5da9__1__1.A_1.B__1.E_1.F

# prolif version
pip install git+https://github.com/chemosim-lab/ProLIF.git@gsoc_implicit_hbond
import os

import prolif as plf
from prolif import sdf_supplier
from prolif.io.protein_helper import ProteinHelper
from prolif.molecule import Molecule
from rdkit import Chem

protein_helper = ProteinHelper(
    templates=[
        {
            "MSE": {"SMILES": "C[Se]CC[CH](N)C=O"},
        }
    ]
)

test_case_dir = "./test_data/5da9__1__1.A_1.B__1.E_1.F"

# Option 1 for reading protein:
protein_mol = Molecule.from_rdkit(
    Chem.MolFromPDBFile(
        f"{test_case_dir}/receptor_protonated.pdb",
        sanitize=False,
        removeHs=False,
        proximityBonding=True,
    )
)
protein_mol = protein_helper.standardize_protein(protein_mol)

# Option 2 for reading protein:
protein_mol = protein_helper.standardize_protein(
    f"{test_case_dir}/receptor_protonated.pdb"
)

# ligand
ligands = []
for ligand_sdf in os.listdir(test_case_dir):  # noqa: PTH208
    if ligand_sdf.endswith("_protonated.sdf"):
        ligands.extend(sdf_supplier(f"{test_case_dir}/{ligand_sdf}"))

ligand = ligands[0]

fp = plf.Fingerprint(["HBDonor", "HBAcceptor"], count=True)
fp.run_from_iterable([ligand], protein_mol, progress=False)
df = fp.to_dataframe().T

Result for options 1 and 2:
Image

view = fp.plot_lignetwork(ligand, kind="frame", frame=0, display_all=False)
view

Result for options 1 and 2:
Image

view = fp.plot_3d(ligand, protein_mol, frame=0, display_all=True)
view

Result for option 1:
Image

Result for option 2:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.