コード例 #1
0
    def test_write_pymol_isosurfaces(self):
        # test out.zip prepared, generate minimal pymol commands to test isosurface gen code
        settings = HotspotWriter.Settings()
        writer = HotspotWriter("testdata/hs_io/minimal_all_grids", settings=settings)  # we won't actually write

        # pymol file initialised in the writer init function, therefore the unzip code is already in place
        writer.pymol_out.commands += writer._write_pymol_isosurfaces({"apolar": None, "donor": None, "acceptor": None},
                                                                     "hotspot",
                                                                     "hotspot",
                                                                     "fhm")

        writer.pymol_out.commands += writer._write_pymol_isosurfaces({"apolar": None, "donor": None, "acceptor": None},
                                                                     "hotspot",
                                                                     "hotspot",
                                                                     "superstar")

        writer.pymol_out.write("testdata/hs_io/minimal_all_grids/test_write_pymol_isosurfaces.py")
コード例 #2
0
    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")