cana.io.sbml module

SBML-qual Boolean model import and export (MathML update functions).

cana.io.sbml.xml_local_name(tag)[source]

Strip an XML namespace URI, leaving the local element name.

Parameters:

tag (str)

Return type:

str

cana.io.sbml.qual_attribute(elem, local_name)[source]

Read a qual/SBML attribute by local name, ignoring namespace prefixes.

Parameters:
  • elem (Element)

  • local_name (str)

Return type:

str | None

cana.io.sbml.mathml_to_python_expr(node)[source]

Convert a MathML boolean-ish subtree to a python boolean expression.

Parameters:

node (Element)

Return type:

str

cana.io.sbml.python_expr_to_mathml(expr)[source]

Parse a restricted python boolean expression into MathML apply trees.

Supports the small DNF language produced by bit_lut_to_expression().

Parameters:

expr (str)

Return type:

Element

cana.io.sbml.lut_to_mathml(input_names, lut)[source]

MathML for the ON condition of a Boolean LUT (resultLevel 1).

Parameters:
  • input_names (Sequence[str])

  • lut (Sequence[Any])

Return type:

Element

cana.io.sbml.parse_sbml(text)[source]

Parse SBML-qual Boolean models into a node list.

Parameters:

text (str)

Return type:

List[BooleanNode]

cana.io.sbml.nodes_to_sbml(nodes, *, warn=True)[source]

Export a node list to SBML Level 3 qualitative XML.

Prefers stored expression, then one-symbol schemata, then LUT DNF for MathML update functions. Soft-warns when verification flags are not True (never blocks).

Parameters:
Return type:

str