python-libsbml: qual plugin error when using SBML 3.2

35 views
Skip to first unread message

Hannes Baukmann

unread,
Jun 8, 2020, 6:13:40 AM6/8/20
to sbml-interoperability
Hello everyone,

I am using SBML 3.2 with QUAL extensions to encode rFBA models. When I tried to import the qual plugin in libsmbl (model.getPlugin("qual")), None was returned. However, when I changed the file to SBML 3.1 (xmlns:qual="http://www.sbml.org/sbml/level3/version2/qual/version1 to xmlns:qual="http://www.sbml.org/sbml/level3/version1/qual/version1, otherwise identical file), the qual plugin was loaded correctly. Using SBML 3.1 ist not an option at the moment, because it won’t let me use QualitativeSpecies as variables in an AssignmentRule element. I tried this with all versions of python-libsbml back to 5.15.0. I did not find any resources on how to use the qual plugin in python-libsbml in my case. It would be great if you could help me!

Best,

Hannes

Frank T. Bergmann

unread,
Jun 8, 2020, 6:19:52 AM6/8/20
to sbml-interoperability
Hello Hannes, 

So that not all packages would have to be changed, the SBML editors decided that packages only have to release a new version of the package, if a change is warranted when using L3V2 or L3V1. As such the solution for you would be to use a SBML L3V2 core document together with qual from L3V1 (the qual namespace refers to the qual specification and there is only one, thus the URL has to remain what it is).  

I hope this makes it clear. 

best
Frank

Hannes Baukmann

unread,
Jun 8, 2020, 6:40:42 AM6/8/20
to sbml-interoperability
Dear Frank,

thank you for your quick reply! I guess using SBML 3.2 with Qual from 3.1 would solve my problem, but I'm not exactly sure how to do that. This is my full header:

<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2" xmlns:qual="http://www.sbml.org/sbml/level3/version2/qual/version1" xmlns:fbc="http://www.sbml.org/sbml/level3/version2/fbc/version2" fbc:required="false" qual:required="true">

When I change the Qual namespace (2 to 1), I get the error about QualitativeSpecies in an AssignmentRule I described earlier:

Error Line 456 Column 31: (SBML Validation Rule #20901) The value of an <assignmentRule>'s 'variable' must be the identifier of an existing <compartment>, <species>, globally-defined <parameter>, or (in Level 3) <speciesReference>, or (in Level 3 Version 2), any identifier in the SId namespace of the model belonging to an element defined by an SBML Level 3 package as having with mathematical meaning. Reference: L3V2 Section 4.9.3 The <assignmentRule> with variable '...' does not refer to an existing <compartment>, <species>, <parameter> or <speciesReference>.

Frank T. Bergmann

unread,
Jun 8, 2020, 6:55:00 AM6/8/20
to sbml-interoperability
Hello Hannes, 

This might be something to bring up with the qual working group. As far as I can see in the spec: 


no interaction with the core element has been defined (including the use of their elements in rules). This is the latest version of the spec however. Since no interaction has been defined, libSBML will mark it as an error to use an element from another package in the assignment rule. 

And again, if you change the namespace url for qual, libSBML will no longer recognize it as a known package, and thus you probably just get a different error, that libSBML does not know about the package you are using (same for fbc). so it will have to be: 

<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2" 

best
Frank

Hannes Baukmann

unread,
Jun 18, 2020, 3:46:19 AM6/18/20
to sbml-interoperability
Hello Frank,

thank you for your help. I was referring to this proposal: http://compbio.igc.gulbenkian.pt/nmd/sites/compbio.igc.gulbenkian.pt.nmd/files/sbml-l3f-qual-proposal.pdf , where the authors state:

leencaldkpakdhag.png

I mistook this as a feature that was already implemented. I will talk to the QUAL working group to ask about their future than to implement this.

Best,

Hannes

Frank T. Bergmann

unread,
Jun 18, 2020, 3:57:54 AM6/18/20
to sbml-interoperability
Hello Hannes, 

I think you should clarify that with the package working group, as to why that did not make it into the release of the first version. I was not part of those discussions and so don't know. The mailing list should be: 


though it has been quiet there for the past years, so it might make sense to contact the key persons directly. 

As far as libSBML (and your current project) is concerned, I'd continue with using the qual/version1 namespace, and ignore the error for the time being. That way all information is accessible to you, and your tools can read and write models. 

best
Frank

Lucian Smith

unread,
Jun 19, 2020, 7:48:43 PM6/19/20
to SBML Software Interoperability Discussion List
Just wanted to chime in here and say that if you want to assign a value to a 'qual' element, using an assignment rule or initial assignment is clearly the correct approach.  This was not possible in SBML L3v1 (when the original qual spec came out), but it is possible in L3v2, as long as the spec defines the element as 'having mathematical meaning'. 

Arguably, the qual spec *does* already define various elements as having mathematical meaning, as it explicitly states that their IDs may be used in MathML.  It also notes that you can't use the IDs in L3v1 core elements, but while that's true, it doesn't preclude the use in L3v2 (which, again, didn't exist when the spec was written.)

The upshot is that it shouldn't take too much effort to come out with a revised version of the qual spec that mentions l3v2, and explicitly states that you can use various IDs in math, and as the target of rule SIdRefs.

At that point (or in parallel), software will have to be written/updated to actually make use of the newly-defined capabilities, and libsbml updated to not record the error you found.

But in general, while all this may take some time, I really can't see any other way this could progress: as you noted, this is what the group wanted originally, and they only scaled back because of the limited capabilities of SBML l3v1.  So for now:  encode your models the way you want, and the rest of the world will catch up soon ;-)

-Lucian

--
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-interoperab...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbml-interoperability/fc29957e-bb33-49d1-868f-727935ff111ao%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages