MATLAB Answers

sbioloadproject or sbiosaveproject loses graphical information

2 views (last 30 days)
Jim Bosley
Jim Bosley on 10 May 2018
Edited: Jim Bosley on 11 May 2018
If you Google "Why did I become a biologist?" most answers include "I loved science and hated math".
One of the key elements of SimBiology for me (and for many clients) is positional notation. If I show a client group (including biologists and physicians for example) matlab code, they run screaming from the room, or at best lean back in their chairs with their arms folded across their chests, and a glare on their face. If I show them graphs and such, they are a bit happier but wonder where the heck the numbers came from. If I show them a graphical representation of the model, with species, nodes and rates, they get it. They understand biological diagrams. They understand chemical reactions. The are more likely to grok and accept the graphs and numerical output. Graphical model representation is extremely powerful in communicating models to and gaining the confidence of people who are not predisposed to, for example, reviewing m file scripts.
It dismays me when folks don't regard graphical model representation seriously. I'm astounded when modelers fail to use graphical representation to improve communication with non-modelers. It's like giving away effective communication tools. I'm aghast that SBML2 doesn't include positional notation when its clear that folks who model like graphical representation (e.g. SimBiology and Pathway Designer both allow for this). I hope that SBML 3 doesnt squander the opportunity to include this. [/general rant]
[specific rant] Suppose I have a model with carefully constructed graphics. If I open that model in Simbiology, ala
> sbioloadproject('Clear_model.sbproj','m1');
and then change it in any way, for example
p1h = sbioselect(m1,'Name','Param1');
set(p1h,'Value',10.5);
and then save the model
sbiosaveproject 'Garbled.sbproj' m1
the resulting Garbled.sbproj, when opened on the desktop, is garbled. Param1 is changed as specified, but all the graphics are rearranged - it is spaghetti and useless for communication. So here's one question: 1) Is there a way to open a model, modify it with code, and close it such that the positional notation is preserved?
Another thing that seems to happen is that any constant parameter graphic that is global that I had in Clear_model.sbproj has been deleted. So if I have a graphical parameter called "Evanescent" in Clear_model, and I open, change, and save the model, Evanescent is gone, graphically. It's still in the model in the rules and rate laws, but the graphical symbol is gone from the desktop. But what if I want that parameter to be visible? So, again, a question:
2. Is there any way to force SB to not mess with my graphics when I open/change/save?
Of course, if I'm doing this wrong, I'll be happy to be set straight! Thanks.

  0 Comments

Sign in to comment.

Accepted Answer

Arthur Goldsipe
Arthur Goldsipe on 11 May 2018
Regarding SBML, the Level 3 specs introduce a couple of packages for dealing with graphical representation of models. I haven't looked closely at those packages, but I'm definitely glad to see they're making progress in this area.
Regarding SimBiology, you are absolutely right that you've identified a serious limitation with sbioloadproject and sbiosaveproject. Right now (as of R2018a), these functions are pretty much only useful for loading and saving the model objects. In other words, they do not load or save desktop-specific information like diagrams or tasks or data sets.
If you want to preserve desktop information in your project, you currently must load and save the project within the desktop. You can still modify the model from the command line or programmaticaly while it is loaded in the desktop. You just need to export the model to the workspace (by viewing the project workspace and right-clicking on the model name within the desktop). So here's my recommended workflow for now: Load the project into the desktop, export the model to the command line, make your changes, and save the project within the desktop.
If you want to minimize the amount of pointing and clicking you do in the desktop, you can open the project in the desktop with the command-line code simbiology('Clear_model.sbproj'). You can even skip the step of exporting the model to workspace, because all models that are in memory can be accessed via the Models property of the SimBiology root object, which you can get access to with the function|sbioroot|. So really, the only step you absolutely must do within the desktop is the final step of saving the model. And you can even avoid using the mouse for that if you use the appropriate keyboard shortcuts.
Rest assured that this annoyance is on our radar, and we do want to fix the problem. I hope the workaround I describe above is an acceptable option for the interim.
Thanks for the feedback.

  1 Comment

Jim Bosley
Jim Bosley on 11 May 2018
Arthur,
Your answer confirmed my suspicions but also gave me the workarounds.
Clear, concise, and very helpful. Many thanks.
Jim

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!