schrodinger.application.msv.structure_model module

exception schrodinger.application.msv.structure_model.RenumberResiduesError[source]

Bases: ValueError

__init__(*args, **kwargs)
args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.msv.structure_model.AbstractStructureModel(*args, **kwargs)[source]

Bases: PyQt5.QtCore.QObject

Manages interactions between sequences and their associated structures. A separate AbstractStructureModel subclass should be created for each program MSV can run alongside of (i.e. Maestro, PyMol, standalone). For programs with a workspace, this class also maintains the workspace alignment, which contains sequences for all structures currently included in the workspace.

This class should not be instantiated directly. Instead StructureModel should be instantiated, which will create an object of the appropriate AbstractStructureModel subclass.

Subclasses must implement _readStructures. Subclasses for programs with a workspace should implement getWorkspaceAlignment, getIncludedEntries, and importStructuresIntoWorkspace and should set IMPLEMENTS_GET_INCLUDED to True. Subclasses for programs with a concept of selected entries should implement getSelectedEntries, and should set IMPLEMENTS_GET_SELECTED to True.

Note that there should be one structure model instance per panel, not one per tab.

Variables
  • IMPLEMENTS_GET_SELECTED (bool) – Whether getSelectedEntries is implemented. Should be set to True in any subclass that implements this method.

  • IMPLEMENTS_GET_INCLUDED (bool) – Whether getIncludedEntries is implemented. Should be set to True in any subclass that implements this method.

  • IMPLEMENTS_AUTOLOAD (bool) – Whether this class implements the concept of autoloading. Subclasses that implement autoloading should define getMsvAutosaveProjectName and emit projectSaveRequested and projectLoadRequested whenever an autoload or autosave is required.

  • workspaceColorsChanged (QtCore.pyqtSignal) – Signal emitted when colors of atoms in the workspace change, if the associated program has a concept of a workspace.

  • seqProjectTitlesChanged (QtCore.pyqtSignal(dict( sequence.ProteinSequence: str), bool)) – Signal emitted when Project Table entry titles change for sequences. Emits a dict mapping sequences whose titles have changed to their new title in the Project Table and whether an immediate sequence name update should be performed.

  • projectLoadRequested – Signal emitted when the MSV should autoload a project.

  • projectSaveRequested (QtCore.pyqtSignal(bool)) – Signal emitted when the MSV should autosave a project. Emits if it should reset the last save file name.

  • structureWarningProduced – Signal emitted when a loading a structure produces a warning

IMPLEMENTS_GET_SELECTED = False
IMPLEMENTS_GET_INCLUDED = False
IMPLEMENTS_AUTOLOAD = False
workspaceColorsChanged
seqProjectTitlesChanged
projectLoadRequested
projectSaveRequested
structureWarningProduced
__init__(*args, **kwargs)[source]
renumberResiduesByTemplate(seq, template_seq)[source]

Renumber seq based on the residue numbers of template_seq.

Parameters
renumberResidues(seq, start, increment, preserve_icode)[source]

Renumbers residues for a sequence.

renumberResiduesByAntibodyCDR(seq, new_res_num_list)[source]

Renumber residues in the sequence based on the given new numbers. :param seq: Sequnce to be renumbered :type seq: protein.sequence.ProteinSequence

Parameters

new_res_num_list (List[str]) – List of residue numbers based on the Antibody CDR numbering scheme.

mapResidues(residues)[source]

Map residues to all residues represented by the same structure residue. Note that only structures currently included in the workspace are considered. If a residue has no structure, the residue is included unchanged.

setGuiModel(gui_model)[source]
onPagesMutated(new_pages, old_pages)[source]

Update state in response to gui_model.pages.mutated signal. Note that this method must be connected to using getSignalsAndSlots rather mutated.connect.

renameSeq(seq, new_name)[source]

Rename the specified sequence

Parameters
getWorkspaceAlignment()[source]

Return an alignment that contains all entries included in the workspace. The structure model will ensure that this alignment is always kept in sync with the workspace. Returns None if the associated program has no concept of a workspace (i.e. StandaloneStructureModel).

Note

This method will always return a split-chain alignment regardless of the current split-chain view setting.

Return type

alignment.BaseAlignment or NoneType

getLinkedAlnSeqs(seq)[source]

Return a set of linked sequences to the specified sequence :type seq: sequence.ProteinSequence :rtype: set

getSelectedEntries()[source]

Returns a list of sequences for all entries that are currently selected in the project table. Raises NotImplementedError if the associated program has no concept of a selected entry. :rtype: list

getIncludedEntries()[source]

Returns a list of sequences for all entries that are currently included in the workspace. Raises NotImplementedError if the associated program has no concept of a workspace. :rtype: list

getWorkspaceColors()[source]

Returns a dict mapping residues to their color in the workspace. :rtype: dict

setWorkspaceColors(color_map, all_atoms=False)[source]

Sets the colors in the workspace to the colors given by color_map.

Parameters

