schrodinger.application.livedesign.ld_import module

Classes used for LiveDesign import GUIs.

Copyright Schrödinger, LLC. All rights reserved.

class schrodinger.application.livedesign.ld_import.ImportThreadRunner(*args, **kwargs)

Bases: schrodinger.application.livedesign.ld_base_classes.ImportExportThreadRunner

Perform the actual import in a thread to not block Maestro.

process_type = 'import'
runMain(task)

See tasks.BaseFunctionRunner for documentation.

postProcess(task)

If a task has successfully finished, perform synchronous post processing. If connected to maestro, import the structures into the project table. Otherwise, write out to an SD file.

Parameters:task (tasks.AbstractTaskWrapper) – the finished task
__init__(*args, **kwargs)
Parameters:func (callable) – the callable that will be run as the main task. Overrides self.runMain(). If self.runMain() is not defined, a func must be provided.
addTask(task)

Add a new task to be tracked. This should be called whenever a task is started.

Parameters:task (AbstractTaskWrapper) – the task
blockSignals(self, bool) → bool
childEvent(self, QChildEvent)
children(self) → object
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
defaultSettings()

Override this method to define default values for any settings. This dictionary of default settings will be used to reset the parent.

deleteLater(self)
destroyed

destroyed(self, QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → object
error(text, caption='Error')
errorHandler()

A context manager for handling errors - catches a few specific error types, creating an error message as a function of the error type and calling. Reraises HandledError(error_msg) if any errors are caught.

Raise:HandledError if any errors are caught.
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]

findTask(name)
info(text, caption='Info')
inherits(self, str) → bool
installEventFilter(self, QObject)
isRunning()
isSignalConnected(self, QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
killTimer(self, int)
metaObject(self) → QMetaObject
moveToThread(self, QThread)
nameChanged
names()
nextName(name_list=None)

Returns the name that will be assigned to the next task that gets run. There is no currentName(), as multiple tasks might be running concurrently. To get the name of an existing task, use task.getName().

If a custom name has been set, that will be used as the next name. Otherwise, the base name will be used to generate a new unique name.

This method can be overridden to alter the task naming behavior.

Parameters:name_list (list of basestring) – Optional list of names to uniquify against. If not given, the name will be compared against the stored self.names()
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) → QObject
postStart(task)

Override this to include any logic that should be run immediately after a task is started. This will only be run after a task actually starts.

The started task is passed in as a parameter to allow interaction with the task instance. Note that there is no guarantee that the task is still running when this method is called.

Parameters:task (AbstractTaskWrapper) – the task that was just started
preValidate()

Override this to include any logic that should be run prior to the validation step.

Returns:Whether this step has succeeded. Returning False will result in aborting the task
Return type:bool
property(self, str) → Any
pullSettings()

This method calls the settings callback, which should return the user’s input for this job, such as input files, options, etc. For GUI panels, this is how the panel state is applied to the job runner.

pushSettings(settings=None)

Pushes a settings dictionary via the settings callback. Doing this will alter the state of the parent object (generally the panel). This function can be used to reset the panel or load saved presets.

If a settings dictionary is not passed in, the current job settings will be used.

Parameters:settings (dict) – a settings dictionary to push to the parent object
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.

question(text, caption='Question')
receivers(self, PYQT_SIGNAL) → int
removeEventFilter(self, QObject)
reportValidation(results)

Present validation messages to the user. This is an implmentation of the ValidationMixin interface and does not need to be called directly.

Parameters:results (ValidationResults) – Set of results generated by validate()
reset()

Resets the parent object using the default settings defined by the task runner.

resetAll()
resetAllRequested
runValidation(silent=False, validate_children=True, stop_on_fail=True)

Runs validation and reports the results (unless run silently).

Parameters:
  • silent (bool) – run without any reporting (i.e. error messages to the user). This is useful if we want to programmatically test validity. Changes return value of this method from ValidationResults to a boolean.
  • validate_children (bool) – run validation on all child objects. See _validateChildren for documentation on what this entails.
  • stop_on_fail (bool) – stop validation when first failure is encountered
