def test_write_pymol_isoslider(self): # read in manually path = "testdata/hs_io/minimal_all_grids/out.zip" base = tempfile.mkdtemp() with zipfile.ZipFile(path) as hs_zip: hs_zip.extractall(base) base = os.path.join(base, "hotspot") interactions = ["donor", "acceptor", "apolar"] super_grids = {p: Grid.from_file(os.path.join(base, f"{p}.grd")) for p in interactions} superstar_grids = {p: Grid.from_file(os.path.join(base, f"superstar_{p}.grd")) for p in interactions} prot = Protein.from_file(os.path.join(base, "protein.pdb")) hr = Results(super_grids=super_grids, protein=prot, superstar=superstar_grids) hr.identifier = "hotspot" settings = HotspotWriter.Settings() settings.output_superstar = True writer = HotspotWriter("testdata/hs_io/minimal_all_grids", settings=settings) # we won't actually write writer.pymol_out.commands += writer._write_pymol_isosurfaces(hr.super_grids, "hotspot", "hotspot", "fhm") writer.pymol_out.commands += writer._write_pymol_isosurfaces(hr.superstar, "hotspot", "hotspot", "superstar") writer._write_pymol_isoslider(hr) writer.pymol_out.write("testdata/hs_io/minimal_all_grids/test_write_pymol_isoslider.py")
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])