all_atoms (bool) – Whether to color all atoms or just carbons

importFile(filename)[source]

Return sequences for the specified file. If the file contains structural data, then the sequences will have associated structures accessible via sequence.getStructure().

Parameters

filename (str) – The filename to read

Returns

All sequences. Note that these sequences have not been loaded into any alignment, including the workspace alignment. If filename contains structural data and the current structure model backend implements a workspace, see importStructuresIntoWorkspace, which imports a file and returns the corresponding workspace alignment sequences.

Return type

list(sequence.Sequence)

Raises

IOError – If there was an error importing the file.

importFiles(filenames)[source]

Return sequences for all specified files. If any of the files contain structural data, then those sequences will have associated structures accessible via sequence.getStructure().

Parameters

filenames (iterable) – The filenames to read

Returns

All imported sequences. Note that these sequences have not been loaded into any alignment, including the workspace alignment.

Return type

list(sequence.Sequence)

Raises

IOError – If there was an error importing the files.

importStructuresIntoWorkspace(filename)[source]

Import all structures from the given file into the workspace and include only the first structure.

Parameters

filename (str) – The filename to read

Returns

Sequences from the workspace alignment that correspond to the newly imported structures.

Return type

list(sequence.Sequence)

classmethod generateEntryResidueASL(residues_by_entry)[source]

Generate an ASL string for the given entry IDs and residues.

Parameters

residues_by_entry (dict[str, list(protein.residue.Residue)]) – Mapping of entry id to residues

static generateResidueASL(residues)[source]

Generate an ASL string for the given residues. Residues should be from the same entry.

classmethod generateMultiEntryResidueASL(residues)[source]

Generate an ASL string for the given residues. Residues can be from different entries.

applyWorkspaceSelectionToSeqs(aln, seqs=None)[source]

Select any residues in the given sequences that are selected in the workspace. Sequences without structures or with structures that aren’t currently included in the workspace are ignored.

This method is a no-op for structure models without a workspace.

Parameters
  • aln (gui_alignment._ProteinAlignment) – The alignment to select the residues in

  • seqs (Iterable(sequence.Sequence)) – The sequences to select residues in. If not given, all sequences in aln will be used.

delayedSyncFromMsvToWorkspace(aln)[source]

Replace residue selection in the workspace with residue selection in the given alignment. When new entries are included in the workspace, their residue selection is not automatically synchronized until selection is changed in either the workspace (in which case residue selection from the workspace is applied to the MSV) or the MSV (in which case residue selection from the MSV active tab is applied to the workspace and to the other MSV tabs). This method forces selection to be immediately synchronized.

This method will also remove workspace selection for any entries without a linked sequence in the given alignment.

This method is a no-op for structure models without a workspace.

Parameters

aln (gui_alignment._ProteinAlignment) – The alignment to take residue selection from

getStructSeq(entry_id, chain_name)[source]

Return a sequence for the chain structure specified by entry_id and chain_name. This sequence will not be monitored by the structure model in any way and will not be kept up to date with any changes to the structure.

This method will always raise a ValueError for structure models without a workspace.

Parameters
  • entry_id (int or str) – The entry id of the structure.

  • chain_name (str) – The name of the chain to create a sequence for.

Returns

The requested sequence

Return type

sequence.Sequence

Raises

ValueError – If the specified entry_id or chain don’t exist.

linkSequence(seq, entry_id, chain_name)[source]

Link a sequence to the structure specified by entry_id and chain name.

This method will always raise a ValueError for structure models without a workspace.

Parameters
  • seq (sequence.Sequence) – The sequence to associate with a structure.

  • entry_id (str or int) – The entry id of the structure to associate

  • chain_name (str) – The name of chain of the structure to associate with the sequence.

Raises

ValueError – If the specified entry_id or chain don’t exist.

blockSignals(self, bool) bool
childEvent(self, QChildEvent)
children(self) List[QObject]
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
findChild(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
inherits(self, str) bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, int)
metaObject(self) QMetaObject
moveToThread(self, QThread)
objectName(self) str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) QObject
property(self, str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) int
removeEventFilter(self, QObject)
sender(self) QObject
senderSignalIndex(self) int
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) bool
signalsBlocked(self) bool
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
thread(self) QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) str
class schrodinger.application.msv.structure_model.StructureModelMeta[source]

Bases: type

__init__(*args, **kwargs)
mro()

Return a type’s method resolution order.

class schrodinger.application.msv.structure_model.StructureModel(parent, undo_stack)[source]

Bases: object

When instantiated, this class will return the appropriate AbstractStructureModel subclass.

class schrodinger.application.msv.structure_model.NewResInfo(resnum, inscode, resname, is_na=None)[source]

Bases: schrodinger.application.msv.structure_model.NewResInfo

Description of a new residue added to the workspace structure during a residuesChanged signal.

chainKey()[source]

A key to uniquely identify the residue within the chain

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

inscode

Alias for field number 1

is_na

Alias for field number 3

