def test_find_unique_metabolites(model): """ Expect there to be less metabolites when removing compartment tag. Metabolites may be transported into different compartments, which means that in a compartimentalized model the number of metabolites may be much higher than in a model with no compartments. This test counts only one occurrence of each metabolite and returns this as the number of unique metabolites. The test expects that the model is compartimentalized, and thus, that the number of unique metabolites is generally lower than the total number of metabolites. Implementation: Reduce the list of metabolites to a unique set by removing the compartment tag. The cobrapy SBML parser adds compartment tags to each metabolite ID. """ ann = test_find_unique_metabolites.annotation ann["data"] = list(basic.find_unique_metabolites(model)) ann["metric"] = len(ann["data"]) / len(model.metabolites) ann["message"] = wrapper.fill( """Not counting the same entities in other compartments, there is a total of {} ({:.2%}) unique metabolites in the model: {}""".format( len(ann["data"]), ann["metric"], truncate(ann["data"]))) assert len(ann["data"]) < len(model.metabolites), ann["message"]
def test_find_unique_metabolites(model): """ Expect there to be less metabolites when removing compartment tag. Metabolites may be transported into different compartments, which means that in a compartimentalized model the number of metabolites may be much higher than in a model with no compartments. This test counts only one occurrence of each metabolite and returns this as the number of unique metabolites. The test expects that the model is compartimentalized, and thus, that the number of unique metabolites is generally lower than the total number of metabolites. Implementation: Reduce the list of metabolites to a unique set by removing the compartment tag. The cobrapy SBML parser adds compartment tags to each metabolite ID. """ ann = test_find_unique_metabolites.annotation ann["data"] = list(basic.find_unique_metabolites(model)) ann["metric"] = len(ann["data"]) / len(model.metabolites) ann["message"] = wrapper.fill( """Not counting the same entities in other compartments, there is a total of {} ({:.2%}) unique metabolites in the model: {}""".format( len(ann["data"]), ann["metric"], truncate(ann["data"]))) assert len(ann["data"]) < len(model.metabolites), ann["message"]
def test_find_unique_metabolites(model, num): """Expect amount of metabolic reactions to be identified correctly.""" assert len(basic.find_unique_metabolites(model)) == num
def test_find_unique_metabolites(read_only_model, store): """Expect there to be less metabolites when removing compartment tag.""" store["num_unique_metabolites"] = len( basic.find_unique_metabolites(read_only_model)) assert store["num_unique_metabolites"] < len(read_only_model.metabolites)