def test_parallel_find_metabolites_not_consumed_with_open_bounds(model, num):
    """Expect the appropriate amount of nonconsumed metabolites to be found."""
    badmets = consistency.find_metabolites_not_consumed_with_open_bounds(
        model, 1)
    multi_badmets = consistency.find_metabolites_not_consumed_with_open_bounds(
        model, 2)
    assert badmets == multi_badmets
def test_find_metabolites_not_consumed_with_open_bounds(model):
    """
    Expect metabolites to be consumable in complete medium.

    In complete medium, a model should be able to divert flux from every
    metabolite. This test opens all the boundary reactions i.e. simulates a
    complete medium and checks if any metabolite cannot be consumed
    individually using flux balance analysis. Metabolites that cannot be
    consumed this way are likely dead-end metabolites or upstream of reactions
    with fixed constraints. To pass this test all metabolites should be
    consumable.

    Implementation:
    Open all model boundary reactions, then for each metabolite in the model
    add a boundary reaction and minimize it with FBA.

    """
    ann = test_find_metabolites_not_consumed_with_open_bounds.annotation
    ann["data"] = get_ids(
        consistency.find_metabolites_not_consumed_with_open_bounds(model)
    )
    ann["metric"] = len(ann["data"]) / len(model.metabolites)
    ann["message"] = wrapper.fill(
        """A total of {} ({:.2%}) metabolites cannot be consumed in complete
        medium: {}""".format(
            len(ann["data"]), ann["metric"], truncate(ann["data"])))
    assert len(ann["data"]) == 0, ann["message"]
Exemple #3
0
def test_find_metabolites_not_consumed_with_open_bounds(read_only_model):
    """
    Expect metabolites to be consumable in complete medium.

    In complete medium, a model should be able to divert flux from every
    metabolite. This test opens all the boundary reactions i.e. simulates a
    complete medium and checks if any metabolite cannot be consumed
    individually using flux balance analysis. Metabolites that cannot be
    consumed this way are likely dead-end metabolites or upstream of reactions
    with fixed constraints. To pass this test all metabolites should be
    consumable.

    """
    ann = test_find_metabolites_not_consumed_with_open_bounds.annotation
    ann["data"] = get_ids(
        consistency.find_metabolites_not_consumed_with_open_bounds(
            read_only_model
        )
    )
    ann["metric"] = len(ann["data"]) / len(read_only_model.metabolites)
    ann["message"] = wrapper.fill(
        """A total of {} ({:.2%}) metabolites cannot be consumed in complete
        medium: {}""".format(
            len(ann["data"]), ann["metric"], truncate(ann["data"])))
    assert len(ann["data"]) == 0, ann["message"]
def test_find_metabolites_not_consumed_with_open_bounds(model, num):
    """Expect the appropriate amount of nonconsumed metabolites to be found."""
    badmets = consistency.find_metabolites_not_consumed_with_open_bounds(model)
    assert len(badmets) == num
def test_find_metabolites_not_consumed_with_open_bounds(model, num):
    """Expect the appropriate amount of nonconsumed metabolites to be found."""
    badmets = consistency.find_metabolites_not_consumed_with_open_bounds(model)
    assert len(badmets) == num