schrodinger.application.livedesign.ld_utils module

schrodinger.application.livedesign.ld_utils.copy_structure_properties(rl_map, from_key, to_key, include_receptors)

For every ligand in a receptor-ligand map, copy the structure property value at key from_key to the structure property at the key to_key. Optionally do the same for the receptor structures.

Parameters:
  • rl_map (data_classes.ReceptorLigandMap) – a receptor-ligand map
  • from_key (str) – the source structure property key
  • to_key (str) – the destination structure property key
  • include_receptors (bool) – whether to also copy structure properties for the receptors in the map
schrodinger.application.livedesign.ld_utils.copy_structure_property_value(st, from_key, to_key)

For the supplied structure, copy the value of the structure property stored at from_key to to_key. The value at from_key will remain unchanged. This function should work as expected regardless of whether values at from_key or to_key are defined.

Parameters:
  • st (structure.Structure) – a structure
  • from_key (str) – the source structure property key
  • to_key (str) – the destination structure property key
schrodinger.application.livedesign.ld_utils.build_receptor_ligand_map(structure_map, maestro_data_type)

Return a receptor-ligand map containing all of the structures in structure_map formatted according to the specified data type.

Note that the resulting map will not preserve the receptor keys from structure_map; because ligands and receptors are stored as pairs, the ligand key will instead be used in any scenario in which a receptor and ligand are paired.

Parameters:
  • structure_map (dict(str, structure.Structure)) – a dictionary mapping string keys to ligand or receptor structures
  • maestro_data_type (data_types.BaseMaestroData) – the data type used for formatting the receptor- ligand map
schrodinger.application.livedesign.ld_utils.update_prop_names(prop_dicts)

Edit the properties to accommodate renaming behavior in SD files; these expect the structure title to have a specific name.

Parameters:prop_dicts (list(OrderedDict(str, str))) – a list of dictionaries each specifying the mapping between a maestro and LD property.
schrodinger.application.livedesign.ld_utils.get_prop_dicts_from_export_data(export_data_list)

Given a list of data_classes.ExportData objects, return a corresponding list of property dictionaries (when possible).

Parameters:export_data_list (list(data_classes.ExportData)) – a list of export data objects
Returns:a list of property dictionaries. Property dictionary formatting should match the dictionary formatting required by the properties argument of LDClient.start_export_assay_and_pose_data().
Return type:list(dict(str, str))
schrodinger.application.livedesign.ld_utils.separate_complex(complex_st)

Given a receptor-ligand complex structure, separate the ligands from the receptors. Return a list of ‘receptor’ structures and a corresponding list of ligand structures. The receptors are the rest of the complex once the ligand has been removed.

Parameters:complex_st (structure.Structure) – a ligand-receptor complex
Returns:a receptor list and corresponding ligand list
Return type:tuple(list(structure.Structure), list(structure.Structure))
schrodinger.application.livedesign.ld_utils.download_ld_client(url, tmp_dir, tar_filename, glob_path)

Download the ld client under tmp_dir. :param url: url of the ld client :type url: str

Parameters:
  • tmp_dir (str) – Directory under which ld client will be downloaded
  • tar_filename (str) – tar filename of the client (without .tar.gz ext)
  • glob_path (str) – glob path with wildcards (ex: ldclient-*)
Returns:

Returns the path to the client

Return type:

str

Raises:

Exception – Raises RuntimeError in case of any error

schrodinger.application.livedesign.ld_utils.remove_previous_existing_files(dirpath, name)

This helper method removed all files and directories matching the given name in the directory specified by dirpath.

Parameters:
  • dirpath – Path to the directory under which the files needs to be removed
  • name (str) – to match any files or directories in the form of ‘name*’
schrodinger.application.livedesign.ld_utils.zip_dir(zipdir, output_file, split_path=True)

Recursively zips a directory, including the empty directories.

Parameters:
  • zipdir (str) – The path to the directory to zip
  • output_file (str) – Output file to write zip to
  • split_path (bool) – Whether to write archive as abspath or relative to the zipdir
schrodinger.application.livedesign.ld_utils.extract_prjzip(prjzip)

Extracts a .prjzip or .prz.zip file to a temp dir. The project’s directory name is not altered.

Parameters:prjzip (str) – The path to the project to unzip
Returns:Path to the unzipped project
schrodinger.application.livedesign.ld_utils.convert_prj(input_prj, decrement=False)

Runs $SCHRODINGER/utilities/project_convert on a project. This can be used to convert a project to the current format, or if decrement is True the project will be converted to the immediate previous version.

Parameters:
  • input_prj (str) – The path to the project to convert
  • decrement (bool) – Whether to decrement the project’s version
Returns:

Path to the converted project

schrodinger.application.livedesign.ld_utils.convert_prjzip(prjzip, decrement=False)

Runs $SCHRODINGER/utilities/project_convert on a zipped project. The project is then re-zipped with the same filename.

Parameters:
  • prjzip (str) – The path to the zipped project to be converted
  • decrement (bool) – Whether to decrement the project’s version
schrodinger.application.livedesign.ld_utils.get_new_file_name(prefix, extension)

Returns a unique filename with the given prefix and extension.

Parameters:
  • prefix (str) – the prefix for the desired file name
  • extension (str) – the extension for the desired file name
Returns:

a file name that begins with prefix, ends with extension, and does not correspond to an existing file

Return type:

str

schrodinger.application.livedesign.ld_utils.modify_prjzip(prjzip_path)

Context manager for opening an older version .prjzip file for modification.

Parameters:prjzip_path (str) – path to an older version .prjzip file
Returns:the project stored in the supplied file
Return type:project.Project