Inchi¶
- addInchiToModel(model, molFileDir, method, printLevel)[source]¶
Assign InChI to the model.inchi structure given a set of mol files for each metabolite
- USAGE:
model = addInchiToModel (model, molFileDir, method, printLevel)
- INPUTS:
model – COBRA model structure with the field:
.mets - m x 1 cell array of metabolite identifiers
molFileDir – path to a directory containing molfiles for the major tautomer of the major microspecies of each metabolite at pH 7, named with the metabolite identifiers in model.mets (without compartment assignments)
- OPTIONAL INPUTS:
method – ‘sdf’ (default) to build InChI via an intermediate SDF, or ‘mol’ to read the molfiles directly
printLevel – verbosity level (default 1)
- OUTPUT:
model – the input model with the additional fields:
.inchi - structure of m x 1 cell arrays of IUPAC InChI strings at varying levels of detail, with subfields .standard, .standardWithStereo, .standardWithStereoAndCharge and .nonstandard
.inchiBool - m x 1 logical, true where an InChI exists
.molBool - m x 1 logical, true where a mol file exists
.compositeInchiBool - m x 1 logical, true where the InChI is composite
Note
When method is ‘sdf’, writes MetStructures.sdf containing all structures passed to the component contribution method for standard Gibbs energy estimation.
- getMolecularWeight(inchis, warnings)[source]¶
Computes molecular weight and elemental matrix of compounds
- USAGE:
[MW, Ematrix] = getMolecularWeight (inchis, warnings)
- INPUT:
inchis – cell array of InChI strings, one per compound
- OPTIONAL INPUT:
warnings – display warnings when a formula cannot be parsed (default true)
- OUTPUTS:
MW – Vector of molecular weights
Ematrix – m x 8 matrix of order [H, C, N, O, P, S, e-] Note that the number of electrons (e-) is counted only for these 6 common elements (i.e. we assume all other elements are not involved in redox reactions anyway).
- inchi2mol(inchis, filenames, outputdir, overwrite)[source]¶
Convert InChI strings to mol files using OpenBabel (compatible with Windows and Unix)
- USAGE:
successbool = inchi2mol (inchis, filenames, outputdir, overwrite)
- INPUT:
inchis – n x 1 cell array of InChI strings (or a single InChI string)
- OPTIONAL INPUTS:
filenames – n x 1 cell array of mol file names without file extension (default {‘1’;’2’;…})
outputdir – directory for the mol files (default <currentDirectory>/molfiles)
overwrite – whether to overwrite existing mol files in outputdir, 0 or 1 (default 0)
- OUTPUT:
successbool – n x 1 logical vector, true at indices of InChI successfully converted to mol files and false elsewhere
- mol2inchi(molFileName, options)[source]¶
Converts metabolite structures in a mol file to an InChI strings with OpenBabel.
An entry can be assigned an InChI identifier if it has an SDF file describing the structure and all of the following conditions hold:
It does not contain an element that is not an atom. This is not common, but SDF files can contain non-atom elements (e.g., an electron or positron) or exotic atoms (e.g., muonium). These elements are not supported by InChI.
It does not contain an unknown or general atom. In addition to a symbol from the periodic table, an SDF file can also contain general elements, often denoted as A, Q, * or R.
It does not contain an R-group. Some atom of the structure may be aliased as an R-group, which indicates an undefined chemical group.
It does not contain an undefined charge. A valid SDF file cannot contain an undefined charge. However, if we convert an mmCIF file containing an undefined charge into an SDF file, the resulting SDF file is excluded.
It does not contain an unknown type of bond. This is not common, but an SDF file can contain an “any” bond, which does not specify the chemical type of the bond.
It is not a polymer with an unknown number of repeating monomers. Some part of the structure can be denoted as a repetitive part, but an InChI identifier cannot be generated if the number of repeats is not known.
https://link.springer.com/article/10.1186/1758-2946-6-15
- USAGE:
[inchi, metAbbr] = mol2inchi (molFileName, options)
- INPUT:
molFileName – MDL mole file name (inc path if not in pwd)
- OPTIONAL INPUTS:
options – Write options for InChI strings. See InChI documentation for details. https://openbabel.org/docs/dev/FileFormats/InChI_format.html If no options are specified the function will output standard InChI.
- OUTPUTS:
inchi – InChI (character array) for metabolites in the SDF file.
annotation – Annotation in first line of molfile Will be empty unless write option t is used (i.e., options >= ‘-xt’).