resname

Alias for field number 2

resnum

Alias for field number 0

class schrodinger.application.msv.structure_model.WHResInfo(eid: int, chain: str, resnum: int, inscode: str, resname: str, is_na: bool)[source]

Bases: tuple

Tuple to hash WHResidue appropriately. Used to create NewResInfo objects.

Note: not using WHResidue.getHash() because it also considers molecule number

eid: int

Alias for field number 0

chain: str

Alias for field number 1

resnum: int

Alias for field number 2

inscode: str

Alias for field number 3

resname: str

Alias for field number 4

is_na: bool

Alias for field number 5

classmethod fromWHRes(whres)[source]

Generate a WHResInfo object from a WHResidue object.

entryKey()[source]

A key to uniquely identify the entry chain

chainKey()[source]

A key to uniquely identify the residue within the chain

residueKey()[source]

A key to uniquely identify the residue and chain

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

class schrodinger.application.msv.structure_model.MaestroStructureModel(parent, undo_stack)[source]

Bases: schrodinger.application.msv.structure_model.AbstractStructureModel

IMPLEMENTS_GET_SELECTED = True
IMPLEMENTS_GET_INCLUDED = True
IMPLEMENTS_AUTOLOAD = True
VALID_AA_NAMES = {'2AS', '3AH', '5HP', 'ACL', 'AGM', 'AIB', 'ALA', 'ALM', 'ALO', 'ALY', 'ARG', 'ARM', 'ARN', 'ASA', 'ASB', 'ASH', 'ASK', 'ASL', 'ASN', 'ASP', 'ASQ', 'AYA', 'BCS', 'BHD', 'BMT', 'BNN', 'BUC', 'BUG', 'C5C', 'C6C', 'CCS', 'CEA', 'CGU', 'CHG', 'CLE', 'CME', 'CSD', 'CSO', 'CSP', 'CSS', 'CSW', 'CSX', 'CXM', 'CY1', 'CY3', 'CYG', 'CYM', 'CYP', 'CYQ', 'CYS', 'CYX', 'DAH', 'DAL', 'DAR', 'DAS', 'DCY', 'DGL', 'DGN', 'DHA', 'DHI', 'DIL', 'DIV', 'DLE', 'DLY', 'DNP', 'DPN', 'DPR', 'DSG', 'DSN', 'DSP', 'DTH', 'DTR', 'DTY', 'DVA', 'EFC', 'FLA', 'FME', 'GGL', 'GL3', 'GLH', 'GLN', 'GLU', 'GLY', 'GLZ', 'GMA', 'GSC', 'HAC', 'HAR', 'HIC', 'HID', 'HIE', 'HIP', 'HIS', 'HMR', 'HPQ', 'HSD', 'HSE', 'HSP', 'HTR', 'HYP', 'IIL', 'ILE', 'IYR', 'KCX', 'LEU', 'LLP', 'LLY', 'LTR', 'LYM', 'LYN', 'LYS', 'LYZ', 'MAA', 'MEN', 'MET', 'MHS', 'MIS', 'MLE', 'MMO', 'MPQ', 'MSA', 'MSE', 'MVA', 'NEM', 'NEP', 'NLE', 'NLN', 'NLP', 'NMC', 'OAS', 'OCS', 'OMT', 'PAQ', 'PCA', 'PEC', 'PHE', 'PHI', 'PHL', 'PR3', 'PRO', 'PRR', 'PTR', 'SAC', 'SAR', 'SCH', 'SCS', 'SCY', 'SEL', 'SEP', 'SER', 'SET', 'SHC', 'SHR', 'SMC', 'SOC', 'STY', 'SVA', 'THO', 'THR', 'TIH', 'TPL', 'TPO', 'TPQ', 'TRG', 'TRO', 'TRP', 'TYB', 'TYM', 'TYO', 'TYQ', 'TYR', 'TYS', 'TYY', 'VAL'}
VALID_NA_NAMES = {'1CC', '1MA', '1MG', '2MG', '5FC', '5HC', '5MC', '5MU', '6MA', '7MG', 'A', 'ADP', 'AMP', 'ATP', 'C', 'CDP', 'CMP', 'CTP', 'DA', 'DC', 'DG', 'DI', 'DT', 'DU', 'G', 'GDP', 'GMP', 'GTP', 'H2U', 'I', 'M2G', 'OMC', 'OMG', 'PSU', 'TDP', 'TMP', 'TTP', 'U', 'UDP', 'UMP', 'UTP', 'YYG'}
__init__(parent, undo_stack)[source]
Parameters
renumberResiduesByTemplate(seq, template_seq)[source]

Renumber seq based on the residue numbers of template_seq.

Parameters
renumberResidues(seq, start, increment, preserve_icode)[source]

Renumbers residues for a sequence and propagates the renumbering to all sequences linked to the same chain.

See _ChainData.renumberResidues for more documentation.

renumberResiduesByAntibodyCDR(seq, new_res_num_list)[source]

