Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/KarrLab/wc_kb_gen

  • Loading branch information
balazs1987 committed Sep 17, 2018
2 parents 96b0cb1 + c6e70e7 commit 2c5832ad5884284827d6f043ccae6a7e62af2c32
Showing with 28 additions and 18 deletions.
  1. +3 −3 docs/requirements.txt
  2. +14 −10 tests/random/test_kb_gen_metabolites.py
  3. +11 −5 wc_kb_gen/random/metabolites.py
@@ -1,6 +1,6 @@
robpol86_sphinxcontrib_googleanalytics
sphinx >= 1.7
sphinx >= 1.8
sphinx_rtd_theme
sphinxcontrib_addmetahtml
git+https://github.com/KarrLab/sphinxcontrib-addmetahtml.git#egg=sphinxcontrib_addmetahtml-0.1.1 >= 0.1.1
sphinxcontrib_bibtex
git+https://github.com/KarrLab/sphinxcontrib-googleanalytics.git#egg=sphinxcontrib_googleanalytics-0.1.1 >= 0.1.1
sphinxcontrib_spelling
@@ -54,16 +54,20 @@ def test_run(self):
})
gen.run()

h2o = cell.species_types.get_one(
__type=wc_kb.core.MetaboliteSpeciesType, id='h2o')
self.assertEqual(h2o.get_empirical_formula(),
wc_utils.util.chem.EmpiricalFormula('H2O'))
h2o = cell.species_types.get_one(__type=wc_kb.core.MetaboliteSpeciesType, id='h2o')
self.assertEqual(h2o.get_empirical_formula(), wc_utils.util.chem.EmpiricalFormula('H2O'))
self.assertEqual(h2o.get_charge(), 0)
self.assertEqual(h2o.concentration, 55.)

h = cell.species_types.get_one(
__type=wc_kb.core.MetaboliteSpeciesType, id='h')
self.assertEqual(h.get_empirical_formula(),
wc_utils.util.chem.EmpiricalFormula('H'))
self.assertEqual(cell.concentrations.get_one(
__type=wc_kb.core.Concentration, value=55.).species.species_type, h2o)
self.assertEqual(cell.concentrations.get_one(
__type=wc_kb.core.Concentration, value=55.).species.compartment.name, 'cytosol')

h = cell.species_types.get_one(__type=wc_kb.core.MetaboliteSpeciesType, id='h')
self.assertEqual(h.get_empirical_formula(), wc_utils.util.chem.EmpiricalFormula('H'))
self.assertEqual(h.get_charge(), 1)
self.assertEqual(h.concentration, 1e-6)

self.assertEqual(cell.concentrations.get_one(
__type=wc_kb.core.Concentration, value=1e-6).species.species_type, h)
self.assertEqual(cell.concentrations.get_one(
__type=wc_kb.core.Concentration, value=1e-6).species.compartment.name, 'cytosol')
@@ -45,8 +45,14 @@ def gen_components(self):

# generate metabolites
for met in self.data:
cell.species_types.get_or_create(
__type=wc_kb.MetaboliteSpeciesType,
id=met['Id'], name=met['Name'],
structure=met['Structure (InChI)'],
concentration=met['Intracellular concentration (M)'])
met_species_type = cell.species_types.get_or_create(
__type=wc_kb.core.MetaboliteSpeciesType,
id=met['Id'], name=met['Name'],
structure=met['Structure (InChI)'])
met_species = wc_kb.core.Species(
species_type=met_species_type,
compartment=cell.compartments.get_or_create(
__type=wc_kb.core.Compartment, id='c', name='cytosol'))
cell.concentrations.get_or_create(
species=met_species,
value=met['Intracellular concentration (M)'])

0 comments on commit 2c5832a

Please sign in to comment.
You can’t perform that action at this time.