CRN#
Chemical reaction network construction, structure handling, querying, symmetry, Petri-net analysis, and visualization utilities.
Construct#
- class synkit.CRN.Construct.abstract.AbstractReactionExtractor[source]#
Bases:
object- build(reactions: Sequence[str] | None = None, *, data: Mapping[str, Any] | None = None, drop_missing_smiles_reactions: bool = True, deduplicate: bool = False, templates: Mapping[str, str] | None = None, order: str = 'appearance', reactant_join: str = '+', product_join: str = '+', prefix_module_in_reaction_id: bool = True, reaction_id_keys: Sequence[str] | None = None, reaction_smiles_keys: Sequence[str] | None = None, template_keys: Sequence[str] | None = None, save_as: str | Path | None = None) AbstractReactionNetwork[source]#
- build_molecule_pool(parsed_reactions: Sequence[Tuple[List[str], List[str]]], *, order: str = 'appearance') List[str][source]#
- extract_reactions_and_templates(reactions: Sequence[str] | None = None, *, data: Mapping[str, Any] | None = None, templates: Mapping[str, str] | None = None, drop_missing_smiles_reactions: bool = True, prefix_module_in_reaction_id: bool = True, reaction_id_keys: Sequence[str] | None = None, reaction_smiles_keys: Sequence[str] | None = None, template_keys: Sequence[str] | None = None) Tuple[List[str], Dict[str, str]][source]#
- class synkit.CRN.Construct.abstract.AbstractReactionNetwork(molecule_pool: ~typing.List[str], reactions: ~typing.List[str], templates: ~typing.Dict[str, str] = <factory>, label_to_molecule: ~typing.Dict[str, str] = <factory>)[source]#
Bases:
object
- synkit.CRN.Construct.abstract.deduplicate_abstract_reactions(reactions: Sequence[str]) List[str][source]#
- class synkit.CRN.Construct.builder.CRNExpand(rules: 'List[Any]', repeats: 'int' = 50, explicit_h: 'bool' = False, implicit_temp: 'bool' = False, strategy: 'Optional[str]' = None, keep_aam: 'bool' = True, max_components: 'int' = 3, use_frontier: 'bool' = True, max_mixtures_per_rule_step: 'int' = 50000, max_tasks_per_step: 'int' = 200000, allow_self_mixtures: 'bool' = False, skip_no_change: 'bool' = True, allow_empty_side: 'bool' = False, dedup_delta: 'bool' = True, dedup_across_rules: 'bool' = False)[source]#
Bases:
object- build(seeds: Iterable[str], *, parallel: bool = False, max_workers: int | None = None, reset: bool = True) DiGraph[source]#
- derivations: DerivationLog#
- state: DerivationState#
- strategy_engine: FrontierStrategy#
- synkit.CRN.Construct.builder.build_crn_from_smarts(rules: List[str], seeds: List[str], *, repeats: int = 50, explicit_h: bool = False, implicit_temp: bool = False, strategy: str | None = None, keep_aam: bool = True, parallel: bool = False, max_workers: int | None = None, max_components: int = 3, use_frontier: bool = True, max_mixtures_per_rule_step: int = 50000, max_tasks_per_step: int = 200000, allow_self_mixtures: bool = False, skip_no_change: bool = True, allow_empty_side: bool = False, dedup_delta: bool = True, dedup_across_rules: bool = False) DiGraph[source]#
- class synkit.CRN.Construct.derivation.DerivationLog(records: 'List[DerivationRecord]' = <factory>)[source]#
Bases:
object- append(*, event_id: int, label: str, step: int, rule_index: int, reactants: Tuple[str, ...], products: Tuple[str, ...]) None[source]#
- records: List[DerivationRecord]#
- class synkit.CRN.Construct.derivation.DerivationRecord(event_id: int, label: str, step: int, rule_index: int, reactants: Tuple[str, ...], products: Tuple[str, ...])[source]#
Bases:
object
- class synkit.CRN.Construct.flattener.ReactionDeltaFlattener(graph: 'nx.DiGraph', skip_no_change: 'bool' = True, allow_empty_side: 'bool' = False, deduplicate: 'bool' = True)[source]#
Bases:
object- build() ReactionDeltaFlattener[source]#
- synkit.CRN.Construct.keys.make_dedup_key(*, dedup_across_rules: bool, rule_index: int, r_keep_keys: Tuple[str, ...], p_keep_keys: Tuple[str, ...]) Tuple[int | None, Tuple[str, ...], Tuple[str, ...]][source]#
- synkit.CRN.Construct.mixtures.iter_mixtures_arity1(pool_keys: List[str], frontier_keys: List[str], *, use_frontier: bool, cap: int) Iterator[Tuple[str, ...]][source]#
- synkit.CRN.Construct.mixtures.iter_mixtures_arity2(pool_keys: List[str], frontier_keys: List[str], *, use_frontier: bool, allow_self_mixtures: bool, cap: int) Iterator[Tuple[str, ...]][source]#
- synkit.CRN.Construct.mixtures.iter_mixtures_arityk(pool_keys: List[str], frontier_keys: List[str], *, use_frontier: bool, allow_self_mixtures: bool, arity: int, cap: int) Iterator[Tuple[str, ...]][source]#
- synkit.CRN.Construct.smiles.assign_deterministic_maps_and_canonical(nomap_smiles: str) str | None[source]#
- synkit.CRN.Construct.smiles.standardize_smiles_rdkit(smiles: str, *, keep_aam: bool) str | None[source]#
- class synkit.CRN.Construct.state.DerivationState(pool_keys: Set[str] = <factory>, frontier_keys: Set[str] = <factory>, step: int = 0)[source]#
Bases:
object
- synkit.CRN.Construct.worker.apply_rule_worker(args: Tuple[int, Any, str, bool, bool, str | None, Tuple[str, ...]]) Tuple[int, Tuple[str, ...], List[str]][source]#
- class synkit.CRN.Construct.DAG.crn.CRN(rule_list: List[Dict[str, Any]], smiles_list: str | Sequence[str], *, n_repeats: int = 3, prune: bool = True, strategy: str | Strategy = Strategy.BACKTRACK, verbosity: int = 0)[source]#
Bases:
object
- class synkit.CRN.Construct.DAG.mod_crn.MODCRN(rule_db_path: str | List[str], initial_smiles: List[str], n_repeats: int = 2)[source]#
Bases:
object
- class synkit.CRN.Construct.DAG.syncrn.ReactionDeltaFlattener(graph: 'nx.DiGraph', skip_no_change: 'bool' = True, allow_empty_side: 'bool' = False, deduplicate: 'bool' = True)[source]#
Bases:
object- build() ReactionDeltaFlattener[source]#
- class synkit.CRN.Construct.DAG.syncrn.SynCRN(rules: 'List[Any]', repeats: 'int' = 50, explicit_h: 'bool' = False, implicit_temp: 'bool' = False, strategy: 'Optional[str]' = None, keep_aam: 'bool' = True, max_components: 'int' = 3, use_frontier: 'bool' = True, max_mixtures_per_rule_step: 'int' = 50000, max_tasks_per_step: 'int' = 200000, skip_no_change: 'bool' = True, allow_empty_side: 'bool' = False, dedup_delta: 'bool' = True, dedup_across_rules: 'bool' = False)[source]#
Bases:
object
- synkit.CRN.Construct.DAG.syncrn.build_syncrn_from_smarts(rules: List[str], seeds: List[str], *, repeats: int = 50, explicit_h: bool = False, implicit_temp: bool = False, strategy: str | None = None, keep_aam: bool = True, parallel: bool = False, max_workers: int | None = None, max_components: int = 3, use_frontier: bool = True, max_mixtures_per_rule_step: int = 50000, max_tasks_per_step: int = 200000, skip_no_change: bool = True, allow_empty_side: bool = False, dedup_delta: bool = True, dedup_across_rules: bool = False) DiGraph[source]#
Structure#
- class synkit.CRN.Structure.reaction.RXNSide(counts: Dict[str, int]=<factory>)[source]#
Bases:
object
- class synkit.CRN.Structure.reaction.Reaction(id: str, source_node_id: Hashable, source_kind: str, lhs: RXNSide, rhs: RXNSide, label: str | None = None, step: int | None = None, rule_index: int | None = None, app_index: int | None = None, rule_repr: str | None = None, rule_id: str | None = None, source_attrs: Dict[str, ~typing.Any]=<factory>, metadata: Dict[str, ~typing.Any]=<factory>, reactant_edge_attrs: Dict[str, ~typing.Dict[str, ~typing.Any]]=<factory>, product_edge_attrs: Dict[str, ~typing.Dict[str, ~typing.Any]]=<factory>)[source]#
Bases:
object
- class synkit.CRN.Structure.rule.Rule(id: str, rule_index: int | None = None, rule_repr: str | None = None, label: str | None = None, metadata: Dict[str, ~typing.Any]=<factory>)[source]#
Bases:
object
- class synkit.CRN.Structure.species.Species(id: str, source_node_id: Hashable, label: str, smiles: str | None = None, source_attrs: Dict[str, ~typing.Any]=<factory>, metadata: Dict[str, ~typing.Any]=<factory>)[source]#
Bases:
object
- class synkit.CRN.Structure.syncrn.SynCRN(species: Dict[str, ~synkit.CRN.Structure.species.Species]=<factory>, reactions: Dict[str, ~synkit.CRN.Structure.reaction.Reaction]=<factory>, rules: Dict[str, ~synkit.CRN.Structure.rule.Rule]=<factory>, graph_attrs: Dict[str, ~typing.Any]=<factory>, metadata: Dict[str, ~typing.Any]=<factory>)[source]#
Bases:
object- format_reaction(reaction_id: str, *, species: str = 'label', include_id: bool = True, include_rule: bool = False, include_step: bool = False, arrow: str = '>>') str[source]#
- classmethod from_digraph(crn: DiGraph, *, species_kind: str = 'species', reaction_kinds: Tuple[str, ...] = ('reaction', 'rule'), species_prefix: str = 's_', reaction_prefix: str = 'r_', rule_prefix: str = 'rule_', strict: bool = True) SynCRN[source]#
- classmethod from_reaction_strings(rxns: List[str], rules: List[str | None] | None = None, *, parser: Callable[[str], Any] | None = None, strict: bool = True) SynCRN[source]#
- to_digraph(*, node_ids: str = 'source', reaction_kind: str | None = None, include_internal_ids: bool = True) DiGraph[source]#
Pathway#
- class synkit.CRN.Pathway.pathfinder.PathFinderConfig(max_depth: int = 12, max_paths: int = 20, stop_after_first: bool = False, deduplicate_by_flow: bool = True)[source]#
Bases:
object
- class synkit.CRN.Pathway.pathfinder.PathwayCandidate(reactions: List[str], flow: Dict[str, int], reached_species: List[str], depth: int, realizable: bool | None = None, certificate: List[str] | None = None)[source]#
Bases:
object
- class synkit.CRN.Pathway.pathfinder.PathwayFinder(config: PathFinderConfig | None = None)[source]#
Bases:
object- find_paths_set(*, source_species: Iterable[str], target_species: Iterable[str], max_depth: int | None = None, max_paths: int | None = None, stop_after_first: bool | None = None, deduplicate_by_flow: bool | None = None) List[PathwayCandidate][source]#
- load_hypergraph(vertices: Iterable[str], edges: Mapping[str, Tuple[Mapping[str, int], Mapping[str, int]]]) PathwayFinder[source]#
- synkit.CRN.Pathway.pathfinder.run_pathfinder_from_syncrn(crn: object, *, source_species: Iterable[str], target_species: Iterable[str], initial_marking: Mapping[str, int] | None = None, species: str = 'label', reaction: str = 'id', max_depth: int = 12, max_paths: int = 20, validate: bool = False, verbose: bool = True) List[PathwayCandidate][source]#
- class synkit.CRN.Pathway.reachability.PathwayReachability(config: ReachabilityConfig | None = None)[source]#
Bases:
object- compute_layers_multiset(initial_marking: Mapping[str, int], max_layers: int | None = None) ReachabilityResult[source]#
- compute_layers_set(initial_species: Iterable[str], max_layers: int | None = None) ReachabilityResult[source]#
- export_layers_json(result: ReachabilityResult, fn: str) PathwayReachability[source]#
- class synkit.CRN.Pathway.reachability.ReachabilityConfig(max_layers: int = 10000, stop_when_no_new_species: bool = True)[source]#
Bases:
object
- class synkit.CRN.Pathway.reachability.ReachabilityLayer(depth: int, newly_enabled_reactions: List[str], newly_reachable_species: List[str], all_reachable_species: List[str])[source]#
Bases:
object
- class synkit.CRN.Pathway.reachability.ReachabilityResult(initial_species: List[str], layers: List[ReachabilityLayer], species_first_depth: Dict[str, int], reaction_first_depth: Dict[str, int])[source]#
Bases:
object- layers: List[ReachabilityLayer]#
- synkit.CRN.Pathway.reachability.run_reachability_from_syncrn(crn: object, initial_species: Iterable[str], *, species: str = 'label', reaction: str = 'id', verbose: bool = True) Tuple[PathwayReachability, ReachabilityResult][source]#
- synkit.CRN.Pathway.reachability.syncrn_to_reachability_inputs(crn: object, *, species: str = 'label', reaction: str = 'id') Tuple[List[str], Dict[str, Tuple[Dict[str, int], Dict[str, int]]]][source]#
- class synkit.CRN.Pathway.realizability.PathwayRealizability(config: RealizabilityConfig | None = None)[source]#
Bases:
object- build_petri_net_from_flow() PathwayRealizability[source]#
- export_pnml(fn: str) PathwayRealizability[source]#
- is_realizable(max_states: int | None = None, max_depth: int | None = None) Tuple[bool, List[str] | None][source]#
- load_hypergraph_and_flow(vertices: Iterable[str], edges: Mapping[str, Tuple[Mapping[str, int], Mapping[str, int]]], flow: Mapping[str, int], *, initial_marking: Mapping[str, int] | None = None) PathwayRealizability[source]#
- load_syncrn_and_flow(crn: object, flow: Mapping[str, int] | None = None, *, initial_marking: Mapping[str, int] | None = None, species: str = 'label', reaction: str = 'id') PathwayRealizability[source]#
- summary() RealizabilitySummary[source]#
- class synkit.CRN.Pathway.realizability.RealizabilityConfig(max_states: int = 100000, max_depth: int = 10000)[source]#
Bases:
object
- class synkit.CRN.Pathway.realizability.RealizabilitySummary(n_species: int, n_reactions: int, active_flow: Dict[str, int]=<factory>, initial_marking: Dict[str, int]=<factory>, goal_exact: Dict[str, int]=<factory>, goal_atleast: Dict[str, int]=<factory>)[source]#
Bases:
object
- synkit.CRN.Pathway.realizability.run_realizability_from_syncrn(crn: object, flow: Mapping[str, int] | None = None, *, initial_marking: Mapping[str, int] | None = None, species: str = 'label', reaction: str = 'id', verbose: bool = True) Tuple[PathwayRealizability, Dict[str, object]][source]#
- synkit.CRN.Pathway.realizability.syncrn_to_pr_inputs(crn: object, flow: Mapping[str, int] | None = None, *, initial_marking: Mapping[str, int] | None = None, species: str = 'label', reaction: str = 'id') Tuple[List[str], Dict[str, Tuple[Dict[str, int], Dict[str, int]]], Dict[str, int], Dict[str, int]][source]#
Petri net#
- class synkit.CRN.Petrinet.analyzer.PetriAnalyzer(crn: Any, *, rtol: float = 1e-12, max_siphon_size: int | None = None)[source]#
Bases:
object- check_persistence() PetriAnalyzer[source]#
- compute_all() PetriAnalyzer[source]#
- compute_semiflows() PetriAnalyzer[source]#
- compute_siphons_traps() PetriAnalyzer[source]#
- property persistence_details: PersistenceCheckResult | None#
- property summary: PetriSummary | None#
- class synkit.CRN.Petrinet.analyzer.PetriSummary(p_semiflows: ndarray, t_semiflows: ndarray, siphons: List[Set[str]], traps: List[Set[str]], persistence_ok: bool, place_order: List[str], transition_order: List[str])[source]#
Bases:
object- p_semiflows: ndarray#
- t_semiflows: ndarray#
- class synkit.CRN.Petrinet.net.PetriNet[source]#
Bases:
object- add_place(p: str, *, label: str | None = None, source_node_id: Hashable | None = None) None[source]#
- class synkit.CRN.Petrinet.net.SynCRNIncidence(species_order: ~typing.List[str], reaction_order: ~typing.List[str], species_labels: ~typing.Dict[str, str], reaction_labels: ~typing.Dict[str, str], pre: ~typing.Dict[str, ~typing.Dict[str, int]], post: ~typing.Dict[str, ~typing.Dict[str, int]], species_source_node_ids: ~typing.Dict[str, ~typing.Hashable] = <factory>, reaction_source_node_ids: ~typing.Dict[str, ~typing.Hashable] = <factory>, graph_attrs: ~typing.Dict[str, ~typing.Any] = <factory>, metadata: ~typing.Dict[str, ~typing.Any] = <factory>)[source]#
Bases:
object
- class synkit.CRN.Petrinet.net.Transition(tid: str, pre: ~typing.Dict[str, int], post: ~typing.Dict[str, int], label: str | None = None, source_reaction_id: str | None = None, metadata: ~typing.Dict[str, ~typing.Any] = <factory>)[source]#
Bases:
object
- synkit.CRN.Petrinet.net.extract_syncrn_incidence(crn: Any) SynCRNIncidence[source]#
- class synkit.CRN.Petrinet.persistence.PersistenceCheckResult(persistence_ok: bool, siphons: List[Set[str]], semiflow_supports: List[Set[str]], uncovered_siphons: List[Set[str]])[source]#
Bases:
object
- synkit.CRN.Petrinet.persistence.siphon_persistence_condition(crn: Any, *, rtol: float = 1e-12, max_siphon_size: int | None = None) bool[source]#
- synkit.CRN.Petrinet.persistence.siphon_persistence_details(crn: Any, *, rtol: float = 1e-12, max_siphon_size: int | None = None, support_tol: float = 1e-08) PersistenceCheckResult[source]#
- synkit.CRN.Petrinet.semiflows.semiflow_supports(crn: Any, *, kind: str = 'p', rtol: float = 1e-12, support_tol: float = 1e-08) List[Dict[str, float]][source]#
- synkit.CRN.Petrinet.semiflows.stoichiometric_matrix(crn: Any) Tuple[List[str], List[str], ndarray][source]#
- synkit.CRN.Petrinet.structure.find_siphons(crn: Any, *, max_size: int | None = None, names: str = 'label') List[Set[str]][source]#
Properties#
- class synkit.CRN.Props.dynamics.StructuralSingularitySummary(n_species: int, structural_rank: int, has_perfect_matching: bool, pattern_singular: bool, determinant_checked: bool, determinant_expr: Any | None = None, determinant_is_zero: bool | None = None)[source]#
Bases:
object
- synkit.CRN.Props.dynamics.jacobian_sign_pattern(crn: Any, *, tol: float = 1e-12) Tuple[List[Any], ndarray][source]#
- synkit.CRN.Props.dynamics.jacobian_sparsity(crn: Any, *, tol: float = 1e-12) Tuple[List[Any], ndarray][source]#
- synkit.CRN.Props.dynamics.species_influence_graph(crn: Any, *, tol: float = 1e-12, use_labels: bool = False) DiGraph[source]#
- synkit.CRN.Props.dynamics.structural_singularity_summary(crn: Any, *, tol: float = 1e-12, max_exact_size: int = 7, symbol_prefix: str = 'rprime') StructuralSingularitySummary[source]#
- synkit.CRN.Props.dynamics.symbolic_jacobian(crn: Any, *, symbol_prefix: str = 'rprime', tol: float = 1e-12) Tuple[List[Any], List[Any], 'sp.Matrix'][source]#
- synkit.CRN.Props.dynamics.symbolic_reactivity_matrix(crn: Any, *, symbol_prefix: str = 'rprime', tol: float = 1e-12) Tuple[List[Any], List[Any], 'sp.Matrix'][source]#
- class synkit.CRN.Props.stoich.StoichSummary(n_species: int, n_reactions: int, rank: int)[source]#
Bases:
object- classmethod from_crn(crn: Any) StoichSummary[source]#
- synkit.CRN.Props.stoich.build_S_minus_plus(crn: Any) Tuple[List[Any], List[Any], ndarray, ndarray][source]#
- synkit.CRN.Props.stoich.integer_conservation_laws(crn: Any, *, rtol: float = 1e-12) List[List[int]][source]#
- synkit.CRN.Props.stoich.left_right_kernels(crn: Any, *, rtol: float = 1e-12) Tuple[ndarray, ndarray][source]#
- synkit.CRN.Props.stoich.summary(crn: Any) StoichSummary[source]#
- class synkit.CRN.Props.thermo.ThermoSummary(conservative: bool | None, consistent: bool | None, example_conservation_law: ndarray | None, irreversible_futile_cycles: bool)[source]#
Bases:
object
- synkit.CRN.Props.thermo.compute_conservativity(crn: Any, *, rtol: float = 1e-12, eps: float = 1e-08) tuple[bool | None, ndarray | None][source]#
- synkit.CRN.Props.thermo.compute_thermo_summary(crn: Any, *, rtol: float = 1e-12, eps: float = 1e-08) ThermoSummary[source]#
- synkit.CRN.Props.thermo.has_irreversible_futile_cycles(crn: Any, *, rtol: float = 1e-12) bool[source]#
Query#
- class synkit.CRN.Query.kegg_api.KEGGClient(base_url: str = 'https://rest.kegg.jp', timeout: float = 60.0)[source]#
Bases:
object
- class synkit.CRN.Query.kegg_extract.KEGGExtractor(client: KEGGClient | None = None, mapper_cls: type[Any] | None = None)[source]#
Bases:
object- build_kegg_json(equations_by_rid: dict[str, str | None], *, smiles_by_rid: Mapping[str, str] | None = None, rules_by_rid: Mapping[str, str | None] | None = None, molecules_by_cid: Mapping[str, Mapping[str, Any]] | None = None) dict[str, Any][source]#
- build_missing_compound_report(equations_by_rid: dict[str, str | None], compounds_by_cid: Mapping[str, Mapping[str, Any]]) dict[str, Any][source]#
- build_module_json(module_id: str, *, with_compounds: bool = True, with_atom_maps: bool = True, save_as: str | None = None) dict[str, Any][source]#
- build_pathway_json(pathway_id: str, *, with_compounds: bool = True, with_atom_maps: bool = True, save_as: str | None = None) dict[str, Any][source]#
- build_reaction_smiles_dict(parsed_by_rid: Mapping[str, Any], compounds_by_cid: Mapping[str, Mapping[str, Any]]) tuple[dict[str, str], dict[str, dict[str, list[str]]]][source]#
- client: KEGGClient | None#
- class synkit.CRN.Query.kegg_impute.KEGGImputer(extractor: KEGGExtractor | None = None)[source]#
Bases:
object- extractor: KEGGExtractor | None = None#
- class synkit.CRN.Query.kegg_parse.KEGGEquation(reactants: list[tuple[str, int]], products: list[tuple[str, int]], reversible: bool)[source]#
Bases:
object
- synkit.CRN.Query.kegg_parse.equation_to_text(parsed: KEGGEquation, arrow: str | None = None) str[source]#
- synkit.CRN.Query.kegg_parse.expand_stoichiometry(items: Sequence[tuple[str, int]]) list[str][source]#
- synkit.CRN.Query.kegg_parse.get_compound_ids_from_equations(equations_by_rid: Mapping[str, str | None]) tuple[list[str], dict[str, KEGGEquation]][source]#
- synkit.CRN.Query.kegg_parse.orient_equation_to_module(parsed: KEGGEquation, left_ids: list[str], right_ids: list[str]) KEGGEquation[source]#
- synkit.CRN.Query.kegg_parse.parse_equation(equation: str) KEGGEquation[source]#
Symmetry#
- class synkit.CRN.Symmetry.automorphism.CRNAutomorphism(source: Any, *, include_rule: bool = True, include_stoich: bool = True, wl_iters: int = 20, wl_digest_size: int = 16, config: SymmetryConfig | None = None)[source]#
Bases:
object
- synkit.CRN.Symmetry.automorphism.detect_automorphisms(source: Any, *, max_count: int = 100, timeout_sec: float | None = 5.0, **kwargs: Any) AutomorphismResult[source]#
- class synkit.CRN.Symmetry.canon.CRNCanonicalizer(source: Any, *, include_rule: bool = True, include_stoich: bool = True, wl_iters: int = 20, wl_digest_size: int = 16, config: SymmetryConfig | None = None)[source]#
Bases:
object- property engine: IRCanonicalEngine#
- class synkit.CRN.Symmetry.isomorphism.CRNIsomorphism(source: Any, *, include_rule: bool = True, include_stoich: bool = True, wl_iters: int = 20, wl_digest_size: int = 16, config: SymmetryConfig | None = None)[source]#
Bases:
object- isomorphic_to(other: CRNIsomorphism) IsomorphismResult[source]#
- subgraph_isomorphic_to(host: CRNIsomorphism) IsomorphismResult[source]#
- synkit.CRN.Symmetry.isomorphism.are_subhypergraph_isomorphic(pattern: Any, host: Any, **kwargs: Any) bool[source]#
- class synkit.CRN.Symmetry.symmetry.CRNSymmetry(source: Any, *, include_rule: bool = True, include_stoich: bool = True, wl_iters: int = 20, wl_digest_size: int = 16, config: SymmetryConfig | None = None)[source]#
Bases:
object
- class synkit.CRN.Symmetry.wl_canon.WLCanonicalResult(canon_graph: DiGraph, graph_type: str, canonical_order: List[Any], canonical_key: Any, automorphism_count: int | None, orbits: List[Set[Any]], colors: Dict[Any, str], color_hist: Dict[str, int], iters_run: int, stabilized: bool, exact: bool, elapsed_seconds: float)[source]#
Bases:
object
- class synkit.CRN.Symmetry.wl_canon.WLCanonicalizer(source: Any, *, include_rule: bool = True, include_stoich: bool = True, n_iter: int = 20, digest_size: int = 16, include_in_neighbors: bool = True, include_out_neighbors: bool = True, estimate_automorphisms: bool = True, automorphism_cap: int = 1000000000000000000, config: SymmetryConfig | None = None)[source]#
Bases:
object- canonical_result() WLCanonicalResult[source]#
Visualization#
- class synkit.CRN.Visualize.crn_vis.CRNVis(graph: DiGraph, layout: str = 'bipartite', species_label: str = 'index', rule_label: str = 'name', font_size: int = 6)[source]#
Bases:
object
- synkit.CRN.Visualize.labels.build_edge_labels(graph: DiGraph, *, mode: str = 'none', max_chars: int | None = 20) Dict[tuple[Hashable, Hashable], str][source]#
- synkit.CRN.Visualize.labels.build_node_labels(graph: DiGraph, *, species_nodes: Iterable[Hashable], rule_nodes: Iterable[Hashable], species_label: str = 'label', rule_label: str = 'label', show_species_labels: bool = True, show_rule_labels: bool = True, max_chars: int | None = 32, wrap_at: int | None = None) Dict[Hashable, str][source]#
- synkit.CRN.Visualize.layout.bipartite_layout(graph: DiGraph, *, species_nodes: List[Hashable], rule_nodes: List[Hashable], node_spacing: float = 1.4, layer_spacing: float = 3.0, orientation: str = 'vertical') Dict[Hashable, Tuple[float, float]][source]#
- synkit.CRN.Visualize.layout.choose_auto_layout(graph: DiGraph, *, species_nodes: List[Hashable], rule_nodes: List[Hashable]) str[source]#
- synkit.CRN.Visualize.layout.circular_bipartite_layout(graph: DiGraph, *, species_nodes: List[Hashable], rule_nodes: List[Hashable], species_radius: float = 2.5, rule_radius: float = 4.0) Dict[Hashable, Tuple[float, float]][source]#
- synkit.CRN.Visualize.layout.compute_layout(graph: DiGraph, *, species_nodes: List[Hashable], rule_nodes: List[Hashable], layout: str = 'step', node_spacing: float = 1.4, layer_spacing: float = 2.5, seed: int = 0, orientation: str = 'vertical') Dict[Hashable, Tuple[float, float]][source]#
- synkit.CRN.Visualize.layout.degree_shell_layout(graph: DiGraph, *, species_nodes: List[Hashable], rule_nodes: List[Hashable]) Dict[Hashable, Tuple[float, float]][source]#
- synkit.CRN.Visualize.layout.multipartite_step_layout(graph: DiGraph, *, species_nodes: List[Hashable], rule_nodes: List[Hashable]) Dict[Hashable, Tuple[float, float]][source]#
- synkit.CRN.Visualize.layout.radial_step_layout(graph: DiGraph, *, species_nodes: List[Hashable], rule_nodes: List[Hashable], radius_step: float = 1.8) Dict[Hashable, Tuple[float, float]][source]#
- synkit.CRN.Visualize.layout.step_layout(graph: DiGraph, *, species_nodes: List[Hashable], rule_nodes: List[Hashable], node_spacing: float = 1.4, layer_spacing: float = 2.5) Dict[Hashable, Tuple[float, float]][source]#
- class synkit.CRN.Visualize.palette.ColorPalette(background: str, species_fill: str, species_edge: str, rule_fill: str, rule_edge: str, reactant_edge: str, product_edge: str, other_edge: str, highlight_node: str, highlight_edge: str, label_text: str, node_index_text: str, legend_text: str, title_text: str)[source]#
Bases:
object- with_overrides(**kwargs) ColorPalette[source]#
- synkit.CRN.Visualize.palette.get_palette(name: str = 'paper_sage', **overrides) ColorPalette[source]#
- class synkit.CRN.Visualize.validation.CRNGraphInfo(species_nodes: 'List[Hashable]', rule_nodes: 'List[Hashable]', is_dag: 'bool')[source]#
Bases:
object
- synkit.CRN.Visualize.validation.validate_crn_graph(graph: DiGraph, *, strict: bool = True) CRNGraphInfo[source]#
- class synkit.CRN.Visualize.vis.CRNStyle(figsize: Tuple[float, float] = (12.0, 7.0), species_node_shape: str = 'o', rule_node_shape: str = 's', species_node_size: int = 760, rule_node_size: int = 540, edge_width: float = 1.2, highlight_edge_width: float = 2.1, reactant_style: str = 'dashed', product_style: str = 'solid', other_style: str = 'solid', arrows: bool = True, arrowstyle: str = '-|>', arrowsize: int = 12, font_size: int = 8, alpha: float = 0.98, margins: float = 0.12, show_label_boxes: bool = False, label_box_alpha: float = 0.0, curved_edges: bool = False, curve_radius: float = 0.0, scale_edge_width_by_stoich: bool = True, stoich_width_factor: float = 0.4, linewidths: float = 1.0, highlight_linewidths: float = 1.6, edge_alpha: float = 0.9, node_alpha: float = 1.0, show_node_outline: bool = True, label_fontweight: str = 'regular', auto_reduce_labels_when_dense: bool = True, dense_node_threshold: int = 45, dense_edge_threshold: int = 70, dense_font_size: int = 7)[source]#
Bases:
object
- class synkit.CRN.Visualize.vis.CRNVis(graph: DiGraph, layout: str = 'auto', species_label: str = 'label', rule_label: str = 'label', show_species_labels: bool = True, show_rule_labels: bool = True, font_size: int | None = None, max_label_chars: int | None = 28, wrap_label_at: int | None = None, style: CRNStyle = <factory>, palette: ColorPalette | str = 'nature_journal', palette_overrides: dict[str, str] | None=None, rule_color_mode: str = 'palette', rule_color_attr: str | None = None, rule_cmap: str = 'Greys', species_color_mode: str = 'palette', species_color_attr: str | None = None, species_cmap: str = 'Greys', node_color_overrides: Hashable, str] | None=None, node_spacing: float = 1.35, layer_spacing: float = 2.5, orientation: str = 'vertical', seed: int = 0, strict: bool = True)[source]#
Bases:
object- draw(ax: Any = None, *, title: str | None = None, show: bool = False, with_legend: bool = True, edge_label_mode: str = 'none', highlight_nodes: Iterable[Hashable] | None = None, highlight_edges: Iterable[Tuple[Hashable, Hashable]] | None = None, highlight_cycles: bool = False, hide_axis: bool = True, auto_align_dense: bool = False) tuple[Any, Any, dict[Hashable, tuple[float, float]]][source]#
- palette: ColorPalette | str = 'nature_journal'#