Questions of SBML 'render', COPASI, and JSBML

31 views
Skip to first unread message

Haoran Yu

unread,
Jul 14, 2017, 5:44:15 AM7/14/17
to sbml-interoperability
Hi All,
I'm currently implementing the following converters between SBML and SBGN-ML:

(1) SBML 'core'+'layout'+'render' <-> SBGN-ML PD
(2) SBML 'core'+'qual' <-> SBGN-ML AF

where PD and AF are the orthogonal languages in SBGN
and 'layout','render','qual' are extensions to the 'core' SBML language

The software I'm using are libSBGN and JSBML, and Java as the interface in between.


Question 1:
I was implementing converter (1) with 'render', on the example https://github.com/sbgn/libsbgn/blob/master/test-files/PD/and-simple.png and my converted SBML looked like this https://2.bp.blogspot.com/-g2g7rIUe9GA/WVyuXXORRaI/AAAAAAAAGfo/CjQQLgTplpgf3PXhiNQrBJ-zhv0GdvoxQCLcBGAs/s1600/and.png

Is there way to specify which object stays on top of other objects? Does the drawing order of the objects affect the overlap between objects?

More specifically, I noticed that if the Image I used is not transparent, the TextGlyph that displays text will be covered by the Image. For example, the IRF1_2 glyph on the bottom right corner of the diagram has a Unit of Information auxiliary glyph, if I use a non-transparent Image as the Style for the Unit of Information, then the text ct:mRNA will be covered up. I looked at the render-version-1-draft-1.pdf specification and couldn't find anything that talks about ordering of the objects in a rendered diagram.

For reference, here's the converted SBML with RenderInformation for the and.sbgn example:
https://github.com/NRNB-GSoC2017-SBML2SBGNML-Converters/SBML2SBGNML/blob/c1ff86112350d230abb4099122106c591404fd44/code/examples/sbgnml_examples/and_SBML.xml



Question 2:

Does the COPASI command line version support automatic generation of diagrams?

I found that manual import of SBML in the COPASI UI and manual generation of diagrams requires a lot of effort. I wanted to find a easier way to do this just like batch jobs. I looked at all the commandline options in http://copasi.org/Support/User_Manual/Model_Creation/Commandline_Version_and_Commandline_Options/ and didn't find an option to automatically generate diagrams. Is there an easier way to generate diagrams in COPASI?



Question 3:
In JSBML, I noticed there are classes like RenderCurveSegment and LogicalOperator that extend AbstractSBase. How are these classes used? I might be able to make good use of them when working with SBML 'render'.


Thank you!
Haoran


Haoran Yu

unread,
Jul 14, 2017, 5:44:21 AM7/14/17
to sbml-interoperability
Hi everyone,

I'm currently implementing the following converters between SBML and SBGN-ML:

(1) SBML 'core'+'layout'+'render' <-> SBGN-ML PD
(2) SBML 'core'+'qual' <-> SBGN-ML AF

where PD and AF are the orthogonal languages in SBGN
and 'layout','render','qual' are extensions to the 'core' SBML language

The software I'm using are libSBGN and JSBML, and Java as the interface in between. I'm also using libSBML for converting between versions of SBML.

I have a couple of questions, I would appreciate anyone to help me answer one of my questions.


Question 1:
I have been working on converter (1) SBGN->SBML. I worked on the example libsbgn/test-files/PD/and.sbgn (https://github.com/sbgn/libsbgn/blob/master/test-files/PD/and.png). Here's the converted SBML diagram: https://2.bp.blogspot.com/-g2g7rIUe9GA/WVyuXXORRaI/AAAAAAAAGfo/CjQQLgTplpgf3PXhiNQrBJ-zhv0GdvoxQCLcBGAs/s1600/and.png

**In 'render', is there a way to specify which object stays on top of other objects? Does the drawing order of the objects affect the overlap between objects?**

More specifically, I noticed that if the Image I used is not transparent, the TextGlyph that displays text will be covered by the Image. For example, the IRF1_2 glyph on the bottom right corner of the diagram has a Unit of Information auxiliary glyph, if I use a non-transparent Image as the Style for the Unit of Information, then the text ct:mRNA will be covered up. I looked at the render-version-1-draft-1.pdf specification and couldn't find anything that talks about ordering of the objects in a rendered diagram.

For reference, here's the converted SBML with RenderInformation for the and.sbgn example:
https://github.com/NRNB-GSoC2017-SBML2SBGNML-Converters/SBML2SBGNML/blob/c1ff86112350d230abb4099122106c591404fd44/code/examples/sbgnml_examples/and_SBML.xml


Question 2:
Does the COPASI command line version support automatic generation of diagrams?

I found that manual import of SBML in the COPASI UI and manual generation of diagrams requires a lot of effort. I wanted to find a easier way to do this just like batch jobs. I looked at all the commandline options in http://copasi.org/Support/User_Manual/Model_Creation/Commandline_Version_and_Commandline_Options/ and didn't find an option to automatically generate diagrams. Is there an easier way to generate diagrams in COPASI?


Question 3:
For the library JSBML, I'm also wondering why there are classes like RenderCurveSegment and LogicalOperator that extend AbstractSBase. How are these classes used?


These questions were originally asked on my blog http://haleyyew-gsoc.blogspot.ca/2017/07/week-11.html and my github issue https://github.com/NRNB-GSoC2017-SBML2SBGNML-Converters/SBML2SBGNML/issues/47.

Thank you!
Haoran

Frank T. Bergmann

unread,
Jul 14, 2017, 9:21:56 AM7/14/17
to sbml-interoperability
Hello Haoran, 

I can answer questions 1 and 2 :) 

