|
You were almost there, it was just that the type of cvterm was not correctly set, please use:
sbmlDoc = SBMLDocument(2, 3)
model = sbmlDoc.createModel()
model.setId("GTModel")
model.setMetaId("metaId_GTModel")
h = ModelHistory()
c = ModelCreator()
c.setFamilyName("Silva")
c.setGivenName("Jose")
h.addCreator(c)
d = Date(2012,03,19,12,50,0,0,0,0)
sga=h.setCreatedDate(d)
sga=h.setModifiedDate(d)
tt=model.unsetModelHistory()
ee=model.setModelHistory(h)
new_cvt = CVTerm()
new_cvt.setQualifierType(BIOLOGICAL_QUALIFIER)
new_cvt.setBiologicalQualifierType(BQB_IS)
new_cvt.addResource("urn:miriam:taxonomy:634956")
model.addCVTerm(new_cvt)
best
Frank
On Mar 20, 2012, at 3:39 PM, Rodrigo Liberal wrote:
> Hi Frank,
>
> I made the following changes, setting in the beginning the id and MetaId of
> the model. However, the cvterm is still not being added.
>
> sbmlDoc = SBMLDocument(2, 3)
> model = sbmlDoc.createModel()
>
> model.setId("GTModel")
> model.setMetaId("metaId_GTModel")
>
>
>
> Thanks,
> Rodrigo
>
> On 20 March 2012 14:24, Frank T. Bergmann <fbergman@caltech.edu> wrote:
>
>> Hello Rodrigo,
>>
>> you want to make sure that you always first set the metaId of all elements
>> before using MIRIAM annotations such as ModelHistory or CVTerms.
>>
>> When you debug your code with model histories, you can always try and ask
>> the object, whether it is complete, by calling
>> modelHistory.hasRequiredAttributes() this is the reason that the model
>> rejects the object. It is valid when you have at least one creator, and a
>> modification and created date.
>>
>> So i think in your case, the model history is rejected, either because it
>> does not have the modification date, or because the meta id on the model is
>> missing.
>>
>> best
>> Frank
>>
>>
>>
>> On Mar 20, 2012, at 3:03 PM, Rodrigo Liberal wrote:
>>
>>> Hi all,
>>>
>>> I have been having some problems working with modelHistory and cvterms. I
>>> have used the following code:
>>>
>>>
>>> 1 sbmlDoc = SBMLDocument(2, 3)
>>>
>>> 2 model = sbmlDoc.createModel()
>>>
>>>
>>> 3 h = ModelHistory()
>>>
>>> 4 c = ModelCreator()
>>>
>>> 5 c.setFamilyName("Silva")
>>>
>>> 6 c.setGivenName("Jose")
>>>
>>> 7 h.addCreator(c)
>>>
>>>
>>> 8 d = Date(2012,03,19,12,50,0,0,0,0)
>>>
>>> 9 sga=h.setCreatedDate(d)
>>>
>>>
>>> 10 sga=h.setModifiedDate(d)
>>>
>>> 11 tt=model.unsetModelHistory()
>>>
>>> 12 ee=model.setModelHistory(h)
>>>
>>>
>>> 13 new_cvt = CVTerm()
>>>
>>> 14 new_cvt.setQualifierType(0)
>>>
>>> 15 new_cvt.setBiologicalQualifierType(BQB_IS)
>>>
>>> 16 new_cvt.addResource("urn:miriam:taxonomy:634956")
>>>
>>> 17 model.addCVTerm(new_cvt)
>>>
>>>
>>>
>>> The 2 main problems are:
>>>
>>> - the line 17 command is always returning "-2". Which I believe it means
>>> something is wrong.
>>>
>>> - when I comment line 10, the line 12 command returns "-5" which I
>> believe
>>> it means something is wrong. This second problem only appears when I
>>> comment the line 10.
>>>
>>> Thanks ,
>>>
>>> Rodrigo
>>> ____________________________________________________________
>>> To manage your sbml-interoperability list subscription, visit
>>> https://utils.its.caltech.edu/mailman/listinfo/sbml-interoperability
>>>
>>> For a web interface to the sbml-interoperability mailing list, visit
>>> http://sbml.org/Forums/
>>>
>>> For questions or feedback about the sbml-interoperability list,
>>> contact sbml-team@caltech.edu
>>
>> ____________________________________________________________
>> To manage your sbml-interoperability list subscription, visit
>> https://utils.its.caltech.edu/mailman/listinfo/sbml-interoperability
>>
>> For a web interface to the sbml-interoperability mailing list, visit
>> http://sbml.org/Forums/
>>
>> For questions or feedback about the sbml-interoperability list,
>> contact sbml-team@caltech.edu
>>
> ____________________________________________________________
> To manage your sbml-interoperability list subscription, visit
> https://utils.its.caltech.edu/mailman/listinfo/sbml-interoperability
>
> For a web interface to the sbml-interoperability mailing list, visit
> http://sbml.org/Forums/
>
> For questions or feedback about the sbml-interoperability list,
> contact sbml-team@caltech.edu
____________________________________________________________
To manage your sbml-interoperability list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/sbml-interoperability
For a web interface to the sbml-interoperability mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the sbml-interoperability list,
contact sbml-team@caltech.edu
|