schrodinger.application.glide.http_client module¶
Glide HTTP client
This module implements objects that connect to a Glide HTTP server (see schrodinger.application.glide.http_server) and use the server to dock ligands remotely.
Sample usage:
from schrodinger import structure
from schrodinger.application.glide import http_client
client = http_client.HTTPClient(host='localhost', port=8000)
ct = structure.Structure.read('mylig.mae')
poses = client.dock(ct)
for pose in poses:
print("gscore=%f" % pose.properties['r_i_glide_gscore'])
For a higher level API that also starts up and monitors the server itself,
see GlideServerManager
.
- exception schrodinger.application.glide.http_client.ServerTimedOutError¶
Bases:
RuntimeError
Exception raised if the Glide server is not ready after
MAX_WAIT
- __init__(*args, **kwargs)¶
- args¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class schrodinger.application.glide.http_client.GlideResult(poses, message='')¶
Bases:
object
Sequence-like object containing the poses returned by Glide for one ligand. When no poses were produced, the reason is available in the .message property.
- __init__(poses, message='')¶
- Parameters
poses (list[structure.Structure]) – poses returned by glide (may be empty)
message (str) – status message explaining why no poses were returned
- __len__()¶
- toJson()¶
Return a JSON representation of the docking result.
- Returns
JSON
- Return type
str
- classmethod fromJson(json_str)¶
Construct a GlideResult from its JSON representation.
- Parameters
json_str (str) – JSON representation
- Returns
GlideResult
- Return type
- class schrodinger.application.glide.http_client.GlideResultIterator(poses, message='')¶
Bases:
object
Iterator over the poses returned by Glide for one ligand. When no poses were produced, the reason is available in the .message property.
- __init__(poses, message='')¶
- Parameters
poses (list[structure.Structure]) – poses returned by glide (may be empty)
message (str) – status message explaining why no poses were returned
- asGlideResult()¶
Convert the iterator back into a GlideResult.
- Returns
GlideResult
- Rype
GlideResult
- class schrodinger.application.glide.http_client.AbstractHTTPClient¶
Bases:
object
Interface for connecting to a Glide HTTP server.
- dock(ct)¶
Dock the ligand in Structure object
ct
using the remote Glide server.
- shutdown_server()¶
Ask the Glide HTTP server to shut down.
- ct_to_multipart(ct)¶
Encode a CT in multipart/form-data format, ready to POST.
- Parameters
ct (structure.Structure) – Structure to encode
- Returns
The body of the request and the boundary
- Return type
tuple[str, str]
- class schrodinger.application.glide.http_client.HTTPClient(con=None, host='localhost', port=8000, timeout=1000)¶
Bases:
schrodinger.application.glide.http_client.AbstractHTTPClient
This class provides an API to connect to an existing Glide HTTP server. For a higher level API that also starts up and monitors the server itself, see
GlideServerManager
.- __init__(con=None, host='localhost', port=8000, timeout=1000)¶
Initialize a new HTTPClient object. The optional ‘con’ is an existing httplib.HTTPConnection object. If not provided, then ‘host’, ‘port’, and ‘timeout’ will be used to create one. The default timeout value is very large to make sure that it is enough for most docking jobs to finish.
- dock(ct)¶
Dock the ligand in Structure object ‘ct’ using the remote Glide server.
- Parameters
ct (structure.Structure) – input ligand
- Returns
docking results as an iterator
- Return type
- setReferenceLigand(ct)¶
Tell the server to use a new reference ligand when docking subsequent ligands. (This only has an effect if the job started with a reference ligand, for example when the job uses core constraints.)
- Parameters
ct (structure.Structure) – new reference ligand
- Returns
Glide results iterator (empty, but with an “Updated reflig” message)
- Return type
- dockSmiles(smiles)¶
Dock a ligand from SMILES. For best results, the server should have been launched with the LIGPREP keyword enabled.
- Parameters
smiles (str) – ligand SMILES
- Returns
docking results as an iterator
- Return type
- shutdown_server()¶
Ask the Glide HTTP server to shut down.
- ct_to_multipart(ct)¶
Encode a CT in multipart/form-data format, ready to POST.
- Parameters
ct (structure.Structure) – Structure to encode
- Returns
The body of the request and the boundary
- Return type
tuple[str, str]
- class schrodinger.application.glide.http_client.NonBlockingHTTPClient(host=None, port=8000)¶
Bases:
schrodinger.application.glide.http_client.AbstractHTTPClient
,PyQt6.QtCore.QObject
Class for connecting to a Glide HTTP server and docking poses without blocking.
- Variables
posesDocked – Signal emitted when a ligand finishes docking. Emitted with a list of pose structures.
noPosesDocked – Signal emitted when a ligand goes through the docking workflow, but does not return any valid poses. Emits the ligand number and the message provided by the backend.
errorOccurred – Signal emitted when there is an error communicating with the server.
finished – Signal emitted when an HTTP request finishes. Note: aliased from self.manager.finished
- posesDocked¶
- noPosesDocked¶
- errorOccurred¶
- __init__(host=None, port=8000)¶
- Parameters
host (str) – Hostname for server
port (int) – Port for server
- dock(ct, lignum=None)¶
Docks the structure without blocking.
- Parameters
ct (structure.Structure) – Structure to dock
lignum (Optional[int]) – A ligand number. If not provided, one will be assigned to each ligand and returned.
- Returns
The ligand number.
- Return type
int
- dockSmiles(smiles, lignum=None)¶
Dock a ligand from SMILES without blocking.
- Parameters
smiles (str) – ligand SMILES
lignum (Optional[int]) – A ligand number. If not provided, one will be assigned to each ligand and returned.
- Returns
The ligand number.
- Return type
int
- shutdown_server()¶
Requests shutting down the server without blocking.
- blockSignals(self, b: bool) bool ¶
- childEvent(self, a0: QChildEvent)¶
- children(self) List[QObject] ¶
- connectNotify(self, signal: QMetaMethod)¶
- ct_to_multipart(ct)¶
Encode a CT in multipart/form-data format, ready to POST.
- Parameters
ct (structure.Structure) – Structure to encode
- Returns
The body of the request and the boundary
- Return type
tuple[str, str]
- customEvent(self, a0: QEvent)¶
- deleteLater(self)¶
- destroyed¶
destroyed(self, object: typing.Optional[QObject] = None) [signal]
- disconnect(a0: QMetaObject.Connection) bool ¶
- disconnect(self) None
- disconnectNotify(self, signal: QMetaMethod)¶
- dumpObjectInfo(self)¶
- dumpObjectTree(self)¶
- dynamicPropertyNames(self) List[QByteArray] ¶
- event(self, a0: QEvent) bool ¶
- eventFilter(self, a0: QObject, a1: QEvent) bool ¶
- findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject ¶
- findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
- findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject] ¶
- findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- inherits(self, classname: str) bool ¶
- installEventFilter(self, a0: QObject)¶
- isSignalConnected(self, signal: QMetaMethod) bool ¶
- isWidgetType(self) bool ¶
- isWindowType(self) bool ¶
- killTimer(self, id: int)¶
- metaObject(self) QMetaObject ¶
- moveToThread(self, thread: QThread)¶
- objectName(self) str ¶
- objectNameChanged¶
objectNameChanged(self, objectName: str) [signal]
- parent(self) QObject ¶
- property(self, name: 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, signal: PYQT_SIGNAL) int ¶
- removeEventFilter(self, a0: QObject)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setObjectName(self, name: str)¶
- setParent(self, a0: QObject)¶
- setProperty(self, name: str, value: Any) bool ¶
- signalsBlocked(self) bool ¶
- startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int ¶
- staticMetaObject = <PyQt6.QtCore.QMetaObject object>¶
- thread(self) QThread ¶
- timerEvent(self, a0: QTimerEvent)¶
- tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str ¶
- class schrodinger.application.glide.http_client.SubprocessJobAdapter(cmd, logfile)¶
Bases:
object
An adapter that starts a subprocess but makes it look a bit like a jobcontrol.Job object. This class does not attempt to expose the full Job API; it only has what is actually used within this module. Its purpose is so the GlideServerManager class can treat job control jobs and subprocesses equally.
- __init__(cmd, logfile)¶
- Parameters
cmd (list of str) – command line to execute
logfile (file) – file to use for log stdout/stderr
- readAgain()¶
- property Status¶
- kill()¶
- isComplete()¶
- class schrodinger.application.glide.http_client.AbstractGlideServerManager(keywords, jobdir='.', jobname=None, use_jc=True)¶
Bases:
object
- config_ext: str¶
- __init__(keywords, jobdir='.', jobname=None, use_jc=True)¶
- Parameters
keywords (dict) – Glide keywords to use for the job. The only required keyword is GRIDFILE.
jobdir (str) – job directory
jobname (str) – basename for input and output files and for job control. By default, a random jobname is chosen.
use_jc (bool) – run the Glide backend under job control?
- start(wait=None)¶
Launch the Glide Server job. By default, returns as soon as the job is launched, but to make sure that the job is ready to dock call .isReady() until True.
- Parameters
wait (int or NoneType) – if given, wait for the server to be ready up to
wait
seconds; if the server is still not ready then, raise a RuntimeError.
- isReady()¶
- Returns
is the server ready to dock?
- Return type
bool
- waitUntilReady(timeout=60)¶
Wait for the server to be ready. If the timeout is reached and the server is still not ready, raise a RuntimeError.
- Parameters
timeout (int) – maximum wait in seconds
- stop(wait=0.0)¶
Stop the server. First it will try to send it a shutdown request via the network; if that doesn’t work, it will kill via job control.
- Parameters
wait (float) – wait up to this time in seconds for the backend process to exit before killing it and returning. If wait==0.0 and the shutdown message was sent successfully via the network, return immediately without killing.
- property config¶
A dictionary with the information needed to connect with the server: host, port, and jobid. This data is obtained from a JSON file written by the server. If the file does not exist (yet?), the dict will be empty.
- property logfile¶
- property client¶
- class schrodinger.application.glide.http_client.GlideServerManager(*args, host='localhost', port=0, timeout=1000, **kwargs)¶
Bases:
schrodinger.application.glide.http_client.AbstractGlideServerManager
A class to start, stop, monitor, and use a Glide HTTP server. Sample use:
server = GlideServerManager({'GRIDFILE': 'grid.zip'}) server.start() while not server.isReady(): time.sleep(1) poses = server.dock(st) server.stop()
- client_module = 'schrodinger.application.glide.http_server'¶
- config_ext: str = '_http.json'¶
- __init__(*args, host='localhost', port=0, timeout=1000, **kwargs)¶
See parent class for additional arguments.
- Parameters
host (str) – host to which the server should bind to
port (int) – port where the server should listen. If zero, pick one automatically.
timeout (int) – the server will shut down automatically if this time, in seconds, passes without receiving any connections.
- dock(st)¶
Dock a ligand. Return a list of poses, which may be empty. If there was a problem connecting to the server, socket.error exceptions may be propagated.
- Parameters
st (structure.Structure) – Structure to dock
- Returns
docking result
- Return type
- dockSmiles(smiles)¶
Dock a ligand from SMILES. For best results, the server should have been launched with the LIGPREP keyword enabled.
- Parameters
smiles (str) – ligand SMILES
- Returns
docking result
- Return type
- setReferenceLigand(st)¶
Tell the server to use a new reference ligand when docking subsequent ligands. (This only has an effect if the job started with a reference ligand, for example when the job uses core constraints.)
- Parameters
st (structure.Structure) – new reference ligand
- Returns
Glide result (empty, but with an “Updated reflig” message)
- Return type
- property client¶
Client object to be used for connecting to the Glide server process.
- Return type
- Returns
the client object.
- property config¶
A dictionary with the information needed to connect with the server: host, port, and jobid. This data is obtained from a JSON file written by the server. If the file does not exist (yet?), the dict will be empty.
- isReady()¶
- Returns
is the server ready to dock?
- Return type
bool
- property logfile¶
- start(wait=None)¶
Launch the Glide Server job. By default, returns as soon as the job is launched, but to make sure that the job is ready to dock call .isReady() until True.
- Parameters
wait (int or NoneType) – if given, wait for the server to be ready up to
wait
seconds; if the server is still not ready then, raise a RuntimeError.
- stop(wait=0.0)¶
Stop the server. First it will try to send it a shutdown request via the network; if that doesn’t work, it will kill via job control.
- Parameters
wait (float) – wait up to this time in seconds for the backend process to exit before killing it and returning. If wait==0.0 and the shutdown message was sent successfully via the network, return immediately without killing.
- waitUntilReady(timeout=60)¶
Wait for the server to be ready. If the timeout is reached and the server is still not ready, raise a RuntimeError.
- Parameters
timeout (int) – maximum wait in seconds
- class schrodinger.application.glide.http_client.NonBlockingGlideServerManager(*args, **kwargs)¶
Bases:
schrodinger.application.glide.http_client.GlideServerManager
,PyQt6.QtCore.QObject
A class to use a Glide HTTP server without blocking.
- Variables
lignum_to_st (dict[int, structure.Structure]) – Current batch ligands sent to the server keyed by their corresponding ligand numbers. It’s cleared when the batch is reset.
posesDocked – Signal emitted when a ligand finishes docking. Emitted with a list of pose structures.
noPosesDocked – Signal emitted when a ligand goes through the docking workflow, but does not return any valid poses. Emits the ligand number and the message provided by the backend.
errorOccurred – Signal emitted when there is an error communicating with the server.
batchFinished – Signal emitted when a docking batch finishes. Emitted with the number of ligands that were docked.
- posesDocked¶
- noPosesDocked¶
- batchFinished¶
- errorOccurred¶
- __init__(*args, **kwargs)¶
See parent class for additional arguments.
- Parameters
host (str) – host to which the server should bind to
port (int) – port where the server should listen. If zero, pick one automatically.
timeout (int) – the server will shut down automatically if this time, in seconds, passes without receiving any connections.
- stop(*args, **kwargs)¶
Stop the server. First it will try to send it a shutdown request via the network; if that doesn’t work, it will kill via job control.
- Parameters
wait (float) – wait up to this time in seconds for the backend process to exit before killing it and returning. If wait==0.0 and the shutdown message was sent successfully via the network, return immediately without killing.
- dockBatch(structures, done_adding=True)¶
Set a batch of structures to dock.
- Parameters
structures (Iterable[structure.Structure]) – Structures to dock.
done_adding (bool) – Whether to emit batchFinished when all sts in
structures
finish docking. Pass False if structures is a generator that can have more structures added to it at runtime.
- cancelBatch()¶
- addStructures(structures)¶
Add more structures to dock. Should call
setDoneAdding
once all structures have been added.- Parameters
structures (Iterable[structure.Structure]) – Structures to dock.
- setDoneAdding()¶
Call this when done adding structures to a batch; once all structures have been docked,
batchFinished
will be emitted.
- resetBatch()¶
- property client¶
Client object to be used for connecting to the Glide server process.
- Return type
- Returns
the client object.
- blockSignals(self, b: bool) bool ¶
- childEvent(self, a0: QChildEvent)¶
- children(self) List[QObject] ¶
- client_module = 'schrodinger.application.glide.http_server'¶
- property config¶
A dictionary with the information needed to connect with the server: host, port, and jobid. This data is obtained from a JSON file written by the server. If the file does not exist (yet?), the dict will be empty.
- config_ext: str = '_http.json'¶
- connectNotify(self, signal: QMetaMethod)¶
- customEvent(self, a0: QEvent)¶
- deleteLater(self)¶
- destroyed¶
destroyed(self, object: typing.Optional[QObject] = None) [signal]
- disconnect(a0: QMetaObject.Connection) bool ¶
- disconnect(self) None
- disconnectNotify(self, signal: QMetaMethod)¶
- dock(st)¶
Dock a ligand. Return a list of poses, which may be empty. If there was a problem connecting to the server, socket.error exceptions may be propagated.
- Parameters
st (structure.Structure) – Structure to dock
- Returns
docking result
- Return type
- dockSmiles(smiles)¶
Dock a ligand from SMILES. For best results, the server should have been launched with the LIGPREP keyword enabled.
- Parameters
smiles (str) – ligand SMILES
- Returns
docking result
- Return type
- dumpObjectInfo(self)¶
- dumpObjectTree(self)¶
- dynamicPropertyNames(self) List[QByteArray] ¶
- event(self, a0: QEvent) bool ¶
- eventFilter(self, a0: QObject, a1: QEvent) bool ¶
- findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject ¶
- findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
- findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject] ¶
- findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- inherits(self, classname: str) bool ¶
- installEventFilter(self, a0: QObject)¶
- isReady()¶
- Returns
is the server ready to dock?
- Return type
bool
- isSignalConnected(self, signal: QMetaMethod) bool ¶
- isWidgetType(self) bool ¶
- isWindowType(self) bool ¶
- killTimer(self, id: int)¶
- property logfile¶
- metaObject(self) QMetaObject ¶
- moveToThread(self, thread: QThread)¶
- objectName(self) str ¶
- objectNameChanged¶
objectNameChanged(self, objectName: str) [signal]
- parent(self) QObject ¶
- property(self, name: 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, signal: PYQT_SIGNAL) int ¶
- removeEventFilter(self, a0: QObject)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setObjectName(self, name: str)¶
- setParent(self, a0: QObject)¶
- setProperty(self, name: str, value: Any) bool ¶
- setReferenceLigand(st)¶
Tell the server to use a new reference ligand when docking subsequent ligands. (This only has an effect if the job started with a reference ligand, for example when the job uses core constraints.)
- Parameters
st (structure.Structure) – new reference ligand
- Returns
Glide result (empty, but with an “Updated reflig” message)
- Return type
- signalsBlocked(self) bool ¶
- start(wait=None)¶
Launch the Glide Server job. By default, returns as soon as the job is launched, but to make sure that the job is ready to dock call .isReady() until True.
- Parameters
wait (int or NoneType) – if given, wait for the server to be ready up to
wait
seconds; if the server is still not ready then, raise a RuntimeError.
- startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int ¶
- staticMetaObject = <PyQt6.QtCore.QMetaObject object>¶
- thread(self) QThread ¶
- timerEvent(self, a0: QTimerEvent)¶
- tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str ¶
- waitUntilReady(timeout=60)¶
Wait for the server to be ready. If the timeout is reached and the server is still not ready, raise a RuntimeError.
- Parameters
timeout (int) – maximum wait in seconds
- class schrodinger.application.glide.http_client.NonBlockingBackendChecker(*args, **kwargs)¶
Bases:
PyQt6.QtCore.QObject
Class to get an GlideServerManager object to the ready state without blocking the GUI.
- Variables
ready – Whether the backend is ready
- __init__(*args, **kwargs)¶
- wait(timeout=60)¶
Block python execution (but not the GUI) until the backend is ready or the timeout is reached.
- Parameters
timeout (int or NoneType) – Timeout in seconds or None to not timeout.
- Returns
Whether the backend is ready
- setBackend(backend)¶
Set the backend object to call isReady on
- stopChecking()¶
Stop checking whether the backend is ready
- onServerTimeout(*, msg=None)¶
- blockSignals(self, b: bool) bool ¶
- childEvent(self, a0: QChildEvent)¶
- children(self) List[QObject] ¶
- connectNotify(self, signal: QMetaMethod)¶
- customEvent(self, a0: QEvent)¶
- deleteLater(self)¶
- destroyed¶
destroyed(self, object: typing.Optional[QObject] = None) [signal]
- disconnect(a0: QMetaObject.Connection) bool ¶
- disconnect(self) None
- disconnectNotify(self, signal: QMetaMethod)¶
- dumpObjectInfo(self)¶
- dumpObjectTree(self)¶
- dynamicPropertyNames(self) List[QByteArray] ¶
- event(self, a0: QEvent) bool ¶
- eventFilter(self, a0: QObject, a1: QEvent) bool ¶
- findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject ¶
- findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
- findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject] ¶
- findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- inherits(self, classname: str) bool ¶
- installEventFilter(self, a0: QObject)¶
- isSignalConnected(self, signal: QMetaMethod) bool ¶
- isWidgetType(self) bool ¶
- isWindowType(self) bool ¶
- killTimer(self, id: int)¶
- metaObject(self) QMetaObject ¶
- moveToThread(self, thread: QThread)¶
- objectName(self) str ¶
- objectNameChanged¶
objectNameChanged(self, objectName: str) [signal]
- parent(self) QObject ¶
- property(self, name: 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, signal: PYQT_SIGNAL) int ¶
- removeEventFilter(self, a0: QObject)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setObjectName(self, name: str)¶
- setParent(self, a0: QObject)¶
- setProperty(self, name: str, value: Any) bool ¶
- signalsBlocked(self) bool ¶
- startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int ¶
- staticMetaObject = <PyQt6.QtCore.QMetaObject object>¶
- thread(self) QThread ¶
- timerEvent(self, a0: QTimerEvent)¶
- tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str ¶
- class schrodinger.application.glide.http_client.ZmqClient(config)¶
Bases:
PyQt6.QtCore.QObject
Connect to a Glide ZMQ driver and dock ligands synchronously.
A Glide ZMQ driver is a Glide job launched with the -mq and -server flags.
- Variables
posesDocked – Signal emitted when a ligand finishes docking. Emitted with a list of pose structures.
noPosesDocked – Signal emitted when a ligand goes through the docking workflow, but does not return any valid poses. Emits the ligand number and the message provided by the backend.
noMoreLigs – Signal emitted when there are no more ligands left to dock in the server’s queue.
gotStatus –
Signal emitted when the server sends a status message. Emitted with a dict with status information. Current keys include:
”elapsed_time”
”ligs_done”
”poses_stored”
”ligs_per_sec”
”lps_per_worker”
”active_workers”
”idle_workers”
”lost_workers”
- posesDocked¶
- noPosesDocked¶
- noMoreLigs¶
- gotStatus¶
- __init__(config)¶
- Parameters
config (dict) – The ZMQ config.
- dock(st, lignum=None)¶
Send a ligand to the server to dock. Poses are returned asynchronously via the posesDocked and noPosesDocked signals.
- Parameters
st (structure.Structure) – Structure to dock
lignum (Optional[int]) – ligand index (stored by Glide in the i_i_glide_lignum property). It can be used to tell which ligand is which, because the poses are not in general returned in the same order in which the ligands are sent to the server. If not provided, a sequential number will be used. Note that unique numbers should be used, because lignum is used as a key by the server!
- Returns
The ligand number assigned.
- Return type
int
- shutdown_server()¶
- cancel()¶
- getStatus()¶
Request a status update from the server. When the response comes, the gotStatus signal is emitted with a dict containing status information.
- disconnect()¶
Disconnect the ZMQ socket and stop listening.
- blockSignals(self, b: bool) bool ¶
- childEvent(self, a0: QChildEvent)¶
- children(self) List[QObject] ¶
- connectNotify(self, signal: QMetaMethod)¶
- customEvent(self, a0: QEvent)¶
- deleteLater(self)¶
- destroyed¶
destroyed(self, object: typing.Optional[QObject] = None) [signal]
- disconnectNotify(self, signal: QMetaMethod)¶
- dumpObjectInfo(self)¶
- dumpObjectTree(self)¶
- dynamicPropertyNames(self) List[QByteArray] ¶
- event(self, a0: QEvent) bool ¶
- eventFilter(self, a0: QObject, a1: QEvent) bool ¶
- findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject ¶
- findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
- findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject] ¶
- findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- inherits(self, classname: str) bool ¶
- installEventFilter(self, a0: QObject)¶
- isSignalConnected(self, signal: QMetaMethod) bool ¶
- isWidgetType(self) bool ¶
- isWindowType(self) bool ¶
- killTimer(self, id: int)¶
- metaObject(self) QMetaObject ¶
- moveToThread(self, thread: QThread)¶
- objectName(self) str ¶
- objectNameChanged¶
objectNameChanged(self, objectName: str) [signal]
- parent(self) QObject ¶
- property(self, name: 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, signal: PYQT_SIGNAL) int ¶
- removeEventFilter(self, a0: QObject)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setObjectName(self, name: str)¶
- setParent(self, a0: QObject)¶
- setProperty(self, name: str, value: Any) bool ¶
- signalsBlocked(self) bool ¶
- startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int ¶
- staticMetaObject = <PyQt6.QtCore.QMetaObject object>¶
- thread(self) QThread ¶
- timerEvent(self, a0: QTimerEvent)¶
- tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str ¶
- class schrodinger.application.glide.http_client.NonBlockingGlideServerManagerZmq(*args, nworkers=2, user_command_args=None, **kwargs)¶
Bases:
schrodinger.application.glide.http_client.AbstractGlideServerManager
,PyQt6.QtCore.QObject
Launch and use Glide ZMQ server without blocking. The server and workers are run on localhost, but future versions might relax this restriction.
This class is meant as a drop-in replacement for NonBlockingGlideServerManager, but there are a couple of subtle differences in behavior: 1) when docking a batch, all ligands are sent immediately to the server, which keeps its own queue. This could be a problem when feeding an infinite iterable to dockBatch(). 2) cancelBatch() causes any currently docking ligands to be aborted, unlike NonBlockingGlideServerManager which waits for the current ligand to complete.
- Variables
lignum_to_st (dict[int, structure.Structure]) – Current batch ligands sent to the server keyed by their corresponding ligand numbers. It’s cleared when the batch is reset.
posesDocked – Signal emitted when a ligand finishes docking. Emitted with a list of pose structures.
noPosesDocked – Signal emitted when a ligand goes through the docking workflow, but does not return any valid poses. Emits the ligand number and the message provided by the backend.
errorOccurred – Signal emitted when there is an error communicating with the server.
batchFinished – Signal emitted when a docking batch finishes. Emitted with the number of ligands that were docked.
gotStatus – Signal emitted when the server sends a status message. Emitted with a dict with status information. Current keys include “elapsed_time”, “ligs_done”, “poses_stored”, “ligs_per_sec”, “lps_per_worker”, “active_workers”, “idle_workers”, and “lost_workers”.
- config_ext: str = '_zmq.json'¶
- posesDocked¶
- noPosesDocked¶
- batchFinished¶
- errorOccurred¶
- gotStatus¶
- __init__(*args, nworkers=2, user_command_args=None, **kwargs)¶
Most arguments are passed through to GlideServerManager; see that class for documentation. Arguments specific to this class:
- Parameters
nworkers (int) – number of workers to launch.
user_command_args (Optional[list[str]]) – A list of additional command line arguments to be passed to the ‘glide’ command.
- stop(*args, **kwargs)¶
Stop the server. First it will try to send it a shutdown request via the network; if that doesn’t work, it will kill via job control.
- Parameters
wait (float) – wait up to this time in seconds for the backend process to exit before killing it and returning. If wait==0.0 and the shutdown message was sent successfully via the network, return immediately without killing.
- dockBatch(structures, done_adding=True, reset=True)¶
Set a batch of structures to dock.
- Parameters
structures (Iterable[structure.Structure]) – Structures to dock. Note the iterable is consumed immediately, so be aware that large datasets could have an effect on memory usage.
done_adding (bool) – Whether to emit batchFinished when all sts in
structures
finish docking. Pass False if structures is a generator that can have more structures added to it at runtime.reset (bool) – Whether to reset the batch before adding. Pass False to expand the current batch instead of starting a new one.
- cancelBatch()¶
- addStructures(structures)¶
Add more structures to dock. Should call
setDoneAdding
once all structures have been added.- Parameters
structures (Iterable[structure.Structure]) – Structures to dock. Note the iterable is consumed immediately, so be aware that large datasets could have an effect on memory usage.
- setDoneAdding()¶
Call this when done adding structures to a batch; once all structures have been docked,
batchFinished
will be emitted.
- property client¶
- getStatus()¶
- resetBatch()¶
- start(*args, **kwargs)¶
Launch the Glide Server job. By default, returns as soon as the job is launched, but to make sure that the job is ready to dock call .isReady() until True.
- Parameters
wait (int or NoneType) – if given, wait for the server to be ready up to
wait
seconds; if the server is still not ready then, raise a RuntimeError.
- blockSignals(self, b: bool) bool ¶
- childEvent(self, a0: QChildEvent)¶
- children(self) List[QObject] ¶
- property config¶
A dictionary with the information needed to connect with the server: host, port, and jobid. This data is obtained from a JSON file written by the server. If the file does not exist (yet?), the dict will be empty.
- connectNotify(self, signal: QMetaMethod)¶
- customEvent(self, a0: QEvent)¶
- deleteLater(self)¶
- destroyed¶
destroyed(self, object: typing.Optional[QObject] = None) [signal]
- disconnect(a0: QMetaObject.Connection) bool ¶
- disconnect(self) None
- disconnectNotify(self, signal: QMetaMethod)¶
- dumpObjectInfo(self)¶
- dumpObjectTree(self)¶
- dynamicPropertyNames(self) List[QByteArray] ¶
- event(self, a0: QEvent) bool ¶
- eventFilter(self, a0: QObject, a1: QEvent) bool ¶
- findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject ¶
- findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
- findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject] ¶
- findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- inherits(self, classname: str) bool ¶
- installEventFilter(self, a0: QObject)¶
- isReady()¶
- Returns
is the server ready to dock?
- Return type
bool
- isSignalConnected(self, signal: QMetaMethod) bool ¶
- isWidgetType(self) bool ¶
- isWindowType(self) bool ¶
- killTimer(self, id: int)¶
- property logfile¶
- metaObject(self) QMetaObject ¶
- moveToThread(self, thread: QThread)¶
- objectName(self) str ¶
- objectNameChanged¶
objectNameChanged(self, objectName: str) [signal]
- parent(self) QObject ¶
- property(self, name: 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, signal: PYQT_SIGNAL) int ¶
- removeEventFilter(self, a0: QObject)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setObjectName(self, name: str)¶
- setParent(self, a0: QObject)¶
- setProperty(self, name: str, value: Any) bool ¶
- signalsBlocked(self) bool ¶
- startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int ¶
- staticMetaObject = <PyQt6.QtCore.QMetaObject object>¶
- thread(self) QThread ¶
- timerEvent(self, a0: QTimerEvent)¶
- tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str ¶
- waitUntilReady(timeout=60)¶
Wait for the server to be ready. If the timeout is reached and the server is still not ready, raise a RuntimeError.
- Parameters
timeout (int) – maximum wait in seconds
- schrodinger.application.glide.http_client.st_from_blob(blob)¶
Return a Structure from a compressed blob.
- Parameters
blob (bytes) – compressed m2io representation of a structure
- Returns
Structure
- Return type