Renumber residues in the sequence based on the given new numbers. :param seq: Sequnce to be renumbered :type seq: protein.sequence.ProteinSequence

Parameters

new_res_num_list (List[str]) – List of residue numbers based on the Antibody CDR numbering scheme.

setGuiModel(gui_model)[source]

Set the GUI Model that this structure model should keep up to date. This method will update any view pages in the GUI model. If a workspace page is present, it will be updated. Otherwise, a new workspace page will be created.

Parameters

gui_model (gui.gui_model.MsvGuiModel) – The GUI model to keep up to date.

applyWorkspaceSelectionToSeqs(aln, seqs=None)[source]

Select any residues in the given sequences that are selected in the workspace. Sequences without structures or with structures that aren’t currently included in the workspace are ignored.

This method is a no-op for structure models without a workspace.

Parameters
  • aln (gui_alignment._ProteinAlignment) – The alignment to select the residues in

  • seqs (Iterable(sequence.Sequence)) – The sequences to select residues in. If not given, all sequences in aln will be used.

updateViewPages(gui_model)[source]

Update linked sequences in all view (i.e. non-workspace) pages in the GUI model. This should be called whenever the MSV panel is reopened, since it doesn’t monitor structure changes while it’s closed.

Parameters

gui_model (gui.gui_model.MsvGuiModel) – The model to update.

onPagesMutated(new_pages, old_pages)[source]

Update state in response to gui_model.pages.mutated signal. Note that this method must be connected to using getSignalsAndSlots rather mutated.connect.

getStructSeq(entry_id, chain_name)[source]

Return a sequence for the chain structure specified by entry_id and chain_name. This sequence will not be monitored by the structure model in any way and will not be kept up to date with any changes to the structure.

This method will always raise a ValueError for structure models without a workspace.

Parameters
  • entry_id (int or str) – The entry id of the structure.

  • chain_name (str) – The name of the chain to create a sequence for.

Returns

The requested sequence

Return type

sequence.Sequence

Raises

ValueError – If the specified entry_id or chain don’t exist.

linkSequence(seq, entry_id, chain_name)[source]

Link a sequence to the structure specified by entry_id and chain name.

This method will always raise a ValueError for structure models without a workspace.

Parameters
  • seq (sequence.Sequence) – The sequence to associate with a structure.

  • entry_id (str or int) – The entry id of the structure to associate

  • chain_name (str) – The name of chain of the structure to associate with the sequence.

Raises

ValueError – If the specified entry_id or chain don’t exist.

Load a structure from the file and link it to the sequence.

Parameters
  • filename (str) – Filename of a structure containing a single protein chain that corresponds to seq’s chain

  • seq (sequence.Sequence) – The sequence to associate with the structure

Raises

ValueError – If the file does not contain the protein chain corresponding to the sequence

getAssociatedChainName(seq)[source]

Get the name of the chain associated with a sequence. Returns None if the seq doesn’t have a structure.

Returns

The associated chain name

Return type

str

unlinkSequence(seq)[source]

Unlink a sequence from its structure.

Parameters

seq (sequence.Sequence) – The sequence to unlink.

disconnect()[source]

Disconnect Maestro callbacks and Workspace Hub signals

getSeqsForEid(eid)[source]

Get sequences for each chain in the specified entry.

Parameters

eid (int or str) – The entry id to fetch sequences for.

Returns

A list of the requested sequences.

Return type

list

getSeqsForEids(eids, *, ignore_missing=False)[source]

Get sequences for each chain in all specified entries.

Parameters
  • eids (list) – The entry ids to fetch sequences for.

  • ignore_missing (bool) – Whether we should ignore any entry ids that aren’t present in the project. If this is False and an entry id is not present, a ValueError will be raised.

Returns

A list of the requested sequences.

Return type

list

Raises

ValueError – If any of the specified eids are not present in the project and ignore_missing is False.

importStructuresIntoWorkspace(filename)[source]

Import all structures from the given file into the workspace and include only the first structure.

Parameters

filename (str) – The filename to read

Returns

Sequences from the workspace alignment that correspond to the newly imported structures.

Return type

list(sequence.Sequence)

getSelectedEntries()[source]

Returns a list of sequences for all entries that are currently selected in the project table. Raises NotImplementedError if the associated program has no concept of a selected entry. :rtype: list

getIncludedEntries()[source]

Returns a list of sequences for all entries that are currently included in the workspace. Raises NotImplementedError if the associated program has no concept of a workspace. :rtype: list

getWorkspaceAlignment()[source]

Return an alignment that contains all entries included in the workspace. The structure model will ensure that this alignment is always kept in sync with the workspace. Returns None if the associated program has no concept of a workspace (i.e. StandaloneStructureModel).

Note

This method will always return a split-chain alignment regardless of the current split-chain view setting.

Return type

alignment.BaseAlignment or NoneType

getMsvAutosaveProjectName()[source]

Get the filepath where projects should be autosaved to and autoloaded from.

