def hot_calc(inputs): pdb, het, pdir = inputs p = Protein.from_file(os.path.join(pdir, f"{pdb}.pdb")) mol = MoleculeReader(os.path.join(pdir, f"{pdb}_{het}.mol2"))[0] runner = Runner() hr = runner.from_protein(p, nprocesses=3, cavities=mol) for p, g in hr.super_grids.items(): hr.super_grids[p] = g.max_value_of_neighbours() # with HotspotReader(os.path.join(pdir, "out.zip")) as r: # hr = [h for h in r.read() if h.identifier == "hotspot"][0] e = Extractor(hr) bv = e.extract_volume(volume=250) # smoothing for p, g in bv.super_grids.items(): bv.super_grids[p] = g.gaussian(sigma=0.5) bv.identifier = "bestvol" hr.identifier = "hotspot" with HotspotWriter(pdir) as w: w.write([hr, bv])
def calc_hotspot(path, prot_name, method, nrot=3000): """ param: path str, path to prepared protein """ protein = prepare_protein(path) h = Runner() settings = h.Settings() settings.nrotations = nrot settings.apolar_translation_threshold = 15 settings.polar_translation_threshold = 15 settings.sphere_maps = False result = h.from_protein(protein=protein, charged_probes=False, probe_size=7, buriedness_method=method, cavities=None, nprocesses=3, settings=settings) #out = make_savedir(prot_name) out = os.getcwd() with hs_io.HotspotWriter(out, visualisation="pymol", grid_extension=".ccp4", zip_results=False) as writer: writer.write(result) return result
def run(self): prot = Protein.from_file(self.input().path) mol = io.MoleculeReader('ligands/{}.sdf'.format(self.pdb))[0] h = Runner() s = h.Settings() s.apolar_translation_threshold = 15 s.polar_translation_threshold = 15 s.polar_contributions = False s.sphere_maps = True s.nrotations = 3000 hr = h.from_protein(prot, buriedness_method='ghecom', nprocesses=1, settings=s, cavities=mol) out_settings = HotspotWriter.Settings() out_settings.charged = False w = HotspotWriter(os.path.dirname(self.output().path), grid_extension=".grd", zip_results=True, settings=out_settings) w.write(hr)
def run_hotspot_calculation(self, method="ghecom", sphere_maps=False): """ Runs the hotspots calculation on the specified PDB structure :return: """ h = Runner() settings = h.Settings() settings.nrotations = self.number_rotations settings.apolar_translation_threshold = 15 settings.polar_translation_threshold = 15 settings.sphere_maps = sphere_maps result = h.from_protein(protein=self.prepare_protein(), charged_probes=self.charged, probe_size=7, buriedness_method=method, cavities=None, nprocesses=1, settings=settings) #self.out_dir = self.make_savedir() # Save and zip the SuperStar Grids: self._save_superstar_grids(h) # Save and zip the Results with hs_io.HotspotWriter(self.out_dir, visualisation="pymol", grid_extension=".ccp4", zip_results=True) as writer: writer.write(result)
def run(self, cavity=True): """from fragment hotspot calc from protein""" h = Runner() settings = Runner.Settings(sphere_maps=False) if self.args.prepare is True: self.prepare_protein() else: self.prot = Protein.from_file(self.args.prot_fname) if cavity is True: cavs = Cavity.from_pdb_file(self.args.prot_fname) print(cavs) else: cavs = None result = h.from_protein(protein=self.prot, charged_probes=False, buriedness_method=self.args.buriedness_method, cavities=cavs, nprocesses=5, settings=settings) with HotspotWriter(path=self.in_dir, zip_results=self.args.zipped) as writer: writer.write(result)
def run_hotspot_calculation(self, method="ghecom"): """ Runs the hotspots calculation on the specified PDB structure :return: """ h = Runner() settings = h.Settings() settings.nrotations = self.number_rotations settings.apolar_translation_threshold = 15 settings.polar_translation_threshold = 15 settings.sphere_maps = self.spheres # Check if SuperStar and Ghecom have already been run. super_archive_path = Path(self.out_dir.parent, "superstar_grids.zip") if super_archive_path.exists(): super_tmp_path = Path(self.out_dir.parent, super_archive_path.stem) if not super_tmp_path.exists(): super_tmp_path.mkdir() unpack_archive(super_archive_path, super_tmp_path, 'zip') b_grid = Grid.from_file( str(Path(super_tmp_path, 'buriedness.ccp4').resolve())) result = h.from_superstar( protein=self.prepare_protein(), superstar_grids=self.create_atomic_hotspots(super_tmp_path), buriedness=b_grid, charged_probes=self.charged, settings=settings, clear_tmp=True) rmtree(super_tmp_path) else: result = h.from_protein(protein=self.prepare_protein(), charged_probes=self.charged, probe_size=7, buriedness_method=method, cavities=None, nprocesses=1, settings=settings) # Save and zip the SuperStar Grids: self._save_superstar_grids(h) # Save and zip the Results with hs_io.HotspotWriter(str(self.out_dir.resolve()), visualisation="pymol", grid_extension=".ccp4", zip_results=True) as writer: writer.write(result) print(f"out_file: {str(Path(self.out_dir, 'out.zip').resolve())}") return Path(self.out_dir, 'out.zip')
def run_hotspot_calculation(self, nrot=100000, method="ghecom", charged=True, sphere_maps=False, save_ligand=True): """ Runs the hotspots calculation on the specified PDB structure :return: """ if not self.out_dir: self.out_dir = self.make_savedir() if not self.protein_path: self.protein_path = self.find_protein() protein = self.prepare_protein() else: protein = Protein.from_file(self.protein_path) if save_ligand: self.extract_ligands() # log the run parameters self.log_runner(nrot) h = Runner() settings = h.Settings() settings.nrotations = nrot settings.apolar_translation_threshold = 15 settings.polar_translation_threshold = 15 settings.sphere_maps = sphere_maps result = h.from_protein(protein=protein, charged_probes=charged, probe_size=7, buriedness_method=method, cavities=None, nprocesses=5, settings=settings) #self.out_dir = self.make_savedir() # Save and zip the SuperStar Grids: self._save_superstar_grids(h) # Save and zip the Results with hs_io.HotspotWriter(self.out_dir, visualisation="pymol", grid_extension=".ccp4", zip_results=True) as writer: writer.write(result)
def get_hotspot(protein): """ generate hotspot result and time :param protein: :return: """ start = time.time() r = Runner() settings = Runner.Settings() settings.rotations = 3000 settings.sphere_maps = False result = r.from_protein(protein=protein, charged_probes=False, nprocesses=3, cavities=None, settings=settings ) return result, time.time() - start
def calc(args): prot_file, hotspot_file = args prot = Protein.from_file(prot_file) # pre prepared runner = Runner() settings = Runner.Settings() settings.apolar_translation_threshold = 8 settings.polar_translation_threshold = 10 # pdb = os.path.basename(prot_file)[0][:4] # # mol_path = os.path.join(os.path.dirname(prot_file)) hr = runner.from_protein(prot, nprocesses=3, settings=settings, probe_size=3) for p, g in hr.super_grids.items(): hr.super_grids[p] = g.dilate_by_atom() try: e = Extractor(hr) bv = e.extract_volume(volume=250) except: bv = Results( protein=hr.protein.copy(), super_grids={p: g.copy() for p, g in hr.super_grids.items()}) hr.identifier = "hotspot" bv.identifier = "bcv" with HotspotWriter(hotspot_file) as w: w.write([hr, bv])
def run(self): prot = Protein.from_file(self.input().path) cavs = Cavity.from_pdb_file(self.input().path) h = Runner() s = h.Settings() s.apolar_translation_threshold = 15 s.polar_translation_threshold = 15 s.polar_contributions = False s.nrotations = 1000 hr = h.from_protein(prot, buriedness_method='ghecom', nprocesses=1, settings=s, cavities=cavs) out_settings = HotspotWriter.Settings() out_settings.charged = False w = HotspotWriter(os.path.dirname(self.output().path), grid_extension=".grd", zip_results=True, settings=out_settings) w.write(hr)
p.remove_ligand(l.identifier) p.add_hydrogens() h = Runner() # hotspot calculation settings s = h.Settings() s.apolar_translation_threshold = 15 s.polar_translation_threshold = 15 s.polar_contributions = False s.nrotations = 3000 s.sphere_maps = True hr = h.from_protein(protein=p, charged_probes=False, buriedness_method='ghecom', nprocesses=3, settings=s, cavities=None) out_settings = HotspotWriter.Settings() out_settings.charged = False out = os.path.join(out_dir, p.identifier) if not os.path.exists(out): os.mkdir(out) with HotspotWriter(out, grid_extension=".grd", zip_results=True, settings=out_settings) as w: w.write(hr)