New

checkForMissingStereo(model, trainingModel)[source]

Identify model metabolites whose stereochemistry is missing relative to the training data

Compares standard InChI without stereochemistry against standard InChI with stereochemistry for both the model and the training model, and returns the model metabolite abbreviations that map to a training-data InChI but lack stereochemical detail.

USAGE:

missingStereo = checkForMissingStereo (model, trainingModel)

INPUTS:
  • model – structure with fields:

    • .mets - metabolite abbreviations

    • .inchi.standard - standard InChI without stereochemistry

    • .inchi.standardWithStereo - standard InChI with stereochemistry

  • trainingModel – training-data structure with fields:

    • .inchi.standard - standard InChI without stereochemistry

    • .inchi.standardWithStereo - standard InChI with stereochemistry

OUTPUTS:

missingStereo – cell array of model metabolite abbreviations present in the training data but lacking stereochemistry

createTrainingModel(trainingModel, trainingMolFileDir, forceMolReplacement, printLevel)[source]

Create the training model, or update an existing one with additional data

Loads the base training data when trainingModel is empty, optionally retrieves and replaces MOL files, and augments the structure with InChI strings, metabolite formulae and charges, pseudoisomer/pKa data, reaction abbreviations, flux bounds and standard transformed reaction Gibbs energies.

USAGE:

trainingModel = createTrainingModel (trainingModel, trainingMolFileDir, forceMolReplacement, printLevel)

INPUTS:

trainingModel – training-data structure to create or extend. When empty it is loaded from the bundled training data. Fields used by this function:

  • .cids - KEGG compound identifiers

  • .mets - m x 1 metabolite abbreviations

  • .metKEGGID - m x 1 KEGG identifiers

  • .S - m x n stoichiometric matrix

  • .inchi - structure of InChI strings (standard and nonstandard variants)

  • .inchiBool - m x 1 true where an InChI exists

  • .metFormulas - m x 1 metabolite formulae

  • .metCharges - m x 1 metabolite charges

  • .pseudoisomers - estimated pseudoisomer/pKa data

  • .rxns - n x 1 reaction abbreviations

  • .lb - n x 1 lower flux bounds

  • .ub - n x 1 upper flux bounds

  • .dG0_prime - standard transformed Gibbs energy (renamed to .DrGt0)

  • .DrGt0 - standard transformed reaction Gibbs energy

OPTIONAL INPUTS:
  • trainingMolFileDir – directory of the MOL files (default: the data/mol folder alongside Transform.m)

  • forceMolReplacement – when true, re-retrieve and replace the existing MOL files with newly acquired ones (default: 0)

  • printLevel – verbosity of the console output

OUTPUTS:

trainingModel – the training model structure augmented with the fields listed above

driver_addChemoinfoToTrainingModel[source]

Generate database

driver_createTrainingModel[source]

Cretate a validated training model for thermochemical estimation Author: Ronan Fleming, German Preciat, Leiden University Reviewers: INTRODUCTION

PROCEDURE Configure the environment All the installation instructions are in a separate .md file named vonBertalanffy.md in docs/source/installation

With all dependencies installed correctly, we configure our environment, verfy all dependencies, and add required fields and directories to the matlab path.

getInchies(target_cids, use_cache)[source]

Retrieve InChI strings for a set of KEGG compounds using OpenBabel

Loads cached InChIs when available, otherwise obtains the MOL file for each KEGG compound and converts it to standard, stereo, stereo+charge and nonstandard InChI strings with OpenBabel, caching the result.

USAGE:

inchies = getInchies (target_cids, use_cache)

INPUTS:

target_cids – numeric vector of KEGG compound identifiers to retrieve

OPTIONAL INPUT:

use_cache – logical, when true (default) load previously cached InChIs from disk instead of recomputing them

OUTPUTS:

inchies – structure of InChI strings with fields:

  • .cids - KEGG compound identifiers

  • .std_inchi - standard InChI

  • .std_inchi_stereo - standard InChI with stereochemistry

  • .std_inchi_stereo_charge - standard InChI with stereochemistry and charge

  • .nstd_inchi - nonstandard InChI

getKeggpKas(target_cids, target_inchi, n_pkas)[source]

Estimate pKa values and pseudoisomer data for KEGG compounds using cxcalc

For each KEGG compound, converts its InChI to SMILES with OpenBabel and runs the ChemAxon cxcalc plugin to estimate acidic/basic pKa values, then derives the pseudoisomer charges and proton counts at pH 7.

USAGE:

