Annotation#
MATLAB functions in RAVEN/src/annotation of the RAVEN toolbox.
Functions#
Function |
Summary |
|---|---|
Assign SBO terms to metabolites and reactions. |
|
Change MIRIAM annotation fields, one type at a time. |
|
Unpack MIRIAM annotations into a table. |
|
Load metDeltaG and rxnDeltaG from CSV files. |
|
Save metDeltaG and rxnDeltaG to CSV files. |
Reference#
assignSBOterms#
function model = assignSBOterms(model, varargin)
Assign SBO terms to metabolites and reactions.
Assigns SBO terms to metabolites and reactions following a generic rule set that opts parameterises. The function is the MATLAB counterpart of yeast-GEM's addSBOterms.
SBO is written via editMiriam(..., 'fill'), which preserves pre-existing SBO annotations. The terms are stored in model.metMiriams and model.rxnMiriams under the namespace 'sbo' (there is no separate SBO field); they can be read with extractMiriam(model.rxnMiriams, 'sbo'). exportModel writes them as the SBML sboTerm attribute.
Parameters
model: structa model structure.
Name-Value Arguments
opts: structstructure with any of the following fields. Missing or empty 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. If true, the biomass, NGAM and pseudoreaction terms are applied only to the last reaction of the model. This reproduces yeast-GEM's addSBOterms.m, which applies the pseudoreaction rule to the last reaction only, because of a typo in the loop header (for i=numel(...)).
transportRxnIdxs : indexes of the transport reactions (default: the reactions identified by getTransportRxns).
Returns
model: structmodel structure with the SBO terms added to model.metMiriams and model.rxnMiriams.
Examples
model = assignSBOterms(model);
model = assignSBOterms(model, struct('onlyLastReactionForPseudo', true));
Notes
Metabolites:
SBO:0000649 (Biomass) when the metabolite 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 'extracellular'),
SBO:0000632 (sink) if coef < 0,
SBO:0000628 (demand) otherwise.
Transport reactions (opts.transportRxnIdxs or, by default, the
reactions identified by getTransportRxns: the same metabolite
name more than once 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: structa model structure.
type: char'met', 'rxn', 'gene' or 'comp', the type of object that the annotations are assigned to.
object: cell or logical or double or chareither a cell array of IDs, a logical vector with the same number of elements as objects of that type in the model, a vector of indexes, or 'all'.
miriamName: charstring specifying the namespace of the identifier, for instance 'bigg.metabolite'. A valid prefix from identifiers.org is expected (for example https://registry.identifiers.org/registry/bigg.metabolite).
miriams: char or cellstring or cell array of strings with annotation identifiers, for example '12dgr161'.
keep: charone 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 with the same miriamName; they are overwritten, even if the new annotation is an empty field.
'fill' : add annotations only to those objects that have no annotation with that miriamName. Otherwise, the existing annotation is kept, even if it differs from the 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: structmodel 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 table.
Unpacks metMiriams, rxnMiriams, geneMiriams or compMiriams into a cell array with one column per miriam name.
Parameters
modelMiriams: cella miriam structure (for example model.metMiriams) for one or more metabolites, reactions, genes or compartments.
Name-Value Arguments
miriamNames: cell or charcell array with miriam names to be extracted (default 'all', which extracts the annotation for all miriam names found in modelMiriams).
Returns
miriams: cella cell array with extracted miriams, with one row per entity and one column per extracted miriam name. If several ids are available for the same entity (metabolite, gene, reaction or compartment) and miriam name, they are concatenated into one cell, separated by '; '.
extractedMiriamNames: cellcell 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 skipped without a message, and every matched value is stored as it appears in the CSV, including yeast-GEM's "no measurement" placeholder (10000000.0). The function does not interpret CSV values, so a value that is to be treated as absent has to be filtered after loading. An empty string ('') for metCsv or rxnCsv skips that side.
Parameters
model: structa model structure.
Name-Value Arguments
metCsv: charpath to the metabolite deltaG CSV, or '' to skip (default '').
rxnCsv: charpath to the reaction deltaG CSV, or '' to skip (default '').
Returns
model: structmodel structure. The metDeltaG field is set only if metCsv is given and the rxnDeltaG field only if rxnCsv is given.
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) for metabolites and one for reactions, one row per entity, in model order. Values are written as the model field holds them, so an entity with no value stored is written as NaN. A file is skipped when its path is '' or when the model lacks the corresponding field.
Parameters
model: structRAVEN model struct.
Name-Value Arguments
metCsv: charPath to write the metabolite deltaG CSV to, or '' to skip.
rxnCsv: charPath to write the reaction deltaG CSV to, or '' to skip.
verbose: logicalPrint 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);