schrodinger.application.combinatorial_screen.driver_utils module

Provides miscellaneous functionality for combinatorial_screen_driver.py.

Copyright Schrodinger LLC, All Rights Reserved.

schrodinger.application.combinatorial_screen.driver_utils.combine_log_files(subjobs, logger)

Concatenates the contents of subjob log files.

Parameters:
  • subjobs (list(str)) – Subjob names
  • logger (Logger) – Logger to which concatenated log files are to be written
schrodinger.application.combinatorial_screen.driver_utils.create_clib_archive(archive_file, route_node, fp_dir=None)

Creates a combinatorial library archive (.czip) from a synthetic route node and fingerprint files for the reactants. It is assumed that for each reactant file <path>/<reactant>.* referenced in route_node, there’s an associated fingerprint file <reactant>.fp in the CWD or in fp_dir.

Parameters:
  • archive_file (str) – The name of the archive to create.
  • route_node (route.RouteNode) – Synthetic route node
  • fp_dir (str) – The directory in which to look for a given fingerprint file if it’s not found in the CWD.
schrodinger.application.combinatorial_screen.driver_utils.create_reactant_files(reactant_files, smiles, titles, counts)

Creates reactant CSV files containing subsets of reactants. If N is the number of reactants, then reactant_files, smiles, titles and counts should each have a length of N. The number of smiles and titles written for the ith reactant is counts[i].

Parameters:
  • reactant_files (list(str)) – The N reactant files to create
  • smiles (list(list(str))) – N lists of reactant SMILES
  • titles (list(list(str))) – N lists of reactant titles
  • counts – The number of reactants in each of the N subsets
schrodinger.application.combinatorial_screen.driver_utils.extract_archive(archive_file, dest_dir=None)

Extracts a combinatorial library archive and returns the path to the archive directory (.clib).

Parameters:
  • archive_file (str) – The name of the archive to extract
  • dest_dir (str) – Extract to directory other than CWD
Returns:

Path to archive directory

Return type:

str

schrodinger.application.combinatorial_screen.driver_utils.find_reactions(reaction_dict, reactions)

Recursive function for descending a reaction route dictionary and finding reaction names.

Parameters:
  • reaction_dict (dict) – Dictionary containing “reaction_name” and “precursors” keys, where the latter points to a list of dictionaries, one of which may also contain “reaction_name” and “precursors” keys, hence the need for recursion.
  • reactions (list(str)) – List of reaction names. Updated by this function.
schrodinger.application.combinatorial_screen.driver_utils.get_clib_dir(archive_file)

Returns the name of the .clib directory within the supplied .czip archive. The normal convention is <library>.czip <–> <library>.clib, but a user may decide to change the name of the root portion of the archive so that this is no longer true.

Parameters:archive_file (str) – The name of the combinatorial library archive
Returns:The name of the .clib directory within the archive
Return type:str
Raises:OSError – If no .clib directory is found
schrodinger.application.combinatorial_screen.driver_utils.get_combinatorial_synthesis_command(args)

Returns the command that should be used to run combinatorial_synthesis minus the -max_products option.

Parameters:args (argparse.Namespace) – Command line arguments
Returns:combinatorial_synthesis command
Return type:list(str)
schrodinger.application.combinatorial_screen.driver_utils.get_distributed_fp_commands(args)

Returns lists of subjob commands for running distributed reactant fingerprint generation. Commands are not returned for fingerprint files that already exist in the CWD or in args.fp_dir.

Parameters:args (argparse.Namespace) – Command line arguments
Returns:list of subjob commands
Return type:list(list(str))
schrodinger.application.combinatorial_screen.driver_utils.get_existing_fp_file(fp_file, fp_dir=None)

Returns the name of a reactant fingerprint file if the file exists in the CWD or in fp_dir. Returns None if the file doesn’t exist in either location.

Parameters:
  • fp_file (str) – The reactant fingerprint file. Only the basename is used.
  • fp_dir (str) – The directory in which to look for the fingerprint file. If None, only the CWD is checked.
