Skip to content

The same atom typer for receptor and ligand #124

@Jalil-Mahdizadeh

Description

@Jalil-Mahdizadeh

Hi,
I'm trying to generate simple grids for receltor's binding site and it's ligand.
I realized that while I've set "defaultGninaReceptorTyper", the receptor's grid has been generated according to the "defaultGninaLigandTyper".
I'm using molgrid v0.5.1 installed by pip.

import molgrid
from molgrid.openbabel import pybel as pybel
import torch

with open('lig.sdf', 'r') as f:
    lig_content = f.read()

lig = pybel.readstring('sdf', lig_content)
lig_coords = molgrid.CoordinateSet(lig)
lig_center = lig_coords.center() # This is the ligand center

lig_gmaker = molgrid.GridMaker()

lig_dims = lig_gmaker.grid_dimensions(molgrid.defaultGninaLigandTyper.num_types())
lig_gridtensor = torch.zeros(lig_dims, dtype=torch.float32)

lig_gmaker.forward(lig_center, lig_coords, lig_gridtensor)
print("Generated ligand grid shape:", lig_gridtensor.shape)

######################################################################################################

with open('rec.pdb', 'r') as f:
    rec_content = f.read()

rec = pybel.readstring('pdb', rec_content)
rec_coords = molgrid.CoordinateSet(rec)
rec_center = rec_coords.center() # This is the receptor center

recp_gmaker = molgrid.GridMaker()

rec_dims = recp_gmaker.grid_dimensions(molgrid.defaultGninaReceptorTyper.num_types())
rec_gridtensor = torch.zeros(rec_dims, dtype=torch.float32)

recp_gmaker.forward(lig_center, rec_coords, rec_gridtensor)
print("Generated receptor grid shape:", rec_gridtensor.shape)

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