Skip to content

Biochemistry Examples#2

Open
paulflang wants to merge 17 commits into
mainfrom
pl/example_single_agent
Open

Biochemistry Examples#2
paulflang wants to merge 17 commits into
mainfrom
pl/example_single_agent

Conversation

@paulflang

@paulflang paulflang commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

This PR adds examples from

After merging this PR and #1 , it might make sense to create a separate file to store all example models.

The following lists a few characteristics, learnings and TODOs (not for this PR) about each example:

toy_model_species_granularity

is inspired by examples 1 and 3 here. It tests:

  • describing a model with only a single agent (of a terminal type ReMonomer)
  • morphisms with nontrivial domain (i.e. other than [])
  • composite morphisms
  • customizing species granularity (i.e. ReB vs. ReB1 and ReB2)

Learnings:

  • We can already reuse one and the same model description for both cases. The only difference is how we define the Signature.
  • This example also makes heavy use of PatTm::Tensors, which we cannot restrict via PatTm::res, IIUC. Instead, we use the .subst method to replace a partial restriction with a "longer" composite restriction.
  • When we define variables for later use in the rules, we need to work with .clone. This is a bit unergonomic, but will be obsolete once models can be parsed from bare text.

toy_model_emergent_agent

  • illustrates emergent behavior: C-binding is only possible (in the sense of reachable) after A to B dimerization. Neither A nor B alone can bind C.
  • trimerization (implemented as nested PatTm::Let)

Open questions:

  • I see one way in which the rule R_dimerization can be restricted. R_trimerization already lives in []. Yet, there are weird nameless transitions like this one generated, that also contain R_dimerization. Why is that?

toy_model_directionality

  • implements monomers with head and tail sites; written, such that rules are agnostic if the monomer is free or at the end of a long chain; reachable states should be identical to the previous example (except maybe for asymmetry in C).

Personal learnings on notation:

  • It seems to be more convenient to reuse the variables for agent sites in let/bond expressions (rather than replacing with generic s1 and s2)
  • Identities appear as variables of the rules. To facilitate readability of more complex rules. To facilitate readability of complex rules, it makes sense to prefix them with "id_" or "1". This helps to distinguish them from (non-trivial) restrictions.

TODO:

  • Look at the transitions after the open question from the previous example is clarified.
  • R_AtoB_dimerization is of type [head, Site_C, Site_C, tail]. Starting from only monomers, this should lead to the same reachable states as if the type were [head, tail], since there is no rule producing AC and BC dimers (remark: this is just for experimentation. In practice, rules should not rely on reachability assumptions and be specified in the most restrictive way possible, to minimize unintended side-effects (esp. when knowledge from different authors is combined) and computational complexity). Test if this is true, once we can restrict to reachable states.

toy_model_phospho_tyrosine

tests:

  • morphisms with nontrivial domain (i.e. other than [])
  • composite morphisms
  • indexing category with parallel morphisms out of objects other than [].

Learnings

  • Parallel restriction morphisms would split up (i.e. have different domains) in a preorder setting. This will require handling different types on LHS and RHS of rules.

@paulflang paulflang force-pushed the pl/example_single_agent branch from 213f88b to 93f7b71 Compare June 11, 2026 18:32
@paulflang paulflang marked this pull request as ready for review June 15, 2026 03:17
@paulflang paulflang force-pushed the pl/example_single_agent branch from 964df70 to 1375e97 Compare June 17, 2026 02:31
Comment thread src/netgen.rs
Comment on lines +736 to +744
// @Evan: This shows the problem that the C is bound to the wrong A. It should be bound to the A that is bound to B.
// let bond [] in
// let bond_AB [] in
// (
// A [e_ha [], e_Ca [], 0.0],
// A [e_ha [], 1.1, e_ta []],
// B [0.1, 1.2, e_tb []],
// C [1.0]
// )

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need emergent sites for this, as described here: https://github.com/ToposInstitute/sys-bio-collab/pull/15

This would make sure that C-binding ability emerges from A-to-B dimerization.

Comment thread src/netgen.rs
// (
// (M [iota_B], M [iota_SiteA [0.0]]),
// ((M [iota_A], M [iota_SiteB 0.1], M [iota_Res phos []]), (M [iota_K]))
// )

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is that (M [iota_B], M [iota_SiteA [0.0]]) is not indecomposable. To generate indecomposable agents from monomers, we'd need something like emergent sites and species, as described here: https://github.com/ToposInstitute/sys-bio-collab/pull/15

@paulflang

Copy link
Copy Markdown
Collaborator Author

@epatters any thoughts on the last two comments? Otherwise I believe this is ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant