|
Am 5/10/12 2:38 PM, schrieb Nicolas Rodriguez:
>
>>>> Hi all,
>>>>
>>>> here is a minimal example that doesn't work properly with the current
>>>> version of JSBML:
>>>>
>>>> public static void main(String[] args) throws Throwable {
>>>> SBMLDocument doc = new SBMLDocument(3, 1);
>>>> Model m = doc.createModel("m1");
>>>> Compartment c = m.createCompartment("c1");
>>>> Species s1 = m.createSpecies("s1", c);
>>>> Species s2 = m.createSpecies("s2", c);
>>>> Reaction r = m.createReaction("r1");
>>>> r.createReactant(s1).setStoichiometry(1d);
>>>> r.createProduct(s2).setStoichiometry(1d);
>>>> KineticLaw kl = r.createKineticLaw();
>>>> ASTNode one = new ASTNode(1, kl);
>>>> ASTNode two = new ASTNode(2, kl);
>>>> one.setUnits(Unit.Kind.MOLE.toString().toLowerCase());
>>>> two.setUnits(Unit.Kind.SECOND.toString().toLowerCase());
>>>> ASTNode ast = ASTNode.frac(one, two);
>>>> kl.setMath(ast);
>>>> SBMLWriter.write(doc, System.out, ' ', (short) 2);
>>>> }
>>>>
>>>> You'll see that the first unit is not written to SBML at all. The second
>>>> unit is written, but the namespace declaration is missing. I already
>>>> found what is probably the reason, but can't fix it at the moment: The
>>>> recursive check if the ASTNode contains unit declarations doesn't work.
>>> Not sure of what is going on there !!
>>>
>>> The unit of the first astnode is reset somewhere.
>>>
>>> if I print the value of the units in
>>> MathMLXMLStreamCompiler.compileInteger(ASTNode), the first astnode
>>> return 'null'.
>> The unit that get deleted is probably due to the code from
>> org.sbml.jsbml.ASTNode.arithmeticOperation(Type, ASTNode) ??
>>
>> The swap node does not copy the units ?
> ok, both fixes are commited now and it should be working fine.
>
> I suppose this a good case to de-freeze the 0.8 branch.
>
> Should I commit there (in the 0.8 branch) the changes to
> Model.registerIds as well ?
>
Hi Nico,
Thank you a lot for your great job! Yes, I agree, please do a commit
here! This is an absolutely necessary change.
Best
Andreas
--
Dr. Andreas Dräger
University of Tuebingen
Center for Bioinformatics Tuebingen (ZBIT)
Sand 1
72076 Tübingen
Germany
Phone: +49-7071-29-78982
Fax: +49-7071-29-5091
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|