Package schrodinger :: Package structutils :: Module smilesfilter
[hide private]
[frames] | no frames]

Module smilesfilter

A group of functions and classes to help filtering structure files on unique SMILES strings.

Copyright Schrodinger, LLC. All rights reserved.

Classes [hide private]
  FilterReporter
A class to handle reporting of results from the remove_dupes function.
  SmilesErrorHandler
A class that acts as an error handler for cases where SMILES generation fails.
Functions [hide private]
 
remove_dupes(smiles_generator, struct_iterator, put_unique, put_dupes=None, error_handler=None, reporter=None)
Process structures from the provided structure iterator 'struct_iterator' using the 'smiles_generator' to compute unique SMILES strings.
 
add_smiles(smiles_generator, struct_iterator, put_output, error_handler=None)
Calculate SMILES strings with 'smiles_generator' for each structure in 'struct_iterator'.
 
_parse_options(args)
Parse command-line options.
 
_make_smiles_writer(filename)
Create a function that takes a structure and a SMILES string, and writes a SMILES format file to file 'filename'.
 
_make_mae_writer(filename, propname)
Returns a function that takes a structure and a SMILES string.
 
_main(args=None)
The main routine for filtering and SMILES generation.
Variables [hide private]
  _version = "$Revision: 1.20 $"
  _output_logger = log.get_output_logger("output.schrodinger.str...
Function Details [hide private]

remove_dupes(smiles_generator, struct_iterator, put_unique, put_dupes=None, error_handler=None, reporter=None)

 

Process structures from the provided structure iterator
'struct_iterator' using the 'smiles_generator' to compute unique SMILES
strings. Unique structures are passed to the 'put_unique' callback and
duplicates to 'put_dupes' (if provided).

Parameters

smiles_generator (SmilesGenerator)

struct_iterator (iterator return Structure objects)
    Any iterator returning Structure objects (such as a StructureReader)
    will work.

put_unique (callable)
put_dupes (callable)
    These functions will be called with (structure, SMILES string)
    arguments in the appropriate situation.

error_handler (callable)
    A callable that takes (index, structure, exception) for cases where
    SMILES generation generates a RuntimeError.

reporter (FilterReporter)
    If present, information will be logged.

add_smiles(smiles_generator, struct_iterator, put_output, error_handler=None)

 

Calculate SMILES strings with 'smiles_generator' for each structure in
'struct_iterator'.  

Parameters

smiles_generator (SmilesGenerator)

struct_iterator (iterator return Structure objects)
    Any iterator returning Structure objects (such as a StructureReader)
    will work.

put_output (callable)
    This function will be called with (structure, SMILES string)
    arguments when a SMILES string can be calculated.

error_handler (callable)
    A callback function that takes (index, structure, exception) and is
    called in cases where SMILES generation generates a RuntimeError.

_parse_options(args)

 

Parse command-line options.

Parameters

args (list of str)
    This should be the list of arguments without any program name at the
    0 index (e.g. pass in sys.argv[1:], not sys.argv).

Like OptionParser.parse_args(), return a tuple of (options, arguments).
(Here, options is an optparse.Values instance and arguments is a list of
the remaining command-line arguments.)

Raises SystemExit exception if the arguments are not good.

_make_mae_writer(filename, propname)

 

Returns a function that takes a structure and a SMILES string. The created function sets the SMILES property and writes the structure to the mae file 'filename'.

_main(args=None)

 

The main routine for filtering and SMILES generation.

Parameters

args (list of str)
    This should be the list of arguments without any program name at the
    0 index (e.g. pass in sys.argv[1:], not sys.argv).

Raises RuntimeError if a filename argument has an unrecognized
    extension (i.e., format).


Variables Details [hide private]

_output_logger

Value:
log.get_output_logger("output.schrodinger.structutils.smilesfilter")