Return type

str

getLinkedAlnSeqs(seq)[source]

Return a set of sequences linked to the same entry ID

Parameters

seq (sequence.ProteinSequence) – Split-chain sequence to get a linked sequence set for

Returns

Set of all sequences in the alignment with the same name linked to the entry ID.

Return type

set(sequence.ProteinSequence)

unsynchEntryID(eid)[source]

Unsynch all non-Workspace sequences for a specified entry ID from the Workspace.

Parameters

eid – Entry ID to unsynchronize.

Def eid

int

renameSeq(seq, new_name, rename_linked_seqs=False, rename_entry=False)[source]

Rename the specified sequence.

Parameters
  • seq (sequence.ProteinSequence) – Sequence to rename

  • new_name (str) – New name for the sequence

  • rename_linked_seqs (bool) – Whether to rename linked sequences from the same alignment. Will be ignored if the seq is from the Workspace alignment.

  • rename_entry (bool) – Whether to rename the linked Project entry. Will be ignored if the seq is from the Workspace alignment.

renameProjectEntry(eid, new_title, aln=None)[source]

Rename the specified Project Table entry. If an alignment is specified, find other sequences related to this entry and alignment and request a rename for them as well.

mapResidues(residues)[source]

Map residues to all residues represented by the same structure residue. Note that only structures currently included in the workspace are considered. If a residue has no structure, the residue is included unchanged.

delayedSyncFromMsvToWorkspace(aln)[source]

Replace residue selection in the workspace with residue selection in the given alignment. When new entries are included in the workspace, their residue selection is not automatically synchronized until selection is changed in either the workspace (in which case residue selection from the workspace is applied to the MSV) or the MSV (in which case residue selection from the MSV active tab is applied to the workspace and to the other MSV tabs). This method forces selection to be immediately synchronized.

This method will also remove workspace selection for any entries without a linked sequence in the given alignment.

This method is a no-op for structure models without a workspace.

Parameters

aln (gui_alignment._ProteinAlignment) – The alignment to take residue selection from

onResidueMiddleClicked(res)[source]

Fits Maestro workspace to the residue clicked with the middle button. The structure must be included in the workspace. :param res: clicked residue :type res: protein.residue.Residue

disassociateChains(entry_id, is_workspace=False, keep_chains=None)[source]

Disassociates chains for an entry.

Parameters

entry_id (int) – The entry ID to split

Returns

Disassociated sequences, now with unique entry ids

Return type

list(sequence.Sequence)

superimposeByAlignment(entry_residue_map)[source]

Creates and runs a Maestro command to superimpose structures by aligned residues in the Multiple Sequence Viewer.

Parameters

selected_seqs (iterable(sequence.ProteinSequence)) – Current selected sequences in MSV

Raises

ValueError – If selected_seqs do not have unique entry IDs

onWorkspaceChanged(changed)[source]

Callback that is called whenever the maestro workspace changes. See maestro_callback for details.

Parameters

changed (a WORKSPACE_CHANGED_* constant in maestro.py) – What kind of change occured in the workspace

getWorkspaceColors()[source]

Get the colors of each sequence residue in the workspace. For amino acid residues, the color of the alpha carbon is returned; for nucleotide residues, the color of the C1’ on the sugar is returned.

Returns

The colors of each residue in the workspace. Each residue is represented by a tuple of (entry_id, chain, resnum, inscode) and each color is represented by a tuple of (r,g,b) values.

Return type

dict(residue.ResidueKey, tuple(int, int, int))

setWorkspaceColors(color_map, all_atoms=False)[source]

Set the colors in the workspace for all the residues in the color map. If a residue is not in the color map, its color will not be changed. All atoms in a residue will be re-colored.

Parameters
  • color_map (dict(residue.ResidueKey, tuple(int, int, int))) – The new colors that residues should have. Each residue is represented by a 4-tuple of (entry_id, chain, resnum, inscode), and each color is represented by a tuple of (r,g,b) values.

  • all_atoms (bool) – Whether to color all atoms or just carbons

