schrodinger.application.msv.gui.viewmodel module¶
-
class
schrodinger.application.msv.gui.viewmodel.
AlignmentInfoProxyModel
(parent=None)¶ Bases:
schrodinger.application.msv.gui.viewmodel.BaseAdjacentAlignmentProxyModel
A proxy model that contains sequence info for an alignment.
-
Column
¶ alias of
AlignmentInfoColumns
-
ROLES_FROM_PROXY
= set([0, 1, <CustomRole.FixedColFontRole: 282>, 3, 7])¶
-
ROLES_FROM_SOURCE
= set([<CustomRole.Included: 272>, <CustomRole.RowType: 257>, <CustomRole.BackgroundSelectionBrush: 260>, <CustomRole.Seq: 262>, 6, <CustomRole.RowHeightScale: 285>, <CustomRole.ReferenceSequence: 271>])¶
-
flags
(index)¶
-
getAlignment
()¶ Return the underlying alignment
Returns: The alignment if the source model exists; else None Return type: schrodinger.protein.alignment.BaseAlignment
-
getTitleColumnWidth
()¶ Return the width of the longest title currently shown, including both sequence titles and annotation names
Return type: int Returns: The length of the longest title currently shown
-
orderChanged
¶
-
-
class
schrodinger.application.msv.gui.viewmodel.
AlignmentMetricsFilterProxy
(parent=None, options_model=None)¶ Bases:
schrodinger.ui.qt.table_speed_up.MultipleRolesRoleProxyPassthroughMixin
,schrodinger.application.msv.gui.viewmodel.GroupExpansionProxyMixin
,PyQt5.QtCore.QSortFilterProxyModel
A filter proxy that displays or hides alignment metric columns.
-
filterAcceptsColumn
(source_column, source_parent)¶ See Qt documentation for method documentation.
-
rowHeightChanged
¶
-
setOptionsModel
(options_model)¶ Set the options model for the proxy, which are used for row filtering.
Parameters: options_model ( schrodinger.application.msv.gui.preferences. OptionsModel
) – The widget options.
-
setSourceModel
(model)¶
-
textSizeChanged
¶
-
-
class
schrodinger.application.msv.gui.viewmodel.
AlignmentMetricsProxyModel
(include_gaps=False, parent=None)¶ Bases:
schrodinger.application.msv.gui.viewmodel.BaseAdjacentAlignmentProxyModel
A proxy model that contains the alignment metrics, such as percentage of identity, similarity, homology and score to the reference sequence.
-
Column
¶ alias of
AlignmentMetricsColumns
-
getIncludeGaps
()¶ Returns: Whether to include gaps. Return type: bool
-
setIncludeGaps
(include_gaps)¶ Parameters: include_gaps (bool) – Whether to include gaps in alignment
-
-
class
schrodinger.application.msv.gui.viewmodel.
AnnotationProxyModel
(parent=None)¶ Bases:
schrodinger.ui.qt.table_speed_up.MultipleRolesRoleProxyMixin
,schrodinger.application.msv.gui.viewmodel.ProxyMixin
,schrodinger.application.msv.gui.viewmodel.NestedProxy
A proxy model that creates children rows for currently displayed annotations and adds a spacer row in between sequences. This proxy can be toggled between grouping rows by sequence and grouping rows by annotation.
Variables: - groupExpansionChanged (
QtCore.pyqtSignal
) –A signal emitted when group expansion is changed. Emitted with:
- A list of all indices to be expanded or collapsed.
- True if the indices should be expanded. False if they should be collapsed.
- groupByChanged (
QtCore.pyqtSignal
) – A signal emitted when the model is toggled between group-by-sequence and group-by-annotation. Emitted with the new group-by setting (GroupBy
). - _all_global_ann (
enum.Enum
or list) – An enum containing all global annotations present in the alignment. If no source model has been set, is an empty list. - _all_seq_ann (
enum.Enum
or list) – An enum containing all sequence annotations present in the alignment. If no source model has been set, is an empty list. - _all_structureless_seq_ann (list) – All sequence annotations present in the alignment that don’t require a structure.
- _shown_global_ann (list) – A list of all global annotations that are currently displayed. Annotations are listed in the order that they are displayed.
- _shown_row_types (set) – A set of all global and sequence annotations that are currently displayed.
- _group_by (
GroupBy
) – Whether the table is currently grouped by sequence or by annotation. - _seq_info (list) – A list of sequences in the table. Each sequence is
represented by a
SequenceInfo
object. TheSequenceInfo.has_struc
values are always populated for each sequence. TheSequenceInfo.ann
values are only populated when the table is grouped by sequence. They areNone
when the table is grouped by annotation. - _group_by_ann_info (list) – A list of annotations currently displayed in the
table. Each annotation is represented by a
GroupByAnnotationInfo
object. This value is only populated when the table is grouped by annotation. It isNone
when the table is grouped by sequence. - _group_by_ann_seq_nums – A
SequenceInfo
object containing sequence numbers for the annotations that do and do not require a structure. Note that theGroupByAnnotationInfo.seqs
values in_group_by_ann_info
point to the sequence number lists in this object. As such, sequence numbers for all annotations can be updated by updating this object. This value is only populated when the table is grouped by annotation. It isNone
when the table is grouped by sequence.
-
columnCount
(parent=None)¶
-
data
(proxy_index, role=0, multiple_roles=None)¶
-
endInsertColumns
()¶
-
endRemoveColumns
()¶
-
flags
(index)¶ See Qt documentation for additional method documentation
Everything is selectable except for spacers
-
getGroupBy
()¶ Are the rows currently grouped by sequence or by annotation type?
Returns: The current setting Return type: GroupBy
-
getShownRowTypes
()¶ Return a set of allowed annotation types
Returns: A set of annotation types. Note that the returned value is a copy of the attribute variable, so modifying it will not have any effect on this proxy. Return type: set
-
groupByChanged
¶
-
groupExpansionChanged
¶
-
mapFromSource
(source_index)¶
-
mapToSource
(proxy_index)¶
-
reorderRow
(proxy_from_row, proxy_to_row)¶ Pass the reorderRow request down to the next proxy after translating the row numbers. We override
PostReorderingProxyMixin.reorderRow
so we can handle drops on annotation rows appropriately. (Drops on an annotation row are treated as a drop after the sequence.)See
ReorderingProxyModel.reorderRow
for documentation on arguments and the return value.
-
rowCount
(parent=None)¶
-
setData
(proxy_index, value, role=2)¶
-
setGroupBy
(group_by)¶ Should the rows be grouped by sequence or by annotation type?
Parameters: group_by ( GroupBy
) – The setting to apply
-
setShownRowTypes
(row_types)¶ Allow only the specified annotations
Parameters: row_types (iter) – An iterable containing the annotations to allow
-
setSourceModel
(model)¶
-
setVisibilityForRowType
(row_type, show=True)¶ Toggle visibility for the specified annotation
Parameters: - row_type (
enum.Enum
) – The annotation to adjust - show (bool) – Whether the annotation should be shown or hidden
- row_type (
- groupExpansionChanged (
-
class
schrodinger.application.msv.gui.viewmodel.
BaseAdjacentAlignmentProxyModel
(parent=None)¶ Bases:
schrodinger.ui.qt.table_speed_up.MultipleRolesRoleProxyMixin
,schrodinger.application.msv.gui.viewmodel.GroupExpansionProxyMixin
,schrodinger.application.msv.gui.viewmodel.NestedProxy
A base proxy model to be subclassed by other proxy models that show data related to and synchronized with an alignment but in separate, adjacent views.
Variables: ROLES_FROM_SOURCE (set) – Set of data roles to query from the source model. -
Column
= None¶
-
FONT_SCALE
= 1.25¶
-
ROLES_FROM_PROXY
= set([0, <CustomRole.FixedColFontRole: 282>, 3, 7])¶
-
ROLES_FROM_SOURCE
= set([<CustomRole.RowType: 257>, <CustomRole.BackgroundSelectionBrush: 260>, 6, <CustomRole.Seq: 262>, <CustomRole.ReferenceSequence: 271>, <CustomRole.RowHeightScale: 285>])¶
-
columnCount
(parent=None)¶
-
data
(proxy_index, role=0, multiple_roles=None)¶
-
isWorkspaceAln
()¶ Returns: Whether this model represents the workspace alignment. Return type: bool
-
mapFromSource
(source_index)¶
-
mapToSource
(proxy_index)¶
-
rowCount
(parent=None)¶
-
rowHeightChanged
¶
-
setSourceModel
(model)¶
-
textSizeChanged
¶
-
updateData
(role, source_row)¶ Update a specified index when data changes.
Parameters: - role (
enum.Enum
) – Role of the data that changed. - source_row (int) – Index of the source model index to update.
- role (
-
-
class
schrodinger.application.msv.gui.viewmodel.
ExportProxyModel
(*args, **kwargs)¶ Bases:
schrodinger.application.msv.gui.viewmodel.PostStyleProxyMixin
,PyQt5.QtCore.QIdentityProxyModel
A proxy for use when generating a static image of the table.
-
tableWidthChanged
(*args, **kwargs)¶ Ignore changes in the table size rather than trying to update row wrapping.
-
-
class
schrodinger.application.msv.gui.viewmodel.
FixedColumn
(title, tooltip=None, role=None, fmt=None, all_rows=False, align=132)¶ Bases:
schrodinger.ui.qt.table_helper.Column
A table column that is fixed on the left or right of the scrollable columns. This object is intended to be used in the
table_helper.TableColumns
enum.
-
class
schrodinger.application.msv.gui.viewmodel.
GroupByAnnotationInfo
(ann, seq_numbers)¶ Bases:
object
Information about a sequence annotation. Used in
AnnotationProxyModel
.
-
class
schrodinger.application.msv.gui.viewmodel.
GroupExpansionProxyMixin
¶ Bases:
object
A mixin for tree models that transmit group expansion information to their view. Used in both the fixed and scrollable columns.
-
groupByChanged
¶
-
groupExpansionChanged
¶
-
setSourceModel
(model)¶
-
-
class
schrodinger.application.msv.gui.viewmodel.
NestedProxy
¶ Bases:
PyQt5.QtCore.QAbstractProxyModel
A base class for proxy models that contain one level of nesting. The internal ID of indices will be either
TOP_LEVEL
or the row number of the parent row.Variables: TOP_LEVEL (int) – The internal ID to use for indices that are at the top level of the table. (Internal ID is an unsigned 32-bit integer according to Qt’s QModelIndex documentation.) -
TOP_LEVEL
= 4294967295¶
-
buddy
(index)¶
-
hasChildren
(parent)¶
-
index
(row, column, parent=None)¶
-
parent
(index)¶
-
-
class
schrodinger.application.msv.gui.viewmodel.
NonNestedProxy
(parent=None)¶ Bases:
PyQt5.QtCore.QAbstractProxyModel
A base class for proxy models that don’t contain any nesting (i.e. that use a flat data structure).
-
index
(row, column, parent=None)¶
-
parent
(child)¶
-
resetCountCache
()¶ Resets the values cached for row and colum counts.
We cache row and column counts in order to avoid going through the C++ layer unnecessarily.
-
-
class
schrodinger.application.msv.gui.viewmodel.
PostAnnotationProxyMixin
(*args, **kwargs)¶ Bases:
schrodinger.application.msv.gui.viewmodel.GroupExpansionProxyMixin
,schrodinger.application.msv.gui.viewmodel.ProxyMixin
A mixin for all proxies that are used after the
AnnotationProxyModel
.-
getShownRowTypes
()¶ See
AnnotationProxyModel.getShownRowTypes
for method documentation.
-
-
class
schrodinger.application.msv.gui.viewmodel.
PostStyleProxyMixin
(*args, **kwargs)¶ Bases:
schrodinger.application.msv.gui.viewmodel.PostAnnotationProxyMixin
A mixin for all proxies that are used after the
AnnotationProxyModel
.-
setSourceModel
(model)¶
-
textSizeChanged
¶
-
-
class
schrodinger.application.msv.gui.viewmodel.
ProxyMixin
(*args, **kwargs)¶ Bases:
schrodinger.ui.qt.table_speed_up.MultipleRolesRoleProxyPassthroughMixin
A mixin class that provides functionality common to all the proxies.
We also cache the sourceModel to avoid going through the C++ layer.
Note that this mixin should be listed first in the parents for the proxy classes that use it.
Variables: fixedColumnDataChanged ( QtCore.pyqtSignal
emitting a tuple of (enum.Enum
, int)) – Signal emitted when the data in a fixed column is changed. Passes a tuple of the role and row index that are changing.-
clearSelection
()¶
-
fixedColumnDataChanged
¶
-
getAlignment
()¶ Return the underlying alignment
Returns: The alignment if the source model exists; else None Return type: schrodinger.protein.alignment.BaseAlignment
-
getIndexForRes
(res)¶ Get the model index for the given residue.
Parameters: res (schrodinger.protein.residue.Residue) – A residue Returns: The model index of the residue Return type: QModelIndex
-
getResidueDisplayMode
()¶ Return the current residue display mode setting.
Returns: The current residue display mode. Return type: enum.Enum
-
isWorkspaceAln
()¶ Returns: Whether this model represents the workspace alignment. Return type: bool
-
reorderRow
(proxy_from_row, proxy_to_row)¶ Pass the reorderRow request down to the next proxy after translating the row numbers.
See
ReorderingProxyModel.reorderRow
for documentation on arguments and the return value.
-
residueFormatChanged
¶
-
rowHeightChanged
¶
-
setSelectionState
(selection, selected)¶ Mark the residues specified by
selection
as either selected or deselected.Parameters: - selection (QtCore.QItemSelection) – A selection containing the entries to update.
- selected (bool) – Whether the entries should be selected (True) or deselected (False).
-
setSourceModel
(model)¶
-
sourceModel
()¶ We override this and return the cached source model so that we avoid going through the C++ layer
-
-
class
schrodinger.application.msv.gui.viewmodel.
RowWrapInsertingChildRows
(source_parent_row, source_start, source_end)¶ Bases:
object
An object to store
RowWrapProxyModel
bookkeeping for the insertion of child rows.Variables: - source_parent_row (int) – The row number of the top-level row that the child rows are being inserted into.
- source_start (int) – The row number of the first row being inserted.
- source_start – The row number of the last row being inserted.
- num_new_rows (int) – The number of rows being inserted.
- wrap (int) – The wrap of
RowWrapProxyModel
that rows were just inserted into - seeRowWrapProxyModel._sourceRowsAboutToBeInserted
.
-
class
schrodinger.application.msv.gui.viewmodel.
RowWrapInsertingRows
(old_source_row_count, new_source_row_count, source_start, source_end)¶ Bases:
object
An object to store
RowWrapProxyModel
bookkeeping for the insertion of top-level rows.Variables: - old_source_row_count (int) – The number of rows in the source model before the insertion.
- new_source_row_count (int) – The number of rows in the source model after the insertion.
- source_start (int) – The row number of the first row being inserted.
- source_start – The row number of the last row being inserted.
- num_new_rows (int) – The number of rows being inserted.
- wrap (int) – The wrap of
RowWrapProxyModel
that rows were just inserted into - seeRowWrapProxyModel._sourceRowsAboutToBeInserted
. - update_row_num (int) – The row number of
RowWrapProxyModel
that was just updated; i.e., that just had child rows inserted into it - seeRowWrapProxyModel._sourceRowsInserted
.
-
class
schrodinger.application.msv.gui.viewmodel.
RowWrapProxyModel
(parent=None)¶ Bases:
schrodinger.application.msv.gui.viewmodel.PostAnnotationProxyMixin
,schrodinger.application.msv.gui.viewmodel.NestedProxy
A proxy model that wraps rows to a specified column count. A blank spacer row will be inserted between each wrap. (Note that there’s no spacer row before the first wrap or after the last wrap.)
Variables: - _width – The current width of the table view, measured in number of columns. The is the width that this proxy will wrap to.
- _source_column_count (int) – The current number of columns in this proxy’s source model.
- _column_count (int) – The current number of columns in this proxy.
- _wrap_count (int) – The number of times the rows are wrapped to fit within
_width
columns. - _top_level_row_count (int) – The current number of top-level row in this proxy (i.e. excluding children rows).
- _source_child_row_counts (list) – The number of child rows for each top-level row of the source model. Note that the length of this list is always equal to the number of top-level rows in the source model.
- _inserting_rows (
RowWrapInsertingRows
or NoneType) – If we’re in the process of inserting top-level rows into the model, this will be aRowWrapInsertingRows
object describing the insertion. Will be None at all other times. - _updating_inserted_rows (
RowWrapInsertingRows
or NoneType) – If we’re in the process of updating top-level rows that were just inserted into the model, this will be aRowWrapInsertingRows
object describing the updating. Will be None at all other times. - _inserting_child_rows (
RowWrapInsertingChildRows
or NoneType) – If we’re in the process of inserting child rows into the model, this will be aRowWrapInsertingChildRows
object describing the insertion. Will be None at all other times. - _removing_rows (
RowWrapRemovingRows
or NoneType) – If we’re in the process of removing top-level rows from the model, this will be aRowWrapRemovingRows
object describing the removal. Will be None at all other times. - _removing_child_rows (
RowWrapRemovingChildRows
or NoneType) – If we’re in the process of removing child rows from the model, this will be aRowWrapRemovingChildRows
object describing the removal. Will be None at all other times.
-
columnCount
(parent=None)¶
-
data
(index, role=0, multiple_roles=None)¶
-
headerData
(section, orientation, role=0)¶
-
mapFromSource
(source_index)¶
-
mapToSource
(proxy_index)¶
-
rowCount
(parent=None)¶
-
setSourceModel
(model)¶
-
tableWidthChanged
(width)¶ Wrap the table to the specified number of columns.
Parameters: width (int) – The number of columns to wrap to.
-
class
schrodinger.application.msv.gui.viewmodel.
RowWrapRemovingChildRows
(source_parent_row, source_start, source_end)¶ Bases:
object
An object to store
RowWrapProxyModel
bookkeeping for the removal of child rows.Variables: - source_parent_row (int) – The row number of the top-level row that the child rows are being removed from.
- source_start (int) – The row number of the first row being removed.
- source_start – The row number of the last row being removed.
- num_rem_rows – The number of rows being removed.
- wrap (int) – The wrap of
RowWrapProxyModel
that rows were just removed from - seeRowWrapProxyModel._sourceRowsAboutToBeRemoved
.
-
class
schrodinger.application.msv.gui.viewmodel.
RowWrapRemovingRows
(old_source_row_count, new_source_row_count, source_start, source_end)¶ Bases:
object
An object to store
RowWrapProxyModel
bookkeeping for the removal of top-level rows.Variables: - old_source_row_count (int) – The number of rows in the source model before the removal.
- new_source_row_count (int) – The number of rows in the source model after the removal.
- source_start (int) – The row number of the first row being removed.
- source_start – The row number of the last row being removed.
- num_rem_rows – The number of rows being removed.
- wrap (int) – The wrap of
RowWrapProxyModel
that rows were just removed from - seeRowWrapProxyModel._sourceRowsAboutToBeRemoved
.
-
class
schrodinger.application.msv.gui.viewmodel.
SequenceAlignmentModel
(parent=None, options_model=None, display_mode=<Format.one_letter: 1>, include_gaps=False)¶ Bases:
schrodinger.ui.qt.table_speed_up.MultipleRolesRoleModelMixin
,schrodinger.ui.qt.table_helper.RowBasedTableModel
A QTable model where each row corresponds to a sequence and each column corresponds to a residue position
Variables: - fixedColumnDataChanged (
QtCore.pyqtSignal
emitting a tuple of (enum.Enum
, int)) – Signal emitted when the data in a fixed column is changed. Passes a tuple of the role and row index that are changing. - rowHeightChanged (
QtCore.pyqtSignal
) – Signal emitted when the height of a row is changed is changed.
-
aln
¶ An alias for the table model’s _rows attribute
-
annotationTypes
()¶ Get the current annotation types
Returns: A tuple of: - The global annotation enum - The sequence annotation enum Return type: tuple
-
clearSelection
()¶
-
columnCount
(parent=None)¶
-
emitLayoutAboutToBeChanged
()¶ Emit a layoutAboutToBeChanged signal. This helper makes disconnecting from the signal easier.
-
emitLayoutChanged
()¶ Emit a layoutChanged signal. This helper makes disconnecting easier.
-
fixedColumnDataChanged
¶
-
flags
(index)¶ See Qt documentation for method documentation
-
getAlignment
()¶ Return the underlying alignment object
Returns: The alignment Return type: schrodinger.protein.alignment.BaseAlignment
-
getIDDispMode
()¶ Are the identities shown as residues or dots?
Returns: The current setting Return type: IdentityDisplayMode
-
getIndexForRes
(res)¶ Get the model index for the given residue.
Parameters: res (schrodinger.protein.residue.Residue) – A residue Returns: The model index of the residue Return type: QModelIndex
-
getResidueDisplayMode
()¶ Return type: ResidueFormat Returns: The residue display mode in current use
-
headerData
(section, orientation, role=0)¶
-
isWorkspaceAln
()¶ Returns: Whether this model represents the workspace alignment. Return type: bool
-
onSelectionChanged
(selected, deselected)¶ Update the view appropriately when residue selection has been changed
Parameters: - selected (iterable of
schrodinger.protein.residue.Residue
) – The residues who have been newly selected - deselected (iterable of
schrodinger.protein.residue.Residue
) – The residues who have been newly deselected
- selected (iterable of
-
resetAnnotation
(ann)¶
-
residueFormatChanged
¶
-
rowCount
(parent=None)¶
-
rowHeightChanged
¶
-
sequenceCount
()¶ Return type: int Returns: The number of sequences in the alignment
-
sequencesReordered
¶
-
setAlignment
(aln)¶ Set the alignment model to display data from
Parameters: alignment ( schrodinger.protein.alignment.BaseAlignment
) – The alignment model
-
setIDDispMode
(id_disp_mode)¶ Should the identities be shown as residues or dots?
Parameters: id_disp_mode ( IdentityDisplayMode
) – The setting to apply
-
setOptionsModel
(options_model)¶ Set the options model for the model, which is used to know what antibody cdr scheme to display
Parameters: options_model ( schrodinger.application.msv.gui.preferences. OptionsModel
) – The widget options.
-
setResidueDisplayMode
(mode)¶ Parameters: mode (ResidueFormat) – The display mode for residue text
-
setSelectionState
(selection, selected)¶ Mark the residues specified by
selection
as either selected or deselected.Parameters: - selection (
QtCore.QItemSelection
) – A selection containing the entries to update. - selected (bool) – Whether the entries should be selected (True) or deselected (False).
- selection (
-
strucTitles
()¶ Get all structure titles
Returns: A list containing all structure titles Return type: list
- fixedColumnDataChanged (
-
class
schrodinger.application.msv.gui.viewmodel.
SequenceInfo
(has_struc=None, anns=None)¶ Bases:
object
Information about a single sequence. Used in
AnnotationProxyModel
.
-
class
schrodinger.application.msv.gui.viewmodel.
SequenceNums
(all, structured_only)¶ Bases:
tuple
-
all
¶ Alias for field number 0
-
structured_only
¶ Alias for field number 1
-
-
schrodinger.application.msv.gui.viewmodel.
ToggleProxyModel
¶ alias of
ToggleProxyModelCachingLayer
-
class
schrodinger.application.msv.gui.viewmodel.
ToggleProxyModelCachingLayer
(*args, **kwargs)¶ Bases:
schrodinger.ui.qt.table_speed_up.FlagCacheProxyMixin
,schrodinger.application.msv.gui.viewmodel._ToggleProxyModel
-
flags
(index)¶ This proxy caches flags per-row instead of per-cell (which is what
table_speed_up.FlagCacheProxyMixin
does) since flags are the same across rows here.See Qt for additional method documentation.
-
-
class
schrodinger.application.msv.gui.viewmodel.
ViewModel
(parent, options_model)¶ Bases:
PyQt5.QtCore.QObject
An abstraction layer for the various table models in this module
Variables: orderChanged ( QtCore.pyqtSignal
) – A signal emitted when the sorting or row reodering (due to drag-and-drop) has changed. Emitted with the new seq indices.-
orderChanged
¶
-
rowWrap
()¶ Return the current row wrapping setting.
Returns: True if the rows are wrapped. False otherwise. Return type: bool
-
setIncludeGaps
(include_gaps)¶ Enable or disable gap including. Gap inclusion only affects whether gaps are used when calculating metrics.
Parameters: include_gaps (bool) – True if gaps should be included, false otherwise.
-
setRowWrap
(enabled)¶ Enable or disabled row wrapping.
Parameters: enabled (bool) – True if rows should be wrapped. False otherwise.
-