In [1]:
import cobra
from cobra.test import create_test_model

In [5]:
model = create_test_model('textbook')

In [6]:
model.summary()


IN FLUXES        OUT FLUXES    OBJECTIVES
---------------  ------------  ----------------------
o2_e      21.8   h2o_e  29.2   Biomass_Ecol...  0.874
glc__D_e  10     co2_e  22.8
nh4_e      4.77  h_e    17.5
pi_e       3.21

In [8]:
from pyefm import calculate_elementary_vectors

In [9]:
efvs = calculate_elementary_vectors(model, verbose=True)


2018-11-15  10:29:08.639  main                     INFO     | =====================================================
2018-11-15  10:29:08.641  main                     INFO     | efmtool version 4.7.1, 2009-12-04 18:30:05
2018-11-15  10:29:08.641  main                     INFO     | Copyright (c) 2009, Marco Terzer, Zurich, Switzerland
2018-11-15  10:29:08.641  main                     INFO     | This is free software, !!! NO WARRANTY !!!
2018-11-15  10:29:08.641  main                     INFO     | See LICENCE.txt for redistribution conditions
2018-11-15  10:29:08.641  main                     INFO     | =====================================================
2018-11-15  10:29:08.929  main    efm.impl         INFO     | Elemetary flux mode computation
2018-11-15  10:29:08.929  main    efm.impl         INFO     | Implementation:
2018-11-15  10:29:08.929  main    efm.impl         INFO     | ..algorithm name   : SequentialDoubleDescriptionImpl
2018-11-15  10:29:08.929  main    efm.impl         INFO     | ..model type       : NullspaceEfmModel
2018-11-15  10:29:08.929  main    efm.impl         INFO     | ..memory type      : InCoreMemory
2018-11-15  10:29:08.929  main    efm.impl         INFO     | ..output type      : RandomAccessFile
2018-11-15  10:29:08.929  main    efm.impl         INFO     | System:
2018-11-15  10:29:13.976  main    efm.impl         INFO     | ..hostname         : pstjohn-28056s.local
2018-11-15  10:29:13.976  main    efm.impl         INFO     | ..operating system : x86_64/Mac OS X/10.12.6
2018-11-15  10:29:13.976  main    efm.impl         INFO     | ..processors       : 4
2018-11-15  10:29:13.977  main    efm.impl         INFO     | ..vm               : Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/25.144-b01
2018-11-15  10:29:13.977  main    efm.impl         INFO     | ..vm-spec          : Oracle Corporation/Java Virtual Machine Specification/1.8
2018-11-15  10:29:13.978  main    efm.impl         INFO     | ..vm arguments     : []
2018-11-15  10:29:13.979  main    efm.impl         INFO     | ..memory, commited : 257M
2018-11-15  10:29:13.979  main    efm.impl         INFO     | ..memory, used     : 18M
2018-11-15  10:29:13.980  main    efm.impl         INFO     | Config:
2018-11-15  10:29:13.980  main    efm.impl         INFO     | ..generator        : Efm
2018-11-15  10:29:13.980  main    efm.impl         INFO     | ..adj method       : pattern-tree-minzero
2018-11-15  10:29:13.980  main    efm.impl         INFO     | ..row ordering     : MostZerosOrAbsLexMin
2018-11-15  10:29:13.980  main    efm.impl         INFO     | ..arithmetic       : double (prec: -1 / zero: 1.0E-10)
2018-11-15  10:29:13.981  main    efm.impl         INFO     | ..compression      : on
2018-11-15  10:29:13.981  main    efm.impl         INFO     | ..compr. methods   : [CoupledZero, CoupledContradicting, CoupledCombine, UniqueFlows, DeadEnd, Recursive]
2018-11-15  10:29:13.981  main    efm.impl         INFO     | ..normalize        : max
2018-11-15  10:29:13.981  main    efm.impl         INFO     | ..max threads      : 4
2018-11-15  10:29:13.981  main    efm.impl         INFO     | ..self test        : off
2018-11-15  10:29:13.981  main    efm.impl         INFO     | ..progress type    : None
2018-11-15  10:29:13.981  main    efm.impl         INFO     | ..progress part.   : 100
2018-11-15  10:29:13.981  main    efm.impl         INFO     | ..suppress         : []
2018-11-15  10:29:13.982  main    efm.impl         INFO     | ..enforce          : []
2018-11-15  10:29:13.982  main    efm.impl         INFO     | ..nosplit          : []
2018-11-15  10:29:13.982  main    efm.impl         INFO     | ..temp dir         : /Users/pstjohn/Dropbox/nrel_research/pyefm/test/./efmtool_tmp4p5vmyvm/???
2018-11-15  10:29:13.982  main    efm.impl         INFO     | ..flag             : (none)
2018-11-15  10:29:13.982  main    efm.impl         INFO     | Distributed Config:
2018-11-15  10:29:13.982  main    efm.impl         INFO     | ..node count       : 2
2018-11-15  10:29:13.983  main    efm.impl         INFO     | ..nodes            : [localhost, localhost]
2018-11-15  10:29:13.983  main    efm.impl         INFO     | ..vmargs           : [-Xmx800M, -Xmx500M]
2018-11-15  10:29:13.983  main    efm.impl         INFO     | ..command          : /usr/bin/java [vmargs] -cp [classpath] [class] [args]
2018-11-15  10:29:13.983  main    efm.impl         INFO     | ..partition        : 256
2018-11-15  10:29:13.983  main    efm.impl         INFO     | ..cand. threshold  : 100000
2018-11-15  10:29:13.992  main    efm.impl         INFO     | original network: 74 metabolites, 98 reactions (46 reversible)
2018-11-15  10:29:14.235  main    efm.impl         INFO     | compressed network: 34 metabolites, 53 reactions (17 reversible)
2018-11-15  10:29:14.402  main    efm.impl         INFO     | stoich expanded has dimensions 34x70
2018-11-15  10:29:14.403  main    efm.impl         INFO     | kernel matrix has dimensions 70x42
2018-11-15  10:29:14.403  main    efm.impl         INFO     | TIME preprocessing: 5510ms
2018-11-15  10:29:14.424  main    efm.impl         INFO     | iteration 0/28: 42 modes, dt=0ms.	{ next 1/28: 0 adj candidates, [+/0/-] = [3/39/0] }
2018-11-15  10:29:14.429  main    efm.impl         INFO     | iteration 1/28: 42 modes, dt=4ms.	{ next 2/28: 2 adj candidates, [+/0/-] = [2/39/1] }
2018-11-15  10:29:14.486  main    efm.impl         INFO     | iteration 2/28: 43 modes, dt=56ms.	{ next 3/28: 2 adj candidates, [+/0/-] = [2/40/1] }
2018-11-15  10:29:14.501  main    efm.impl         INFO     | iteration 3/28: 44 modes, dt=15ms.	{ next 4/28: 2 adj candidates, [+/0/-] = [2/41/1] }
2018-11-15  10:29:14.525  main    efm.impl         INFO     | iteration 4/28: 45 modes, dt=17ms.	{ next 5/28: 3 adj candidates, [+/0/-] = [3/41/1] }
2018-11-15  10:29:14.545  main    efm.impl         INFO     | iteration 5/28: 47 modes, dt=18ms.	{ next 6/28: 6 adj candidates, [+/0/-] = [2/42/3] }
2018-11-15  10:29:14.576  main    efm.impl         INFO     | iteration 6/28: 49 modes, dt=31ms.	{ next 7/28: 8 adj candidates, [+/0/-] = [1/40/8] }
2018-11-15  10:29:14.603  main    efm.impl         INFO     | iteration 7/28: 48 modes, dt=27ms.	{ next 8/28: 11 adj candidates, [+/0/-] = [11/36/1] }
2018-11-15  10:29:14.632  main    efm.impl         INFO     | iteration 8/28: 58 modes, dt=29ms.	{ next 9/28: 20 adj candidates, [+/0/-] = [10/46/2] }
2018-11-15  10:29:14.662  main    efm.impl         INFO     | iteration 9/28: 67 modes, dt=30ms.	{ next 10/28: 36 adj candidates, [+/0/-] = [18/47/2] }
2018-11-15  10:29:14.670  main    efm.impl         INFO     | iteration 10/28: 75 modes, dt=8ms.	{ next 11/28: 187 adj candidates, [+/0/-] = [17/47/11] }
2018-11-15  10:29:14.679  main    efm.impl         INFO     | iteration 11/28: 91 modes, dt=9ms.	{ next 12/28: 43 adj candidates, [+/0/-] = [1/47/43] }
2018-11-15  10:29:14.687  main    efm.impl         INFO     | iteration 12/28: 91 modes, dt=8ms.	{ next 13/28: 384 adj candidates, [+/0/-] = [12/47/32] }
2018-11-15  10:29:14.696  main    efm.impl         INFO     | iteration 13/28: 107 modes, dt=8ms.	{ next 14/28: 930 adj candidates, [+/0/-] = [30/46/31] }
2018-11-15  10:29:14.780  main    efm.impl         INFO     | iteration 14/28: 132 modes, dt=80ms.	{ next 15/28: 1800 adj candidates, [+/0/-] = [45/47/40] }
2018-11-15  10:29:14.812  main    efm.impl         INFO     | iteration 15/28: 152 modes, dt=26ms.	{ next 16/28: 5 adj candidates, [+/0/-] = [5/146/1] }
2018-11-15  10:29:14.820  main    efm.impl         INFO     | iteration 16/28: 155 modes, dt=5ms.	{ next 17/28: 1111 adj candidates, [+/0/-] = [101/43/11] }
2018-11-15  10:29:14.843  main    efm.impl         INFO     | iteration 17/28: 575 modes, dt=22ms.	{ next 18/28: 1599 adj candidates, [+/0/-] = [3/39/533] }
2018-11-15  10:29:14.866  main    efm.impl         INFO     | iteration 18/28: 1641 modes, dt=23ms.	{ next 19/28: 289120 adj candidates, [+/0/-] = [208/43/1390] }
2018-11-15  10:29:14.967  main    efm.impl         INFO     | iteration 19/28: 4941 modes, dt=100ms.	{ next 20/28: 2595498 adj candidates, [+/0/-] = [606/52/4283] }
2018-11-15  10:29:15.198  main    efm.impl         INFO     | iteration 20/28: 7444 modes, dt=231ms.	{ next 21/28: 13588557 adj candidates, [+/0/-] = [3831/66/3547] }
2018-11-15  10:29:15.577  main    efm.impl         INFO     | iteration 21/28: 11142 modes, dt=379ms.	{ next 22/28: 11194876 adj candidates, [+/0/-] = [1463/2027/7652] }
2018-11-15  10:29:15.678  main    efm.impl         INFO     | iteration 22/28: 11515 modes, dt=101ms.	{ next 23/28: 4584475 adj candidates, [+/0/-] = [7973/2967/575] }
2018-11-15  10:29:15.739  main    efm.impl         INFO     | iteration 23/28: 12051 modes, dt=61ms.	{ next 24/28: 28708456 adj candidates, [+/0/-] = [3304/58/8689] }
2018-11-15  10:29:16.148  main    efm.impl         INFO     | iteration 24/28: 40905 modes, dt=407ms.	{ next 25/28: 78491025 adj candidates, [+/0/-] = [38761/119/2025] }
2018-11-15  10:29:18.017  main    efm.impl         INFO     | iteration 25/28: 53543 modes, dt=1869ms.	{ next 26/28: 907341 adj candidates, [+/0/-] = [17/153/53373] }
2018-11-15  10:29:18.265  main    efm.impl         INFO     | iteration 26/28: 6836 modes, dt=248ms.	{ next 27/28: 7791432 adj candidates, [+/0/-] = [1452/18/5366] }
2018-11-15  10:29:18.694  main    efm.impl         INFO     | iteration 27/28: 44614 modes, dt=424ms.	{ next 28/28: 272993530 adj candidates, [+/0/-] = [35873/1131/7610] }
2018-11-15  10:29:20.972  main    efm.impl         INFO     | iteration 28/28: 95124 modes, dt=2276ms.
2018-11-15  10:29:20.972  main    efm.impl         INFO     | TIME iterate: 6555ms
2018-11-15  10:29:20.975  main    efm.impl         INFO     | efm count before postprocessing: 95124
2018-11-15  10:29:21.083  main    efm.impl         INFO     | efm count after filtering/consolidation: 95107
2018-11-15  10:29:21.088  main    efm.impl         INFO     | uncompressing modes (can take a while)
2018-11-15  10:31:57.987  main    efm.impl         INFO     | TIME postprocessing: 157008ms
2018-11-15  10:31:57.987  main    efm.impl         INFO     | overall computation time: 169094ms