blockSignals(self, bool) bool
childEvent(self, QChildEvent)
children(self) List[QObject]
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
findChild(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
classmethod generateEntryResidueASL(residues_by_entry)

Generate an ASL string for the given entry IDs and residues.

Parameters

residues_by_entry (dict[str, list(protein.residue.Residue)]) – Mapping of entry id to residues

classmethod generateMultiEntryResidueASL(residues)

Generate an ASL string for the given residues. Residues can be from different entries.

static generateResidueASL(residues)

Generate an ASL string for the given residues. Residues should be from the same entry.

importFile(filename)

Return sequences for the specified file. If the file contains structural data, then the sequences will have associated structures accessible via sequence.getStructure().

Parameters

filename (str) – The filename to read

Returns

All sequences. Note that these sequences have not been loaded into any alignment, including the workspace alignment. If filename contains structural data and the current structure model backend implements a workspace, see importStructuresIntoWorkspace, which imports a file and returns the corresponding workspace alignment sequences.

Return type

list(sequence.Sequence)

Raises

IOError – If there was an error importing the file.

importFiles(filenames)

Return sequences for all specified files. If any of the files contain structural data, then those sequences will have associated structures accessible via sequence.getStructure().

Parameters

filenames (iterable) – The filenames to read

Returns

All imported sequences. Note that these sequences have not been loaded into any alignment, including the workspace alignment.

Return type

list(sequence.Sequence)

Raises

IOError – If there was an error importing the files.

inherits(self, str) bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, int)
metaObject(self) QMetaObject
moveToThread(self, QThread)
objectName(self) str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) QObject
projectLoadRequested
projectSaveRequested
property(self, str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) int
removeEventFilter(self, QObject)
sender(self) QObject
senderSignalIndex(self) int
seqProjectTitlesChanged
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) bool
signalsBlocked(self) bool
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
structureWarningProduced
thread(self) QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) str
workspaceColorsChanged
class schrodinger.application.msv.structure_model.StandaloneStructureModel[source]

Bases: schrodinger.application.msv.structure_model.AbstractStructureModel

A structure model for when the MSV is run directly from the command line.

Note

When copying a sequence, this structure model currently strips all structural information from the copy. If we need the copy to retain structural information, we should make sure that setting the structure on one copied chain updates the structure on all other copied chains without affecting the structure from the original sequences.

__init__()[source]
renameSeq(seq, new_name)[source]

Rename the specified sequence

Parameters
IMPLEMENTS_AUTOLOAD = False
IMPLEMENTS_GET_INCLUDED = False
IMPLEMENTS_GET_SELECTED = False
applyWorkspaceSelectionToSeqs(aln, seqs=None)

Select any residues in the given sequences that are selected in the workspace. Sequences without structures or with structures that aren’t currently included in the workspace are ignored.

This method is a no-op for structure models without a workspace.

Parameters
  • aln (gui_alignment._ProteinAlignment) – The alignment to select the residues in

  • seqs (Iterable(sequence.Sequence)) – The sequences to select residues in. If not given, all sequences in aln will be used.

blockSignals(self, bool) bool
childEvent(self, QChildEvent)
children(self) List[QObject]
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
delayedSyncFromMsvToWorkspace(aln)

Replace residue selection in the workspace with residue selection in the given alignment. When new entries are included in the workspace, their residue selection is not automatically synchronized until selection is changed in either the workspace (in which case residue selection from the workspace is applied to the MSV) or the MSV (in which case residue selection from the MSV active tab is applied to the workspace and to the other MSV tabs). This method forces selection to be immediately synchronized.

This method will also remove workspace selection for any entries without a linked sequence in the given alignment.

This method is a no-op for structure models without a workspace.

Parameters

aln (gui_alignment._ProteinAlignment) – The alignment to take residue selection from

deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
findChild(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
classmethod generateEntryResidueASL(residues_by_entry)

Generate an ASL string for the given entry IDs and residues.

Parameters

residues_by_entry (dict[str, list(protein.residue.Residue)]) – Mapping of entry id to residues

classmethod generateMultiEntryResidueASL(residues)

Generate an ASL string for the given residues. Residues can be from different entries.

static generateResidueASL(residues)

Generate an ASL string for the given residues. Residues should be from the same entry.

getIncludedEntries()

Returns a list of sequences for all entries that are currently included in the workspace. Raises NotImplementedError if the associated program has no concept of a workspace. :rtype: list

getLinkedAlnSeqs(seq)

Return a set of linked sequences to the specified sequence :type seq: sequence.ProteinSequence :rtype: set

getSelectedEntries()

Returns a list of sequences for all entries that are currently selected in the project table. Raises NotImplementedError if the associated program has no concept of a selected entry. :rtype: list

getStructSeq(entry_id, chain_name)

Return a sequence for the chain structure specified by entry_id and chain_name. This sequence will not be monitored by the structure model in any way and will not be kept up to date with any changes to the structure.

This method will always raise a ValueError for structure models without a workspace.

Parameters
  • entry_id (int or str) – The entry id of the structure.

  • chain_name (str) – The name of the chain to create a sequence for.

Returns

The requested sequence

Return type

sequence.Sequence

Raises

ValueError – If the specified entry_id or chain don’t exist.

getWorkspaceAlignment()

Return an alignment that contains all entries included in the workspace. The structure model will ensure that this alignment is always kept in sync with the workspace. Returns None if the associated program has no concept of a workspace (i.e. StandaloneStructureModel).

Note

This method will always return a split-chain alignment regardless of the current split-chain view setting.

Return type

alignment.BaseAlignment or NoneType

getWorkspaceColors()

Returns a dict mapping residues to their color in the workspace. :rtype: dict

importFile(filename)

Return sequences for the specified file. If the file contains structural data, then the sequences will have associated structures accessible via sequence.getStructure().

Parameters

filename (str) – The filename to read

Returns

All sequences. Note that these sequences have not been loaded into any alignment, including the workspace alignment. If filename contains structural data and the current structure model backend implements a workspace, see importStructuresIntoWorkspace, which imports a file and returns the corresponding workspace alignment sequences.

Return type

list(sequence.Sequence)

Raises

IOError – If there was an error importing the file.

importFiles(filenames)

Return sequences for all specified files. If any of the files contain structural data, then those sequences will have associated structures accessible via sequence.getStructure().

Parameters

filenames (iterable) – The filenames to read

Returns

All imported sequences. Note that these sequences have not been loaded into any alignment, including the workspace alignment.

Return type

list(sequence.Sequence)

Raises

IOError – If there was an error importing the files.

importStructuresIntoWorkspace(filename)

Import all structures from the given file into the workspace and include only the first structure.

Parameters

filename (str) – The filename to read

Returns

Sequences from the workspace alignment that correspond to the newly imported structures.

Return type

list(sequence.Sequence)

inherits(self, str) bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, int)
linkSequence(seq, entry_id, chain_name)

