rxnutils.pipeline package

Subpackages

Submodules

rxnutils.pipeline.base module

Module containing routines for the validation framework

rxnutils.pipeline.base.action(obj)

Decorator that register a callable as a validation action.

An action will be called with a pandas.DataFrame object and return a new pandas.DataFrame object.

An action needs to have an attribute pretty_name.

Parameters:

obj (Callable[[DataFrame], DataFrame]) – the callable to register as an action

Returns:

the same as obj.

Return type:

Callable[[DataFrame], DataFrame]

rxnutils.pipeline.base.list_actions(short=False)

List all available actions in a nice table

Parameters:

short (bool)

Return type:

None

rxnutils.pipeline.base.create_action(pretty_name, *args, **kwargs)

Create an action that can be called

Parameters:
  • pretty_name (str) – the name of the action

  • args (Any)

  • kwargs (Any)

Returns:

the instantiated actions

Return type:

Callable[[DataFrame], DataFrame]

class rxnutils.pipeline.base.ReactionActionMixIn

Bases: object

Mixin class with standard routines for splitting and joining reaction SMILES

join_lists(reactants_list, reagents_list, products_list)

Join list of components into a reaction SMILES

Parameters:
  • reactants_list (List[str]) – the list of reactant SMILES

  • reagents_list (List[str]) – the list of reagent SMILES

  • products_list (List[str]) – the list of product SMILES

Returns:

the concatenated reaction SMILES

Return type:

str

join_smiles(reactants, reagents, products)

Join component SMILES into a reaction SMILES

Parameters:
  • reactants (str) – the reactant SMILES

  • reagents (str) – the reagent SMILES

  • products (str) – the product SMILES

Returns:

the concatenated reaction SMILES

Return type:

str

split_lists(row)

Split a reaction SMILES into list of component SMILES

Parameters:

row (Series) – the row with the SMILES

Returns:

the list of SMILES of the components

Return type:

Tuple[List[str], List[str], List[str]]

split_smiles(row)

Split a reaction SMILES into components SMILES

Parameters:

row (Series) – the row with the SMILES

Returns:

the SMILES of the components

Return type:

Tuple[str, str, str]

rxnutils.pipeline.runner module

Module containg routines and interface to run pipelines

rxnutils.pipeline.runner.run_pipeline(data, pipeline, filename, save_intermediates=True)

Run a given pipeline on a dataset

The actions are applied sequentials as they are defined in the pipeline

The intermediate results of the pipeline will be written to separate tab-separated CSV files.

Parameters:
  • data (DataFrame) – the dataset

  • pipeline (Dict[str, Any]) – the action specifications

  • filename (str) – path to the final output file

  • save_intermediates (bool) – if True will save intermediate results

Returns:

the dataset after completing the pipeline

Return type:

DataFrame

rxnutils.pipeline.runner.main(args=None)

Function for command line argument

Parameters:

args (Sequence[str] | None)

Return type:

None

Module contents