schrodinger.application.msv.gui.msv_widget module

class schrodinger.application.msv.gui.msv_widget.AbstractMsvWidget(parent=None, undo_stack=None, struc_model=None, aln=None, is_workspace=False)

Bases: PyQt5.QtWidgets.QWidget

Acts as a controller/container for a ProteinAlignment, the viewmodel proxy stacks that wrap it, and the views required to present these proxy stacks.

Each tab in the MSV contains a different instance of an MSV Widget.

Variables:
  • alignmentLengthChanged (QtCore.pyqtSignal) – A signal emitted when the widget’s alignment length is changed. Emits an int indicating the new number of sequences in the alignment.
  • seqWSVisibilityChanged (QtCore.pyqtSignal) – Signal emitted when sequences are shown or hidden in the Workspace. Emits a pair of ints. The first indicates the number of visible sequences in the Workspace, the second the number of hidden sequences in the Workspace.
  • selectedSeqsChanged – Emitted when the number of sequences containing selected residues changes. Emits an int indicating the number of sequences that contain selected residues.
  • importRequested – A signal emitted when the user clicks on the “Load sequences from FILE” button. The parent of this widget (i.e. msv_gui.MSVPanel) is responsible for opening a file dialog and importing any specified files.
addSeq(seq)

Adds a given sequence to the widget’s alignment

Parameters:seq (schrodinger.protein.sequence.ProteinSequence) – The sequence to add
addSeqs(seqs)

Add a list of seqs to the widget’s alignment

Parameters:seqs (list(schrodinger.protein.sequence.ProteinSequence)) – An list of seqs
alignmentLengthChanged
applyColorScheme(row_type, scheme)

Sets the color scheme for a given row type.

Parameters:
  • row_type – The type of row whose scheme is to be changed.
  • scheme – The color scheme to be applied.
Type:

schrodinger.application.msv.gui.viewconstants.RowType

Type:

schrodinger.application.msv.gui.color.RowColorScheme

applyColorsToWorkspace()

Update the colors in the workspace with colors from the MSV.

blastSelectedSeq()

Set selected sequence as reference sequence and open BLAST search dialog.

clear()
clearSelection()

Deselect all residues.

deleteSelectedResidues()

Delete selected residues from the alignment

deleteSelection()
getAlignment()

Returns the widget’s alignment instance

Return type:schrodinger.protein.alignment.BaseAlignment
Returns:The widget’s alignment
getColorScheme()
getPDB()

Opens GetPDB dialog. The PDB structures imported in Maestro will automatically be incorporated into MSV panel.

getReferenceSeq()

Helper function that returns the reference sequence.

Returns:reference sequence of the underlying alignment
Return type:Sequence
getResidueFormat()
Return type:schrodinger.application.msv.gui.viewconstants.ResidueFormat
Returns:An enum representing the residue display format in current use in the widget
getSelectedSequences()

Return a list of the currently selected sequences.

Returns:list of selected sequences
Return type:list of sequence.Sequence
getSequenceStatusInfo()

Return info about the status of the current alignment, including number of sequences in the alignment, number of sequences with selected residues, number of sequences visible in the Worksapce, and number of sequences hidden in theWorkspace.

Returns:4-tuple of (Number of sequences, number of selected sequences, number of sequences shown in Workspace, number of sequences hidden in Workspace)
Return type:4-tuple of (int, int, int, int)
getShownRowTypes()

Returns a list of enums representing the shown row types

Return type:list
Returns:A list of enums
groupedByType()

Indicates whether rows are grouped by type

Return type:bool
Returns:Whether the rows are currently grouped by type
importIncluded()

Import all sequences that are included in the Maestro workspace.

importRequested
importSelected()

Import all sequences that are selected in the Maestro project table.

isWorkspace()
Returns:Whether this widget contains an alignment that is always kept in sync with the Maestro workspace.
Return type:bool
classmethod moveItems(all_items, sel_items, direction)

Move the specified items in the specified direction.

Parameters:
  • all_items (list) – List of unique items.
  • sel_items (list) – Items to move; must be a subset of all_items.
  • direction (viewconstants.Direction) – Direction to move items.
Returns:

