Format conversion#

MATLAB functions in RAVEN/src/conversion of the RAVEN toolbox.

Functions#

Function

Summary

addIdentifierPrefix

Add identifier prefixes required by SBML.

ravenCobraWrapper

Convert between RAVEN and COBRA structures.

removeIdentifierPrefix

Remove SBML-required identifier prefixes.

standardizeModelFieldOrder

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 : struct

model whose identifiers should be modified.

Name-Value Arguments

fields : cell

cell 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 : struct

modified model.

hasChanged : cell

cell 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 : struct

a RAVEN/COBRA-compatible model structure.

Returns

newModel : struct

a 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 : struct

model whose identifiers should be modified.

Name-Value Arguments

fields : cell

cell 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 : logical

if prefixes should be removed even if not all entries in a model field have the prefix (default false).

Returns

model : struct

modified model.

hasChanged : cell

cell 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 : struct

model structure, either RAVEN or COBRA format.

Returns

orderedModel : struct

model structure with ordered fields.

Examples

orderedModel = standardizeModelFieldOrder(model);

See also

ravenCobraWrapper