Link a sequence to the structure specified by entry_id and chain name.

This method will always raise a ValueError for structure models without a workspace.

Parameters
  • seq (sequence.Sequence) – The sequence to associate with a structure.

  • entry_id (str or int) – The entry id of the structure to associate

  • chain_name (str) – The name of chain of the structure to associate with the sequence.

Raises

ValueError – If the specified entry_id or chain don’t exist.

mapResidues(residues)

Map residues to all residues represented by the same structure residue. Note that only structures currently included in the workspace are considered. If a residue has no structure, the residue is included unchanged.

metaObject(self) QMetaObject
moveToThread(self, QThread)
objectName(self) str
objectNameChanged

objectNameChanged(self, str) [signal]

onPagesMutated(new_pages, old_pages)

Update state in response to gui_model.pages.mutated signal. Note that this method must be connected to using getSignalsAndSlots rather mutated.connect.

parent(self) QObject
projectLoadRequested
projectSaveRequested
property(self, str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) int
removeEventFilter(self, QObject)
renumberResidues(seq, start, increment, preserve_icode)

Renumbers residues for a sequence.

renumberResiduesByAntibodyCDR(seq, new_res_num_list)

Renumber residues in the sequence based on the given new numbers. :param seq: Sequnce to be renumbered :type seq: protein.sequence.ProteinSequence

Parameters

new_res_num_list (List[str]) – List of residue numbers based on the Antibody CDR numbering scheme.

renumberResiduesByTemplate(seq, template_seq)

Renumber seq based on the residue numbers of template_seq.

Parameters
sender(self) QObject
senderSignalIndex(self) int
seqProjectTitlesChanged
setGuiModel(gui_model)
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) bool
setWorkspaceColors(color_map, all_atoms=False)

Sets the colors in the workspace to the colors given by color_map.

Parameters

all_atoms (bool) – Whether to color all atoms or just carbons

signalsBlocked(self) bool
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
structureWarningProduced
thread(self) QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) str
workspaceColorsChanged
class schrodinger.application.msv.structure_model.PyMolStructureModel(*args, **kwargs)[source]

Bases: schrodinger.application.msv.structure_model.AbstractStructureModel

A stub for a PyMol structure model.

IMPLEMENTS_AUTOLOAD = False
IMPLEMENTS_GET_INCLUDED = False
IMPLEMENTS_GET_SELECTED = False
__init__(*args, **kwargs)
applyWorkspaceSelectionToSeqs(aln, seqs=None)

Select any residues in the given sequences that are selected in the workspace. Sequences without structures or with structures that aren’t currently included in the workspace are ignored.

This method is a no-op for structure models without a workspace.

Parameters
  • aln (gui_alignment._ProteinAlignment) – The alignment to select the residues in

  • seqs (Iterable(sequence.Sequence)) – The sequences to select residues in. If not given, all sequences in aln will be used.

blockSignals(self, bool) bool
childEvent(self, QChildEvent)
children(self) List[QObject]
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
delayedSyncFromMsvToWorkspace(aln)

Replace residue selection in the workspace with residue selection in the given alignment. When new entries are included in the workspace, their residue selection is not automatically synchronized until selection is changed in either the workspace (in which case residue selection from the workspace is applied to the MSV) or the MSV (in which case residue selection from the MSV active tab is applied to the workspace and to the other MSV tabs). This method forces selection to be immediately synchronized.

This method will also remove workspace selection for any entries without a linked sequence in the given alignment.

This method is a no-op for structure models without a workspace.

Parameters

aln (gui_alignment._ProteinAlignment) – The alignment to take residue selection from

deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
findChild(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) QObject
findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) List[QObject]
classmethod generateEntryResidueASL(residues_by_entry)

Generate an ASL string for the given entry IDs and residues.

Parameters

residues_by_entry (dict[str, list(protein.residue.Residue)]) – Mapping of entry id to residues

