CRN#
The synkit.CRN package provides SynKit’s chemical reaction network layer.
It supports CRN construction from rules or curated pathway data, normalized network
representation through SynCRN, symmetry-aware
comparison, stoichiometric and thermodynamic summaries, and pathway-level analysis such
as reachability and realizability.
Key CRN submodules include:
Construct — expand rule systems into reaction-network digraphs
Query — retrieve and curate KEGG-derived reaction collections
Structure — represent CRNs as normalized
SynCRNobjectsSymmetry — canonicalization and isomorphism for CRN comparison
Props — stoichiometric, thermodynamic, and dynamical summaries
Pathway — reachability, path-finding, and realizability analysis
Expand rule sets into reaction-network digraphs and convert them into
normalized SynCRN objects.
Retrieve KEGG pathway content, curate incomplete entries, and prepare pathway-derived CRN inputs.
Canonicalize and compare CRNs through isomorphism and symmetry-aware structural analysis.
Construct#
The synkit.CRN.Construct package expands reaction rules into a reaction-network
digraph, which can then be converted into a normalized
SynCRN object.
This layer is useful when you want to generate a CRN from:
a seed pool of starting molecules
a rule set
repeated rule applications
frontier-based exploration with deduplication
1from synkit.CRN.Construct.DAG.crn import CRNExpand
2from synkit.CRN.Structure.syncrn import SynCRN
3
4dg = CRNExpand(
5 rules=RULES,
6 repeats=repeats,
7 explicit_h=False,
8 implicit_temp=False,
9 keep_aam=False,
10 use_frontier=True,
11 dedup_delta=True,
12)
13
14g = dg.build(seeds=SEEDS, parallel=False)
15syn = SynCRN.from_digraph(g)
16
17print(syn.n_species)
18print(syn.n_reactions)
Example output
42
67
Query#
The synkit.CRN.Query package provides KEGG-oriented retrieval and curation
utilities. It is the natural entry point when your CRN comes from a biological
pathway rather than from rule-based expansion.
Key helpers include:
Example: retrieve a KEGG pathway as structured JSON#
1from synkit.CRN.Query.kegg_extract import KEGGExtractor
2
3pathway_data = KEGGExtractor().build_pathway_json(
4 "hsa00010",
5 with_compounds=True,
6 with_atom_maps=True,
7 save_as="Data/KEGG/hsa00010_raw.json",
8)
9
10pathway_data
This query layer is especially useful when you want to:
retrieve pathway reaction entries
keep compound metadata together with reactions
atom-map pathway reactions when possible
patch incomplete records before building a final CRN
Structure#
The synkit.CRN.Structure package provides the main normalized CRN representation
used throughout SynKit.
The core object is:
with supporting structural components:
A SynCRN object is the preferred representation when you want:
stable species and reaction ordering
table-like and graph-like interoperability
conversion to digraph or Petri-net views
downstream symmetry, property, and pathway analysis
1from synkit.CRN.Structure.syncrn import SynCRN
2
3syn = SynCRN.from_reaction_strings([
4 "A + B >> C",
5 "C >> D",
6])
7
8print(syn)
9print(syn.n_species)
10print(syn.n_reactions)
Symmetry#
The synkit.CRN.Symmetry package supports CRN isomorphism and canonicalization.
This is the right layer when you want to compare two networks independently of their
original labeling.
Relevant modules include:
Typical use cases:
test whether two CRNs are structurally equivalent
compute deterministic canonical forms
compare rule-expanded and pathway-curated networks
perform symmetry-aware downstream analysis
1from synkit.CRN.Structure.syncrn import SynCRN
2from synkit.CRN.Symmetry.isomorphism import crn_isomorphic
3from synkit.CRN.Symmetry.canon import canonicalize_crn
4
5syn1 = SynCRN.from_reaction_strings([
6 "A + B >> C",
7 "C >> D",
8])
9
10syn2 = SynCRN.from_reaction_strings([
11 "X + Y >> Z",
12 "Z >> W",
13])
14
15print(crn_isomorphic(syn1, syn2))
16
17can1 = canonicalize_crn(syn1)
18can2 = canonicalize_crn(syn2)
19
20print(can1 == can2)
Example output
True
True
Props#
The synkit.CRN.Props package provides quantitative summaries and analysis layers
on top of a normalized CRN.
Important modules include:
This layer is useful for computing:
stoichiometric summaries and matrices
thermodynamic annotations or aggregate summaries
symbolic dynamical quantities such as Jacobian structure
helper statistics over species and reactions
Example: stoichiometric analysis#
1from synkit.CRN.Structure.syncrn import SynCRN
2from synkit.CRN.Props.stoich import compute_stoich_summary
3
4syn = SynCRN.from_reaction_strings([
5 "A + B >> C",
6 "C >> D",
7])
8
9stoich = compute_stoich_summary(syn)
10print(stoich)
Example: thermodynamic summary#
1from synkit.CRN.Props.thermo import compute_thermo_summary
2
3thermo = compute_thermo_summary(syn)
4print(thermo)
Example: Jacobian or dynamical structure#
1from synkit.CRN.Props.dynamics import compute_jacobian_structure
2
3J = compute_jacobian_structure(syn)
4print(J)
Note
Exact function names may vary slightly across versions, but the Props package
is the correct place for stoichiometric, thermodynamic, and Jacobian-style CRN
analysis.
Pathway#
The synkit.CRN.Pathway package provides pathway-level reasoning on top of a CRN.
This is the right layer when you want to analyze whether a target is merely connected
in the graph or actually reachable and realizable from a specified starting pool.
Relevant modules include:
Typical questions addressed here are:
which species are reachable from a given seed set?
can a target route actually be realized under mass-conserving progression?
which subset of reactions supports a target product?
Example: reachability#
1from synkit.CRN.Structure.syncrn import SynCRN
2from synkit.CRN.Pathway.reachability import reachable_species
3
4syn = SynCRN.from_reaction_strings([
5 "A + B >> C",
6 "C >> D",
7 "E >> F",
8])
9
10reached = reachable_species(syn, seeds={"A", "B"})
11print(reached)
Example: realizability#
1from synkit.CRN.Pathway.realizability import is_realizable
2
3ok = is_realizable(syn, seeds={"A", "B"}, targets={"D"})
4print(ok)
Example output
True
Recommended workflow#
A practical CRN workflow in SynKit is:
Construct a CRN from rules, or Query a curated pathway source such as KEGG
Convert the result into
SynCRNUse Props to inspect stoichiometric, thermodynamic, or dynamical features
Use Pathway to analyze reachability and realizability
Use Symmetry when you need canonicalization or structural comparison