-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
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)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels