PyRosetta (3) Viewer

PyRosetta (3): Viewer

Introduction

The pyrosetta.distributed Viewer quickly renders .pdb files, dynamically instantiating Pose objects if required for certain visualization modules (viewer.set*).

So when adding visualization modules to the Viewer or using presets, passing Pose or PackedPose objects to the Viewer is suggested for quicker rendering.

If a Pose object or list, tuple, or set of Pose objects are provided to the Viewer, the Viewer will dynamically update upon Pose conformational changes by calling the view.show() method or equivalently view().

The Viewer applies visualization modules in the same order they are added (from left to right), so layering different styles (and ResidueSelectors) on top of one another becomes possible.

WARNING: pyrosetta.distributed.viewerruns in a Jupyter notebook.

Initialization & load

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
!pip install pyrosettacolabsetup
import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()
import pyrosetta;
pyrosetta.init()

import glob
import logging
logging.basicConfig(level=logging.INFO)
import numpy as np
import os
import pyrosetta
import pyrosetta.distributed
import pyrosetta.distributed.io as io
import pyrosetta.distributed.viewer as viewer
import sys
1
my_pose = pyrosetta.io.pose_from_file("inputs/3EK4.pdb")

Configuring ditributedfor visualizing ligands and non-canonical residues

The user must have already initialized PyRosetta providing .params for any ligands and non-canonical residues in the input Poseobjects /PackedPoseobjects/.pdb files.

Otherwise pyrosetta.distributed automatically initializes PyRosetta with default command line options.

E.g.:

1
2
3
4
5
6
7
flags = """
-auto_setup_metals 1
-detect_disulf 1
"""
# Display metal: True
# Display disulfide bonds: True
pyrosetta.distributed.init(flags)

Instantiation of distributed.viewer

1
2
view = viewer.init(pose, window_size=(800, 600))
view()

distributed.viewer methods

The pyrosetta.distributed Viewer quickly renders .pdb files, dynamically instantiating Pose objects if required for certain visualization modules (viewer.set*).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# All Available `viewer` objects:
viewer.__all__

'''
>>>
['expand_notebook',
'init',
'presets',
'setBackgroundColor',
'setDisulfides',
'setHydrogenBonds',
'setHydrogens',
'setStyle',
'setSurface',
'setZoom',
'setZoomTo']

'''
  1. visualization modules: viewer.set*
  2. visualization presets: viewer.presets
1
2
viewer.presets.__all__
# >>> ['coreBoundarySurface', 'ligandsAndMetals']
  1. pyrosetta.distributed.viewer.expand_notebook() expands the Jupyter notebook cell width to fit your internet browser
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2024-2025 Michael Lau
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信