schrodinger.application.msv.structure_model module¶
-
class
schrodinger.application.msv.structure_model.
AbstractStructureModel
¶ 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 appropriateAbstractStructureModel
subclass.Subclasses must implement
_readStructures
. Subclasses for programs with a workspace should implementgetWorkspaceAlignment
andgetIncludedEntries
, and should setIMPLEMENTS_GET_INCLUDED
to True. Subclasses for programs with a concept of selected entries should implementgetSelectedEntries
, and should setIMPLEMENTS_GET_SELECTED
to True.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. - workspaceColorsChanged (QtCore.pyqtSignal) – Signal emitted when colors of atoms in the workspace change, if the associated program has a concept of a workspace.
- resetRequested – Signal emitted when the MSV should be reset (e.g., due to a Maestro project close).
-
IMPLEMENTS_GET_INCLUDED
= False¶
-
IMPLEMENTS_GET_SELECTED
= False¶
-
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
-
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
-
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). :rtype:
alignment.BaseAlignment
or NoneType
-
getWorkspaceColors
()¶ Returns a dict mapping residues to their color in the workspace. Returns an empty dict if the associated program has no concept of a 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 (basestring) – The filename to read Returns: All sequences Return type: list 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 sequences Return type: list Raises: IOError – If there was an error importing the files.
-
resetRequested
¶
-
setWorkspaceColors
(color_map)¶ Sets the colors in the workspace to the colors given by color_map. This is a no-op if the associated program has no concept of a workspace. :type color_map: dict
-
workspaceColorsChanged
¶
- IMPLEMENTS_GET_SELECTED (bool) – Whether
-
class
schrodinger.application.msv.structure_model.
ChainData
(eid, chain, all_res, vis_res, included)¶ Bases:
PyQt5.QtCore.QObject
Information about a single chain of a single entry from the current Maestro project.
Variables: - wsVisibilityChangeRequested (
QtCore.pyqtSignal
) –A signal emitted when the workspace visibility of a chain should be changed. The
MaestroStructureModel
instance is responsible for changing the workspace visibility in response to this signal. Emitted with:- the entry id of the chain (int)
- the chain name (str)
- whether the chain should be shown (True) or hidden (False) (bool)
- whether the entry is currently in the workspace (bool)
- eid (int) – The entry id of the chain.
- chain (str) – The chain name.
- seqs (
weakref.WeakSet
) – A set of all sequences representing this chain. - workspace_seq (schrodinger.application.msv.domain.sequence.Sequence) – The sequence representing this chain in the workspace
alignment (i.e. the alignment shown in the workspace tab). Note that
this sequence also appears in
seqs
.
-
addSeq
(seq)¶ Monitor a new sequence that represents this chain.
Parameters: seq ( schrodinger.application.msv.domain.sequence.Sequence
) – The sequence to monitor
-
clearVisRes
()¶ Clear the set of residues that are currently visible in the Maestro workspace.
-
entryRemoved
()¶ Respond to the entry being removed from the project. Mark all sequences as not having an associated structure and disconnect the sequences from visibility updates.
-
included
¶ Whether the entry is currently included in the Maestro workspace. :type: bool
-
updateAllRes
(added, removed)¶ Update the set of residues that exist in this chain.
Parameters: Note: Each residue must be a tuple of (residue number, insertion code).
-
updateVisRes
(added, removed)¶ Update the set of residues that are currently visible in the Maestro workspace.
Parameters: Note: Each residue must be a tuple of (residue number, insertion code).
-
visibility
¶ The visibility of this chain in the Maestro workspace. May not be updated directly. Use
updateVisRes
orupdateAllRes
instead. :type:Inclusion
-
wsVisibilityChangeRequested
¶
- wsVisibilityChangeRequested (
-
class
schrodinger.application.msv.structure_model.
MaestroStructureModel
(parent)¶ Bases:
schrodinger.ui.qt.appframework2.maestro_callback.MaestroCallbackModelMixin
,schrodinger.application.msv.structure_model.AbstractStructureModel
-
IMPLEMENTS_GET_INCLUDED
= True¶
-
IMPLEMENTS_GET_SELECTED
= True¶
-
getIncludedEntries
()¶
-
getSelectedEntries
()¶
-
getSeqsForEid
(eid)¶ 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)¶ Get sequences for each chain in all specified entries.
Parameters: eid (list) – The entry ids to fetch sequences for. Returns: A list of the requested sequences. Return type: list
-
getWorkspaceAlignment
()¶
-
getWorkspaceColors
()¶ 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 mapping (string, string, int, string) to (int, int, int)
-
onWorkspaceChanged
(changed)¶ 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
-
setWorkspaceColors
(color_map)¶ 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 mapping (string, string, int, string) to (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.
-
splitChains
(seqs_by_entry, aln)¶ Splits chains for an entry while preserving gaps and structureless residues.
Parameters: seqs_by_entry (dict mapping int entry_id to a list of Sequence
) – a mapping of the entry ids to seqsReturn selected_seqs: Split sequences, now with unique entry ids Rtype selected_seqs: List of Sequence
-
superimposeByAlignment
(selected_seqs)¶ 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
-
-
class
schrodinger.application.msv.structure_model.
PyMolStructureModel
¶ Bases:
schrodinger.application.msv.structure_model.AbstractStructureModel
A stub for a PyMol structure model.
-
class
schrodinger.application.msv.structure_model.
StandaloneStructureModel
¶ 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.
-
class
schrodinger.application.msv.structure_model.
StructureModel
¶ Bases:
object
When instantiated, this class will return the appropriate
AbstractStructureModel
subclass.
-
class
schrodinger.application.msv.structure_model.
StructureModelMeta
¶ Bases:
type