schrodinger.application.livedesign.upload_utils module

class schrodinger.application.livedesign.upload_utils.CommandType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.Enum

normal = 'NORMAL'
realtime = 'REALTIME'
click_to_run = 'CLICK_TO_RUN'
clustering = 'CLUSTERING'
schrodinger.application.livedesign.upload_utils.upload_ld_attachment(file_path, project_id, ld_client, remote_file_name=None, file_type='ATTACHMENT')

Upload a file to LiveDesign as an attachment and return the corresponding attachment ID.

Parameters
  • file_path (str) – the path to the file to be uploaded

  • project_id (int) – the ID of the LiveDesign project that the file should be uploaded to

  • ld_client (ldclient.client.LDClient) – an instance of the LD client to use for the upload

  • remote_file_name (str or NoneType) – the name of the attachment once uploaded; None, use the (base) name of the file path

  • file_type (str) – Type of file being uploaded. Param should be an image, attachment, or 3D structure in LD_FILE_TYPES.

Returns

the attachment ID

Return type

str

schrodinger.application.livedesign.upload_utils.get_template_vars(template_data, template_class)

Provided a list containing LiveDesign attachment IDs and names, generate and return a list of template variables.

Parameters
  • template_data (list of 2-tuple of (int, str)) – a list of 2-tuple containing LD attachment IDs and corresponding names

  • template_class (class) – the template class to initialize, from the downloaded ldclient.models module.

Returns

a list of template variables

Return type

list of ldclient.models.ModelTemplateVar

schrodinger.application.livedesign.upload_utils.get_model_by_name(ld_client, model_name, include_archived=True)

Retrieves a single model. Used in KNIME.

Parameters
  • ld_client (ldclient.client.LDClient) – an instance of the LD client to get models

  • model_name (str) – Name of the model to retrieve

  • include_archived (bool) – Whether to include archived models or not. If False, ignore archived models

Returns

Matched model object

Return type

models.Model

schrodinger.application.livedesign.upload_utils.upload_ld_model(name, user_name, folder, project_id, template_vars, description, protocol_id, ld_client, model_class, model_recursive_class, command_type=CommandType.normal, predictions=None, model_id=None, overwrite=False)

Create a LiveDesign model and upload it to a LiveDesign server.

Parameters
  • name (str) – the name of the model

  • user_name (str) – the name of the user uploading this model

  • folder (str) – the directory path in which the model should be created on the LiveDesign server

  • project_id (str) – the ID of the LiveDesign project that the file should be uploaded to

  • template_vars – a list of template variables containing attachment data

  • description (str) – a description of the model

  • protocol_id (str) – the ID of the parent protocol for this model

  • ld_client (ldclient.client.LDClient) – an instance of the LD client to use for the upload

  • model_class (class) – the model class, from the downloaded ldclient.models module

  • model_recursive_class – the “model recursive class” that is necessary to build the model instance

  • command_type (CommandType) – Command type of the model to be uploaded

  • predictions (list of ldclient.models.ModelReturn) – the predictions to be added to the model

  • model_id (int) – Id of the model to be updated. If model_id is specified, ‘overwrite’ option will be ignored.

  • overwrite (bool) – If true and if exactly one model with ‘name’ already exists, then instead of creating a new one, update the model. If no model or more than one model exist with same name, then create a new model. If ‘model_id’ is specified, this option will be ignored and always the given model_id is updated.

Return type

list of ldclient.models.ModelTemplateVar

Type

model_recursive_class: :class: ModelRecursive

Returns

a tuple containing the model instance uploaded to the LiveDesign server (if available) and a message about the status of the upload

Return type

tuple[ldclient.models.Model or None, str]

schrodinger.application.livedesign.upload_utils.get_uploaded_model_url(host, model_id, ld_version, use_lig_designer_config: bool = False)

Gets the URL for a model the user has uploaded

Parameters
  • host (str) – host name for model

  • model_id (str) – model’s ID number

  • ld_version (login.Version) – Version of LD used

  • use_lig_designer_config – if the ligand designer config url should be used

Returns

URL for the user’s uploaded model

Return type

str