Format conversion#
MATLAB functions in RAVEN/src/conversion of the RAVEN toolbox.
Functions#
Function |
Summary |
|---|---|
Add identifier prefixes required by SBML. |
|
Convert between RAVEN and COBRA structures. |
|
Remove SBML-required identifier prefixes. |
|
Order RAVEN model structure fields. |
Reference#
addIdentifierPrefix#
function [model, hasChanged]=addIdentifierPrefix(model,varargin)
Add identifier prefixes required by SBML.
If reaction, metabolite, compartment, gene or model identifiers do not start with a letter or _, which conflicts with SBML specifications, prefixes are added for all identifiers in the respective model field. The prefixes are:
"R_" for model.rxns,
"M_" for model.mets,
"C_" for model.comps;
"G_" for model.genes (and also represented in model.grRules)
Parameters
model: structmodel whose identifiers should be modified.
Name-Value Arguments
fields: cellcell array with model field names that should be checked if prefixes should be added, possible values: 'rxns', 'mets', 'comps', 'genes', 'id' (default all listed model fields will be checked).
Returns
model: structmodified model.
hasChanged: cellcell array with fields and prefixes that are added.
Examples
[model, hasChanged] = addIdentifierPrefix(model, fields);
ravenCobraWrapper#
function newModel=ravenCobraWrapper(model)
Convert between RAVEN and COBRA structures.
Recognises a COBRA structure by checking for the field 'rules', found only in a COBRA Toolbox structure. If the COBRA model also has a grRules field, that is used instead of parsing rules.
Parameters
model: structa RAVEN/COBRA-compatible model structure.
Returns
newModel: structa COBRA/RAVEN-compatible model structure.
Examples
newModel = ravenCobraWrapper(model);
Notes
During the RAVEN -> COBRA -> RAVEN conversion cycle the following fields are lost: annotation, compOutside, compMiriams, rxnComps, geneComps, unconstrained. Boundary metabolites are lost, because the COBRA structure does not involve boundary metabolites, so they are removed using simplifyModel before RAVEN -> COBRA conversion. The field 'rev' is also partially lost, but during COBRA -> RAVEN conversion it is reconstructed based on lower bound reaction values.
During the COBRA -> RAVEN -> COBRA conversion cycle the following fields are lost: geneEntrezID, modelVersion, proteins.
The information about mandatory RAVEN fields was taken from the checkModelStruct function, whereas the corresponding information about COBRA fields was fetched from the verifyModel function.
removeIdentifierPrefix#
function [model, hasChanged]=removeIdentifierPrefix(model,varargin)
Remove SBML-required identifier prefixes.
Removes identifier prefixes:
"R_" for model.rxns, model.rxnNames and model.id,
"M_" for model.mets and model.metNames,
"C_" for model.comps;
"G_" for model.genes (and also represented in model.grRules).
By default, the prefixes are only removed if all entries in a particular field have the prefix. The prefixes might have been present because one or more identifiers do not start with a letter or _, which conflicts with SBML specifications.
Parameters
model: structmodel whose identifiers should be modified.
Name-Value Arguments
fields: cellcell array with model field names from which the identifiers should be removed, possible values: 'rxns', 'mets', 'comps', 'genes', 'metNames', 'rxnNames', 'id' (default all listed model fields will be checked).
forceRemove: logicalif prefixes should be removed even if not all entries in a model field have the prefix (default false).
Returns
model: structmodified model.
hasChanged: cellcell array with fields and prefixes that are removed.
Examples
model = removeIdentifierPrefix(model, fields, forceRemove);
standardizeModelFieldOrder#
function orderedModel=standardizeModelFieldOrder(model)
Order RAVEN model structure fields.
Orders fields of a RAVEN model structure as specified at https://raven-docs.readthedocs.io/en/latest/guide/model-structure.html
The model fields themselves are not changed, only the order is modified. For changing model fields between RAVEN and COBRA format, use ravenCobraWrapper().
Parameters
model: structmodel structure, either RAVEN or COBRA format.
Returns
orderedModel: structmodel structure with ordered fields.
Examples
orderedModel = standardizeModelFieldOrder(model);
See also
ravenCobraWrapper