Annotation#

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

Functions#

Function

Summary

assignSBOterms

Assign SBO terms to metabolites and reactions.

editMiriam

Change MIRIAM annotation fields, one type at a time.

extractMiriam

Unpack MIRIAM annotations into a human-readable table.

loadDeltaGCSV

Load metDeltaG and rxnDeltaG from CSV files.

saveDeltaGCSV

Save metDeltaG and rxnDeltaG to CSV files.

Reference#

assignSBOterms#

function model = assignSBOterms(model, varargin)

Assign SBO terms to metabolites and reactions.

Assign SBO terms to metabolites and reactions following a generic rule set. The MATLAB counterpart of yeast-GEM's legacy addSBOterms; organism-agnostic, parameterised entirely by opts.

SBO is written via editMiriam(..., 'fill') so pre-existing SBO annotations are preserved. The terms are stored in model.metMiriams and model.rxnMiriams under the namespace 'sbo' (there is no separate SBO field); read them with extractMiriam(model.rxnMiriams, 'sbo'). exportModel writes them as the SBML sboTerm attribute.

Parameters

model : struct

RAVEN model struct.

Name-Value Arguments

opts : struct

Struct with any of the following fields. Missing fields take the defaults shown:

  • biomassMetNames : {'biomass','DNA','RNA','protein','carbohydrate', 'lipid','cofactor','ion'}

  • biomassMetSuffixes : {' backbone',' chain'}

  • biomassRxnName : 'biomass pseudoreaction'

  • ngamRxnName : 'non-growth associated maintenance reaction'

  • pseudoreactionSubstrings : {'pseudoreaction','SLIME rxn'}

  • onlyLastReactionForPseudo : false. yeast-GEM bug-compat flag that replicates the legacy for i=numel(...) typo (pseudoreaction SBOs applied only to the last reaction). Off by default; turn ON for byte-equivalent yeast-GEM output.

Returns

model : struct

Modified model.

Examples

model = assignSBOterms(model);
model = assignSBOterms(model, struct('onlyLastReactionForPseudo', true));

Notes

Metabolites:

SBO:0000649 (Biomass) when met.name is in opts.biomassMetNames, or
ends with any of opts.biomassMetSuffixes. Otherwise SBO:0000247
(Simple chemical).

Reactions (default → override → pseudoreaction override):

SBO:0000176 (Metabolic reaction) default.
Single-reactant reactions become:
    SBO:0000627 (exchange) if the lone metabolite is extracellular
        (compartment 'e' or compartment name containing
        'extracellular'),
    SBO:0000632 (sink) if coef < 0,
    SBO:0000628 (demand) otherwise.
Transport reactions (detected by opts.transportDetector or the
    default heuristic: same metName in ≥ 2 compartments in a single
    reaction) → SBO:0000655.
Reactions whose name matches opts.biomassRxnName → SBO:0000629.
Reactions whose name matches opts.ngamRxnName → SBO:0000630.
Reactions whose name contains any of opts.pseudoreactionSubstrings
    → SBO:0000395.

editMiriam#

function model=editMiriam(model,type,object,miriamName,miriams,keep)

Change MIRIAM annotation fields, one type at a time.

Parameters

model : struct

model structure.

type : char

'met', 'rxn', 'gene' or 'comp' dependent on which objects the annotations should be assigned to.

object : cell or logical or double or char

either a cell array of IDs, a logical vector with the same number of elements as the type (see above) in the model, a vector of indexes, or 'all'.

miriamName : char

string specifying the namespace of the identifier, for instance 'bigg.metabolite'. Should be a valid prefix from identifiers.org (e.g. https://registry.identifiers.org/registry/bigg.metabolite).

miriams : char or cell

string or cell array of strings with annotation identifiers, e.g. '12dgr161'.

keep : char

one of the following strings, specifying what should be done if an object already has existing MIRIAM annotations with the same miriamName:

  • 'replace' : discard all existing annotations, all will be overwritten, even if the new annotation is an empty field. Should only be used if you do not want to keep any of the old annotation with the same miriamName.

  • 'fill' : only add annotations to those objects that did not yet have an annotation with that miriamName. Otherwise, the existing annotation is kept, even if it is different from the suggested new annotation.

  • 'add' : keep all existing annotations, and add any new annotations, after removing duplicates.

  • 'remove' : remove all annotations with the given miriamName from the specified objects. The miriams argument is ignored.

Returns

model : struct

model structure with updated MIRIAM annotation field.

Examples

model = editMiriam(model, type, object, miriamName, miriams, keep);

extractMiriam#

function [miriams,extractedMiriamNames]=extractMiriam(modelMiriams,varargin)

Unpack MIRIAM annotations into a human-readable table.

Unpacks metMiriams, rxnMiriams, geneMiriams or compMiriams into a human-readable cell array, formatted as in Excel, with the columns split so each miriam name gets its own column.

Parameters

modelMiriams : cell

a miriam structure (e.g. model.metMiriams) for one or multiple metabolites.

Name-Value Arguments

miriamNames : cell or char

cell array with miriam names to be extracted (default 'all', meaning that annotation for all miriam names found in modelMiriams will be extracted).

Returns

miriams : cell

a cell array with extracted miriams. If several miriam names are requested, the corresponding information is saved in different columns. If there are several ids available for the same entity (metabolite, gene, reaction or compartment), they are concatenated into one column. The total number of columns represents the number of unique miriam names per entity.

extractedMiriamNames : cell

cell array with extracted miriam names.

Examples

[miriams, extractedMiriamNames] = extractMiriam(modelMiriams, miriamNames);

loadDeltaGCSV#

function model = loadDeltaGCSV(model, varargin)

Load metDeltaG and rxnDeltaG from CSV files.

Each CSV is a two-column table: identifier, deltaG. On load, rows whose identifier is not in the model are silently skipped, and every matched value is stored exactly as it appears in the CSV -- including yeast-GEM's own "no measurement" placeholder (10000000.0). Callers that need to treat a particular value as absent should filter it themselves after loading; this function does not interpret CSV values. Pass '' for either metCsv or rxnCsv to skip that side.

Parameters

model : struct

RAVEN model struct.

Name-Value Arguments

metCsv : char

Path to the metabolite deltaG CSV, or '' to skip.

rxnCsv : char

Path to the reaction deltaG CSV, or '' to skip.

Returns

model : struct

Updated model struct.

Examples

model = loadDeltaGCSV(model, 'data/met_dG.csv', 'data/rxn_dG.csv');
model = loadDeltaGCSV(model, 'metCsv', 'data/met_dG.csv');

saveDeltaGCSV#

function saveDeltaGCSV(model, varargin)

Save metDeltaG and rxnDeltaG to CSV files.

Writes a two-column table (identifier, deltaG) per side, one row per entity, in model order. An entity with no value stored is written as NaN, unchanged from whatever the model field holds -- this function does not interpret or substitute values. Pass '' for either metCsv or rxnCsv to skip that side.

Parameters

model : struct

RAVEN model struct.

Name-Value Arguments

metCsv : char

Path to write the metabolite deltaG CSV to, or '' to skip.

rxnCsv : char

Path to write the reaction deltaG CSV to, or '' to skip.

verbose : logical

Print a confirmation line per file written (default false).

Examples

saveDeltaGCSV(model, 'data/met_dG.csv', 'data/rxn_dG.csv');
saveDeltaGCSV(model, 'metCsv', 'data/met_dG.csv', 'verbose', true);