diff --git a/.gitignore b/.gitignore index b39dd5438..cb914e644 100644 --- a/.gitignore +++ b/.gitignore @@ -92,6 +92,7 @@ ipython_config.py .idea/**/usage.statistics.xml .idea/**/dictionaries .idea/**/shelf +.idea/ # Generated files .idea/**/contentModel.xml diff --git a/release-notes/next-release.md b/release-notes/next-release.md index a3c099474..532c6b037 100644 --- a/release-notes/next-release.md +++ b/release-notes/next-release.md @@ -4,6 +4,12 @@ ## Fixes +* Reformatted example files (e_coli_core.xml, mini_cobra.xml, mini.json, mini.yml, textbook.xml.gz) to be more compliant with identifiers.org. ncbigi is not a valid identifiers.org, so it was replaced with ncbiprotein. +* make sbml.py subsystem reading add partonomy, which matches the definition +of SBO:0000633 (see https://sourceforge.net/p/sbo/term-request/113/) +* Correct reading and writing of subsystem in mat. +* General cleanup of code in mat.py + ## Other * Resolve `flake8` issues and add missing type annotations and docstrings in `src/cobra/io` and `tests/test_io` (#1212). diff --git a/src/cobra/data/mini.json b/src/cobra/data/mini.json index 658bd26c1..df70c0a4f 100644 --- a/src/cobra/data/mini.json +++ b/src/cobra/data/mini.json @@ -26,9 +26,9 @@ }, { "annotation": { - "ncbigi": [ - "GI:1208453", - "GI:1652654" + "ncbiprotein": [ + "1208453", + "1652654" ] }, "id": "b1676", @@ -84,7 +84,7 @@ }, { "annotation": { - "ncbigi": "GI:1653839" + "ncbiprotein": "1653839" }, "id": "b2779", "name": "eno" @@ -95,7 +95,7 @@ }, { "annotation": { - "ncbigi": "GI:1653609" + "ncbiprotein": "1653609" }, "id": "b2926", "name": "pgk" @@ -114,9 +114,9 @@ }, { "annotation": { - "ncbigi": [ - "GI:1006614", - "GI:1651919" + "ncbiprotein": [ + "1006614", + "1651919" ] }, "id": "b3916", @@ -128,7 +128,7 @@ }, { "annotation": { - "ncbigi": "GI:1653253" + "ncbiprotein": "1653253" }, "id": "b4025", "name": "pgi" @@ -1278,6 +1278,7 @@ "pyr_c": 1.0 }, "name": "D-lactate dehydrogenase", + "subsystem": "Pyruvate Metabolism", "upper_bound": 1000.0 }, { diff --git a/src/cobra/data/mini.mat b/src/cobra/data/mini.mat index a470f0f50..9f46abd4c 100644 Binary files a/src/cobra/data/mini.mat and b/src/cobra/data/mini.mat differ diff --git a/src/cobra/data/mini.pickle b/src/cobra/data/mini.pickle index 135ce225e..b0e0f1f40 100644 Binary files a/src/cobra/data/mini.pickle and b/src/cobra/data/mini.pickle differ diff --git a/src/cobra/data/mini.yml b/src/cobra/data/mini.yml index e5e9e3b05..cd9a28a41 100644 --- a/src/cobra/data/mini.yml +++ b/src/cobra/data/mini.yml @@ -960,6 +960,7 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b2133 or b1380 + - subsystem: Pyruvate Metabolism - annotation: !!omap - bigg.reaction: LDH_D - biocyc: META:DLACTDEHYDROGNAD-RXN @@ -1080,9 +1081,9 @@ - id: b1676 - name: pykF - annotation: !!omap - - ncbigi: - - GI:1208453 - - GI:1652654 + - ncbiprotein: + - '1208453' + - '1652654' - !!omap - id: b1723 - name: pfkB @@ -1123,7 +1124,7 @@ - id: b2779 - name: eno - annotation: !!omap - - ncbigi: GI:1653839 + - ncbiprotein: '1653839' - !!omap - id: b2925 - name: fbaA @@ -1131,7 +1132,7 @@ - id: b2926 - name: pgk - annotation: !!omap - - ncbigi: GI:1653609 + - ncbiprotein: '1653609' - !!omap - id: b2987 - name: pitB @@ -1145,9 +1146,9 @@ - id: b3916 - name: pfkA - annotation: !!omap - - ncbigi: - - GI:1006614 - - GI:1651919 + - ncbiprotein: + - '1006614' + - '1651919' - !!omap - id: b3919 - name: tpiA @@ -1155,7 +1156,7 @@ - id: b4025 - name: pgi - annotation: !!omap - - ncbigi: GI:1653253 + - ncbiprotein: '1653253' - !!omap - id: b4395 - name: ytjC diff --git a/src/cobra/data/mini_cobra.xml b/src/cobra/data/mini_cobra.xml index 5f2e7b547..bc0d31f38 100644 --- a/src/cobra/data/mini_cobra.xml +++ b/src/cobra/data/mini_cobra.xml @@ -1,5 +1,5 @@ - + @@ -1333,8 +1333,8 @@ - - + + @@ -1359,7 +1359,7 @@ - + @@ -1373,7 +1373,7 @@ - + @@ -1389,8 +1389,8 @@ - - + + @@ -1404,7 +1404,7 @@ - + diff --git a/src/cobra/data/textbook.xml.gz b/src/cobra/data/textbook.xml.gz index a5d1fbc51..f9bd11ca0 100644 Binary files a/src/cobra/data/textbook.xml.gz and b/src/cobra/data/textbook.xml.gz differ diff --git a/src/cobra/io/mat.py b/src/cobra/io/mat.py index 73f52e417..ae436b646 100644 --- a/src/cobra/io/mat.py +++ b/src/cobra/io/mat.py @@ -35,7 +35,7 @@ "metUniPathway": "unipathway.compound", "metPubChemID": "pubchem.compound", "metPubChemSubstance": "pubchem.substance", - "metCHEBIID": "CHEBI", + "metCHEBIID": "chebi", "metMetaNetXID": "metanetx.chemical", "metSEEDID": "seed.compound", "metBiGGID": "bigg.metabolite", @@ -44,9 +44,9 @@ "metLIPIDMAPSID": "lipidmaps", "metReactomeID": "reactome", "metSABIORKID": "sabiork.compound", - "metSLMID": "SLM", + "metSLMID": "slm", "metSMILES": "SMILES", - "metSBOTerm": "SBO", + "metSBOTerms": "sbo", "metCasNumber": "cas", } @@ -73,21 +73,22 @@ "rxnReactomeID": "reactome", "rxnSABIORKID": "sabiork.reaction", "rxnBRENDAID": "brenda", - "rxnSBOTerms": "SBO", + "rxnSBOTerms": "sbo", } RXN_PROVIDERS_TO_MATLAB = { RXN_MATLAB_TO_PROVIDERS[k]: k for k in RXN_MATLAB_TO_PROVIDERS.keys() } +CONFIDENCE_STR = "Confidence Level" RXN_MATLAB_TO_NOTES = { "rxnReferences": "References", "rxnNotes": "NOTES", - "rxnConfidenceScores": "Confidence Level", + "rxnConfidenceScores": CONFIDENCE_STR, } RXN_NOTES_TO_MATLAB = { - "Confidence Level": "rxnConfidenceScores", + CONFIDENCE_STR: "rxnConfidenceScores", "NOTES": "rxnNotes", "References": "rxnNotes", } @@ -141,6 +142,7 @@ _double_punctuation_re = re.compile(r"[;,.'\"]{2,}") _ec_re = re.compile(r"([\d\-]+.[\d\-]+.[\d\-]+.[\d-]+)") _chebi_re = re.compile(r"\D*(\d+),?") +_sbo_re = re.compile(r"\D*(\d+),?") def _get_id_compartment(_id: str) -> str: @@ -233,7 +235,9 @@ def _cell_to_str_list( def _cell_to_float_list( - m_cell: np.ndarray, empty_value: Optional[float] = None + m_cell: np.ndarray, + empty_value: Optional[float] = None, + inf_value: Optional[float] = None, ) -> List: """Turn an ndarray (cell) to a list of floats. @@ -242,13 +246,41 @@ def _cell_to_float_list( m_cell: np.ndarray empty_value: float, optional What value to replace empty cells with. Default None. + inf_value: float, optional + Replace infinite values with defined inf. Default None (don't replace), will be + replaced by given value if given. Returns ------- List A list of processed floats. """ - return [float(x[0]) if np.size(x[0]) else empty_value for x in m_cell] + + def fix_inf(val: str, _inf_value: float): + """Fix inf value, used for rxn.lb and rxn.ub. + + Parameters + ---------- + val: str + the str to process into float + _inf_value: float + A value to replace infite values with. + """ + val = float(val) + if np.isinf(val) and val < 0: + return -_inf_value + elif np.isinf(val) and val > 0: + return _inf_value + else: + return val + + if inf_value: + return [ + fix_inf(x[0], _inf_value=inf_value) if np.size(x[0]) else empty_value + for x in m_cell + ] + else: + return [float(x[0]) if np.size(x[0]) else empty_value for x in m_cell] def load_matlab_model( @@ -302,7 +334,6 @@ def load_matlab_model( except ValueError as e: print(f"Some problem with the model, causing error {e}") # TODO: use custom cobra exception to handle exception - pass # If code here is executed, then no model was found. raise IOError(f"No COBRA model found at {infile_path}.") @@ -382,6 +413,14 @@ def mat_parse_annotations( annotations[name] = _cell_to_str_list( mat_struct[caseunfold[mat_key]][0, 0], None, _chebi_re, "CHEBI:" ) + elif mat_key == "metSBOTerms".casefold() or mat_key == "rxnSBOTerms".casefold(): + annotations[name] = _cell_to_str_list( + mat_struct[caseunfold[mat_key]][0, 0], None, _sbo_re, "SBO:" + ) + elif mat_key == "metSLMID".casefold(): + annotations[name] = _cell_to_str_list( + mat_struct[caseunfold[mat_key]][0, 0], None, _sbo_re, "SLM:" + ) else: # If it something else, which may have commas, turn it into a list annotations[name] = [ @@ -479,42 +518,39 @@ def annotations_to_mat( """ providers_used = set() for i in range(len(annotation_list)): - if annotation_list[i]: - providers_used.update(annotation_list[i].keys()) + providers_used.update(annotation_list[i].keys()) providers_used = providers_used.intersection(DICT_REPLACE[d_replace].keys()) providers_used = list(providers_used) annotation_matlab = {prov: DICT_REPLACE[d_replace][prov] for prov in providers_used} - empty_lists = [[""] * len(annotation_list) for x in annotation_matlab] + empty_lists = [[""] * len(annotation_list) for _ in annotation_matlab] annotation_cells_to_be = dict(zip(annotation_matlab.values(), empty_lists)) for i in range(len(annotation_list)): - if annotation_list[i]: - for provider_key, v in annotation_list[i].items(): - if isinstance(v, str): - v = [v] - if provider_key == "pubmed": - v = ", ".join( - [ - "PMID:" + annot if "PMID:" not in annot else annot - for annot in v - ] - ) - elif provider_key == "CHEBI": - v = ", ".join( - [ - "CHEBI:" + annot if "CHBEI:" not in annot else annot - for annot in v - ] - ) - elif provider_key == "ec-code": - v = " or ".join(v) - else: - v = ", ".join(v) - if provider_key not in providers_used: - continue - annotation_cells_to_be[annotation_matlab[provider_key]][i] = v + for provider_key, obj_annotation in annotation_list[i].items(): + if isinstance(obj_annotation, str): + obj_annotation = [obj_annotation] + if provider_key == "pubmed": + obj_annotation = ", ".join( + [ + "PMID:" + annot if "PMID:" not in annot else annot + for annot in obj_annotation + ] + ) + elif provider_key == "CHEBI": + obj_annotation = ", ".join( + [ + "CHEBI:" + annot if "CHBEI:" not in annot else annot + for annot in obj_annotation + ] + ) + elif provider_key == "ec-code": + obj_annotation = " or ".join(obj_annotation) + else: + obj_annotation = ", ".join(obj_annotation) + if provider_key not in providers_used: + continue + annotation_cells_to_be[annotation_matlab[provider_key]][i] = obj_annotation for annotation_key, item_list in annotation_cells_to_be.items(): - if annotation_key not in mat_dict: - mat_dict[annotation_key] = _cell(item_list) + mat_dict[annotation_key] = _cell(item_list) # TODO - When cobrapy.notes are revised not be a dictionary (possibly when # annotations are fully SBML compliant, revise this function. @@ -542,28 +578,26 @@ def notes_to_mat( """ providers_used = set() for i in range(len(note_list)): - if note_list[i]: - providers_used.update(note_list[i].keys()) + providers_used.update(note_list[i].keys()) providers_used = providers_used.intersection(DICT_REPLACE[d_replace].keys()) providers_used = list(providers_used) annotation_matlab = {prov: DICT_REPLACE[d_replace][prov] for prov in providers_used} - empty_lists = [[""] * len(note_list) for x in annotation_matlab] + empty_lists = [[""] * len(note_list) for _ in annotation_matlab] annotation_cells_to_be = dict(zip(annotation_matlab.values(), empty_lists)) for i in range(len(note_list)): - if note_list[i]: - for provider_key, v in note_list[i].items(): - if provider_key not in providers_used: - continue - if provider_key == "Confidence Level": - v = float(v) - if not len(annotation_cells_to_be[annotation_matlab[provider_key]][i]): - annotation_cells_to_be[annotation_matlab[provider_key]][i] = v - else: - # References that aren't MIRIAM compliant will go to rxnNotes - annotation_cells_to_be[annotation_matlab[provider_key]][i] = ( - annotation_cells_to_be[annotation_matlab[provider_key]][i] - + f"; {v}" - ) + for provider_key, object_note in note_list[i].items(): + if provider_key not in providers_used: + continue + if provider_key == CONFIDENCE_STR: + object_note = float(object_note) + if not len(annotation_cells_to_be[annotation_matlab[provider_key]][i]): + annotation_cells_to_be[annotation_matlab[provider_key]][i] = object_note + else: + # References that aren't MIRIAM compliant will go to rxnNotes + annotation_cells_to_be[annotation_matlab[provider_key]][i] = ( + annotation_cells_to_be[annotation_matlab[provider_key]][i] + + f"; {object_note}" + ) for annotation_key, item_list in annotation_cells_to_be.items(): mat_dict[annotation_key] = _cell(item_list) @@ -588,13 +622,11 @@ def create_mat_dict(model: Model) -> OrderedDict: mat = OrderedDict() mat["mets"] = _cell(mets.list_attr("id")) model_has_compartment_names = False - for comp, compName in model.compartments.items(): - if comp != compName: - model_has_compartment_names = True - if ( - set([_get_id_compartment(met_id) for met_id in mets.list_attr("id")]) == {None} - or model_has_compartment_names - ): + if list(model.compartments.keys()) != list(model.compartments.values()): + model_has_compartment_names = True + if {_get_id_compartment(met_id) for met_id in mets.list_attr("id")} == { + None + } or model_has_compartment_names: comps = list(model.compartments.keys()) mat["comps"] = _cell(comps) mat["compNames"] = _cell([model.compartments[comp] for comp in comps]) @@ -629,7 +661,28 @@ def create_mat_dict(model: Model) -> OrderedDict: mat["rxnNames"] = _cell(rxns.list_attr("name")) annotations_to_mat(mat, rxns.list_attr("annotation"), DICT_REACTION_REV) notes_to_mat(mat, rxns.list_attr("notes"), DICT_REACTION_NOTES_REV) - mat["subSystems"] = _cell(rxns.list_attr("subsystem")) # TODO - output groups + rxn_subsystems = _cell(rxns.list_attr("subsystem")) + group_ids = model.groups.list_attr("id") + group_names = model.groups.list_attr("name") + group_ids = [ + _id if not _name else _name for _id, _name in zip(group_ids, group_names) + ] + group_members_list = model.groups.list_attr("members") + if set(rxn_subsystems) == {""} and set(group_ids) != {""}: + subsystems = [[] for _ in rxns] + for group_id, group_members in zip(group_ids, group_members_list): + group = model.groups.get_by_id(group_id) + if group.kind == "partonomy": + for member in group_members: + if isinstance(member, Reaction): + rxn_ind = model.reactions.index(member) + # noinspection PyTypeChecker + subsystems[rxn_ind].append(group_id) + mat["subSystems"] = _cell( + [", ".join(subsystem_list) for subsystem_list in subsystems] + ) + else: + mat["subSystems"] = _cell(rxns.list_attr("subsystem")) stoich_mat = create_stoichiometric_matrix(model) mat["S"] = stoich_mat if stoich_mat is not None else [[]] # multiply by 1 to convert to float, working around scipy bug @@ -674,9 +727,7 @@ def from_mat_struct( """ m = mat_struct - if m.dtype.names is None or not {"rxns", "mets", "S", "lb", "ub"} <= set( - m.dtype.names - ): + if m.dtype.names is None or {"rxns", "mets", "S", "lb", "ub"} > set(m.dtype.names): raise ValueError("Invalid MATLAB struct.") old_cobratoolbox_fields = [ @@ -721,7 +772,7 @@ def from_mat_struct( model.name = m["modelName"][0, 0][0] met_ids = _cell_to_str_list(m["mets"][0, 0]) - if all(var in m.dtype.names for var in ["metComps", "comps", "compNames"]): + if {"metComps", "comps", "compNames"}.issubset(m.dtype.names): met_comp_index = [x[0] - 1 for x in m["metComps"][0][0]] comps = _cell_to_str_list(m["comps"][0, 0]) comp_names = _cell_to_str_list(m["compNames"][0][0]) @@ -760,7 +811,7 @@ def from_mat_struct( except (IndexError, ValueError): # TODO: use custom cobra exception to handle exception pass - new_metabolites = list() + new_metabolites = [] for i in range(len(met_ids)): new_metabolite = Metabolite(met_ids[i], compartment=met_comps[i]) if met_names: @@ -775,7 +826,6 @@ def from_mat_struct( model.add_metabolites(new_metabolites) if "genes" in m.dtype.names: - new_genes = [] gene_names = None gene_ids = _cell_to_str_list(m["genes"][0, 0]) try: @@ -783,12 +833,10 @@ def from_mat_struct( except (IndexError, ValueError): # TODO: use custom cobra exception to handle exception pass - for i in range(len(gene_ids)): - if gene_names: - new_gene = Gene(gene_ids[i], name=gene_names[i]) - else: - new_gene = Gene(gene_ids[i]) - new_genes.append(new_gene) + new_genes = [ + Gene(gene_ids[i], name=gene_names[i]) if gene_names else Gene(gene_ids[i]) + for i in range(len(gene_ids)) + ] mat_parse_annotations(new_genes, m, d_replace=DICT_GENE) for current_gene in new_genes: current_gene._model = model @@ -796,10 +844,8 @@ def from_mat_struct( new_reactions = [] rxn_ids = _cell_to_str_list(m["rxns"][0, 0]) - rxn_lbs = _cell_to_float_list(m["lb"][0, 0]) - rxn_lbs = [-inf if np.isinf(x) and x < 0 else x for x in rxn_lbs] - rxn_ubs = _cell_to_float_list(m["ub"][0, 0]) - rxn_ubs = [inf if np.isinf(x) and x > 0 else x for x in rxn_ubs] + rxn_lbs = _cell_to_float_list(m["lb"][0, 0], empty_value=None, inf_value=inf) + rxn_ubs = _cell_to_float_list(m["ub"][0, 0], empty_value=None, inf_value=inf) rxn_gene_rules, rxn_names, rxn_subsystems = None, None, None try: rxn_gene_rules = _cell_to_str_list(m["grRules"][0, 0], "") @@ -815,14 +861,16 @@ def from_mat_struct( # RECON3.0 mat has an array within an array for subsystems. # If we find a model that has multiple subsytems per reaction, this should be # modified - if isinstance(m["subSystems"][0, 0][0][0][0], np.ndarray): + if np.sctype2char(m["subSystems"][0, 0][0][0]) == "O" and isinstance( + m["subSystems"][0, 0][0][0][0], np.ndarray + ): rxn_subsystems = [ - each_cell[0][0][0][0] if each_cell else None + each_cell[0][0][0][0] if each_cell else "" for each_cell in m["subSystems"][0, 0] ] # Other matlab files seem normal. else: - rxn_subsystems = _cell_to_str_list(m["subSystems"][0, 0]) + rxn_subsystems = _cell_to_str_list(m["subSystems"][0, 0], "") except (IndexError, ValueError): # TODO: use custom cobra exception to handle exception pass diff --git a/src/cobra/io/sbml.py b/src/cobra/io/sbml.py index 081d8f672..5eed30d52 100644 --- a/src/cobra/io/sbml.py +++ b/src/cobra/io/sbml.py @@ -598,7 +598,7 @@ def _sbml_to_model( if not libsbml.SyntaxChecker.isValidSBMLSId(model_id): LOGGER.error(f"'{model_id}' is not a valid SBML 'SId'.") cobra_model = Model(model_id) - cobra_model.name = model.getName() + cobra_model.name = model.getName() or None # meta information meta = { @@ -685,7 +685,7 @@ def _sbml_to_model( specie_fbc: "libsbml.FbcSpeciesPlugin" = specie.getPlugin("fbc") if specie_fbc: met.charge = specie_fbc.getCharge() - met.formula = specie_fbc.getChemicalFormula() + met.formula = specie_fbc.getChemicalFormula() or None else: if specie.isSetCharge(): LOGGER.warning( @@ -710,7 +710,7 @@ def _sbml_to_model( f"Use of FORMULA in the notes element is " f"discouraged, use fbc:chemicalFormula instead: {specie}" ) - met.formula = met.notes["FORMULA"] + met.formula = met.notes["FORMULA"] or None # Detect boundary metabolites if specie.getBoundaryCondition() is True: @@ -829,7 +829,7 @@ def process_association(ass: "libsbml.FbcAssociation") -> Union[BoolOp, Name]: if f_replace and F_REACTION in f_replace: rid = f_replace[F_REACTION](rid) cobra_reaction = Reaction(rid) - cobra_reaction.name = reaction.getName() + cobra_reaction.name = reaction.getName().strip() cobra_reaction.annotation = _parse_annotations(reaction) cobra_reaction.notes = _parse_notes_dict(reaction) @@ -1089,6 +1089,7 @@ def process_association(ass: "libsbml.FbcAssociation") -> Union[BoolOp, Name]: if f_replace and F_REACTION in f_replace: obj_id = f_replace[F_REACTION](obj_id) cobra_member = cobra_model.reactions.get_by_id(obj_id) + cobra_member.subsystem = group.name elif typecode == libsbml.SBML_FBC_GENEPRODUCT: if f_replace and F_GENE in f_replace: obj_id = f_replace[F_GENE](obj_id) @@ -1110,6 +1111,7 @@ def process_association(ass: "libsbml.FbcAssociation") -> Union[BoolOp, Name]: for cobra_reaction in cobra_model.reactions: if "SUBSYSTEM" in cobra_reaction.notes: g_name = cobra_reaction.notes["SUBSYSTEM"] + cobra_reaction.subsystem = g_name if g_name in groups_dict: groups_dict[g_name].append(cobra_reaction) else: @@ -1118,7 +1120,8 @@ def process_association(ass: "libsbml.FbcAssociation") -> Union[BoolOp, Name]: for gid, cobra_members in groups_dict.items(): if f_replace and F_GROUP in f_replace: gid = f_replace[F_GROUP](gid) - cobra_group = Group(gid, name=gid, kind="collection") + cobra_group = Group(gid, name=gid, kind="partonomy") + cobra_group.annotation["sbo"] = "SBO:0000633" cobra_group.add_members(cobra_members) groups.append(cobra_group) @@ -1612,9 +1615,8 @@ def _check_required(sbase: "libsbml.Base", value: str, attribute: str) -> str: elif hasattr(sbase, "getMetaId") and sbase.getMetaId(): msg += f" with metaId '{sbase.getName()}'" raise CobraSBMLError(msg) - if attribute == "id": - if not libsbml.SyntaxChecker.isValidSBMLSId(value): - LOGGER.error(f"'{value}' is not a valid SBML 'SId'.") + if attribute == "id" and not libsbml.SyntaxChecker.isValidSBMLSId(value): + LOGGER.error(f"'{value}' is not a valid SBML 'SId'.") return value @@ -1669,7 +1671,7 @@ def _parse_notes_dict(sbase) -> dict: """ notes = sbase.getNotesString() if notes and len(notes) > 0: - notes_store = dict() + notes_store = {} for match in pattern_notes.finditer(notes): _content = match.group("content") try: diff --git a/tests/data/annotation.xml b/tests/data/annotation.xml index 8be18e5b1..ae00ba3c5 100644 --- a/tests/data/annotation.xml +++ b/tests/data/annotation.xml @@ -148,7 +148,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + diff --git a/tests/data/e_coli_core.xml b/tests/data/e_coli_core.xml index a50651aae..ab2494b5c 100644 --- a/tests/data/e_coli_core.xml +++ b/tests/data/e_coli_core.xml @@ -19,35 +19,35 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups="