Reordered items

Return type:

list

Raises:

ValueError – Invalid value of direction or sel_items is not a subset of all_items.

moveSequences(seq_list, direction)

Move the specified sequences in the specified direction.

Parameters:
  • seq_list (Sequence) – Sequences to move
  • direction (viewconstants.Direction) – Direction to move items.
Raises:
  • ValueError – Invalid value of direction.
  • IndexErrorseq_list is not a subset of self.
onSequenceSelection(selection_info)

Respond to sequence selection changes.

Parameters:selection_info (list of schrodinger.protein.sequence.Sequence) – List of selected sequences
onWorkspaceColorsChanged()
openBlastSearchDialog()

Implement sequence-type-specific BLAST dialog in child classes

preserveExpansionState(*args, **kwds)

Context manager to preserve the expansion state of the sequences

profileScrolling()

Scroll the alignment while recording profiling data.

pullWorkspaceColors()

Update the current color scheme with colors from the workspace. This does not modify the options model.

redo()

Call redo on the undo stack

removeSelectedSeqs()

Remove the currently selected sequences from the alignment.

removeSeq(seq)

Remove a given sequence from the widget’s alignment

Parameters:seq (schrodinger.protein.sequence.ProteinSequence) – The sequence to add
replaceIDsWithDots()

Return whether or not dots should be drawn for columns of the same residue.

Returns:Whether or not dots should be drawn for columns of the same residue.
Return type:bool
resetUndoStack()

Reset the undo stack

This needs to be called when we perform an operation that gets tangled up with Maestro’s single step undo, so that permitting an undo from msv would result in data corruption.

rowWrap()

Indicates whether rows are currently wrapped

Return type:bool
Returns:Whether the rows are currently wrapped
runAlignment(aligner)
saveImage()

Saves multiple sequence alignment as an image file, by default, exports image of the entire alignment.

selectResForSeqs(seqs)

Select all residues in the alignment for the specified sequences

Parameters:seqs (list of sequence.Sequence) – List of sequences to select residues of
selectedSeqsChanged
seqWSVisibilityChanged
setAlignment(aln)
setLoadSequencesWidget(is_workspace=False)

Construct the load sequences widget and insert before the view widget.

setSelectedResColor(color)

Set the selected residues to the specified color

Parameters:color (QtGui.CColor) – Color to set the selected residues to
setSelectedSeqAsReference()

Set the selected sequence as the reference sequence. If more than one sequence is selected, no reference sequence will be set. Restore the expanded state of each sequence afterwards, because it will be reset after the reordering of the rows.

setSelectedSequences(seqs)

Set sequence selection to the specified sequences.

Parameters:seqs (list of schrodinger.protein.sequence.Sequence) – List of sequences to select
setShownRowTypes(row_types)
showColorSchemeEditor()
sortBy(key, reverse=False)

Sort the alignment by the specified criteria.

Parameters:
  • key (function) – A function that takes a seuqnece and returns a key to sort by for each sequence.
  • reverse – Whether to sort in reverse (descending) order.
timeScrolling()

Scroll the alignment and print how long it takes to the terminal.

undo()

Call undo on the undo stack

updateAnnotationVisibility(ann)

Update the visibility of an annotation

Parameters:ann (annotation.ProteinSequenceAnnotations.ANNOTATION_TYPES or annotation.ProteinAlignmentAnnotations.ANNOTATION_TYPES) – The annotation to show or hide
updateColorsEnabled()

Set whether to color all sequences from the preferences model

updateFontSize()

Change the font size to match the text size in the preferences model.

updateGroupAnnotationsByType()

Set the grouping option for annotations and sequences to be grouped by type or by sequence

updateIncludeGaps()

Set whether to include gaps from the preferences model.

updateReplaceIDsWithDots()

Set the identities to be displayed as dots or not.

updateResidueFormat()

Sets the residue format to be displayed as one letter, three letters or spaces.

updateRowWrap()

Set the row wrapping on the widget

updateSeqColorScheme()

Set the sequence color scheme from the preferences model.

warning(title, text, *args, **kwargs)

Create a warning messagebox.

See QMessageBox.warning for parameter documentation.

