schrodinger.application.canvas.driverutils module

Utility functions for writing Canvas drivers in python.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.canvas.driverutils.gen_range_specification(spec, max_endpoint=None)

A generator of ints from a range specification.

Note that if max_endpoint is None the generator will yield results to infinity.

schrodinger.application.canvas.driverutils.get_driver_option_parser(opts)

A function to create an OptionParser with standard options that are used in multiple Canvas drivers.

Options are generally stored under mnemonic attribute names rather than the option name itself.

The mapping is as follows:
  • d is delimiter
  • fieldIn is field_in
  • fieldOut is field_out
  • in is input_file
  • lt is train_list
  • lx is independent_vars
  • out is output_file
  • seed is random_seed
Some names are stored as their option names:
  • build
  • y
Parameters:opts (list of strings) – A list of names of options to add.
schrodinger.application.canvas.driverutils.get_excluded_columns(input_file, delimiter, independent_vars=None, field_in=None, field_out=None)

Given an input file and delimiter, get the columns that should be excluded from processing.

schrodinger.application.canvas.driverutils.get_range_specification(spec, max_endpoint=None)

A function to return the ints determined by the string range specification.

Parameters:max_endpoint – If provided, will fill in explicit values through max_endpoint and set the ‘to_end’ return value to False.
Returns:A tuple (values, to_end) of specific values to include and a boolean indicating whether to continue through the final endpoint.
schrodinger.application.canvas.driverutils.open_csv(input_file, delimiter, y, independent_vars=None, field_in=None, field_out=None)

Return a ChmDelimitedPatterns object that has been opened with specification of a dependent variable.

schrodinger.application.canvas.driverutils.open_multiy_csv(input_file, delimiter, y, independent_vars=None, field_in=None, field_out=None)

Return a ChmMultiYDelimitedPatterns object that has been opened with specification of a dependent variable.

Parameters:y (sequence of strings or integers) – A sequence of either column names or numbers (with 1-based indices).
schrodinger.application.canvas.driverutils.option_float_varargs_callback(option, opt_str, value, parser)

A callback to be used with the OptionParser to give an option a variable number of string arguments.

schrodinger.application.canvas.driverutils.option_string_varargs_callback(option, opt_str, value, parser)

A callback to be used with the OptionParser to allow an option to have a variable number of arguments that will be converted to a list of floats.

schrodinger.application.canvas.driverutils.print_report(model_reporter, output_file=None)

Given a ChmModelReporter, print the log. If output_file is not None, write to the file; otherwise write to stdout.