Open UlrichSi opened 7 years ago
I don't think this scenario (cross referencing molecules parameters) was ever intended to be supported. In general molecules are independent entities and do not need to reference each other's parameters.
As a workaround, could you define the parameter in the spatial structure and reference it from all molecules? Would that work?
And just to understand, what use case is that ? Why do you have two different molecules at the first place?
The reason is that I created a 2-compartment PK model by using reactions. Another use case would be that a family of molecules derived from the same start structure are created, e.g.: A -> B -> C where A is the parent compound, B the hydroxylated and C the glycosylated metabolite. B has always the MW of A plus 16, C of plus 180 for glucose. If different members of molecule A, all leading to the same metabolization pattern, are to be simulated, it would simplify changing this.
Anyway - the second error should never occur, something turns sour here.
The workaround via a reaction or spatial structure parameter will hopefully work. Alternatively, "Molecular weight" parameters stay separate and will be changed by a script.
In general molecules are independent entities and do not need to reference each other's parameters.
And just to understand, what use case is that ? Why do you have two different molecules at the first place?
Without going into details, this is not an uncommon scenario, and having the ability to reference parameters from one molecule in another would be very helpful in several cases.
@Yuri05 seems like the issue that was reported today https://github.com/Open-Systems-Pharmacology/MoBi/issues/1167#issuecomment-1766819972
@Yuri05 seems like the issue that was reported today #1167 (comment)
Lol, seems to be 1:1 the same issue.
ok going to check this out. I am curious
Purpose: The molecular weight of several molecules should be easily kept in synch. Thus, only one MW is to be defined as numerical value, whereas others are set by a formula. This procedure currently leads to an error.
To reproduce:
Open the "Manual Model" installed with MoBi, then open the "Molecules BB" for edit.
Click on molecule "A", click on the "Parameters" tab.
Add a new parameter, name it "Molecular weight" (the convention name needed for generating plots in weight per volume (e.g., µg/L; if the parameter is named "Test1" instead, no issue was observed). The parameter type is "Property", dimension "Molecular weight".
Define the parameter by a formula, name it "MWtest".
Drag and drop the parameter "MW" of the molecule "B" (!) into the references field. The alias should read "MW", the path "B|MW". (Use the molecule "B" in the level underneath "BigVial" to find this parameter.)
Enter "MW" into the formula expression field. Make sure no warning mark remains.
Expand the simulation "S1" in the simulations explorer. A red exclamation sign should be visible in the "Molecules" section underneath "Configuration".
Update "Molecules" from the building block using the context menu. Confirm the wizard popup window with clicking "Ok".
Run simulation "S1". An error is thrown: MoBi Cannot evaluate formula for 'Molecular weight' with path 'B|MW' For more information or questions, please visit the Open Systems Pharmacology Forum (forum.open-systems-pharmacology.org).
Re-run the simulation "S1". An even more interesting error is now thrown: Application: MoBi 7.1.0 - Build 66
An item with the key 'b16474f3-b455-40ba-9d2e-1e3606a22fd4' has already been added
An item with the same key has already been added.
Stack trace: