Skip to content

Annotation

MATLAB functions in RAVEN/annotation of the RAVEN toolbox. Help text is collected from the source of the tracked branch.

Functions

Function Summary
assignSBOterms Assign SBO terms to metabolites and reactions.
deltaGCSV Load or save metDeltaG and rxnDeltaG via CSV files.
editMiriam Change MIRIAM annotation fields, one type at a time.
extractMiriam Unpack MIRIAM annotations into a human-readable table.

Reference

assignSBOterms

Assign SBO terms to metabolites and reactions.

Assign SBO terms to metabolites and reactions following a generic rule set. Mirrors raven_python.annotation.add_sbo_terms; organism-agnostic, parameterised entirely by opts. The yeast-GEM port of this function is the legacy addSBOterms.m, which becomes a thin shim here.

SBO is written via editMiriam(..., 'fill') so pre-existing SBO annotations are preserved.

Input arguments:

Name Type Description Default
model struct

RAVEN model struct.

required

Name-value arguments:

Name Type Description Default
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.

Output arguments:

Name Type Description
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.

deltaGCSV

Load or save metDeltaG and rxnDeltaG via CSV files.

Consolidates loadDeltaGfromCSV and saveDeltaGtoCSV into a single function. Mirrors raven_python.annotation.load_delta_g_csv /save_delta_g_csv.

Each CSV is a two-column table: identifier, deltaG. On load, rows whose identifier is not in the model are silently skipped. Pass '' for either metCsv or rxnCsv to skip that side.

Input arguments:

Name Type Description Default
model struct

RAVEN model struct.

required
direction char

'load' to populate model fields from CSV; 'save' to write them out.

required

Name-value arguments:

Name Type Description Default
metCsv char

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

rxnCsv char

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

verbose logical

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

Output arguments:

Name Type Description
model struct

Updated model struct (unchanged for save direction).

Examples:

model = deltaGCSV(model, 'load', 'data/met_dG.csv', 'data/rxn_dG.csv');
deltaGCSV(model, 'save', 'data/met_dG.csv', 'data/rxn_dG.csv');

editMiriam

Change MIRIAM annotation fields, one type at a time.

Input arguments:

Name Type Description Default
model struct

model structure.

required
type char

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

required
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'.

required
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).

required
miriams char or cell

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

required
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.
required

Output arguments:

Name Type Description
model struct

model structure with updated MIRIAM annotation field.

Examples:

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

extractMiriam

Unpack MIRIAM annotations into a human-readable table.

This function unpacks the information kept in metMiriams, rxnMiriams, geneMiriams or compMiriams to make the annotation more human-readable. The obtained cell array looks the same as in Excel format, just the columns are split to have a particular miriam name in the corresponding column.

Input arguments:

Name Type Description Default
modelMiriams cell

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

required

Name-value arguments:

Name Type Description Default
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).

Output arguments:

Name Type Description
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);