3. Thermodynamic Databases¶
3.1. Converting a Matlab thermodynamic database¶
If you have a Matlab thermodynamic database, you can easily convert it to a
Python database thanks to the script thermoDBconverter.py
:
python thermoDBconverter.py database.mat converted_database.thermodb
3.2. Loading a thermodynamic database¶
Thermodynamic databases are compressed through zlib
and binary-encoded
with pickle
. In order to load them, you need first to uncompress them
with zlib.decompress
then load the result into memory with
pickle.loads
:
import pickle
import zlib
with open('thermoDatabases/DB_AlbertyUpdate.thermodb', 'rb') as file:
ReactionDB = pickle.loads(zlib.decompress(file.read()))
Warning
Since the file is compressed, you MUST load it as a binary file by
calling open
with the b
flag, otherwise Python will try to
decode it as unicode and raise an exception !
3.3. Structure of a thermodynamic database¶
A thermodynamic database is a dict
with the following fields:
name
:string
The name of the database
units
:string
The unit of the energies in the database. Can bekcal/mol
orkJ/mol
.
metabolites
:dict
A dictionnary containing the metabolites’ thermodynamic data. See Metabolites for more information.
cues
:dict
A dictionnary containing the cues’ thermodynamic data. See Cues for more information.
3.3.1. Metabolites¶
This is a dictionnary storing various thermodynamic data about metabolites. It
is stored as a dict
where each key is a SeedID
. The values are
others dict
with the following keys.
id |
|
charge_std |
|
deltaGf_std |
|
deltaGf_err |
|
mass_std |
|
nH_std |
|
error |
|
formula |
|
nH_std |
|
name |
|
other_names |
|
pKa |
|
struct_cues |
The keys of the array are the names of the cues, and the values the number of cues of this type that are part of the structure. |
Here is an example:
ReactionDB['metabolites']['cpd00001'] = {
'charge_std': 0,
'deltaGf_err': 0.5,
'deltaGf_std': -56.686999999999998,
'error': 'Nil',
'formula': 'H2O',
'id': 'cpd00001',
'mass_std': 18.0,
'nH_std': 2,
'name': 'H2O',
'other_names': ['H2O', 'Water', 'HO-', 'OH-', 'h2o'],
'pKa': [15.7],
'struct_cues': {'H2O': 1}
}
3.3.2. Cues¶
This is a dictionnary storing various thermodynamic data about cues. It
is stored as a dict
where each key is the cue ID, as referrenced
in the struct_cues
attribute of Metabolites. The values are
others dict
with the following keys.
id |
|
charge |
|
datfile |
|
energy |
|
error |
|
formula |
|
names |
|
small |
|
Here is an example:
ReactionDB['cues']['H2O'] = {
'charge': 0,
'datfile': 'H2O.gds',
'energy': -56.686999999999998,
'error': 0.5,
'formula': 'H2O',
'id': 'H2O',
'names': ['H2O', 'OH-', 'HO-'],
'small': True
}