Esempio n. 1
0
def test_find_stoichiometrically_balanced_cycles(read_only_model, store):
    """Expect no stoichiometrically balanced loops to be present."""
    store["looped_reactions"] = [
        rxn.id for rxn in consistency.find_stoichiometrically_balanced_cycles(
            read_only_model)
    ]
    assert len(store["looped_reactions"]) == 0,\
        "The following reactions participate in stoichiometrically balanced" \
        " cycles: {}".format(
            ", ".join(store["looped_reactions"]))
Esempio n. 2
0
def test_find_stoichiometrically_balanced_cycles(read_only_model):
    """
    Expect no stoichiometrically balanced loops to be present.

    Stoichiometrically Balanced Cycles are artifacts of insufficiently
    constrained networks resulting in reactions that can carry flux when
    all the boundaries have been closed.
    """
    ann = test_find_stoichiometrically_balanced_cycles.annotation
    ann["data"] = consistency.find_stoichiometrically_balanced_cycles(
        read_only_model)
    ann["metric"] = len(ann["data"]) / len(read_only_model.reactions)
    ann["message"] = wrapper.fill(
        """There are {} ({:.2%}) reactions
        which participate in SBC in the model: {}""".format(
            len(ann["data"]), ann["metric"], truncate(ann["data"])))
    assert len(ann["data"]) == 0, ann["message"]
Esempio n. 3
0
def test_find_stoichiometrically_balanced_cycles(read_only_model):
    """
    Expect no stoichiometrically balanced loops to be present.

    Stoichiometrically Balanced Cycles are artifacts of insufficiently
    constrained networks resulting in reactions that can carry flux when
    all the boundaries have been closed.
    """
    # Skip inside function so it happens during call and not during setup.
    # TODO: Consider using a timeout on the solver in future instead.
    pytest.skip("Loopless FVA currently runs too slowly for large models.")
    ann = test_find_stoichiometrically_balanced_cycles.annotation
    ann["data"] = get_ids(
        consistency.find_stoichiometrically_balanced_cycles(read_only_model))
    ann["metric"] = len(ann["data"]) / len(read_only_model.reactions)
    ann["message"] = wrapper.fill("""There are {} ({:.2%}) reactions
        which participate in SBC in the model: {}""".format(
        len(ann["data"]), ann["metric"], truncate(ann["data"])))
    assert len(ann["data"]) == 0, ann["message"]
Esempio n. 4
0
def test_find_stoichiometrically_balanced_cycles(model):
    """
    Expect no stoichiometrically balanced loops to be present.

    Stoichiometrically Balanced Cycles are artifacts of insufficiently
    constrained networks resulting in reactions that can carry flux when
    all the boundaries have been closed.

    Implementation:
    Close all model boundary reactions and then use flux variability analysis
    (FVA) to identify reactions that carry flux.

    """
    ann = test_find_stoichiometrically_balanced_cycles.annotation
    ann["data"] = consistency.find_stoichiometrically_balanced_cycles(model)
    ann["metric"] = len(ann["data"]) / len(model.reactions)
    ann["message"] = wrapper.fill(
        """There are {} ({:.2%}) reactions
        which participate in SBC in the model: {}""".format(
            len(ann["data"]), ann["metric"], truncate(ann["data"])))
    assert len(ann["data"]) == 0, ann["message"]
Esempio n. 5
0
def test_find_stoichiometrically_balanced_cycles(model, num):
    """Expect no stoichiometrically balanced loops to be present."""
    rxns_in_loops = consistency.find_stoichiometrically_balanced_cycles(model)
    assert len(rxns_in_loops) == num
Esempio n. 6
0
def test_find_stoichiometrically_balanced_cycles(model, num):
    """Expect no stoichiometrically balanced loops to be present."""
    rxns_in_loops = consistency.find_stoichiometrically_balanced_cycles(
        model
    )
    assert len(rxns_in_loops) == num