schrodinger.application.livedesign_ml.ldml_client module

Module to interact with LiveDesign ML (LDML) APIs. This module is intended to be the single point of contact to access any LDML client APIs.

class schrodinger.application.livedesign_ml.ldml_client.LDMLJobStatus

Bases: JsonableEnum

RUNNING = 'running'
FINISHED = 'finished'
EXITED = 'exited'
exception schrodinger.application.livedesign_ml.ldml_client.LDMLClientError

Bases: Exception

Exception when access to ldml client fails.

exception schrodinger.application.livedesign_ml.ldml_client.LDMLApiError

Bases: Exception

Exception for LDML API errors.

class schrodinger.application.livedesign_ml.ldml_client.AbstractApiProxy(ldml_url: str | None = None, jsession_id: str | None = None)

Bases: QObject

Abstract proxy class to call LDML APIs.

connectionFailed

A pyqtSignal emitted by instances of the class.

__init__(ldml_url: str | None = None, jsession_id: str | None = None)

Initialize the API proxy class. If ldml_url and jsession_id are provided, they will be used for API connection and authentication. If only ldml_url is provided, the JSESSIONID will be obtained from LDClient’s session cookies. If both are not specified, ldml_url is derived from the LDClient’s host and JSESSIONID is obtained from LDClient’s session cookies.

Parameters:
  • ldml_url – LiveDesign ML URL.

  • jsession_id – JSESSIONID for api authentication.

class schrodinger.application.livedesign_ml.ldml_client.DatasetsApiProxy(ldml_url: str | None = None, jsession_id: str | None = None)

Bases: AbstractApiProxy

Proxy class to call LDML Datasets API methods.

class schrodinger.application.livedesign_ml.ldml_client.AsyncInferenceApiProxy(ldml_url: str | None = None, jsession_id: str | None = None)

Bases: AbstractApiProxy

Proxy class to call LDML Async Inference API methods.

class schrodinger.application.livedesign_ml.ldml_client.RetroSynthesisApiProxy(ldml_url: str | None = None, jsession_id: str | None = None)

Bases: AbstractApiProxy

Proxy class to call LDML Retrosynthesis API methods.

class schrodinger.application.livedesign_ml.ldml_client.LDMLClient(ldml_url: str = None, jsession_id: str = None)

Bases: QObject

A class to interact with LiveDesign ML (LDML) APIs.

By default, this class will be based on the currently connected LDClient. The ldml client will be downloaded and installed for the current LiveDesign host. The API proxies will pick the host and JSESSIONID from the connected LDClient.

If ldml_url and jsession_id are provided during initialization, they will be used for API connection and authentication. In that case, the ldml client will be downloaded and installed for the given url and the API proxies will use the provided url and JSESSIONID.

If only ldml_url is provided, the ldml client will be downloaded and installed for the given url and JSESSIONID will be obtained from LDClient’s session cookies.

To create LDMLClient for a given LDML url and jsession_id, call the class method createFromConfig() before calling getInstance.

For example, a ComboJobTask creates an LDMLClient in its mainFunction(), based on the given LDML url and jsession_id.

connectionChanged

A pyqtSignal emitted by instances of the class.

connectionFailed

A pyqtSignal emitted by instances of the class.

__init__(ldml_url: str = None, jsession_id: str = None)

Initialize LDMLClient. If an explicit ldml_url and jsession_id are provided, they will be used for API connection and authentication. If LDML_URL environment is set, it is used as the URL. Otherwise, the url will be derived from the LDClient’s host. In both these case, jsession_id will be obtained from LDClient’s session cookies.

Parameters:
  • ldml_url – LiveDesign ML URL.

  • jsession_id – JSESSIONID for API authentication.

classmethod createFromConfig(ldml_url: str, jsession_id: str) LDMLClient

Create LDMLClient instance from the given config parameters.

Parameters:
  • ldml_url – LiveDesign ML URL.

  • jsession_id – JSESSIONID for API authentication.

Returns:

LDMLClient instance.

classmethod getInstance() LDMLClient

Get singleton LDMLClient instance.

getHost() str | None

Get the LiveDesign ML host associated with this ldml client.

Returns:

LiveDesign ML host URL

getLDMLUrl() str | None

Get the LiveDesign ML URL associated with this ldml client.

Returns:

LiveDesign ML URL

isErrorResponse(response: any) bool

Check if the response is an error response.

getErrorResponseMsg(response: ErrorResponse) str

Extract error message from the error response.

isValidationError(response: any) bool

Check if the response is a list of validation errors.

getValidationError(response: list['ValidationErrorModel']) str

Extract validation error message from the response.

getManualDatasets() DatasetListResponse

Get the list of manual datasets from LDML.

Returns:

List of datasets

Raises:
createDataset(dataset_display_name: str, csv_file: str, project_id: str, comments: str | None = None) DatasetCreateSuccess

Create a new LDML dataset.

Parameters:
  • display_name – Dataset display name of the new dataset.

  • csv_file – Path to the CSV file with dataset.

  • comments – Comments for the dataset.

  • project_id – Project ID to which the dataset belongs.

Returns:

DatasetCreateSuccess object containing created dataset and message

Raises:
updateDataset(dataset_name: str, csv_file: str | None, comments: str | None = None) DatasetUpdateSuccess

Update an existing LDML dataset. Either comments or csv_file must be provided.

Parameters:
  • dataset_name – Dataset internal name of the dataset to update.

  • csv_file – Path to the new CSV file for the dataset.

  • comments – New comments for the dataset.

Returns:

DatasetUpdateSuccess object containing updated dataset and message

Raises:
getAllDatasets() DatasetListResponse

Get the list of all datasets from LDML

Returns:

List of datasets

Raises:
submitInferenceJob(dataset_display_name: str, sts: list[Structure]) str

Submit an inference job for the given structures on the dataset

Parameters:
  • dataset_display_name – Dataset display name to use for inference.

  • sts – List of structures for inference.

Returns:

Job ID of the submitted inference job.

Raises:
getInferenceStatus(job_id: str) LDMLJobStatus

Get the status of the inference job.

Parameters:

job_id – Job ID of the inference job.

Returns:

LDMLJobStatus of the inference job.

Raises:
getInferenceResults(job_id: str) list['InferenceOutputData']

Get inference results for the given job ID.

Parameters:

job_id – Job ID of the inference job.

Returns:

List of InferenceOutputData objects.

Raises:
getRetroSynthProjects() list[str]

Get the list of RetroSynthesis projects from LDML.

Returns:

List of RetroSynthesis projects

Raises:
submitRetroSynthJob(sts: list[Structure], project_name: str) str

Submit a retrosynthesis job for the given SMILES and project.

Parameters:
  • sts – List of structures for retrosynthesis.

  • project_name – RetroSynthesis project name.

Returns:

Job ID of the submitted retrosynthesis job.

Raises:
getRetroSynthJobStatus(job_id: str, project_name: str) LDMLJobStatus

Get the status of the retrosynthesis job.

Parameters:
  • job_id – Job ID of the retrosynthesis job.

  • project_name – RetroSynthesis project name.

Returns:

Job status as LDMLJobStatus.

Raises:
getRetroSynthResults(job_id: str, project_name: str) list['RetroSynthOutputData']

Get the retrosynthesis results for the given job ID.

Parameters:
  • job_id – Job ID of the retrosynthesis job.

  • project_name – RetroSynthesis project name.

Returns:

List of RetroSynthOutputData objects.

Raises: