schrodinger.application.bioluminate.ssv.viewer module

The simplified version of the sequence viewer used in the MSV.

Also provides access to the viewer as a QtWidgets.QMainWindow and as a QtWidgets.QDockWidget.

class schrodinger.application.bioluminate.ssv.viewer.SequenceDockWidget

Bases: PyQt5.QtWidgets.QDockWidget

The dock widget that can set a ViewerWindow as the main widget. This makes the ViewerWindow dockable.

CLOSABLE = 1
FLOATABLE = 4
MOVABLE = 2
WINDOW_TITLE = 'Sequence Viewer'
closeEvent(event)

Override the close event so that when the widget is floating clicking the close button will just dock it. This is a workaround since MacOSX does not have the float button when the panel is floating.

floatChange(floating=False)

Slot for callback that is fired when the dock’s floating status changes. Currently this only set the dock’s window title is it is floating.

setFloatable()

Configure the dock widget to only be able to pop out, not be draggable.

setFloatableMovable()

Configure the dock widget to be draggable and be able to pop out.

setFloatableMovableClosable()

Configure the dock widget to be draggable, be able to pop out and be closable.

class schrodinger.application.bioluminate.ssv.viewer.SimplifiedSequenceViewer(parent, toolbars=None, auto_align=False, require3d=True)

Bases: schrodinger.ui.sequencealignment.sequence_viewer.SequenceViewer

Creates a sequence viewer that can be opened by an action or added to a main window as a dockable item. Here is an example of how to add a dockable item to a QMainWindow, or AppFramework window:

from schrodinger.applications.bioluminate import sequence_viewer 

self.sequence_viewer = sequence_viewer.SimplifiedSequenceViewer(<window>)
self.addDockWidget(
    QtCore.Qt.TopDockWidgetArea,
    self.sequence_viewer.asDock()
)

If you want to add a button that will open the viewer in a new window:

from schrodinger.applications.bioluminate import sequence_viewer

self.sequence_viewer = sequence_viewer.SimplifiedSequenceViewer(<window>)
self.viewer_button   = QtWidgets.QPushButton(self.tr('Open Model Viewer...'))
self.viewer_button.clicked.connect(self.openSequenceViewer)

then in the connected method (openSequenceViewer):

self.sequence_viewer.window.show()
self.sequence_viewer.window.setFocus()

If you want to simply add a sequence viewer frame to your app:

self.sequence_viewer = SimplifiedSequenceViewer(<window>)
<layout>.addWidget( self.sequence_viewer.asFrame() )
FILES = 'files'
MANUAL_SEQUENCE = 'manual_sequence'
PDB_STRING = 'pdb_string'
PROJET_TABLE = 'projecttable'
WORKSPACE = 'workspace'
addAnnotationAction()
asDock()

Returns the viewer as a dock widget.

asFrame()

Returns the viewer as a frame widget

closeWindow()

Action for the “Close” button

createSequence(*args, **kwargs)
deleteByEntry(entry_ids)

Deletes rows in the sequence viewer that are associated with the passed in entry ids. If any rows are selected before this is called, they are retained.

deleteBySequences(sequences)

Deletes rows in the sequence viewer that are associated with the passed in sequences. If any rows are selected before this is called, they are retained.

dock_widget = None

Widget the allows C{self.window} to be dockable

enableMaestroSync()

Enables selection and color synchronization with Maestro

focusFinder()

Switch focus to Find Pattern input box.

generateSeqProjectRows(include_reference=True)

Create a generator for all sequences that have a project table row associated with them. Yields each sequence’s row from the PT.

Parameters:include_reference (bool) – Whether to include the reference seq
Returns:A generator that yields a schrodinger.project.ProjectRow
Return type:generator
generateSeqStructures(include_reference=True)

Create a generator for all sequences that have a project table row associated with them. Yields each sequence’s structure from the PT.

Parameters:include_reference (bool) – Whether to include the reference structure
Returns:A generator that yields a schrodinger.structure.Structure
Return type:generator
getReferenceStructure()

Gets the structure associated with the reference sequence from maestro’s PT. If there is no structure for the reference None is returned.

Return type:schrodinger.structure.Structure
getSeqStructure(sequence)

Get the structure associated with a Sequence.

Returns:A structure object if found otherwise None
Return type:None or structure
importFromFile(*args, **kwargs)
importFromFilePaths(filenames, to_maestro=True)

Import a list of filesnames into the sequence viewer.

Parameters:filenames (list of strings) – Filenames to be imported
importFromMaestro(method)
importFromPDB(*args, **kwargs)
importFromProjectTable(*args, **kwargs)
importFromWorkspace(*args, **kwargs)
last_sequences_imported = None

