Ejemplo n.º 1
0
        def test_viewer_with_poses(self, local_dir=workdir):

            pdbfiles = glob.glob(os.path.join(local_dir, "*.pdb"))
            packed_poses = [io.pose_from_file(pdbfile) for pdbfile in pdbfiles]
            poses = [io.to_pose(p) for p in packed_poses]
            viewer.presets.coreBoundarySurface(packed_poses, delay=0)
            viewer.presets.ligandsAndMetals(packed_poses,
                                            continuous_update=True,
                                            window_size=(100., 100.))
            modules = [
                viewer.setBackgroundColor("grey"),
                viewer.setStyle(style="sphere",
                                colorscheme="greenCarbon",
                                radius=1.)
            ]
            view = sum([viewer.init(poses)] + modules)
            view()
            self.assertEqual(view.poses, poses)
            self.assertEqual(len(view.modules), 2)
            view.reinit()
            self.assertEqual(view.poses, poses)
            self.assertEqual(len(view.modules), 0)
            view.modules = modules
            self.assertEqual(len(view.modules), len(modules))
            view.reset()
            self.assertIsNone(view.poses)
            self.assertIsNone(view.pdbstrings)
            view = viewer.init(poses, modules=modules)
            self.assertEqual(len(view.modules), len(modules))
            view.reset()
            self.assertIsNone(view.modules)
Ejemplo n.º 2
0
def ligandsAndMetals(packed_and_poses_and_pdbs=None, *args, **kwargs):
    """
    Display residues with ResidueProperty.LIGAND as 'brownCarbon' sticks with opaque surface,
    and ResidueProperty.METAL as 'chainHetatm' spheres, with 'spectrum' cartoon representation,
    disulfide bonds, polar hydrogens, and dashed hydrogen bonds.

    @klimaj
    """
    metals_selector = pyrosetta.rosetta.core.select.residue_selector.ResiduePropertySelector(
        pyrosetta.rosetta.core.chemical.ResidueProperty(31))
    ligands_selector = pyrosetta.rosetta.core.select.residue_selector.ResiduePropertySelector(
        pyrosetta.rosetta.core.chemical.ResidueProperty(2))

    view = viewer.init(packed_and_poses_and_pdbs=packed_and_poses_and_pdbs, *args, **kwargs) \
        + viewer.setBackgroundColor("lightgrey") \
        + viewer.setStyle(style="stick", colorscheme="lightgreyCarbon", radius=0.15) \
        + viewer.setStyle(residue_selector=ligands_selector, style="stick", colorscheme="brownCarbon", radius=0.5, label=True) \
        + viewer.setStyle(residue_selector=metals_selector, style="sphere", colorscheme="chainHetatm", radius=1.5, label=True) \
        + viewer.setHydrogenBonds() \
        + viewer.setDisulfides(radius=0.15) \
        + viewer.setHydrogens(color="white", radius=0.033, polar_only=True) \
        + viewer.setSurface(residue_selector=ligands_selector, surface_type="VDW", opacity=0.5, colorscheme="brownCarbon") \
        + viewer.setZoomTo(residue_selector=ligands_selector)

    return view()
Ejemplo n.º 3
0
def templatePreset(packed_and_poses_and_pdbs=None, *args, **kwargs):
    """
    Add a description of the preset Viewer here

    @author
    """
    view = viewer.init(packed_and_poses_and_pdbs=packed_and_poses_and_pdbs,
                       *args,
                       **kwargs)

    # Add custom Viewer commands here

    return view()
Ejemplo n.º 4
0
        def test_viewer_with_pdbfiles(self, local_dir=workdir):

            pdbfiles = glob.glob(os.path.join(local_dir, "*.pdb"))
            viewer.presets.coreBoundarySurface(pdbfiles,
                                               continuous_update=True)
            viewer.presets.ligandsAndMetals(pdbfiles,
                                            window_size=(200.01, 200.01))
            view = viewer.init(pdbfiles, (1600, 400), delay=0.1234567890) \
                + viewer.setBackgroundColor("black") \
                + viewer.setStyle(style="line", colorscheme="blueCarbon")
            view.show()
            self.assertEqual(view.poses, [None] * len(pdbfiles))
            self.assertEqual(len(view.modules), 2)
            view.reinit()
            self.assertEqual(view.poses, [None] * len(pdbfiles))
            self.assertEqual(len(view.modules), 0)
            view.reset()
            self.assertIsNone(view.poses)
            self.assertIsNone(view.pdbstrings)
Ejemplo n.º 5
0
def coreBoundarySurface(packed_and_poses_and_pdbs=None, *args, **kwargs):
    """
    Display core residues as 'blackCarbon' sticks, boundary residues as 'greyCarbon' sticks, and surface residues
    as 'whiteCarbon' sticks, with 'spectrum' cartoon representation, using the default arguments in
    pyrosetta.rosetta.core.select.residue_selector.LayerSelector() to select layers.

    @klimaj
    """
    core_selector = pyrosetta.rosetta.core.select.residue_selector.LayerSelector(
    )
    core_selector.set_layers(True, False, False)
    boundary_selector = pyrosetta.rosetta.core.select.residue_selector.LayerSelector(
    )
    boundary_selector.set_layers(False, True, False)
    surface_selector = pyrosetta.rosetta.core.select.residue_selector.LayerSelector(
    )
    surface_selector.set_layers(False, False, True)

    view = viewer.init(packed_and_poses_and_pdbs=packed_and_poses_and_pdbs,
                       *args,
                       **kwargs)
    view.add(viewer.setStyle())
    view.add(
        viewer.setStyle(residue_selector=core_selector,
                        style="stick",
                        colorscheme="blackCarbon",
                        radius=0.25,
                        label=False))
    view.add(
        viewer.setStyle(residue_selector=boundary_selector,
                        style="stick",
                        colorscheme="greyCarbon",
                        radius=0.25,
                        label=False))
    view.add(
        viewer.setStyle(residue_selector=surface_selector,
                        style="stick",
                        colorscheme="whiteCarbon",
                        radius=0.25,
                        label=False))
    view.add(viewer.setDisulfides(radius=0.25))

    return view.show()