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 human-readable 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.
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: structRAVEN model struct.
Name-Value Arguments
opts: structStruct 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: structModified 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: structmodel 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 chareither 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: charstring 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 cellstring or cell array of strings with annotation identifiers, e.g. '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, 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: 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 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: cella miriam structure (e.g. model.metMiriams) for one or multiple metabolites.
Name-Value Arguments
miriamNames: cell or charcell array with miriam names to be extracted (default 'all', meaning that annotation for all miriam names found in modelMiriams will be extracted).
Returns
miriams: cella 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: 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 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: structRAVEN model struct.
Name-Value Arguments
metCsv: charPath to the metabolite deltaG CSV, or '' to skip.
rxnCsv: charPath to the reaction deltaG CSV, or '' to skip.
Returns
model: structUpdated 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: 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);