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
.
- 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.
- class schrodinger.application.bioluminate.ssv.viewer.SequenceDockWidget¶
Bases:
PyQt6.QtWidgets.QDockWidget
The dock widget that can set a
ViewerWindow
as the main widget. This makes the ViewerWindow dockable.- WINDOW_TITLE = 'Sequence Viewer'¶
- FLOATABLE = 4¶
- MOVABLE = 2¶
- CLOSABLE = 1¶
- __init__()¶
- 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.
- 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.
- class schrodinger.application.bioluminate.ssv.viewer.ViewerWindow(parent)¶
Bases:
PyQt6.QtWidgets.QMainWindow
Provides the
SimplifiedSequenceViewer
with a window to occupy. This has the benefit of adding toolbars and allowing the sequence viewer (which is aQtWidgets.QSplitter
) to be a stand-alone window.- WINDOW_TITLE = 'Sequence Viewer'¶
- IMPORT_TOOLBAR = 'import_toolbar'¶
- UNDO_REDO_TOOLBAR = 'undo_redo_toolbar'¶
- FIND_TOOLBAR = 'find_toolbar'¶
- ALIGN_TOOLBAR = 'align_toolbar'¶
- CONSENSUS_TOOLBAR = 'consensus_toolbar'¶
- ANTIBODY_NUM_TOOLBAR = 'antibody_numbering_toolbar'¶
- BREAK_TOOLBAR = 'break_toolbar'¶
- DEFAULT_TOOLBARS = ['import_toolbar', 'undo_redo_toolbar', 'find_toolbar', 'align_toolbar']¶
- __init__(parent)¶
- Parameters
parent (
SimplifiedSequenceViewer
) – The sequence viewer object that will use this window- Raises
RuntimeError – If
parent
is not correct type
- action_factory¶
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.
- 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, ifobjname
isNone
, removal of all the window’s toolbars.
- addToolBars(toolbars)¶
Add toolbars to the sequence viewer. The
toolbars
arg should be a list of items taken from theViewerWindow
properties:
- setToolBars(toolbars)¶
Deletes all window toolbars and sets them to the new
toolbars
- addImportToolBar(area=ToolBarArea.TopToolBarArea)¶
Adds an
ImportToolBar
widget to the area indicated (default: top).- Parameters
area – The area to add the dock widget to
- addUndoRedoToolBar(area=ToolBarArea.TopToolBarArea)¶
Adds a widget that handles undo/redo operations to the area indicated (default: top).
- Parameters
area – The area to add the dock widget to
- addFindToolBar(area=ToolBarArea.TopToolBarArea)¶
Adds a
FindToolBar
widget to the area indicated (default: top).- Parameters
area – The area to add the dock widget to
- addAlignToolBar(area=ToolBarArea.BottomToolBarArea)¶
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
- addConsensusToolBar(area=ToolBarArea.BottomToolBarArea)¶
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
- addAntibodyNumberingToolBar(area=ToolBarArea.BottomToolBarArea)¶
Add a
AntibodyNumberingToolBar
widget to the area indicated (default: bottom).- Parameters
area – The area to add the dock widget to
- setAntibodyNumberingToolBarVisible(show=True)¶
- 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() )
- WORKSPACE = 'workspace'¶
- PROJET_TABLE = 'projecttable'¶
- PDB_STRING = 'pdb_string'¶
- FILES = 'files'¶
- MANUAL_SEQUENCE = 'manual_sequence'¶
- 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:
SimplifiedSequenceViewer.PROJECT_TABLE
- __init__(parent, toolbars=None, auto_align=False, require3d=True)¶
- Parameters
parent – Parent widget of the sequence viewer
toolbars (list of strings) – A list of toolbar flags to use (see
ViewerWindow
for available toolbarsauto_align (boolean) – Whether to auto-align sequences when a new one is imported
require3d (boolean) – Whether to allow fasta sequence files to be imported. If set to True (default) only structures with 3D coordinates are allowed.
- See
- dock_widget¶
Widget the allows
self.window
to be dockable
- last_sequences_imported¶
Stores the last sequences added to the viewer.
- setupViewer()¶
Sets up the viewer’s window and context menus
- enableMaestroSync()¶
Enables selection and color synchronization with Maestro
- asDock()¶
Returns the viewer as a dock widget.
- asFrame()¶
Returns the viewer as a frame widget
- property protein_sequences¶
Property for all sequences in the viewer that are valid proteins
- Return type
list of
sequences
- property structure_sequences¶
Property for all sequences in the viewer that have structures.
- Return type
list of
sequences
- property selected_sequences¶
Property returning all selected sequences in the viewer. This does not include a child sequence.
- Return type
list of
sequences
- 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
- 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
- getSeqStructure(sequence)¶
Get the structure associated with a
Sequence
.- Returns
A structure object if found otherwise
None
- Return type
None
orstructure
- importFromPDB(*args, **kwargs)¶
- 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
- importFromWorkspace(*args, **kwargs)¶
- importFromProjectTable(*args, **kwargs)¶
- createSequence(*args, **kwargs)¶
Creates a new sequence and adds it to the sequence group.
- addAnnotationAction()¶
- setColorModeAction()¶
- focusFinder()¶
Switch focus to Find Pattern input box.
- nameContextCallback(position, seq=None)¶
Callback used when context menus called for the view with the pdb name.
- sequenceContextCallback(position, res=None)¶
Callback used when context menus called for the view with the sequences in it.
- treeContextCallback(position, tree=None)¶
Callback used when context menus called for the tree view
- 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
- 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.
- importFromMaestro(method)¶
- closeWindow()¶
Action for the “Close” button