Returns:

if silent is False, returns the validation results. If silent is True, returns a boolean generated by reportValidation.

Return type:

ValidationResults or bool

sender(self) → QObject
senderSignalIndex(self) → int
setCallbacks(messaging_callback=None, settings_callback=None)
setCustomName(name)

Sets a custom name for the next task to be run.

Parameters:name (str) – the custom name. Pass in an empty string to return to standard naming.
setErrorStatus(curr_name, error_msg)

Update self.status and self.error with the proper error messages. :param curr_name: the name of the task that is reporting the error :param error_msg: the error message

setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) → bool
setRunnerOptions()

Optional override to set options for the runner. Not overriding this at all results in using all default values.

self.allow custom_name - whether name is user-editable. Default: False

self.allow_concurrent - whether another task can be started while one is still running. Default: True

self.history_length - how many past jobs to keep track of. Default: 5

self.base_name - the base for task names. The base name gets modified to generate unique task names. Ex. MyTask_3. Default: “task”

self.runner_name - a name to describe the type of task. Equivalent to program_name for jobs. Default: ‘task’

settings()
showMessage(message_type, text, options=None)

Communicates with the parent object via the messaging_callback. This method generally doesn’t need to be called; call error, warning, question, or info instead.

Parameters:
  • message_type (int) – the type of message to send
  • text (str) – the main text of the message
  • options (dict) – a dictionary of other options to be processed by the messaging_callback.
signalsBlocked(self) → bool
start()

Starts the task. This includes the preliminary work of calling preValidate() and running validation before attempting to actually start the task itself.

The actual starting of the task should be handled in the _start method in the derived classes and will vary depening on the type of runner.

startFailed
startRequested
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
stateChanged
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
status(text, timeout=3000, color=None)

Request a status message to be displayed by the runner’s parent.

Parameters:
  • text (str) – the text to display
  • timeout (int) – duration in ms to display the status. A timeout of 0 results in a permanent message.
  • color (QtGui.QColor) – color of the status message.
taskEnded
taskStarted
tasks()
thread(self) → QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = -1) → str
updateStatusText()

Override this to update the status, for example, when settings have changed or the current task runner is switched.

use_event_loop = True
warning(text, caption='Warning')
schrodinger.application.livedesign.ld_import.save_to_disk(imported_sts, outfile)

Save the imported structures to disk.

Parameters:
  • imported_sts ({str: ({int: structure.Structure}, {structure.Structure: int})}) – The imported structures, expressed as an ordered dictionary by column name of pairs or ordered dictionaries containing the pose_id: ligand and protein: pose_id mappings.
  • outfile (str) – the name of the output file to create
schrodinger.application.livedesign.ld_import.project_table_import(imported_sts)

Import structures into the project table, grouping them first by column name, then by protein.

Parameters:imported_sts ({str: ({int: structure.Structure}, {structure.Structure: int})}) – The imported structures, expressed as an ordered dictionary by column name of pairs or ordered dictionaries containing the pose_id: ligand and protein: pose_id mappings.
schrodinger.application.livedesign.ld_import.project_table_select_only(entry_ids, pt)

shorthand for pt.selectRows with select_mode REPLACE

schrodinger.application.livedesign.ld_import.maestro_create_group(entry_ids, name, pt)

Creates a group from the current selection with the name specified. If groups are included in the selection this will create nested groups.

schrodinger.application.livedesign.ld_import.set_group(st, group_title, group_id)

Set the group for a structure by setting the M2IO_DATA_SUBGROUP_TITLE and M2IO_DATA_SUBGROUP_ID properties.

schrodinger.application.livedesign.ld_import.get_next_subgroup_id(subgroup_id_base, unique_subgroup_ids)

Get the next unique subgroup id by appending an index to a given base name.