classmethod generateMultiEntryResidueASL(residues)

Generate an ASL string for the given residues. Residues can be from different entries.

static generateResidueASL(residues)

Generate an ASL string for the given residues. Residues should be from the same entry.

getIncludedEntries()

Returns a list of sequences for all entries that are currently included in the workspace. Raises NotImplementedError if the associated program has no concept of a workspace. :rtype: list

getLinkedAlnSeqs(seq)

Return a set of linked sequences to the specified sequence :type seq: sequence.ProteinSequence :rtype: set

getSelectedEntries()

Returns a list of sequences for all entries that are currently selected in the project table. Raises NotImplementedError if the associated program has no concept of a selected entry. :rtype: list

getStructSeq(entry_id, chain_name)

Return a sequence for the chain structure specified by entry_id and chain_name. This sequence will not be monitored by the structure model in any way and will not be kept up to date with any changes to the structure.

This method will always raise a ValueError for structure models without a workspace.

Parameters
  • entry_id (int or str) – The entry id of the structure.

  • chain_name (str) – The name of the chain to create a sequence for.

Returns

The requested sequence

Return type

sequence.Sequence

Raises

ValueError – If the specified entry_id or chain don’t exist.

getWorkspaceAlignment()

Return an alignment that contains all entries included in the workspace. The structure model will ensure that this alignment is always kept in sync with the workspace. Returns None if the associated program has no concept of a workspace (i.e. StandaloneStructureModel).

Note

This method will always return a split-chain alignment regardless of the current split-chain view setting.

Return type

alignment.BaseAlignment or NoneType

getWorkspaceColors()

Returns a dict mapping residues to their color in the workspace. :rtype: dict

importFile(filename)

Return sequences for the specified file. If the file contains structural data, then the sequences will have associated structures accessible via sequence.getStructure().

Parameters

filename (str) – The filename to read

Returns

All sequences. Note that these sequences have not been loaded into any alignment, including the workspace alignment. If filename contains structural data and the current structure model backend implements a workspace, see importStructuresIntoWorkspace, which imports a file and returns the corresponding workspace alignment sequences.

Return type

list(sequence.Sequence)

Raises

IOError – If there was an error importing the file.

importFiles(filenames)

Return sequences for all specified files. If any of the files contain structural data, then those sequences will have associated structures accessible via sequence.getStructure().

Parameters

filenames (iterable) – The filenames to read

Returns

All imported sequences. Note that these sequences have not been loaded into any alignment, including the workspace alignment.

Return type

list(sequence.Sequence)

Raises

IOError – If there was an error importing the files.

importStructuresIntoWorkspace(filename)

Import all structures from the given file into the workspace and include only the first structure.

Parameters

filename (str) – The filename to read

Returns

Sequences from the workspace alignment that correspond to the newly imported structures.

Return type

list(sequence.Sequence)

inherits(self, str) bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, int)
linkSequence(seq, entry_id, chain_name)

Link a sequence to the structure specified by entry_id and chain name.

This method will always raise a ValueError for structure models without a workspace.

Parameters
  • seq (sequence.Sequence) – The sequence to associate with a structure.

  • entry_id (str or int) – The entry id of the structure to associate

  • chain_name (str) – The name of chain of the structure to associate with the sequence.

Raises

ValueError – If the specified entry_id or chain don’t exist.

mapResidues(residues)

Map residues to all residues represented by the same structure residue. Note that only structures currently included in the workspace are considered. If a residue has no structure, the residue is included unchanged.

metaObject(self) QMetaObject
moveToThread(self, QThread)
objectName(self) str
objectNameChanged

objectNameChanged(self, str) [signal]

onPagesMutated(new_pages, old_pages)

Update state in response to gui_model.pages.mutated signal. Note that this method must be connected to using getSignalsAndSlots rather mutated.connect.

parent(self) QObject
projectLoadRequested
projectSaveRequested
property(self, str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) int
removeEventFilter(self, QObject)
renameSeq(seq, new_name)

Rename the specified sequence

Parameters
renumberResidues(seq, start, increment, preserve_icode)

Renumbers residues for a sequence.

renumberResiduesByAntibodyCDR(seq, new_res_num_list)

Renumber residues in the sequence based on the given new numbers. :param seq: Sequnce to be renumbered :type seq: protein.sequence.ProteinSequence

Parameters

new_res_num_list (List[str]) – List of residue numbers based on the Antibody CDR numbering scheme.

renumberResiduesByTemplate(seq, template_seq)

Renumber seq based on the residue numbers of template_seq.

Parameters
sender(self) QObject
senderSignalIndex(self) int
seqProjectTitlesChanged
setGuiModel(gui_model)
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) bool
setWorkspaceColors(color_map, all_atoms=False)

Sets the colors in the workspace to the colors given by color_map.

Parameters

all_atoms (bool) – Whether to color all atoms or just carbons

signalsBlocked(self) bool
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
structureWarningProduced
thread(self) QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) str
workspaceColorsChanged