KeggSpeciespKa = getKeggpKas (target_cids, target_inchi, n_pkas)

INPUTS:
  • target_cids – numeric vector of KEGG compound identifiers

  • target_inchi – cell array of InChI strings, one per compound in target_cids

OPTIONAL INPUT:

n_pkas – maximum number of acidic and basic pKa values to estimate per compound (default: 20)

OUTPUTS:

KeggSpeciespKa – structure array of pseudoisomer data with fields:

  • .pKas - matrix of pKa values between pseudoisomers

  • .majorMSpH7 - logical marking the major microspecies at pH 7

  • .zs - pseudoisomer charges

  • .nHs - pseudoisomer proton counts

  • .cid - KEGG compound identifier

loadTrainingData(param)[source]

Generate the structure that contains all the training data needed for Component Contribution

Reads the TECRDB (NIST), formation-energy and redox-potential data files, assembles a stoichiometric matrix over the union of compounds, and returns a training-data structure. Some problematic TECRDB reactions are removed.

USAGE:

trainingModel = loadTrainingData (param)

OPTIONAL INPUT:

param – structure of parameters. Field used by this function:

  • .formation_weight - relative weight given to the formation energies (Alberty’s data) compared to the reaction measurements (TECRDB); default 1

OUTPUT:

trainingModel – structure with data for Component Contribution:

  • .S - m x n stoichiometric matrix of training data

  • .cids - m x 1 compound ids

  • .dG0_prime - n x 1 standard transformed reaction Gibbs energies

  • .T - n x 1 temperatures

  • .I - n x 1 ionic strengths

  • .pH - n x 1 pH values

  • .pMg - n x 1 pMg values

  • .weights - n x 1 reaction weights

  • .balance - n x 1 true where the reaction is balanced

  • .rxns - n x 1 reaction abbreviations

  • .lb - n x 1 lower bounds

  • .ub - n x 1 upper bounds

  • .cids_that_dont_decompose - k x 1 ids of compounds that do not decompose

prepareTrainingData(model, printLevel, params)[source]

Given a standard COBRA model, add thermodynamic data to it using the Component Contribution method

Loads the training data, retrieves InChIs and pKa values for the training compounds, balances the training reactions, builds the group incidence matrix against the model, and applies the reverse Legendre transform.

USAGE:

training_data = prepareTrainingData (model, printLevel, params)

INPUT:

model – COBRA model structure

OPTIONAL INPUTS:
  • printLevel – verbose level (default: 0)

  • params – structure of parameters. Fields used:

    • .use_cached_kegg_inchis - logical, use cached KEGG InChIs

    • .use_model_pKas_by_default - logical, prefer model pKa data

OUTPUTS:

training_data – training-data structure with thermodynamic data and the group incidence matrix, with fields such as:

  • .S - the stoichiometric matrix of measured reactions

  • .G - the group incidence matrix

  • .dG0 - the observation vector (standard Gibbs energy of reactions)

  • .weights - the weight vector for each reaction in S

  • .Model2TrainingMap - map from model to training-data compounds

reverseTransformTrainingData(trainingModel, use_model_pKas_by_default, model)[source]

Calculate the reverse Legendre transform for all reactions in the training model

Applies the reverse Legendre transform to convert the standard transformed reaction Gibbs energies (.DrGt0) into standard reaction Gibbs energies (.DrG0), using either the model or the training-data pseudoisomer/pKa data.

USAGE:

trainingModel = reverseTransformTrainingData (trainingModel, use_model_pKas_by_default, model)

INPUTS:

trainingModel – training-data structure. Fields used:

  • .S - m x n stoichiometric matrix of training reactions

  • .cids - m x 1 compound ids

  • .I - n x 1 ionic strengths (NaN entries default to 0.25 M)

  • .pMg - n x 1 pMg values (NaN entries default to 14)

  • .T - n x 1 temperatures

  • .pH - n x 1 pH values

  • .kegg_pKa - structure array of KEGG pKa/pseudoisomer data

  • .pseudoisomers - structure array of pseudoisomer data per compound

  • .Model2TrainingMap - map from model to training-data compound indices

  • .DrGt0 - n x 1 standard transformed reaction Gibbs energy

OPTIONAL INPUTS:
  • use_model_pKas_by_default – logical, when true use the model pseudoisomer data in preference to the training data (default: 0)

  • model – COBRA model structure. Field used:

    • .pseudoisomers - structure array of model pseudoisomer data

OUTPUTS:

trainingModel – the training model with an added field:

  • .DrG0 - n x 1 standard reaction Gibbs energy