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
.
-
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.
-
static
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)
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
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. Returns an iterator with the output pose(s).
-
shutdown_server
()¶ Ask the Glide HTTP server to shut down.
-
static
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
,PyQt5.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.
- finished – Signal emitted when an HTTP request finishes. Note: aliased from self.manager.finished
-
posesDocked
¶
-
__init__
(host=None, port=8000)¶ Parameters: - host (str) – Hostname for server
- port (int) – Port for server
-
dock
(ct)¶ Docks the structure without blocking.
Parameters: ct (schrodinger.structure.Structure) – Structure to dock
-
shutdown_server
()¶ Requests shutting down the server without blocking.
-
blockSignals
(self, bool) → bool¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → object¶
-
connectNotify
(self, QMetaMethod)¶
-
static
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, QEvent)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → object¶
-
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.glide.http_client.
GlideServerManager
(keywords, jobdir='.', jobname='glide_server', host='localhost', port=0, timeout=1000)¶ Bases:
object
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()
-
__init__
(keywords, jobdir='.', jobname='glide_server', host='localhost', port=0, timeout=1000)¶ Parameters: keywords – Glide keywords to use for the job. The only required keyword is GRIDFILE. :type keywords: dict
Parameters: - jobdir (str) – job directory
- jobname – basename for input and output files and for job control
- host – 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.
-
start
()¶ Launch the Glide Server job. Returns as soon as the job is launched, but to make sure that the job is ready to dock call .isReady() until True.
-
isReady
()¶ Returns: is the server ready to dock? Return type: bool
-
dock
(st)¶ Dock a ligand. Returns 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 (schrodinger.structure.Structure) – Structure to dock Returns: list of poses Return type: list of schrodinger.structure.Structure
-
stop
()¶ Stop the server. First it will try to send it a shutdown request via HTTP; if that doesn’t work, it will kill via job control.
-
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.
-
client
¶ Client object to be used for connecting to the Glide server process.
Return type: HTTPClient Returns: the client object.
-
-
class
schrodinger.application.glide.http_client.
NonBlockingGlideServerManager
(*args, **kwargs)¶ Bases:
schrodinger.application.glide.http_client.GlideServerManager
,PyQt5.QtCore.QObject
A class to use a Glide HTTP server without blocking.
Variables: - posesDocked – Signal emitted when a ligand finishes docking. Emitted with a list of pose structures.
- batchFinished – Signal emitted when a docking batch finishes. Emitted with the number of ligands that were docked.
-
posesDocked
¶
-
batchFinished
¶
-
__init__
(*args, **kwargs)¶ Parameters: keywords – Glide keywords to use for the job. The only required keyword is GRIDFILE. :type keywords: dict
Parameters: - jobdir (str) – job directory
- jobname – basename for input and output files and for job control
- host – 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. Returns 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 (schrodinger.structure.Structure) – Structure to dock Returns: list of poses Return type: list of schrodinger.structure.Structure
-
dockBatch
(structures)¶ Dock structures and emit a signal when all requests are finished.
Parameters: structures (iterable[schrodinger.structure.Structure]) – Structures to dock
-
client
¶ Client object to be used for connecting to the Glide server process.
Return type: HTTPClient Returns: the client object.
-
blockSignals
(self, bool) → bool¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → object¶
-
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, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → object¶
-
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)¶
-
isReady
()¶ Returns: is the server ready to dock? Return type: bool
-
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¶
-
start
()¶ Launch the Glide Server job. Returns as soon as the job is launched, but to make sure that the job is ready to dock call .isReady() until True.
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
stop
()¶ Stop the server. First it will try to send it a shutdown request via HTTP; if that doesn’t work, it will kill via job control.
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