Skip to content

Reaction rules can only be built in the graphics editor: no textual route, and the BNGL column is read-only for rules #2068

Description

@jcschaff

The problem

A rule-based model cannot be built in VCell without the graphics editor. That makes rule-based modelling the one part of the client that is unreachable from a script, from a test, or from anyone who would rather type than draw — and it is not a small gap, since reaction rules are the whole point of a rule-based model.

Two separate things close the door, and both are worth stating because either one alone would be enough:

1. The BioNetGen definition column is read-only for rules. BioModelEditorReactionTableModel.isCellEditable allows the equation/BNGL column only when the row is a ReactionStep:

if (column == COLUMN_EQUATION) {
    if(process instanceof ReactionStep) {
        return true;
    } else {
        return false;
    }
}

A ReactionRule is not a ReactionStep, so the cell is never editable — not even on first specification, which is the rule for every other table. Directly below this method sits a commented-out version that was reaching for exactly this: it would have allowed the edit while the rule's molecules had no components. So the idea has been here before.

2. The rule editor exposes nothing to address. Its entire reactant/product pattern area is a single anonymous component:

ReactionRuleEditorPropertiesPanel$1   777x200 px   children = 0

Every molecule, site, state and bond is painted onto that one component. The only real Swing controls in the panel are Add Reactant, Add Product, Reversible and three display toggles — so pressing New Rule gives you an empty rule and no way to fill it in except by right-clicking painted pixels.

Notably, Molecules, Species and Observables do not have this problem. Their BioNetGen definition columns are writable, and the 7.7 tutorial says so itself: "Every table has a column BioNetGen definition… It is useful if you have separate BNGL code you want to paste, but do not want to import for some reason." Setting one cell to EGFR(ecd,tmd,Y1~u~p,Y2~u~p) replaces about a dozen right-click gestures. Only rules are missing.

What this blocks today

While scripting the two rule-based tutorials (#2067) both models had to be built by writing BNGL to a file and using File > Import, because there is no other way in. That works — both reproduce their public reference models exactly — but it means:

  • the tutorials cannot be scripted the way they are taught;
  • there is no way to make a small edit to one rule without the graphics editor;
  • rule-based models are effectively untestable through the UI.

The obvious fix, and why it is not sufficient on its own

Making the BioNetGen definition column writable for ReactionRule is a small change and would unblock all of the above. But raw BNGL is a poor primary interface for the people this feature is for:

  • it needs autocomplete over the molecule patterns actually available in the model, or the user is typing identifiers from memory;
  • site states, bonds, and bound / unbound / "bound to anything" (!+, !?, unbound) have to be applied consistently across reactant and product patterns — the editor currently enforces that by construction, and greys out combinations that are impossible;
  • an expert can get it right, but the syntax is technical and unintuitive for a new user, which is precisely who the graphics editor serves well.

So this should not land as "make the cell editable" and stop there. That would create a second way to build a rule that is easy to get subtly wrong and hard to diagnose.

What is actually wanted

A more accessible textual (or hybrid) route to specifying a rule, with the consistency the graphics editor currently guarantees. There are a few plausible shapes for it and picking between them deserves a proper design pass rather than a first guess — autocomplete-backed BNGL entry, a structured non-graphical editor, a text form that round-trips against the existing editor, or some combination.

Out of scope for #2067; opening this to record the finding and the constraints.

/cc for design discussion — this one needs a plan before any code.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions