rxn.reaction_preprocessing.special_tokens

Module for functionality related to special tokens (such as light and heat) to include in reaction SMILES.

Important comments: 1. Other modules should always try to use the functions defined here, i.e. try to:

  • never explicitly mention “[Lv]” or “[Ts]”

  • not refer directly to LIGHT_TOKEN or HEAT_TOKEN: normally the functions in this module should be sufficient (adding such tokens, removing them, querying whether a reaction contains them).

  1. The functions here rely on ReactionEquation instead of SMILES strings. This makes the code independent of the reaction SMILES format. Conversion to and from strings should be done outside this module.

  2. The Python objects starting with an underscore are meant not to be used elsewhere.

Functions

add_heat_token(reaction_or_list[, in_place])

Add the heat token to the precursors of a reaction or list of SMILES.

add_light_token(reaction_or_list[, in_place])

Add the light token to the precursors of a reaction or list of SMILES.

contains_heat_token(reaction_or_iterable)

Whether a reaction (or set of SMILES strings) contains the heat token.

contains_light_token(reaction_or_iterable)

Whether a reaction (or set of SMILES strings) contains the light token.

strip_all_special_tokens(reaction_or_list[, ...])

Strip all the special tokens from a reaction or list of SMILES strings.

strip_heat_token(reaction_or_list[, in_place])

Strip the heat from a reaction or list of SMILES strings.

strip_light_token(reaction_or_list[, in_place])

Strip the light token from a reaction or list of SMILES strings.