Rule#

Rule objects and utilities for composing, applying, and modifying reaction rules.

Core#

class synkit.Rule.syn_rule.SynRule(rc: Graph, name: str = 'rule', canonicaliser: GraphCanonicaliser | None = None, *, canon: bool = True, implicit_h: bool = True, format: Literal['typesGH', 'tuple'] | None = None)[source]#

Bases: object

classmethod from_gml(gml: str, name: str = 'rule', canonicaliser: GraphCanonicaliser | None = None, *, canon: bool = True, implicit_h: bool = True) SynRule[source]#
classmethod from_smart(smart: str, name: str = 'rule', canonicaliser: GraphCanonicaliser | None = None, *, canon: bool = True, implicit_h: bool = True, format: Literal['typesGH', 'tuple'] = 'typesGH') SynRule[source]#
help() None[source]#

Compose#

class synkit.Rule.Compose.compose_rule.ComposeRule[source]#

Bases: object

static filter_smallest_vertex(combo: List[object]) List[object][source]#
get_rule_comp(smart_1: str, smart_2: str) str | None[source]#
static rule_cluster(graphs: List[Any]) List[Any][source]#
class synkit.Rule.Compose.rule_compose.RuleCompose[source]#

Bases: object

static filter_smallest_vertex(combo: List[object]) List[object][source]#
static rule_cluster(graphs: List) List[source]#
static save_gml_from_text(gml_content: str, gml_file_path: str, rule_id: str, parent_ids: List[str]) bool[source]#
class synkit.Rule.Compose.rule_mapping.RuleMapping[source]#

Bases: object

static enumerate_all_unique_mappings(child: Graph, parent: Graph) List[Dict[Any, Any]][source]#
fit(rule_1: str, rule_2: str, comp_rule: str) Dict[Any, Any] | None[source]#
static get_child1_to_child2_mapping(mapping_child1_to_parent: Dict[Any, Any], mapping_child2_to_parent: Dict[Any, Any]) Dict[Any, Any | None][source]#
static graph_alignment(child: Graph, parent: Graph, node_label_names: List[str] = ['element'], node_label_default: List[str] = ['*'], edge_attribute: str = 'standard_order') Tuple[bool, Dict[Any, Any] | None][source]#
static keep_largest_component(graph: Graph) Graph[source]#
static standardize_order(order_tuple: Tuple[float, ...]) Tuple[float, ...] | None[source]#
static subtract_parent_from_child(child: Graph, parent: Graph, mapping: Dict[Any, Any]) Graph[source]#
class synkit.Rule.Compose.seq_comp.SeqComp[source]#

Bases: object

static sequence_map(smarts: List[str]) Dict[str, dict | None][source]#
class synkit.Rule.Compose.valence_constrain.ValenceConstrain[source]#

Bases: object

check_rule(rule, verbose: bool = False, log_error: bool = False) bool[source]#
split(rules: List) Tuple[List, List][source]#
valence(vertex) int[source]#

Apply#

class synkit.Rule.Apply.reactor_rule.ReactorRule[source]#

Bases: object

class synkit.Rule.Apply.retro_reactor.RetroReactor[source]#

Bases: object

class synkit.Rule.Apply.rule_matcher.RuleMatcher(rsmi: str, rule: str | Graph, explicit_h: bool = True, electron_diagnostics: bool = False)[source]#

Bases: object

static all_in(a: List[str], b: List[str]) bool[source]#
property diagnostics: list[dict]#
get_result() Tuple[str, Graph][source]#
help() None[source]#
class synkit.Rule.Apply.rule_rbl.RuleRBL[source]#

Bases: object

rbl(rsmi: str, gml_rule: str, remove_aam: bool = True) List[str][source]#

Modify#

Note

synkit.Rule.Modify.implict_rule is currently omitted from this page because it fails to import in the uploaded repository due to an internal import error. Re-enable the directive below after that module is fixed.

class synkit.Rule.Modify.longest_path.LongestPath(G: Graph)[source]#

Bases: object

BFS(u: int) Tuple[int, int][source]#
LongestPathInDisconnectedGraph() int[source]#
class synkit.Rule.Modify.molecule_rule.MoleculeRule[source]#

Bases: object

static generate_atom_map(smiles: str) str | None[source]#
generate_molecule_rule(smiles: str, name: str = 'molecule', explicit_hydrogen: bool = True, sanitize: bool = True) str | None[source]#
static generate_molecule_smart(smiles: str) str | None[source]#
static remove_edges_from_left_right(input_str: str) str[source]#
class synkit.Rule.Modify.prune_templates.PruneTemplate(templates: List[List[Dict[str, Any]]], graph_key: str)[source]#

Bases: object

fit() List[List[Dict[str, Any]]][source]#
static remove_edges_by_attribute(input_graph: Graph, attribute: str = 'standard_order', value: Any = 0) Graph[source]#
synkit.Rule.Modify.rule_utils.filter_context(context_lines, relevant_nodes)[source]#
synkit.Rule.Modify.rule_utils.find_block(lines, keyword)[source]#
synkit.Rule.Modify.rule_utils.get_nodes_from_edges(block_lines)[source]#
synkit.Rule.Modify.rule_utils.parse_context(context_lines, node_regex=None, edge_regex=None)[source]#
synkit.Rule.Modify.rule_utils.strip_context(gml_text: str, remove_all: bool = True) str[source]#
synkit.Rule.Modify.strip_rule.filter_context(context_lines, left_edges)[source]#
synkit.Rule.Modify.strip_rule.strip_context(gml_text: str, remove_all: bool = False) str[source]#