Forums

F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Search Search
SBML Discussions » sbml-interoperability » Numerical value of kineticLaw
Show: Today's Posts  :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
AuthorTopic
Juanky


Posts: 3
Location:
Sevilla
Registered:
May 2006
Numerical value of kineticLaw 27 Jun '06 05:37 Go to next message

Hi!

I'm develop a parser using libsbml in Java. The parser this to 90%. I only need a part.
In this fragment of xml:

<reaction id="Reaction_6" reversible="true">
- <listOfReactants>
<speciesReference id="EGFR-EGF2*" speciesType="s" />
</listOfReactants>
- <listOfProducts>
<speciesReference id="EGFR-EGF2" speciesType="s" />
</listOfProducts>
- <kineticLaw>
- <math xmlns="http://www-w3.org/1998/MathMathML">
- <apply>
<times />
<cn>0.0271</cn>
<ci>EGFR-EGF2*</ci>
</apply>
</math>
</kineticLaw>
</reaction>

I need to accede to the numerical value (written in black letters) but am not able. Exists some method to accede to this field in the bookstore (and I have not seen it)?

Thanks and Sorry if my english is bad.

      
Tully Yates


Posts: 7
Registered:
June 2006
RE: Numerical value of kineticLaw 27 Jun '06 13:06 Go to previous messageGo to next message

Hi,

If you are only interested in the parameter value you can use the
getParameters() and then use getValue() method on the resulting
Parameter object.

Most likely you want to know the math too, so you will need to get the
kinetic law and then use the getMath() method.
This will return ASTNode (Abstract Syntax Tree).
There is an ASTNode class in the javadoc org.sbml.libsbml.ASTNode that
has methods to help parse the abstract syntax tree.
You will see that most of the get methods return ints; you will need to
look these up in the constant field values to see what the int returned
actually represents.
http://sbml.org/software/libsbml/docs/java/constant-values.html contains
this information.

Hope that helps,


T.



-----Original Message-----
From: libsbml-discuss-bounces@caltech.edu
[mailto:libsbml-discuss-bounces@caltech.edu] On Behalf Of Juanky
Sent: 27 June 2006 19:30
To: libsbml-discuss@caltech.edu
Subject: [libsbml-discuss] Numerical value of kineticLaw



Hi!

I'm develop a parser using libsbml in Java. The parser this to 90%. I
only need a part.
In this fragment of xml:

<reaction id="Reaction_6" reversible="true">
- <listOfReactants>
<speciesReference id="EGFR-EGF2*" speciesType="s" />
</listOfReactants>
- <listOfProducts>
<speciesReference id="EGFR-EGF2" speciesType="s" />
</listOfProducts>
- <kineticLaw>
- <math xmlns="http://www-w3.org/1998/MathMathML">
- <apply>
<times />
<cn>0.0271</cn>
<ci>EGFR-EGF2*</ci>
</apply>
</math>
</kineticLaw>
</reaction>

I need to accede to the numerical value (written in black letters) but
am not able. Exists some method to accede to this field in the
bookstore (and I have not seen it)?

Thanks and Sorry if my english is bad.


      
Juanky


Posts: 3
Location:
Sevilla
Registered:
May 2006
Re: RE: Numerical value of kineticLaw 28 Jun '06 10:49 Go to previous messageGo to next message

Tully Yates wrote on Tue, 27 June 2006 22:06

Hi,
Most likely you want to know the math too, so you will need to get the
kinetic law and then use the getMath() method.
This will return ASTNode (Abstract Syntax Tree).



Hi!

How can I covert ASTNode in to double or float number?
I have been trying it, but I have not been able it to do.

If i use getParameters() and then getValue(), I can't accede to that value.

Thanks.

      
lyang


Posts: 9
Registered:
June 2006
Re: RE: Numerical value of kineticLaw 28 Jun '06 13:48 Go to previous messageGo to next message

When a ASTNode is created, you need have a type of libsbmlConstants by using class constructor or setType() function. When you getMath() as an ASTNode, you may need access ASTNode with loop (for list) or recursively (for child) but first call getType() to check the type. Then based on the type to check isXXX() function and finally call getName() or getValue().

I am not sure if this is a better way.

      
Juanky