class schrodinger.application.msv.gui.msv_widget.MSVImageExportDialog(parent=None)

Bases: schrodinger.application.msv.gui.msv_widget._BaseMSVExportDialog

class schrodinger.application.msv.gui.msv_widget.MSVSequenceExportDialog(parent=None)

Bases: schrodinger.application.msv.gui.msv_widget._BaseMSVExportDialog

File dialog that offers options specific to exporting sequence information

Variables:
FASTA_FILTER = 'FASTA (*.fasta *.fst *.fas *.seq *.fa)'
TEXT_FILTER = 'Text (*)'
class schrodinger.application.msv.gui.msv_widget.ProteinAlignmentMsvWidget(parent=None, undo_stack=None, struc_model=None, aln=None, is_workspace=False)

Bases: schrodinger.application.msv.gui.msv_widget.AbstractMsvWidget

Variables:blastAddSequencesRequested (QtCore.pyqtSignal) – A signal emitted when BLAST results need to be incorporated into the alignment window. Emitted with a list of protein.ProteinSequence objects.
alignByResidueNumbers()
alignBySuperposition()

Align sequences by structure superposition.

The pairwise residue C-alpha distances are converted to a scoring matrix where a short distance is a high score and vice versa.

The reference sequence must have a structure. If no sequences are selected, all subsequent structured sequences will be aligned to the reference structure. Otherwise, only selected structured sequences will be aligned.

blastAddSequencesRequested
blast_results_dialog

Decorator that converts a method with a single self argument into a property cached on the instance.

Use del to delete the currently cached value and force a recalculation on the next access. See the tests for examples.

This class is based on code that is Copyright (c) Django Software Foundation

blast_search_dialog

Decorator that converts a method with a single self argument into a property cached on the instance.

Use del to delete the currently cached value and force a recalculation on the next access. See the tests for examples.

This class is based on code that is Copyright (c) Django Software Foundation

displayBlastResults(query_name=None, results=None)

Opens BLAST results dialog and optionally populates the results table. If the results are not specified, open the dialog with results of the previous search.

Parameters:results (list of dict) – List of hits passed from finished BLAST job.
displayErrorDialog(query_name, error_msg)

Displays an error message that includes the specific exception that triggered Blast search failure.

Parameters:
  • query_name (str) – name of the BLAST query sequence
  • error_msg (str) – the string representation of the Exception message
displayRemoteSearchDialog(error_msg, reference_seq, settings, genomes)

Displays a question dialog when Blast search fails locally and asks the user whether to try remote search.

Parameters:
  • error_msg (str) – the string representation of the Exception message
  • reference_seq (schrodinger.protein.sequence.ProteinSequence) – the current reference sequence to perform search on
  • settings (dict) – User-selected options from the Search dialog
  • genomes (list) – User-selected genomes to search through
exportSequences()

Exports sequences in FASTA format.

mergedPairwiseAlignment()

Runs a pairwise alignment while preserving query gaps.

movePattern(forward=True)

Scroll view to next or previous pattern instance.

Parameters:forward (bool) – whether to move pattern view forward
multipleAlignment()

Run multiple sequence alignment.

onBlastAddStructuresRequested(pdb_paths)

Add structures from BLAST to alignment.

Parameters:pdb_paths (list[str]) – List of PDB paths to incorporate
openBlastSearchDialog()

Opens Blast Search dialog.

pairwiseAlignment(merge=False)

Run pairwise sequence alignment using modified Smith-Waterman algorithm.

runStructureAlignment()

Runs protein structure alignment.

showDendrogram()

Displays and populates dendrogram viewer widget and dendrogram settings dialog.

startBlastSearch(reference_seq, settings, genomes)

Initializes a BlastJob object and runs the job based on the given settings and genomes to search through.

Parameters:
  • reference_seq (schrodinger.protein.sequence.ProteinSequence) – the current reference sequence to perform search on
  • settings (dict) – User-selected options from the Search dialog
  • genomes (list) – User-selected genomes to search through
superimposeStructures(show_panel=True)

Superimposes the workspace structures according to their sequence alignment in the MSV.

Parameters:show_panel (bool) – Whether to show the superimpose ASL panel