File: test_annotate.py

package info (click to toggle)
python-cobra 0.29.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,512 kB
  • sloc: python: 14,703; xml: 12,841; makefile: 137; sh: 32
file content (20 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Test functionalities of model component annotation functions."""

from cobra.core import Model, Reaction
from cobra.manipulation import add_SBO


def test_sbo_annotation(model: Model) -> None:
    """Test SBO annotation function."""
    rxns = model.reactions
    rxns.EX_o2_e.annotation.clear()
    fake_DM = Reaction("DM_h_c")
    model.add_reactions([fake_DM])
    fake_DM.add_metabolites({model.metabolites.get_by_id("h_c"): -1})
    # this exchange will be set wrong. The function should not overwrite
    # an existing SBO annotation
    rxns.get_by_id("EX_h_e").annotation["sbo"] = "SBO:0000628"
    add_SBO(model)
    assert rxns.EX_o2_e.annotation["sbo"] == "SBO:0000627"
    assert rxns.DM_h_c.annotation["sbo"] == "SBO:0000628"
    assert rxns.EX_h_e.annotation["sbo"] == "SBO:0000628"