-
Notifications
You must be signed in to change notification settings - Fork 30
FBC3 KeyValuePair annotations + metaid #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for raising this issue, we did not anticipate that someone would annotate the key value pair itself with cvterms. Since the key value pair is the annotation to a specific SBase object, we assumed that CVTerms would be on that SBase object, rather than the KVP. We'll look into that. |
Thank you! |
Thanks, interesting issue. @fbergmann we should discuss this at some point. |
with the commit from yesterday the output of the code above is now:
while I still recommend not to annotate the KVP directly (since after all the model element is the e coli core model, not the kvp), the current behaviour of libsbml needs to change. |
Thank you for looking into it and implementing it so quickly. I think the only missing thing is that the And about the discussion of whether to have this feature at all: Agreed that it should probably not be the recommended way of annotating anything, and, indeed, in the test code, it does not make sense. However, it is not really well-defined what can be stored in this type of annotation. So one could very well set a certain property/feature of a modelling species and annotate it with And I think part of the confusion is that (also looking at the discussion around this pull request) it is not stated in the specification that KeyValuePair inherits from SBase, but in the libsbml implementation it does. And the spec also states:
So I guess it should ideally be implemented as an object that does not inherit from SBase, but does have a lot of its properties (SId, name, sboTerm, annotation, etc.), which will lead to a lot of duplicated code. |
thanks, of course you are right, I've added this to the PR. Thanks! as for why those rules where there in libSBML to begin with, that was just since that code got automatically generated by deviser. I don't see the need to change that internal part of the libSBML implementation with the SBase inheritance, it is useful enough. No need of all that code duplication. Thank you again |
From an interoperability/design perspective having nested KVP's is not ideal. It could only possibly make sense to put a CV term on KVP exclusively in the case that there is no other model property/element to add it to. KVP's with Annotations that contain KVP's are not what we want. However, pragmatically only the top-level KVP's will be implemented so we can go with Franks implementation. |
Or we could ask the author of the code (mea culpa) to rewrite it so that KVP is not derived from SBase and not let it have any further attributes/elements but @pascalaldo I'm guessing you have a sensible use case for actually putting annotations on the KVP |
@skeating I don't necessarily have a use case. It's just that I tried to implement the spec, which mentioned kvps having annotations is possible. Based on that and the libsbml code, I also made the cobrapy KVP equivalent inherit from the SBase equivalent. I then found the inconsistency of libsbml being able to read this, but not write when testing the code. That being said, as illustrated in my previous comment, there can be a use case. KVPs are very general and it's not really specified what their exact usecase is, so I can imagine people using it. But I'm fine with either this implementation or removing it from the spec and from cobrapy. |
i think it is fine, it is already implemented, it could be useful. and it would involve a lot of work to change. So i'm in favor of just fixing the libSBML behavior (which is done) |
I suppose it's all annotation anyway so I'm okay with going with the fixed libSBML behaviour. |
Hi,
I recently picked up the implementation of SBML L3 FBC v3 in cobrapy (see opencobra/cobrapy#1440). All of the specification implemented so far was nicely available in libsbml, so thank you for that! The only issue I ran into is with KeyValuePair objects:
The issue is with
fbc-21501
andfbc-21502
of the spec, which state that KeyValuePair can have sboTerm and metaid attributes, and an annotation subobject. This is indeed implemented in the libsbml code by having KeyValuePair inherit from SBase. However, the code to convert this into XML is not present. I think the issue lies within the functions atFbcSBasePlugin::writeKeyValuePairsAnnotation
andKeyValuePair::toXML()
. The latter indeed seems to lack any call to export SBase attributes etc., whilst the first lacks the ability to write the attributes metaid and sboTerm, as perfbc-21509
(we're not usingfbc-21509
in cobrapy, so I do not really care about that, just noticed it).The following code illustrates the issue:
The output of this is:
This shows that setting annotations (cvterms) to a KeyValuePair works fine and reading it from an SBML file also works. It's just writing them to xml that is missing.
Hope you can help with this, let me know if you need more info.
The text was updated successfully, but these errors were encountered: