Bug when using multiple anchors in rule-based compartments NFSim
The rule-based model with three compartments and three reactions transport molecules anchored to a membrane to a volume. It manifests itself only when there are two different membranes. Model Compartments_bug2022a
The simplest model has 2 molecules R, A and 2 species R in pm , A in cyt. R is anchored to two membranes pm and em and is initially located in pm.
The first reaction reversibly binds A to R in pm. The next moves any complex with R to em. The third moves aby complex with A to cyt. The bug: the model creates R-A in cytosol, where R can not be located.
If R moving to em is disabled, R-A stays in pm - no error.
The behavior is consistent with our current implementation, as follows: The reaction A_translocate tries to move ApmRpm to the cyt, the result being AcytRpm Since cyt is not a permitted destination for R, the algorithm tries to find a possible destination that's acceptable for both A and R If none is found, we throw an exception If exactly one is found, that's the correct destination If more than one is found (in our case pm and em are both acceptable) we throw an exception because we don't know how to choose between them.
For deterministic BNG it properly gives an error and does not allow saving, but for NFSim VCell generates species in a wrong compartment, which is a bug.
In short term could prevent anchoring molecule in multiple compartments, but limit to anchor to a single compartment. Need to decide and possibly revisit more complete fix in 7.6 Jim, Michael and Dan will discuss. Jim will query to see how many models have multiple anchors.
see #770 which is a stop-gap measure to create a warning.