Q1: *In 'render', is there a way to specify which object stays on top of other objects? Does the drawing order of the objects affect the overlap between objects?*

Yes there is, both render and layout package support positioning elements along the z axis. However, I'm not sure this will actually help in your case. There is a certain order in which layout glyphs are rendered within COPASI: 

- compartment glyphs
- reaction glyphs
- species glyphs
- text glyphs
- additional graphical objects

among each of those lists the z order should be adhered, but since they are rendered in that order and your example chooses to use the general glyph = additional graphical object to render the reaction symbols, they will appear below the text glyphs in the copasi implementation. 

Q2: Does the COPASI command line version support automatic generation of diagrams

The COPASI standalone command line version is compiled without a dependency on a GUI framework. That being said, it would be simple to create version that just opens an sbml file and renders it to PDF, in case it has render / layout information. I would just need to know for which OS & architecture you would need a binary. 

best
Frank

P.S: I'll be offline for the next week and will only get to building the binary after that. 

Haoran Yu

unread,
Jul 27, 2017, 3:23:19 AM7/27/17
to sbml-interoperability
Hello Frank,

Thank you for providing the additional information for the order of layout glyphs. However I still have ongoing issues with compartmentOrder. I have multiple compartments that overlap: although I specify the 'order' attribute for each CompartmentGlyph, the image generated by COPASI doesn't adhere to the order I specified it. It seems the order is random. I was wondering if there is some extra information I need to provide in the Layout or RenderInformation that allows the correct order of the compartments.

Currently I'm still using the <Image> constructs for LocalStyles RenderGroup, rather than properly creating e.g. Rectangles, Ellipses, etc. Is it possible that the wrong order of the compartments is due to the <Image> in RenderGroup? I read your converter for "SBML Layout: Graphical SBML Annotations" LayoutFormats.cs but didn't find a candidate solution to the compartment order problem. But I'm going to make some changes to the RenderGroup to see if anything improves.

Thank you,
Haoran

Frank T. Bergmann

unread,
Jul 27, 2017, 4:34:07 AM7/27/17
to sbml-interoperability
Hello Haoran, 

I've opened a COPASI bug to track this item then we don't have to disturb the people on this list: http://tracker.copasi.org/show_bug.cgi?id=2441. The online converter sorts glyphs by their z value before drawing them, that is not implemented in COPASI as of yet. 

As for the rendering of the SBGN glyphs with individual elements, you could have a look at the style sheet file I've created in the past to map SBO terms to the individual SBGN styles. That might be helpful in the future. 


thanks
Frank

Haoran Yu

unread,
Jul 28, 2017, 1:38:39 AM7/28/17
to sbml-inter...@googlegroups.com
Thank you Frank! SBGNstyles.xml is exactly what I was looking for!

Haoran

--
You received this message because you are subscribed to a topic in the Google Groups "sbml-interoperability" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sbml-interoperability/TvgE6xtKm2A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sbml-interoperability+unsub...@googlegroups.com.
To post to this group, send email to sbml-interoperability@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbml-interoperability/85eb9f47-1ad5-4d60-a798-22f1e1a20d7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Haoran Yu

unread,
Aug 28, 2017, 12:07:39 AM8/28/17
to sbml-interoperability
After working on my GSoC project, I'm listing a number of problems for the SBML-SBGNML converter I implemented. I hope this may be helpful for future discussions on improvements of the SBML extension languages. All the problems can be seen in the example file SBGN-PD_all.sbgn, here's the diagram converted to SBML+layout+render:
SBGN-PD_all_SBML.xml


These problems are still present on the last post on my blog:


Problem 1:
The clone markers can't be drawn using the existing object types in SBML 'render' package. See "simple chemical" glyph above. This is because we can't draw "half" of a circle using attributes cx, cy, rx, ry. I think if we have an "angle" attribute for drawing circles, then we can draw parts of a circle by specifying the "start" and "end" degrees. For example, here's something from calculus notes.


Problem 2:

