linchemin.cgu.syngraph_operations.extract_reactions_from_syngraph

linchemin.cgu.syngraph_operations.extract_reactions_from_syngraph(syngraph: MonopartiteReacSynGraph | BipartiteSynGraph | MonopartiteMolSynGraph) List[dict][source]

To extract the smiles of the chemical reaction included in a SynGraph object in a format suitable for atom mapping

Parameters:

syngraph: Union[MonopartiteReacSynGraph, BipartiteSynGraph, MonopartiteMolSynGraph]

The input graph for which the reaction smiles should be extracted

Returns:

reactions: List[dict]

The list of dictionary with the reaction smiles in the form [{‘query_id’: n, ‘input_string’: reaction}]

Raises:

TypeError: if the input graph is not a SynGraph object

Example:

>>> graph_az = json.loads(open('az_file.json').read())
>>> syngraph = translator('az_retro', graph_az[0], 'syngraph', 'monopartite_reactions')
>>> reactions = extract_reactions_from_syngraph(syngraph)