Stores the last sequences added to the viewer.

nameContextCallback(position, seq=None)

Callback used when context menus called for the view with the pdb name.

protein_sequences

Property for all sequences in the viewer that are valid proteins

Return type:list of sequences
selectOnlyByEntry(entry_ids)

Selects rows in the sequence viewer that are associated with the passed in entry ids.

selectOnlyBySeqs(sequences)

Selects rows in the sequence viewer that are associated with the passed in sequences.

Parameters:sequences (schrodinger.ui.sequencealignment.sequence.Sequence or list of them.) – Sequence or sequences to select in viewer
selected_sequences

Property returning all selected sequences in the viewer. This does not include a child sequence.

Return type:list of sequences
sequenceContextCallback(position, res=None)

Callback used when context menus called for the view with the sequences in it.

sequencesImported

Signal emitted after any structures have been imported by any means into the viewer. The string passed in the emit will be one of:

  • L{SimplifiedSequenceViewer.WORKSPACE}
  • L{SimplifiedSequenceViewer.PROJECT_TABLE}
  • L{SimplifiedSequenceViewer.PDB_STRING}
  • L{SimplifiedSequenceViewer.FILES}
setColorModeAction()
setupViewer()

Sets up the viewer’s window and context menus

structure_sequences

Property for all sequences in the viewer that have structures.

Return type:list of sequences
treeContextCallback(position, tree=None)

Callback used when context menus called for the tree view

class schrodinger.application.bioluminate.ssv.viewer.ViewerWindow(parent)

Bases: PyQt5.QtWidgets.QMainWindow

Provides the SimplifiedSequenceViewer with a window to occupy. This has the benefit of adding toolbars and allowing the sequence viewer (which is a QtWidgets.QSplitter) to be a stand-alone window.

ALIGN_TOOLBAR = 'align_toolbar'
ANTIBODY_NUM_TOOLBAR = 'antibody_numbering_toolbar'
BREAK_TOOLBAR = 'break_toolbar'
CONSENSUS_TOOLBAR = 'consensus_toolbar'
DEFAULT_TOOLBARS = ['import_toolbar', 'undo_redo_toolbar', 'find_toolbar', 'align_toolbar']
FIND_TOOLBAR = 'find_toolbar'
IMPORT_TOOLBAR = 'import_toolbar'
UNDO_REDO_TOOLBAR = 'undo_redo_toolbar'
WINDOW_TITLE = 'Sequence Viewer'
action_factory = None

The factory to use when creating actions. We want to set all the action’s parent to the passed in parent, which is a SequenceViewer. All of the actions associated with the viewer are the module, schrodinger.ui.sequencealignment.sequence_viewer.

addAlignToolBar(area=8)

Adds a toolbar to the area indicated (default: bottom) that contains all of the actions for alignment.

Parameters:area – The area to add the dock widget to
addAntibodyNumberingToolBar(area=8)

Add a AntibodyNumberingToolBar widget to the area indicated (default: bottom).

Parameters:area – The area to add the dock widget to
addConsensusToolBar(area=8)

Adds a ConsensusToolBar widget to the area indicated (default: bottom) that contains all of the actions for consensus visualization.

Parameters:area – The area to add the dock widget to
addFindToolBar(area=4)

Adds a FindToolBar widget to the area indicated (default: top).

Parameters:area – The area to add the dock widget to
addImportToolBar(area=4)

Adds an ImportToolBar widget to the area indicated (default: top).

Parameters:area – The area to add the dock widget to
addToolBars(toolbars)

Add toolbars to the sequence viewer. The toolbars arg should be a list of items taken from the ViewerWindow properties:

addUndoRedoToolBar(area=4)

Adds a widget that handles undo/redo operations to the area indicated (default: top).

Parameters:area – The area to add the dock widget to
removeToolBar(objname=None)

Overrides the base class’s QtWidgets.QMainWindow.removeToolBar method to allow for removal of a single toolbar based on the toolbar’s object name or, if objname is None, removal of all the window’s toolbars.

setAntibodyNumberingToolBarVisible(show=True)
setToolBars(toolbars)

Deletes all window toolbars and sets them to the new toolbars

schrodinger.application.bioluminate.ssv.viewer.catch_last_added(fn)

A decorator for action callbacks that deal with importing sequences into the sequence viewer. The decorator will add a last_sequences_added property to the class of the decorated method. This will store all sequences added to the viewer in the last import step.

This must decorate a class with a sequence_group property.