コード例 #1
0
ファイル: test_consistency.py プロジェクト: biosustain/memote
def test_find_reactions_unbounded_flux_default_condition(model):
    """
    Expect the fraction of unbounded reactions to be low.

    A large fraction of model reactions able to carry unlimited flux under
    default conditions indicates problems with reaction directionality,
    missing cofactors, incorrectly defined transport reactions and more.

    Implementation:
    Without changing the default constraints run flux variability analysis.
    From the FVA results identify those reactions that carry flux equal to the
    model's maximal or minimal flux.

    """
    ann = test_find_reactions_unbounded_flux_default_condition.annotation
    unbounded_rxn_ids, fraction, _ = \
        consistency.find_reactions_with_unbounded_flux_default_condition(model)
    ann["data"] = unbounded_rxn_ids
    ann["metric"] = fraction
    ann["message"] = wrapper.fill(
        """ A fraction of {:.2%} of the non-blocked reactions (in total {}
        reactions) can carry unbounded flux in the default model
        condition. Unbounded reactions may be involved in
        thermodynamically infeasible cycles: {}""".format(
            ann["metric"], len(ann["data"]), truncate(ann["data"])
        )
    )
    # TODO: Arbitrary threshold right now! Update after meta study!
    assert ann["metric"] <= 0.1, ann["message"]
コード例 #2
0
ファイル: test_consistency.py プロジェクト: sgalkina/memote
def test_find_reactions_unbounded_flux_default_condition(read_only_model):
    """
    Expect the fraction of unbounded reactions to be low.

    A large fraction of model reactions able to carry unlimited flux under
    default conditions indicates problems with reaction directionality,
    missing cofactors, incorrectly defined transport reactions and more.
    """
    # TODO: Arbitrary threshold right now! Update after meta study!
    ann = test_find_reactions_unbounded_flux_default_condition.annotation
    unbounded_rxns, fraction, _ = \
        consistency.find_reactions_with_unbounded_flux_default_condition(
            read_only_model
        )
    ann["data"] = get_ids(unbounded_rxns)
    ann["metric"] = fraction
    ann["message"] = wrapper.fill(
        """ A fraction of {:.2%} of the non-blocked reactions (in total {}
        reactions) can carry unbounded flux in the default model
        condition. Unbounded reactions may be involved in
        thermodynamically infeasible cycles: {}""".format(
            len(ann["data"]), ann["metric"], truncate(ann["data"])
        )
    )
    assert ann["metric"] <= 0.1, ann["message"]
コード例 #3
0
def test_find_reactions_unbounded_flux_default_condition(model):
    """
    Expect the fraction of unbounded reactions to be low.

    A large fraction of model reactions able to carry unlimited flux under
    default conditions indicates problems with reaction directionality,
    missing cofactors, incorrectly defined transport reactions and more.

    Implementation:
    Without changing the default constraints run flux variability analysis.
    From the FVA results identify those reactions that carry flux equal to the
    model's maximal or minimal flux.

    """
    ann = test_find_reactions_unbounded_flux_default_condition.annotation
    unbounded_rxn_ids, fraction, _ = \
        consistency.find_reactions_with_unbounded_flux_default_condition(model)
    ann["data"] = unbounded_rxn_ids
    ann["metric"] = fraction
    ann["message"] = wrapper.fill(
        """ A fraction of {:.2%} of the non-blocked reactions (in total {}
        reactions) can carry unbounded flux in the default model
        condition. Unbounded reactions may be involved in
        thermodynamically infeasible cycles: {}""".format(
            ann["metric"], len(ann["data"]), truncate(ann["data"])))
    # TODO: Arbitrary threshold right now! Update after meta study!
    assert ann["metric"] <= 0.1, ann["message"]
コード例 #4
0
def test_find_reactions_with_unbounded_flux_default_condition_errors(model):
    """Expect the number of unbounded and blocked metabolites to be correct."""
    consistency.find_reactions_with_unbounded_flux_default_condition(model)
コード例 #5
0
def test_find_reactions_with_unbounded_flux_default_condition(model, fraction):
    """Expect the number of unbounded and blocked metabolites to be correct."""
    _, unb_fraction, _ = \
        consistency.find_reactions_with_unbounded_flux_default_condition(model)
    assert unb_fraction == fraction
コード例 #6
0
def test_find_reactions_with_unbounded_flux_default_condition_errors(model):
    """Expect the number of unbounded and blocked metabolites to be correct."""
    consistency.find_reactions_with_unbounded_flux_default_condition(model)
コード例 #7
0
def test_find_reactions_with_unbounded_flux_default_condition(model, fraction):
    """Expect the number of unbounded and blocked metabolites to be correct."""
    _, unb_fraction, _ = \
        consistency.find_reactions_with_unbounded_flux_default_condition(model)
    assert unb_fraction == fraction