For a detailed description, please see Note 1 on my Github wiki. We mapped the 'AND' glyph to a Species+SpeciesGlyph, but we cannot draw the center Curve that connects the Arcs. We need to create a separate ReferenceGlyph to mimic the appearance of the center Curve of a ReactionGlyph. The reason that we map SBGN logic operators to Species+SpeciesGlyph is because of the restriction we faced in Rule 21111 in the sbml-level-3-version-1-core-release-2 specification. ModifierSpeciesReference cannot participate in 2 reactions (the species attribute must refer to an existing Species). In this case, if the 'AND' glyph is mapped to a Reaction, then ModifierSpeciesReference would be a Product in the 'AND' Reaction and at the same time a Modifier in the 'association' Reaction.

Maybe we can relax Rule 21111 to allow the species attribute to refer to anything so that we can map SBGN logic operators to Reaction+ReactionGlyph.


Problem 3:

We also have a drawing order problem using COPASI. If the "fill" attribute is set to a color or gradient, then the TextGlyph will get covered up. This problem was mentioned by me in a Github issue, but it still couldn't be fixed. I think this is due to the drawing order of the objects in layout. If the TextGlyph is drawn last, then it should not get covered up by any other objects. For now, I didn't set any color to the Units of Information and State Variable glyphs, this is why the texts seem to collide with lines of other objects. Similarly, with compartmentGlyphs, the drawing order problem is also present (see this blog post, the neuronal_muscle_signalling.sbgn converted diagram).


Problem 4:

Maybe this is a problem with COPASI, but I'm not sure. The CubicBezier in layout can be drawn, but the RenderCubicBezier in render couldn't be draw in the converted diagram. See "multimer nucleic acid feature" glyph above. Notice that the bottom part of the glyph should be round, but instead, it's a straight line. I noticed that the "render:basepoint1_x", etc attributes has no effect on the graphics, could this be a bug in the 'render' package?


Thank you,


Haoran

Frank Bergmann

unread,
Aug 28, 2017, 3:49:51 AM8/28/17
to sbml-inter...@googlegroups.com
Hello Haoran, 

just to your problems: 

P1: if you look at the styles created in the style file i mentioned before [1], there i created specific clone marker styles for all the symbols specifically the styles for simple chemicals or a multimer of them (SBO-0000247-clone. and SBO-0000247-multimer-clone). So it can be done ...

P2: I don't think the SBML spec should change in this regard. The constraints there are quite important for simulating a model. 

P3: this is resolved in the copasi code base, where now z-order is adhered to as well. You never came back to my questions as to whether you needed binaries. 

P4: thanks for letting me know I'll be sure to get that fixed. 

best
Frank


--
You received this message because you are subscribed to the Google Groups "sbml-interoperability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbml-interoperability+unsub...@googlegroups.com.

To post to this group, send email to sbml-interoperability@googlegroups.com.

Haoran Yu

unread,
Aug 28, 2017, 10:46:42 AM8/28/17
to sbml-inter...@googlegroups.com
Hi Frank,

I was making some suggestions that might or might not be discussed, in case the same problems are encountered in the future.

P1: I did use the SBGNstyles.xml, but it did not use the shape of a clone marker. Maybe some rendering tools can correctly interpret the style, but if there is something that explicitly specify the shape of the clone marker, then all rendering tools can correctly draw the markers.

P2: I'm only making a suggestion due to the difficulty I encountered in converting between SBGN and SBML, I didn't consider the main use of the constraints: to correctly represent the model that has biological meaning.

P3: I didn't get the correctly ordering using the z coordinates, for example, please see the attached files. Do you mean layout:z or render:z? Maybe an extra attribute such as render:order might solve the problem, I'm just making a suggestion, it might not be as useful.
I thought the binaries are extra work for you, so I never asked you for it.

Thank you,
Haoran

To unsubscribe from this group and stop receiving emails from it, send an email to sbml-interoperability+unsubscri...@googlegroups.com.

To post to this group, send email to sbml-interoperability@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "sbml-interoperability" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sbml-interoperability/TvgE6xtKm2A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sbml-interoperability+unsub...@googlegroups.com.

To post to this group, send email to sbml-interoperability@googlegroups.com.
compartmentOrder2_SBML.xml
compartmentOrder1_SBML.xml

Frank T. Bergmann

unread,
Aug 28, 2017, 4:00:44 PM8/28/17
to sbml-interoperability
Hello Haoran, 

P1: well ... I think it is the task of the tool writing the file. It already knows if certain names will occur multiple times. If so in my software I simply apply the suffix '-clone' to the style to be used, and the correct clone marker will be drawn out of the stylesheet. 

P3: the offer still stands. In the meantime the PDF of how the current development branch of COPASI will render the files you attached. 

P4: this turned out to be an issue in the code of the libSBML render extension. I pushed a patch today, and now COPASI (if compiled and linked against it) will also draw the correct nucleic acid features. 

cheers
Frank
compartmentOrder2_SBML.pdf
compartmentOrder1_SBML.pdf
Reply all
Reply to author
Forward
0 new messages