Description

-

This is a metabolism model of Escherichia coli str. K-12 substr. MG1655 in +

This is a metabolism model of Escherichia coli str. K-12 substr. MG1655 in SBML format.

-
The content of this model has been carefully created in a manual research effort. This file has been exported from the software - COBRApy and further processed with the - JSBML-based +
The content of this model has been carefully created in a manual research effort. This file has been exported from the software + COBRApy and further processed with the + JSBML-based ModelPolisher application.
-
This file has been produced by the - Systems Biology Research Group using +
This file has been produced by the + Systems Biology Research Group using BiGG Models knowledge-base version of Feb 24, 2018, where it is currently hosted and - identified by: + identified by: e_coli_core.

Terms of use

Copyright © 2017 The Regents of the University of California.
-

Redistribution and use of any part of this model from BiGG Models knowledge-base, with or without modification, are permitted provided that the following conditions are met: +

Redistribution and use of any part of this model from BiGG Models knowledge-base, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of this SBML file must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in a different form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
This model is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-

For specific licensing terms about this particular model and regulations of commercial use, see +

For specific licensing terms about this particular model and regulations of commercial use, see this model in BiGG Models knowledge-base.

-

References

When using content from BiGG Models knowledge-base in your research works, please cite +

References

When using content from BiGG Models knowledge-base in your research works, please cite
-
King ZA, Lu JS, Dräger A, Miller PC, Federowicz S, Lerman JA, Ebrahim A, Palsson BO, and Lewis NE. (2015). -
BiGG Models: A platform for integrating, standardizing, and sharing genome-scale models. - Nucl Acids Res. +
King ZA, Lu JS, Dräger A, Miller PC, Federowicz S, Lerman JA, Ebrahim A, Palsson BO, and Lewis NE. (2015). +
BiGG Models: A platform for integrating, standardizing, and sharing genome-scale models. + Nucl Acids Res. doi:10.1093/nar/gkv1049
@@ -94,7 +94,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -115,7 +115,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -137,7 +137,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -158,7 +158,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -179,7 +179,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -200,7 +200,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -221,7 +221,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -242,7 +242,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -263,7 +263,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -284,7 +284,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -305,7 +305,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -326,7 +326,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -347,7 +347,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -368,7 +368,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -389,7 +389,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -410,7 +410,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -431,7 +431,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -452,7 +452,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -473,7 +473,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -494,7 +494,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -515,7 +515,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -536,7 +536,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -557,7 +557,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -578,7 +578,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -599,7 +599,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -620,7 +620,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -641,7 +641,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -662,7 +662,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -683,7 +683,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -704,7 +704,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -725,7 +725,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -746,7 +746,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -767,7 +767,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -788,7 +788,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -809,7 +809,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -830,7 +830,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -851,7 +851,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -872,7 +872,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -893,7 +893,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -914,7 +914,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -935,7 +935,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -956,7 +956,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -977,7 +977,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -998,7 +998,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1019,7 +1019,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1040,7 +1040,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1061,7 +1061,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1082,7 +1082,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1103,7 +1103,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1124,7 +1124,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1145,7 +1145,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1166,7 +1166,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1187,7 +1187,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1208,7 +1208,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1229,7 +1229,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1250,7 +1250,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1271,7 +1271,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1292,7 +1292,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1313,7 +1313,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1334,7 +1334,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1355,7 +1355,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1376,7 +1376,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1397,7 +1397,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1418,7 +1418,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1439,7 +1439,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1460,7 +1460,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1481,7 +1481,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1502,7 +1502,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1523,7 +1523,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1544,7 +1544,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1565,7 +1565,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1586,7 +1586,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1607,7 +1607,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1628,7 +1628,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1649,7 +1649,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1670,7 +1670,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1691,7 +1691,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1712,7 +1712,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1733,7 +1733,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1754,7 +1754,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1775,7 +1775,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1796,7 +1796,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1817,7 +1817,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1838,7 +1838,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1859,7 +1859,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1880,7 +1880,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1901,7 +1901,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1922,7 +1922,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1943,7 +1943,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1964,7 +1964,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -1985,7 +1985,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2006,7 +2006,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2027,7 +2027,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2048,7 +2048,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2069,7 +2069,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2090,7 +2090,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2111,7 +2111,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2132,7 +2132,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2153,7 +2153,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2174,7 +2174,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2195,7 +2195,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2216,7 +2216,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2237,7 +2237,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2258,7 +2258,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2279,7 +2279,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2300,7 +2300,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2321,7 +2321,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2342,7 +2342,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2363,7 +2363,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2384,7 +2384,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2405,7 +2405,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2426,7 +2426,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2447,7 +2447,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2468,7 +2468,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2489,7 +2489,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2510,7 +2510,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2531,7 +2531,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2552,7 +2552,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2573,7 +2573,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2594,7 +2594,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2615,7 +2615,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2636,7 +2636,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2657,7 +2657,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2678,7 +2678,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2699,7 +2699,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2720,7 +2720,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2741,7 +2741,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2762,7 +2762,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2783,7 +2783,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2804,7 +2804,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2825,7 +2825,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2846,7 +2846,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2867,7 +2867,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2888,7 +2888,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2909,7 +2909,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -2930,7 +2930,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6035,7 +6035,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6052,7 +6052,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6069,7 +6069,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6086,7 +6086,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6103,7 +6103,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6120,7 +6120,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6137,7 +6137,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6154,7 +6154,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6171,7 +6171,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6188,7 +6188,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6205,7 +6205,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6238,7 +6238,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6255,7 +6255,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6272,7 +6272,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6289,7 +6289,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6305,7 +6305,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6322,7 +6322,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6339,7 +6339,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -6356,7 +6356,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - + @@ -7423,7 +7423,7 @@ xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups=" - diff --git a/tests/data/example_notes.xml b/tests/data/example_notes.xml index 9d4680f2d..13fcdff15 100644 --- a/tests/data/example_notes.xml +++ b/tests/data/example_notes.xml @@ -15,19 +15,6 @@ - - - - - - - - - - - - - @@ -41,98 +28,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -151,7 +46,7 @@ - + @@ -177,7 +72,7 @@ - + @@ -288,7 +183,7 @@ - + @@ -307,7 +202,7 @@ - + FLUX_VALUE diff --git a/tests/data/iJO1366.pickle b/tests/data/iJO1366.pickle index c35e3fa24..3856b85be 100644 Binary files a/tests/data/iJO1366.pickle and b/tests/data/iJO1366.pickle differ diff --git a/tests/data/mini.json b/tests/data/mini.json index 658bd26c1..df70c0a4f 100644 --- a/tests/data/mini.json +++ b/tests/data/mini.json @@ -26,9 +26,9 @@ }, { "annotation": { - "ncbigi": [ - "GI:1208453", - "GI:1652654" + "ncbiprotein": [ + "1208453", + "1652654" ] }, "id": "b1676", @@ -84,7 +84,7 @@ }, { "annotation": { - "ncbigi": "GI:1653839" + "ncbiprotein": "1653839" }, "id": "b2779", "name": "eno" @@ -95,7 +95,7 @@ }, { "annotation": { - "ncbigi": "GI:1653609" + "ncbiprotein": "1653609" }, "id": "b2926", "name": "pgk" @@ -114,9 +114,9 @@ }, { "annotation": { - "ncbigi": [ - "GI:1006614", - "GI:1651919" + "ncbiprotein": [ + "1006614", + "1651919" ] }, "id": "b3916", @@ -128,7 +128,7 @@ }, { "annotation": { - "ncbigi": "GI:1653253" + "ncbiprotein": "1653253" }, "id": "b4025", "name": "pgi" @@ -1278,6 +1278,7 @@ "pyr_c": 1.0 }, "name": "D-lactate dehydrogenase", + "subsystem": "Pyruvate Metabolism", "upper_bound": 1000.0 }, { diff --git a/tests/data/mini.mat b/tests/data/mini.mat index a92a1570b..9f46abd4c 100644 Binary files a/tests/data/mini.mat and b/tests/data/mini.mat differ diff --git a/tests/data/mini.pickle b/tests/data/mini.pickle index 135ce225e..b0e0f1f40 100644 Binary files a/tests/data/mini.pickle and b/tests/data/mini.pickle differ diff --git a/tests/data/mini.yml b/tests/data/mini.yml index e5e9e3b05..cd9a28a41 100644 --- a/tests/data/mini.yml +++ b/tests/data/mini.yml @@ -960,6 +960,7 @@ - lower_bound: -1000.0 - upper_bound: 1000.0 - gene_reaction_rule: b2133 or b1380 + - subsystem: Pyruvate Metabolism - annotation: !!omap - bigg.reaction: LDH_D - biocyc: META:DLACTDEHYDROGNAD-RXN @@ -1080,9 +1081,9 @@ - id: b1676 - name: pykF - annotation: !!omap - - ncbigi: - - GI:1208453 - - GI:1652654 + - ncbiprotein: + - '1208453' + - '1652654' - !!omap - id: b1723 - name: pfkB @@ -1123,7 +1124,7 @@ - id: b2779 - name: eno - annotation: !!omap - - ncbigi: GI:1653839 + - ncbiprotein: '1653839' - !!omap - id: b2925 - name: fbaA @@ -1131,7 +1132,7 @@ - id: b2926 - name: pgk - annotation: !!omap - - ncbigi: GI:1653609 + - ncbiprotein: '1653609' - !!omap - id: b2987 - name: pitB @@ -1145,9 +1146,9 @@ - id: b3916 - name: pfkA - annotation: !!omap - - ncbigi: - - GI:1006614 - - GI:1651919 + - ncbiprotein: + - '1006614' + - '1651919' - !!omap - id: b3919 - name: tpiA @@ -1155,7 +1156,7 @@ - id: b4025 - name: pgi - annotation: !!omap - - ncbigi: GI:1653253 + - ncbiprotein: '1653253' - !!omap - id: b4395 - name: ytjC diff --git a/tests/data/mini_cobra.xml b/tests/data/mini_cobra.xml index e64a625b8..bc0d31f38 100644 --- a/tests/data/mini_cobra.xml +++ b/tests/data/mini_cobra.xml @@ -1333,8 +1333,8 @@ - - + + @@ -1359,7 +1359,7 @@ - + @@ -1373,7 +1373,7 @@ - + @@ -1389,8 +1389,8 @@ - - + + @@ -1404,7 +1404,7 @@ - + diff --git a/tests/data/mini_fbc2.xml b/tests/data/mini_fbc2.xml index e64a625b8..bc0d31f38 100644 --- a/tests/data/mini_fbc2.xml +++ b/tests/data/mini_fbc2.xml @@ -1333,8 +1333,8 @@ - - + + @@ -1359,7 +1359,7 @@ - + @@ -1373,7 +1373,7 @@ - + @@ -1389,8 +1389,8 @@ - - + + @@ -1404,7 +1404,7 @@ - + diff --git a/tests/data/mini_fbc2.xml.bz2 b/tests/data/mini_fbc2.xml.bz2 index cdfa3736a..73cc7b9e0 100644 Binary files a/tests/data/mini_fbc2.xml.bz2 and b/tests/data/mini_fbc2.xml.bz2 differ diff --git a/tests/data/mini_fbc2.xml.gz b/tests/data/mini_fbc2.xml.gz index efdb5e4c5..569cd4ffe 100644 Binary files a/tests/data/mini_fbc2.xml.gz and b/tests/data/mini_fbc2.xml.gz differ diff --git a/tests/data/mini_wrong_key_caps.mat b/tests/data/mini_wrong_key_caps.mat index ef093934e..017c0c53c 100644 Binary files a/tests/data/mini_wrong_key_caps.mat and b/tests/data/mini_wrong_key_caps.mat differ diff --git a/tests/data/raven.pickle b/tests/data/raven.pickle index 5bb891e73..8d4b59859 100644 Binary files a/tests/data/raven.pickle and b/tests/data/raven.pickle differ diff --git a/tests/data/salmonella.pickle b/tests/data/salmonella.pickle index 644fa8ee8..1f355d41c 100644 Binary files a/tests/data/salmonella.pickle and b/tests/data/salmonella.pickle differ diff --git a/tests/data/textbook.xml.gz b/tests/data/textbook.xml.gz index a5d1fbc51..f9bd11ca0 100644 Binary files a/tests/data/textbook.xml.gz and b/tests/data/textbook.xml.gz differ diff --git a/tests/test_io/test_annotation.py b/tests/test_io/test_annotation.py index f58e267ec..a1aca93bd 100644 --- a/tests/test_io/test_annotation.py +++ b/tests/test_io/test_annotation.py @@ -35,15 +35,15 @@ def _check_sbml_annotations(model: "Model") -> None: # gene annotation # {'asap': 'ABE-0006162', 'ncbigene': '946368', 'uniprot': 'P33221', - # 'ncbigi': 'gi:16129802', 'ecogene': 'EG11809'} + # 'ncbiprotein': 'gi:16129802', 'ecogene': 'EG11809'} annotation = model.genes.G1.annotation assert len(annotation) == 5 - for key in ["asap", "ncbigene", "uniprot", "ncbigi", "ecogene"]: + for key in ["asap", "ncbigene", "uniprot", "ncbiprotein", "ecogene"]: assert key in annotation assert annotation["asap"] == "ABE-0006162" assert annotation["ncbigene"] == "946368" assert annotation["uniprot"] == "P33221" - assert annotation["ncbigi"] == "gi:16129802" + assert annotation["ncbiprotein"] == "16129802" assert annotation["ecogene"] == "EG11809" # compartment annotation diff --git a/tests/test_io/test_mat.py b/tests/test_io/test_mat.py index 4e392e92e..a7d79a330 100644 --- a/tests/test_io/test_mat.py +++ b/tests/test_io/test_mat.py @@ -137,60 +137,12 @@ def test_read_rewrite_matlab_model( assert compare_models(raven_mat_model, raven_mat_model_reload) is None -def _fix_xml_annotation_to_identifiers(model: "Model") -> None: - """Fix XML annotations to respect identifiers.org . - - This function will fix the dict keys of annotations to match identifiers.org. - Eventually, the XML models should be fixed and cobrapy should be strict, but this is - part of SBML rewriting of annotations - see: https://github.com/opencobra/cobrapy/issues/684 - - It also changes met formulas from empty string to None (which is the default - when creating a metabolite with no fomula given) and strips spaces from reaction - names. - - Parameters - ---------- - model : cobra.Model - The model to fix. - - """ - for met in model.metabolites: - if met.formula == "": - met.formula = None - if len(met.annotation): - if "chebi" in met.annotation.keys(): - met.annotation["CHEBI"] = met.annotation.pop("chebi") - if "sbo" in met.annotation.keys(): - met.annotation["SBO"] = met.annotation.pop("sbo") - for annot, val in met.annotation.items(): - if isinstance(val, str): - met.annotation[annot] = [val] - for rxn in model.reactions: - rxn.name = rxn.name.strip() - if "sbo" in rxn.annotation.keys(): - rxn.annotation["SBO"] = rxn.annotation.pop("sbo") - if len(rxn.annotation): - for annot, val in rxn.annotation.items(): - if isinstance(val, str): - rxn.annotation[annot] = [val] - for gene in model.genes: - if len(gene.annotation): - if "ncbigi" in gene.annotation.keys(): - gene.annotation["ncbiprotein"] = gene.annotation.pop("ncbigi") - for annot, val in gene.annotation.items(): - if isinstance(val, str): - gene.annotation[annot] = [val] - - @pytest.mark.skipif(scipy is None, reason="scipy unavailable") @pytest.mark.parametrize( "xml_file", ["e_coli_core.xml", "salmonella.xml", "mini_cobra.xml", "mini_fbc2.xml"] ) # When using a better comparison function, can run test on # "annotation.xml", "example_notes.xml", "fbc_ex1.xml", "fbc_ex2.xml", "validation.xml" -# "example_notes.xml" contains a group and groups are not yet correctly exported to -# matlab # "valid_annotation_output.xml" has reaction annotations in a metabolite, so they would # be thrown out by matlab def test_compare_xml_to_written_matlab_model( @@ -214,7 +166,6 @@ def test_compare_xml_to_written_matlab_model( """ xml_model = read_sbml_model(str((data_directory / xml_file).resolve())) - _fix_xml_annotation_to_identifiers(xml_model) mat_output_file = tmp_path / xml_file.replace(".xml", ".mat") save_matlab_model( xml_model, str(mat_output_file.resolve()) @@ -338,6 +289,7 @@ def test_mat_model_wrong_caps(compare_models: Callable, data_directory: Path) -> "bigg.reaction": ["LDH_D"], "ec-code": ["1.1.1.28"], "biocyc": ["META:DLACTDEHYDROGNAD-RXN"], + "sbo": ["SBO:0000375"], } for rxn in mat_model.reactions.list_attr("id"): assert ( @@ -350,6 +302,15 @@ def test_mat_model_wrong_caps(compare_models: Callable, data_directory: Path) -> "lipidmaps": ["LMFA01060077"], "reactome": ["REACT_113557", "REACT_389680", "REACT_29398"], "biocyc": ["PYRUVATE"], + "chebi": [ + "CHEBI:15361", + "CHEBI:14987", + "CHEBI:8685", + "CHEBI:32816", + "CHEBI:45253", + "CHEBI:26466", + "CHEBI:26462", + ], "pubchem.substance": ["3324"], "bigg.metabolite": ["pyr"], "cas": ["127-17-3"], diff --git a/tests/test_io/test_sbml.py b/tests/test_io/test_sbml.py index 776c3dcb8..658a62cd1 100644 --- a/tests/test_io/test_sbml.py +++ b/tests/test_io/test_sbml.py @@ -76,7 +76,7 @@ def test_validate(trial: IOTrial, data_directory: str) -> None: Parameters ---------- - IOTrial: + trial: IOTrial Which model trial to check. data_directory: str Directory where the data is.