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 keyto_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
toto_key
. The value atfrom_key
will remain unchanged. This function should work as expected regardless of whether values atfrom_key
orto_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 groups, the ligand key will instead be used in any scenario in which a receptor and ligand are grouped.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
Returns: a receptor-ligand map constructed from the supplied inputs
Return type:
-
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 ofLDClient.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.
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
isTrue
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 withextension
, and does not correspond to an existing fileReturn 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
-
schrodinger.application.livedesign.ld_utils.
get_sha1
(file_path)¶ Return the SHA1 hash of a specified file. If no file path is provided, return
None
.Parameters: file_path (str or None) – the path to a file, or None
Returns: the SHA1 hash of the file located at file_path
, orNone
Return type: str or None
-
schrodinger.application.livedesign.ld_utils.
get_round_trip_hash
(st)¶ Return a hash of relevant structure and host data. This will be used to determine whether structures imported from LiveDesign can be exported back to LiveDesign using corporate ID (vs. structure) matching.
Parameters: st (structure.Structure) – a structure Returns: a hash value related to the provided structure Return type: str
-
schrodinger.application.livedesign.ld_utils.
apply_round_trip_hash
(st)¶ Store a structure-dependent hash as a property on this structure.
Parameters: st (structure.Structure) – a structure
-
schrodinger.application.livedesign.ld_utils.
st_matches_round_trip_hash
(st)¶ Determine whether the supplied structure has been altered in an important way since its structure hash was stored.
Parameters: st (structure.Structure) – a structure Returns: whether the round trip hash value stored on this structure matches a newly-generated structure hash Return type: bool
-
schrodinger.application.livedesign.ld_utils.
safely_set_property
(st, key, value)¶ Set a specified property on a structure. If the supplied
value
isNone
, delete the property if it is already defined on the structure if possible.Raises: ValueError – if the user attempts to set the title to
None
Parameters: - st (structure.Structure) – a structure
- key (str) – a structure property key
- value (bool or int or float or str or None) – the value to store in the structure property dictionary