In [11]:
efvs.head()


Out[11]:
ACALD ACALDt ACKr ACONTa ACONTb ACt2r ADK1 AKGDH AKGt2r ALCD2x ATPM ATPS4r Biomass_Ecoli_core CO2t CS CYTBD D_LACt2 ENO ETOHt2r EX_ac_e EX_acald_e EX_akg_e EX_co2_e EX_etoh_e EX_for_e EX_fru_e EX_fum_e EX_glc__D_e EX_gln__L_e EX_glu__L_e EX_h_e EX_h2o_e EX_lac__D_e EX_mal__L_e EX_nh4_e EX_o2_e EX_pi_e EX_pyr_e EX_succ_e FBA FBP FORt2 FORti FRD7 FRUpts2 FUM FUMt2_2 G6PDH2r GAPD GLCpts GLNS GLNabc GLUDy GLUN GLUSy GLUt2r GND H2Ot ICDHyr ICL LDH_D MALS MALt2_2 MDH ME1 ME2 NADH16 NADTRHD NH4t O2t PDH PFK PFL PGI PGK PGL PGM PIt2r PPC PPCK PPS PTAr PYK PYRt2 RPE RPI SUCCt2_2 SUCCt3 SUCDi SUCOAS TALA THD2 TKT1 TKT2 TPI
UEV1 0.0 0.0 0.0 0.000000 0.000000 0.0 0.0 0.000000 0.0 0.0 0.00 0.000000 0.0 0.000000 0.000000 0.000000 0.0 0.000000 0.0 0.0 0.0 0.0 0.000000 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.000000 0.000000 0.0 0.0 0.0 0.000000 0.0 0.0 0.0 0.000000 0.0 0.000000 0.000000 1.0 0.0 0.000000 0.0 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.000000 0.000000 0.0 0.0 0.0 0.0 0.000000 0.0 0.0 0.000000 0.000000 0.0 0.000000 0.000000 0.000000 0.000000 0.0 0.000000 0.0 0.000000 0.0 0.0 0.0 0.0 0.0 0.000000 0.0 0.000000 0.000000 0.0 0.0 1.000000 0.000000 0.000000 0.0 0.000000 0.000000 0.000000
BEV1 0.0 0.0 0.0 20.000000 20.000000 0.0 0.0 20.000000 0.0 0.0 8.39 -31.610000 0.0 -60.000000 20.000000 120.000000 0.0 20.000000 0.0 0.0 0.0 0.0 60.000000 0.0 0.000000 0.0 0.0 -10.0 0.0 0.0 0.000000 60.000000 0.0 0.0 0.0 -60.000000 0.0 0.0 0.0 10.000000 0.0 666.440000 666.440000 0.0 0.0 20.000000 0.0 0.0 20.000000 10.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -60.000000 20.000000 0.0 0.0 0.0 0.0 20.000000 0.0 0.0 100.000000 20.000000 0.0 60.000000 20.000000 10.000000 0.000000 10.0 -20.000000 0.0 -20.000000 0.0 0.0 0.0 0.0 0.0 10.000000 0.0 0.000000 0.000000 0.0 0.0 20.000000 -20.000000 0.000000 0.0 0.000000 0.000000 10.000000
BEV2 0.0 0.0 0.0 16.666667 16.666667 0.0 0.0 16.666667 0.0 0.0 8.39 -24.943333 0.0 -60.000000 16.666667 120.000000 0.0 16.666667 0.0 0.0 0.0 0.0 60.000000 0.0 0.000000 0.0 0.0 -10.0 0.0 0.0 0.000000 60.000000 0.0 0.0 0.0 -60.000000 0.0 0.0 0.0 6.666667 0.0 649.773333 649.773333 0.0 0.0 16.666667 0.0 10.0 16.666667 10.0 0.0 0.0 0.0 0.0 0.0 0.0 10.0 -60.000000 16.666667 0.0 0.0 0.0 0.0 16.666667 0.0 0.0 103.333333 36.666667 0.0 60.000000 16.666667 6.666667 0.000000 0.0 -16.666667 10.0 -16.666667 0.0 0.0 0.0 0.0 0.0 6.666667 0.0 6.666667 -3.333333 0.0 0.0 16.666667 -16.666667 3.333333 0.0 3.333333 3.333333 6.666667
BEV3 0.0 0.0 0.0 20.000000 20.000000 0.0 0.0 20.000000 0.0 0.0 8.39 -31.610000 0.0 -40.000000 20.000000 100.000000 0.0 20.000000 0.0 0.0 0.0 0.0 40.000000 0.0 20.000000 0.0 0.0 -10.0 0.0 0.0 20.000000 40.000000 0.0 0.0 0.0 -50.000000 0.0 0.0 0.0 10.000000 0.0 546.440000 566.440000 0.0 0.0 20.000000 0.0 0.0 20.000000 10.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -40.000000 20.000000 0.0 0.0 0.0 0.0 20.000000 0.0 0.0 80.000000 20.000000 0.0 50.000000 0.000000 10.000000 20.000000 10.0 -20.000000 0.0 -20.000000 0.0 0.0 0.0 0.0 0.0 10.000000 0.0 0.000000 0.000000 0.0 0.0 20.000000 -20.000000 0.000000 0.0 0.000000 0.000000 10.000000
BEV4 0.0 0.0 0.0 16.666667 16.666667 0.0 0.0 16.666667 0.0 0.0 8.39 -24.943333 0.0 -43.333333 16.666667 103.333333 0.0 16.666667 0.0 0.0 0.0 0.0 43.333333 0.0 16.666667 0.0 0.0 -10.0 0.0 0.0 16.666667 43.333333 0.0 0.0 0.0 -51.666667 0.0 0.0 0.0 6.666667 0.0 549.773333 566.440000 0.0 0.0 16.666667 0.0 10.0 16.666667 10.0 0.0 0.0 0.0 0.0 0.0 0.0 10.0 -43.333333 16.666667 0.0 0.0 0.0 0.0 16.666667 0.0 0.0 86.666667 36.666667 0.0 51.666667 0.000000 6.666667 16.666667 0.0 -16.666667 10.0 -16.666667 0.0 0.0 0.0 0.0 0.0 6.666667 0.0 6.666667 -3.333333 0.0 0.0 16.666667 -16.666667 3.333333 0.0 3.333333 3.333333 6.666667

In [12]:
import matplotlib.pyplot as plt
%matplotlib inline

In [17]:
plt.plot(efvs.EX_glc__D_e, efvs.Biomass_Ecoli_core, '.')
plt.xlabel('Glucose Uptake Rate')
plt.ylabel('Growth Rate')


Out[17]:
Text(0,0.5,'Growth Rate')