Returns:

The name of the existing fingerprint file, or None. If found in fp_dir, the leading path to fp_dir is included.

Return type:

str

schrodinger.application.combinatorial_screen.driver_utils.get_existing_fp_files(route_node, fp_dir=None)

Returns the names of any existing reactant fingerprint files in the CWD or in fp_dir that will be used in lieu of generating from scratch.

Parameters:
  • route_node (route.RouteNode) – Synthetic route node
  • fp_dir (str) – The directory in which to look for the fingerprint file. If None, only the CWD is checked.
Returns:

Existing fingerprint file names, including the leading path if found in fp_dir.

Return type:

list(str)

schrodinger.application.combinatorial_screen.driver_utils.get_fp_files(archive_dir)

Returns the names of the fingerprint files within the directory of an extracted combinatorial library archive.

Parameters:archive_dir (str) – Path to archive directory (.clib)
Returns:Fingerprint files names, including leading path
Return type:list(str)
schrodinger.application.combinatorial_screen.driver_utils.get_jobname(args)

Returns an appropriate name based on args.subjob, SCHRODINGER_JOBNAME, the job control backend, or the base name of args.lib_file. In the last case, “_setup” or “_run” is appended to the string.

Parameters:args (argparse.Namespace) – Command line arguments
Returns:job name
Return type:str
schrodinger.application.combinatorial_screen.driver_utils.get_parser()

Creates argparse.ArgumentParser with supported command line options.

Returns:Argument parser object
Return type:argparser.ArgumentParser
schrodinger.application.combinatorial_screen.driver_utils.get_reactant_files(route_file)

Returns the list of runtime paths for the reactant files referenced in the supplied JSON route file.

Parameters:route_file – JSON route file
Returns:List of reactant file names
Return type:list(str)
schrodinger.application.combinatorial_screen.driver_utils.replace_reactant_file_name(reaction_dict)

Recursive function for descending a reaction route dictionary and replacing reagent names or reagent file names with CSV file names which have a matching root but no leading path. For example, the reagent name name “thiols” would be replaced with “thiols.csv”, as would the reagent file name “/path/to/thiols.pfx”.

Parameters:reaction_dict (dict) – Dictionary containing “reaction_name” and “precursors” keys, where the latter points to a list of dictionaries, one of which may also contain “reaction_name” and “precursors” keys, hence the need for recursion. The dictionary is modified in-place.
schrodinger.application.combinatorial_screen.driver_utils.replace_reactant_file_names(route_node)

Returns a synthetic route node which is identical to the supplied one, except for the replacement of the reagent names or reagent file names with matching CSV file names which have no leading path.

Parameters:route_node (route.RouteNode) – Synthetic route node
Returns:Synthetic route node containing new reactant file names
Return type:route.RouteNode
schrodinger.application.combinatorial_screen.driver_utils.summarize_archive(archive_file)

Returns a string that summarizes the contents of a combinatorial library archive.

Parameters:archive_file (str) – The name of the combinatorial library archive
Returns:A summary of the archive contents
Return type:str
schrodinger.application.combinatorial_screen.driver_utils.validate_args(args)

Checks the validity of command line arguments.

Parameters:args (argparser.Namespace) – argparser.Namespace with command line arguments
Returns:tuple of validity and non-empty error message if not valid
Return type:bool, str
schrodinger.application.combinatorial_screen.driver_utils.write_hits(args, num_hits, logger)

Writes the products with the highest similarities to the query to the hit file.

Parameters:
  • args (argparser.Namespace) – argparser.Namespace with command line arguments
  • num_hits (int) – The number of hits to write
  • logger (Logger) – Logger to which messages are to be written
schrodinger.application.combinatorial_screen.driver_utils.zip_library_dir(library_dir)

Creates a Zip file <library>.czip from a directory <library>.clib.

Parameters:library_dir (str) – The library directory to zip