Posts: 3
Location:
Sevilla
Registered:
May 2006
Re: RE: Numerical value of kineticLaw 04 Jul '06 01:27 Go to previous messageGo to next message

When I getMath() it return a null ASTNode.
ASTNode isn't the solution.

Anyone know how can I accede to this value?

      
Ben Bornstein


Posts: 287
Registered:
September 2003
Re: Re: RE: Numerical value of kineticLaw 18 Jul '06 18:24 Go to previous messageGo to next message

Hi,

> When a ASTNode is created, you need have a type of libsbmlConstants
> by using class constructor or setType() function. When you getMath
> () as an ASTNode, you may need access ASTNode with loop (for list)
> or recursively (for child) but first call getType() to check the
> type. Then based on the type to check isXXX() function and finally
> call getName() or getValue().

Actually, getType() and isXXX() provide the same information. The
getType() method is useful in 'switch' statements, e.g.:

switch (node.getType())
{
case AST_PLUS : ... beak;
case AST_MINUS: ... break;
/* etc. */
}

while isXXX() is arguably a little bit more succinct and readable
than getType() == AST_XXX. Also, the isXXX() methods can encompass a
range of values returned by getType(). For example, isLogical() is
equivalent to (getType() >= AST_RELATIONAL_AND) && (getType() <=
AST_RELATIONAL_XOR).

For extracting numeric values, here are the predicates (isXXX()
methods) and their corresponding accessor methods:

isInteger () -> getInteger()
isRational() -> getNumerator() and getDenominator()
isReal () -> getReal()
getType() == AST_REAL_E -> getReal() or getMantissa() and
getExponent()

For "special" numeric values, there's also:

isInfinity ()
isNegInfinity()
isNaN ()

In these cases getReal() still returns the appropriate floating point
value.

I hope this helps.

Thanks.

Ben



      
Ben Bornstein


Posts: 287
Registered:
September 2003
Re: Re: RE: Numerical value of kineticLaw 18 Jul '06 18:26 Go to previous messageGo to next message

Hi,

> When I getMath() it return a null ASTNode.
> ASTNode isn't the solution.
>
> Anyone know how can I accede to this value?

What (lib)SBML object are you trying to call getMath() on and what
value are you trying to access?

Thanks.

Ben

      
Ben Bornstein


Posts: 287
Registered:
September 2003
Re: Numerical value of kineticLaw 18 Jul '06 18:33 Go to previous message

Hi Juanky,

In this case, you would call:

double value = model.getReaction("Reaction_6").getKineticLaw
().getMath().getLeftChild().getReal();

But in general, you should probably put in some sanity checks (or run
the libSBML consistency checks) in case the model author has omitted
something. For example:


Reaction r = model.getReaction("Reaction_6");

if ( r.isSetKineticLaw() )
{
KineticLaw kl = getKineticLaw();

if ( kl.isSetMath() )
{
ASTNode math = kl.getMath();
double value = math.getLeftChild().getReal();
}
}


I hope this helps.

Thanks.

Ben


On Jun 27, 2006, at 11:30 AM, Juanky wrote:

> I'm develop a parser using libsbml in Java. The parser this to 90%.
> I only need a part.
> In this fragment of xml:
>
> <reaction id="Reaction_6" reversible="true">
> - <listOfReactants>
> <speciesReference id="EGFR-EGF2*" speciesType="s" />
> </listOfReactants>
> - <listOfProducts>
> <speciesReference id="EGFR-EGF2" speciesType="s" />
> </listOfProducts>
> - <kineticLaw>
> - <math xmlns="http://www-w3.org/1998/MathMathML">
> - <apply>
> <times />
> <cn>0.0271</cn>
> <ci>EGFR-EGF2*</ci>
> </apply>
> </math>
> </kineticLaw>
> </reaction>
>
> I need to accede to the numerical value (written in black letters)
> but am not able. Exists some method to accede to this field in the
> bookstore (and I have not seen it)?

      
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic:The getSpecies() method for a SpeciesReference causes a crash in Java
Next Topic:SBMLDocument_print*
Go to forum:
-=] Back to Top [=-

Powered by FUDforum. (Copyright Advanced Internet Designs Inc.)

Please use our issue tracking system for any questions or suggestions about this website.