def shrink_to_mols(self, mols): """Reduces the grid size to be just large enough to contain all mol objects in mol""" blank_grd = Grid.initalise_grid( [a.coordinates for l in mols for a in l.atoms]) for probe, g in self.super_grids.items(): self.super_grids[probe] = Grid.shrink(blank_grd, g)
def augmentation(hr, hits): # create a grid which can contain all pharmacophore poses small_blank = Grid.initalise_grid(coords={ atm.coordinates for mol in hits.hits for atm in mol.molecule.heavy_atoms }, padding=3) # dilate the grids for p, g in hr.super_grids.items(): hr.super_grids[p] = g.dilate_by_atom() # inflate prot_g = Grid.initalise_grid( [a.coordinates for a in hr.protein.heavy_atoms], padding=1) for p, g in hr.super_grids.items(): hr.super_grids[p] = prot_g.common_boundaries(g) # shrink hotspot maps to save time sub_grids = { p: Grid.shrink(small=small_blank, big=g) for p, g in hr.super_grids.items() } # create single grid mask_dic, sg = Grid.get_single_grid(sub_grids) hr.super_grids = mask_dic # set background to 1 hr.set_background() hr.normalize_to_max() return hr
def testscore_atoms_as_spheres(self): with PushDir("testdata/result/data"): mols = [m for m in MoleculeReader("gold_docking_poses.sdf")] # create a grid which can contain all docking poses small_blank = Grid.initalise_grid(coords={ atm.coordinates for mol in mols for atm in mol.heavy_atoms }, padding=2) # read hotspot maps with HotspotReader(path="out.zip") as r: self.result = r.read() # dilate the grids for p, g in self.result.super_grids.items(): self.result.super_grids[p] = g.dilate_by_atom() # shrink hotspot maps to save time sub_grids = { p: Grid.shrink(small=small_blank, big=g) for p, g in self.result.super_grids.items() } # create single grid mask_dic, sg = Grid.get_single_grid(sub_grids) self.result.super_grids = mask_dic # set background to 1 self.result.set_background() self.result.normalize_to_max() print([g.extrema for p, g in self.result.super_grids.items()]) for m in mols[:1]: s = self.result.score_atoms_as_spheres(m, small_blank) print(s)
def augmentation(hr, entries): # create a grid which can contain all docking poses coords = set() for i, entry in enumerate(entries): for atm in entry.molecule.heavy_atoms: coords.add(atm.coordinates) if i > 100: break small_blank = Grid.initalise_grid(coords=coords, padding=12) # dilate the grids # for p, g in hr.super_grids.items(): # hr.super_grids[p] = g.dilate_by_atom() # inflate prot_g = Grid.initalise_grid( [a.coordinates for a in hr.protein.heavy_atoms], padding=1) for p, g in hr.super_grids.items(): hr.super_grids[p] = prot_g.common_boundaries(g) # shrink hotspot maps to save time sub_grids = { p: Grid.shrink(small=small_blank, big=g) for p, g in hr.super_grids.items() } # create single grid mask_dic, sg = Grid.get_single_grid(sub_grids) hr.super_grids = mask_dic # set background to 1 hr.set_background() hr.normalize_to_max() return hr