Commit 30413e7b authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 0.13.3

parent e3e44933
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -8,8 +8,7 @@ Please explain:

#### Code Sample

Create a [minimal, complete, verifiable example
](https://stackoverflow.com/help/mcve).
Create a [minimal, complete, verifiable example](https://stackoverflow.com/help/mcve).

```python
# Paste your code here.
@@ -20,9 +19,13 @@ Create a [minimal, complete, verifiable example

#### Expected Output

#### Output of `cobra.show_versions()`
#### Dependency Information

Please paste the output of `python -c "from cobra import show_versions;
show_versions()"` in the details block below.

<details>
# Paste the output of `import cobra;cobra.show_versions()` here.

[Paste output here.]

</details>
+2 −5
Original line number Diff line number Diff line
@@ -2,8 +2,7 @@ language: python
python: 3.5
sudo: false
cache:
  directories:
    - $HOME/.cache/pip
  pip: true
git:
  depth: 2

@@ -15,8 +14,6 @@ branches:

env:
  global:
    - secure: "hkKBaGLvoDVgktSKR3BmX+mYlGzHw9EO11MRHtiH8D9BbdygOR9p9aSV/OxkaRWhnkSP5/0SXqVgBrvU1g5OsR6cc85UQSpJ5H5jVnLoWelIbTxMCikjxDSkZlseD7ZEWrKZjRo/ZN2qym0HRWpsir3qLpl8W25xHRv/sK7Z6g8="
    - secure: "DflyBz+QiyhlhBxn4wN00xu248EJUMjKTxUZQN6wq22qV55xO3ToGJTy9i4D6OBfZGAlSXxjjKCJ2+0sAjsghBSDEK56ud3EEg/08TIo7/T8ex/C58FsGoGFz3yDBATmquClEWN8vAMrLdxwniHmQVCBZCP/phdt5dct0AUuDc8="
    - GITHUB_REPO=opencobra/cobrapy

matrix:
@@ -80,7 +77,7 @@ deploy:
      repo: $GITHUB_REPO
      python: '3.6'
      condition: $TRAVIS_OS_NAME == "linux"
    user: $PYPI_USERNAME
    user: cobrapy
    password: $PYPI_PASSWORD
  - provider: script
    skip_cleanup: true
+2 −6
Original line number Diff line number Diff line
@@ -8,23 +8,18 @@ environment:

  global:
    PIP_CACHE_DIR: "pip_cache"
    PIP_DISABLE_PIP_VERSION_CHECK: "yes"

  matrix:
    - PYTHON: "C:\\Miniconda-x64"
      CONDA: true

    - PYTHON: "C:\\Miniconda35-x64"
      CONDA: true

    - PYTHON: "C:\\Miniconda36-x64"
      CONDA: true

    - PYTHON: "C:\\Python27-x64"
      TOXENV: py27

    - PYTHON: "C:\\Python35-x64"
      TOXENV: py35

    - PYTHON: "C:\\Python36-x64"
      TOXENV: py36

@@ -46,6 +41,7 @@ install:
  - ps: |
      if ($env:CONDA -eq "true") {
        conda config --set always_yes yes --set changeps1 no;
        conda config --add channels conda-forge
        conda install -q pip setuptools wheel numpy scipy;
        pip install -r develop-requirements.txt;
        pip install .
+112 −0
Original line number Diff line number Diff line
%% Cell type:code id: tags:

``` python
import logging
```

%% Cell type:code id: tags:

``` python
logging.basicConfig(level="DEBUG")
```

%% Cell type:code id: tags:

``` python
from cobra.test import create_test_model
```

%% Output

    DEBUG:optlang.util:Gurobi python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/gurobipy
    DEBUG:optlang.util:GLPK python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/swiglpk
    DEBUG:optlang.util:Mosek python bindings not available.
    DEBUG:optlang.util:CPLEX python bindings found at /home/moritz/.virtualenvs/cobra/lib/python3.5/site-packages/cplex
    DEBUG:optlang.util:Scipy solver not available
    DEBUG:pip._internal.utils.misc:lzma module is not available
    DEBUG:pip._internal.vcs:Registered VCS backend: git
    DEBUG:pip._internal.vcs:Registered VCS backend: hg
    DEBUG:pip._internal.vcs:Registered VCS backend: svn
    DEBUG:pip._internal.vcs:Registered VCS backend: bzr

%% Cell type:code id: tags:

``` python
from cobra.flux_analysis import geometric_fba
```

%% Cell type:code id: tags:

``` python
model = create_test_model("textbook")
```

%% Cell type:code id: tags:

``` python
model.solver = "cplex"
```

%% Cell type:code id: tags:

``` python
logging.getLogger().setLevel(logging.DEBUG)
```

%% Cell type:code id: tags:

``` python
%time geometric_fba(model)
```

%% Output

    DEBUG:cobra.flux_analysis.geometric:Iteration: 1; delta: 4e-13; status: optimal.

    CPU times: user 481 ms, sys: 0 ns, total: 481 ms
    Wall time: 480 ms

    <Solution 0.000 at 0x7f0c62d3f6a0>

%% Cell type:code id: tags:

``` python
model.solver = "gurobi"
```

%% Cell type:code id: tags:

``` python
%time geometric_fba(model)
```

%% Output

    DEBUG:cobra.flux_analysis.geometric:Iteration: 1; delta: 6.47e-12; status: optimal.

    CPU times: user 504 ms, sys: 2.91 ms, total: 507 ms
    Wall time: 505 ms

    <Solution 0.000 at 0x7f0c6288be10>

%% Cell type:code id: tags:

``` python
model.solver = "glpk"
```

%% Cell type:code id: tags:

``` python
%time geometric_fba(model)
```

%% Output

    DEBUG:optlang.glpk_interface:Status undefined. GLPK status code returned by glp_simplex was 1
    DEBUG:cobra.flux_analysis.geometric:Iteration: 1; delta: 2.96e-13; status: optimal.

    CPU times: user 263 ms, sys: 3.46 ms, total: 267 ms
    Wall time: 263 ms

    <Solution -0.000 at 0x7f0c6283d9b0>
+164 −0
Original line number Diff line number Diff line
%% Cell type:code id: tags:

``` python
from cobra.io import read_sbml_model
```

%% Cell type:code id: tags:

``` python
from optlang.symbolics import Zero, One, add, mul, Add, Mul, Real
```

%% Cell type:code id: tags:

``` python
one = Real(1.0)
```

%% Cell type:code id: tags:

``` python
model = read_sbml_model("/home/moritz/Projects/memote/Models/iJO1366.xml.gz")
```

%% Cell type:code id: tags:

``` python
import cobra.util.solver as sutil
```

%% Cell type:code id: tags:

``` python
from itertools import chain
```

%% Cell type:code id: tags:

``` python
model.solver = "glpk"
```

%% Cell type:code id: tags:

``` python
reaction_variables = ((rxn.forward_variable, rxn.reverse_variable)
                      for rxn in model.reactions)
variables = list(chain(*reaction_variables))
```

%% Cell type:code id: tags:

``` python
%%timeit
with model:
    model.objective = model.problem.Objective(
        Zero, direction='min', sloppy=True,
        name="_pfba_objective")
    model.objective.set_linear_coefficients({v: 1.0 for v in variables})
```

%% Output

    146 ms ± 3.94 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

%% Cell type:code id: tags:

``` python
%%timeit
with model:
    model.objective = model.problem.Objective(
        add([mul(one, v) for v in variables]),
        direction='min', sloppy=True, name="_pfba_objective")
```

%% Output

    149 ms ± 2.13 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

%% Cell type:code id: tags:

``` python
model.solver = "gurobi"
```

%% Cell type:code id: tags:

``` python
reaction_variables = ((rxn.forward_variable, rxn.reverse_variable)
                      for rxn in model.reactions)
variables = list(chain(*reaction_variables))
```

%% Cell type:code id: tags:

``` python
%%timeit
with model:
    model.objective = model.problem.Objective(
        Zero, direction='min', sloppy=True,
        name="_pfba_objective")
    model.objective.set_linear_coefficients({v: 1.0 for v in variables})
```

%% Output

    13.7 ms ± 269 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

%% Cell type:code id: tags:

``` python
%%timeit
with model:
    model.objective = model.problem.Objective(
        add([mul(one, v) for v in variables]),
        direction='min', sloppy=True, name="_pfba_objective")
```

%% Output

    218 ms ± 2.55 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

%% Cell type:code id: tags:

``` python
model.solver = "cplex"
```

%% Cell type:code id: tags:

``` python
reaction_variables = ((rxn.forward_variable, rxn.reverse_variable)
                      for rxn in model.reactions)
variables = list(chain(*reaction_variables))
```

%% Cell type:code id: tags:

``` python
%%timeit
with model:
    model.objective = model.problem.Objective(
        Zero, direction='min', sloppy=True,
        name="_pfba_objective")
    model.objective.set_linear_coefficients({v: 1.0 for v in variables})
```

%% Output

    2.04 s ± 32.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

%% Cell type:code id: tags:

``` python
%%timeit
with model:
    model.objective = model.problem.Objective(
        add([mul(one, v) for v in variables]),
        direction='min', sloppy=True, name="_pfba_objective")
```

%% Output

    183 ms ± 5.28 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
Loading