linchemin.cgu.syngraph.MonopartiteReacSynGraph¶
- class linchemin.cgu.syngraph.MonopartiteReacSynGraph(initiator: List[dict] | Iron | None = None)[source]¶
SynGraph subclass representing a Monopartite (ChemicalEquation nodes only) SynGraph
- __init__(initiator: List[dict] | Iron | None = None)¶
To instantiate a new SynGraph instance
Parameters:¶
- initiator: initiator: Union[List[dict], Iron, None]
The initiator of the new SynGraph instance (default None -> an empty graph is initialized)) It can be:
an Iron instance
a list of dictionaries of reaction strings in the form
[{‘query_id’: n, ‘output_string’: reaction}]
Methods
__init__([initiator])To instantiate a new SynGraph instance
add_node(nodes_tup)To add a 'parent' node and its 'children' nodes to a SynGraph instance.
build_chemical_equations(string_list[, ...])To build a list of ChemicalEquation objects from a list of smiles
builder_from_iron(iron_graph)To build a MonopartiteReacSynGraph from an Iron instance.
builder_from_reaction_list(chemical_equations)To build a MonopartiteReacSynGraph from a list of ChemicalEquation objects
get_leaves()To get the list of ChemicalEquation leaves in a MonopartiteSynGraph.
get_molecule_leaves()To get the list of Molecule leaves in a MonopartiteReacSynGraph.
get_molecule_roots()To get the list of Molecules roots in a MonopartiteReacSynGraph.
get_roots()To retrieve the list of 'root' nodes of a SynGraph instance
get_unique_nodes()To get the set of unique nodes included in a SynGraph instance
remove_isolated_ces()To remove sequences of nodes if they form isolated branches.
remove_node(node_to_remove_id)To remove a node by its uid from a SynGraph instance
set_name(name)To set the name attribute of a SynGraph instance
Attributes
uidTo define the SynGraph unique identifier based on the underlying graph