schrodinger.application.livedesign.io_utils module¶
LiveDesign protocol io utils
Copyright Schrodinger, LLC. All rights reserved.
- class schrodinger.application.livedesign.io_utils.SupportedFormats¶
Bases:
Enum
- mae = 'maestro'¶
- sd = 'sd'¶
- csv = 'smilescsv'¶
- schrodinger.application.livedesign.io_utils.safely_access_path(target_path: str, max_duration: int) Generator[bool, None, None] ¶
If a path is specified, wait until it is unlocked. Then lock it and yield control. Unlock the path upon exit.
This is copied directly from application.scisol.packages.livedesign.utils so the whole module isn’t loaded and fills up memory
- Parameters:
target_path – the path to a file or directory that should only be accessed by a single process at a time
max_duration – a maximum duration (in seconds) to wait before aborting the access attempt
- Yield:
True
if the lock was successful;False
if the path was already locked for longer thanmax_duration
seconds
- schrodinger.application.livedesign.io_utils.check_ligand_file(lig_file: str) str ¶
Check the ligand file format. If it’s a CSV file, convert it a RDKit binary mol file
- Parameters:
lig_file – Ligand file
- Returns:
File name containing the ligands
- schrodinger.application.livedesign.io_utils.get_structure_ids(infile: str) Set[str] ¶
Create a set of titles for all structures found in the input file
- Parameters:
infile – Input SD file
- Returns:
Set containing all structure titles
- schrodinger.application.livedesign.io_utils.read_csv_columns(csv_file: str, columns: List[str]) Generator[List[str], None, None] ¶
Reads specified columns from a CSV file and yields the values as a list for each row.
- Parameters:
csv_file – The path to the CSV file.
columns – The list of column names to read from the CSV file.
- Yield:
A list of values for each row, corresponding to the specified columns.
- schrodinger.application.livedesign.io_utils.apply_random_color(st: Structure) None ¶
Apply a random color scheme to the structure
- Parameters:
st – Structure to be colored
- schrodinger.application.livedesign.io_utils.record_failures(results_list: List[Dict[str, Union[str, float, int]]], header: Union[KeysView[str], List[str]], failures: List[Tuple[List[str], str]]) List[Dict[str, Union[str, float, int]]] ¶
Create a dictionary with empty values for the corporate ID that failed a stage in a LiveDesign protocol and updated the list that is passed in.
- Parameters:
results_list – List of dictionaries where each dictionary contains the required data to write to the CSV file
header – Header in the CSV file
failures – List of list where each nested list contains a list of IDs that failed the task, and the task name
- Returns:
Update list of dictionaries where each dictionary contains the required data to write to the output CSV file
- schrodinger.application.livedesign.io_utils.create_csv(results_list: List[Dict[str, Union[str, float, int]]], csv_file: str) None ¶
Write a CSV file from a list of dictionaries. The output file name ‘results.csv’, is required by LiveDesign so the module-level constant will always be used
- Parameters:
results_list – List of dictionaries where each dictionary contains the required data to write to the CSV file. Column headers will be take from the keys of the first dict
csv_file – CSV filename
- schrodinger.application.livedesign.io_utils.create_postmortem(job_ids: List[str]) List[str] ¶
Run postmortem on for the given job_ids
- Parameters:
job_ids – List of job_control/jobserver job ids
- Returns:
List of postmortem file names
- schrodinger.application.livedesign.io_utils.str_remove_suffix(s: str, suffix: str) str ¶
Remove a suffix from a string
- Parameters:
s – String to remove the suffix from
suffix – Suffix to remove
- Returns:
String with suffix removed
- schrodinger.application.livedesign.io_utils.license_check(required_licenses: List) None ¶
Check the existence of all required licenses If any license is missing, process will exit
- Parameters:
required_licenses – List of license to check for
- schrodinger.application.livedesign.io_utils.write_unique_ligands(input_file: str, output_file: str)¶
Get the unique ligands from the structure file
- Parameters:
input_file – Input structure file
output_file – Output structure file name
- schrodinger.application.livedesign.io_utils.get_float_value_from_column(csv_file: str) dict[str, float] ¶
Get the float values from a LD column
- Parameters:
csv_file – Column CSV file containing Corporate ID and Data columns
- Returns:
Dict from Corp ID to values