Skip to content

astnodes

Construction of formulas as libsbml ASTs.

The converter keeps every formula as the AST libsbml reads from the model and builds the new ones (reaction terms, amounts, rates) from nodes. A formula as text in the syntax of libsbml cannot tell an id from a symbol of the syntax: a parameter avogadro, pi or NaN would be read back as the constant.

name

name(sid)

The reference to the element of an id, never a symbol of that name.

number

number(value, units=None)

A real number, infinity and NaN included.

Parameters:

Name Type Description Default
value float

the value.

required
units str | None

id of the SBML units of the number, none when None.

None

apply

apply(operator, *arguments)

An operator or function applied to copies of its arguments.

Parameters:

Name Type Description Default
operator int

type of the node, e.g. libsbml.AST_TIMES.

required
arguments ASTNode

the arguments in their order, they are not changed.

()

signed_sum

signed_sum(terms)

The sum of terms which are added (AST_PLUS) or subtracted (AST_MINUS).

Parameters:

Name Type Description Default
terms list[tuple[int, ASTNode]]

sign and term, at least one; the terms are not changed and every term is copied once, whatever the number of terms.

required

Returns:

Type Description
ASTNode

((-a + b) - c) ..., the terms in their order.

text

text(node)

The formula in the syntax of libsbml, for logs and messages only.