chemart / smn
View on GitHubString Metabolic Network (SMN) — A metabolism made of strings. Metabolites are strings over a small alphabet, joined and cut, or recombined by swapping tails between two of them - and every reaction has its own enzyme, so an organism's genome is simply …
How it works
A metabolism made of strings. Metabolites are strings over a small alphabet, joined and cut, or recombined by swapping tails between two of them - and every reaction has its own enzyme, so an organism's genome is simply the set of enzymes it owns. Letter counts are conserved by all three operations, but ligation and cleavage change the number of molecules; a regulated flow holds the total amount of substance fixed, so an organism holding more letters holds longer compounds.
- S
- metabolites = strings over an alphabet of up to 8 letters {a..h}, arbitrary length (bounded here by max_length) · implicit
- R
- Ligation/cleavage A + B <-> AB (eq. 18.17) and recombination AB + CD <-> AD + CB (eq. 18.18), e.g. adbg + ef <-> adbgef and facbaha + eefg <-> facbfg + eeaha. Each reaction is catalysed by its own enzyme, and the genome of an organism is its list of enzymes; the metabolism is the network of those reactions (both directions) over the organism's compound set. · arity 2
- A
- ode · regulated inflow/outflow keeps the total amount of substance in the cell constant (constant-total)
Parameters
| name | default | meaning |
|---|---|---|
| alphabet_size int · structural |
8 | number of letters (a, b, ...); the book's SMN uses 8 [2, 8] |
| n_metabolites int · population |
6 | number of distinct random initial metabolites (ignored when initial_metabolites or genome is given) [1, 1000] |
| max_metabolite_length int · population |
3 | random initial metabolites have a length drawn uniformly from 1 to this value [1, 50] |
| initial_metabolites list · population |
[] | explicit initial metabolites (resources present at the start of the organism's life); empty: the educts of an explicit genome, or random strings |
| n_enzymes int · structural |
12 | size of the random initial genome; each enzyme acts on compounds already in the compound set (ignored when genome is given) [0, 10000] |
| ligation_fraction float · stochastic |
0.5 | probability that a random enzyme is a ligation rather than a recombination [0, 1] |
| genome list · structural |
[] | explicit enzymes: 'A + B' for the ligation A + B <-> AB, 'A|B + C|D' for the recombination AB + CD <-> AD + CB (e.g. 'facb|aha + ee|fg'); replaces the random genome |
| mutations int · stochastic |
0 | applications of the book's duplicate-and-mutate operator to the genome, without selection [0, 100000]; the book's control: networks grown by random mutation without selection are not modular |
| max_length int · structural |
12 | longest compound allowed; random enzymes and mutations whose products are longer are redrawn (the book allows arbitrary length) [2, 1000] |
| initial_amount float · population |
1.0 | initial concentration of each initial metabolite (the book gives no amounts) [0, ∞] |
String Metabolic Network (SMN)
One of the artificial chemistries of Banzhaf & Yamamoto, Artificial Chemistries (MIT Press, 2015), §18.3.1; first proposed by Ono, Fujiwara & Yuta, 2005.
Its generator ships with the chemart library, so loading it runs no code from the hub and needs no trust_remote_code.
import chemart
net = chemart.generate_network("chemart/smn", seed=0) # same as "smn"
print(net.summary())
What to look for
- letter counts are conserved by ligation, cleavage and recombination
- with the amount of substance held constant, a larger letter mass means longer compounds, the fitness criterion
- evolved networks show a power-law community-size distribution close to the average of 100 organisms with large metabolic networks (book figure 18.6, 30 SMN runs)
- networks grown by random mutation without selection pressure are not modular
Implementation decisions
- The original paper (Ono, Fujiwara & Yuta, Artificial metabolic system: an evolutionary model for community organization in metabolic networks, ECAL 2005, LNAI 3630, pp. 716-724, https://doi.org/10.1007/11553090_72) is closed access: no open copy was found via Springer, Unpaywall, Semantic Scholar or the Internet Archive. Everything here follows book section 18.3.1.
- The v1 origin 'Ono, Fujimoto & Ikegami' is wrong; bibliography entry [638] gives N. Ono, Y. Fujiwara and K. Yuta.
- The book equates an enzyme with the reaction it catalyses, so enzymes are not species. Each enzyme gives two directed reactions (forward and reverse); enzymes catalysing the same reaction share them. extras.genome lists every enzyme with its notation, its reversible reaction, the indices of its two reactions and, for mutants, its parent enzyme.
- No kinetics: the book says only that synthesising longer molecules is harder and gives no coefficients, so every rate is None and the v1 parameter rate_bias is dropped. The fact is recorded in extras.kinetics.
- The regulated inflow/outflow keeps the amount of substance constant (the book: a larger letter mass therefore means longer compounds), which is outflow = constant-total. The composition of the inflow is not given, so there is no explicit inflow.
- The book does not say how the initial genome or the initial metabolites are made. Here the initial metabolites are n_metabolites distinct random strings (or given explicitly), and the genome grows one random enzyme at a time, each acting on compounds already in the compound set (initial metabolites plus earlier products), a ligation with probability ligation_fraction and otherwise a recombination with uniform cut points. Draws that are elastic or exceed max_length are redrawn. Initial amounts are all initial_amount, a Chemart choice.
- Mutation follows the book's operator: a random enzyme is duplicated, one of its two educts (chosen at random) is replaced by a different compound from the current compound set (of length >= 2 for a recombination), a new recombination point is drawn uniformly in the replaced educt only (the book says 'a new point of recombination', singular), and the mutant is added to the genome. Mutants that are elastic or exceed max_length are redrawn.
- Evolution (fitness = letter mass after a fixed number of timesteps, selection across generations) needs the paper's kinetics and acts across networks, so it is not part of one network. The v1 parameters mutation (callable text) and fitness (callable) are dropped; mutations applies the operator without selection, and the fitness definition is recorded in extras.fitness.
- Species are strings without internal structure beyond their letters; letter counts are conserved by both reaction classes (extras.conservation, one vector per letter).
Banzhaf & Yamamoto, Artificial Chemistries (2015), §18.3.1
Preview at default parameters
21 species · 24 reactions · status complete · seed 1
cg + bcg -> cgbcg cgbcg -> cg + bcg ea + eg -> eaeg eaeg -> ea + eg 2 cg -> cgcg cgcg -> 2 cg cg + d -> cgd cgd -> cg + d bcg + eg -> bg + ecg bg + ecg -> bcg + eg abg + ecg -> abgecg abgecg -> abg + ecg abg + cgd -> ad + cgbg ad + cgbg -> abg + cgd bg + bcg -> bgbcg bgbcg -> bg + bcg eaeg + cgcg -> egcg + caeg egcg + caeg -> eaeg + cgcg cgd + cgbcg -> cgdcgbcg cgdcgbcg -> cgd + cgbcg abg + cgbg -> abgbg + cg abgbg + cg -> abg + cgbg ecg + cgbcg -> ecgcgbcg ecgcgbcg -> ecg + cgbcg
Generated by the uploader with chemart push; the hub never runs uploaded code.