Skip to main content

COBRApy is a package for constraints-based modeling of biological networks

Project description

cobrapy - constraint-based reconstruction and analysis in python
================================================================

|Build Status| |Coverage Status| |Build status| |PyPI| |Gitter|

What is cobrapy?
~~~~~~~~~~~~~~~~

COBRA methods are widely used for genome-scale modeling of metabolic
networks in both prokaryotes and eukaryotes. **cobrapy** is a
constraint-based modeling package that is designed to accommodate the
biological complexity of the next generation of COBRA models and
provides access to commonly used COBRA methods, such as flux balance
analysis, flux variability analysis, and gene deletion analyses.

Our aim with cobrapy is to provide useful, efficient infrastructure
for:

- creating and managing metabolic models
- accessing popular solvers
- analyzing models with methods such as FVA, FBA, pFBA, MOMA etc.
- inspecting models and drawing conclusions on gene essentiality,
testing consequences of knock-outs etc.

Our goal with cobrapy is for it to be useful on its own, and for it to
be the natural choice of infrastructure for developers that want to
build new COBRA related python packages for e.g. visualization,
strain-design and data driven analysis. By re-using the same classes
and design principles, we can make new methods both easier to
implement and easier to use, thereby bringing the power of COBRA to
more researchers.

The documentation is browseable online at
`readthedocs <https://cobrapy.readthedocs.org/en/stable/>`_ and can
also be
`downloaded <https://readthedocs.org/projects/cobrapy/downloads/>`_.

Please use the `Google
Group <http://groups.google.com/group/cobra-pie>`_ for help.
Alternatively, you can use
`gitter.im <https://gitter.im/opencobra/cobrapy>`_ for quick questions
and discussions about cobrapy (faster response times).

More information about opencobra is available at the
`website <http://opencobra.github.io/>`_.

If you use cobrapy in a scientific publication, please cite
`doi:10.1186/1752-0509-7-74 <http://dx.doi.org/doi:10.1186/1752-0509-7-74>`_

Installation
~~~~~~~~~~~~

Use pip to install cobrapy from
`PyPI <https://pypi.python.org/pypi/cameo>`_ (we recommend doing this
inside a `virtual
environment <http://docs.python-guide.org/en/latest/dev/virtualenvs/>`_)::

pip install cobra

In case you downloaded the source code, run::

pip install -e .

In the ``cobrapy`` directory. For further information, please follow
the `detailed installation instructions <INSTALL.rst>`_.

Contributing
~~~~~~~~~~~~

Contributions are always welcome! Please read the `contributions
guideline <CONTRIBUTING.rst>`_ to get started.

License
-------

The cobrapy source is released under both the GPL and LGPL licenses. You
may choose which license you choose to use the software under. However,
please note that binary packages which include GLPK (such as the binary
wheels distributed at https://pypi.python.org/pypi/cobra) will be bound
by its license as well.

This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License or the Lesser GNU
General Public License as published by the Free Software Foundation,
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.

.. |Build Status| image:: https://travis-ci.org/opencobra/cobrapy.svg?branch=master
:target: https://travis-ci.org/opencobra/cobrapy
.. |Coverage Status| image:: https://codecov.io/github/opencobra/cobrapy/coverage.svg?branch=master
:target: https://codecov.io/github/opencobra/cobrapy
.. |Build status| image:: https://ci.appveyor.com/api/projects/status/2o549lhjyukke8nd/branch/master?svg=true
:target: https://ci.appveyor.com/project/hredestig/cobrapy/branch/master
.. |PyPI| image:: https://img.shields.io/pypi/v/cobra.svg
:target: https://pypi.python.org/pypi/cobra
.. |Gitter| image:: https://badges.gitter.im/opencobra/cobrapy.svg
:target: https://gitter.im/opencobra/cobrapy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge



Installation of cobrapy
=======================

For installation help, please use the `Google
Group <http://groups.google.com/group/cobra-pie>`_. For usage
instructions, please see the
`documentation <https://cobrapy.readthedocs.org/en/latest/>`_.

All releases require Python 2.7+ or 3.4+ to be installed before
proceeding. Mac OS X (10.7+) and Ubuntu ship with Python. Windows users
without python can download and install python from the `python
website <https://www.python.org/ftp/python/2.7.9/python-2.7.9.amd64.msi>`_.
Please note that though Anaconda and other python distributions may work
with cobrapy, they are not explicitly supported (yet!).

Stable version installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~

cobrapy can be installed with any recent installation of pip.
Instructions for several operating systems are below:

Mac OS X or Linux
-----------------

0. `install
pip <http://pip.readthedocs.org/en/latest/installing.html>`_.
1. In a terminal, run ``sudo pip install cobra``

We highly recommend updating ``pip`` beforehand (``pip install pip --upgrade``).

Microsoft Windows
-----------------

The preferred installation method on Windows is also to use pip. The
latest Windows installers for Python 2.7 and 3.4 include pip, so if you
use those you will already have pip.

1. In a terminal, run ``C:\Python27\Scripts\pip.exe install cobra`` (you
may need to adjust the path accordingly).

To install without pip, you will need to download and use the
appropriate installer for your version of python from the `python
package index <https://pypi.python.org/pypi/cobra/>`_.

Installation for development
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Get the `detailed contribution instructions <CONTRIBUTING.rst>`_ for contributing to cobrapy.

Installation of optional dependencies
=====================================

Optional Dependencies
~~~~~~~~~~~~~~~~~~~~~

On windows, these can downloaded from [this site]
(http://www.lfd.uci.edu/~gohlke/pythonlibs/). On Mac/Linux, they can be
installed using pip, or from the OS package manager (e.g brew, apt,
yum).

1. `libsbml <http://sbml.org>`_ >= 5.10 to read/write SBML level 2
files

- `Windows libsbml installer <http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsbml>`_
- Use ``sudo pip install python-libsbml`` on Mac/Linux

2. `lxml <http://lxml.de/>`_ to speed up read/write of SBML level 3 files.
3. `numpy <http://numpy.org>`_ >= 1.6.1 for double deletions

- `Windows numpy installer <http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy>`_
4. `scipy <http://scipy.org>`_ >= 0.11 for ArrayBasedModel and saving to \*.mat files.

- `Windows scipy installer <http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy>`_

Other solvers
~~~~~~~~~~~~~

cobrapy comes with bindings to the GNU Linear Programming Kit ([glpk]
(http://www.gnu.org/software/glpk/)) using its own bindings called
"cglpk" in cobrapy. In addition, cobrapy currently supports these linear
programming solvers:

- ILOG/CPLEX (available with
`Academic <https://www.ibm.com/developerworks/university/academicinitiative/>`_
and
`Commercial <http://www.ibm.com/software/integration/optimization/cplex-optimizer/>`_
licenses).
- `gurobi <http://gurobi.com>`_
- `QSopt\_ex
esolver <http://www.dii.uchile.cl/~daespino/ESolver_doc/main.html>`_
- `MOSEK <http://www.mosek.com/>`_
- `coin-or clp and cbc <http://coin-or.org/>`_ through
`cylp <https://github.com/coin-or/CyLP>`_.

ILOG/CPLEX, MOSEK, and Gurobi are commercial software packages that
currently provide free licenses for academics and support both linear
and quadratic programming. GLPK and clp are open source linear
programming solvers; however, they may not be as robust as the
commercial solvers for mixed-integer and quadratic programming.
QSopt\_ex esolver is also open source, and can solve linear programs
using rational operations, giving exact solutions.

Testing your installation
=========================

While it is not a hard requirement for using cobrapy, you need pytest and
pytest-benchmark to run its tests. First do

.. code:: shell
pip install pytest pytest-benchmark


Then start python and type the following into the Python shell

.. code:: python

from cobra.test import test_all
test_all()

You should see some skipped tests and expected failures, and the
function should return ``True``.


Project details


Release history Release notifications | RSS feed

This version

0.5.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

cobra-0.5.7.win-amd64-py3.5.exe (2.2 MB view details)

Uploaded Source

cobra-0.5.7.win-amd64-py3.4.exe (1.9 MB view details)

Uploaded Source

cobra-0.5.7.win-amd64-py2.7.exe (1.9 MB view details)

Uploaded Source

cobra-0.5.7.win32-py3.5.exe (2.1 MB view details)

Uploaded Source

cobra-0.5.7.win32-py3.4.exe (1.8 MB view details)

Uploaded Source

cobra-0.5.7.win32-py2.7.exe (1.8 MB view details)

Uploaded Source

cobra-0.5.7-cp35-cp35m-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.5m Windows x86-64

cobra-0.5.7-cp35-cp35m-win32.whl (1.6 MB view details)

Uploaded CPython 3.5m Windows x86

cobra-0.5.7-cp35-cp35m-manylinux1_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.5m

cobra-0.5.7-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.5m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

cobra-0.5.7-cp34-cp34m-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.4m Windows x86-64

cobra-0.5.7-cp34-cp34m-win32.whl (1.6 MB view details)

Uploaded CPython 3.4m Windows x86

cobra-0.5.7-cp34-cp34m-manylinux1_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.4m

cobra-0.5.7-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.4m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

cobra-0.5.7-cp27-cp27mu-manylinux1_x86_64.whl (3.0 MB view details)

Uploaded CPython 2.7mu

cobra-0.5.7-cp27-cp27m-win_amd64.whl (1.7 MB view details)

Uploaded CPython 2.7m Windows x86-64

cobra-0.5.7-cp27-cp27m-win32.whl (1.6 MB view details)

Uploaded CPython 2.7m Windows x86

cobra-0.5.7-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (2.6 MB view details)

Uploaded CPython 2.7m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

File details

Details for the file cobra-0.5.7.win-amd64-py3.5.exe.

File metadata

File hashes

Hashes for cobra-0.5.7.win-amd64-py3.5.exe
Algorithm Hash digest
SHA256 2b56d1b3548c986a432a1e2d07e42169b544eb97b9465164a5aa23fa5a54ef7d
MD5 ca111e255a7c88f44151c2aa462f76ab
BLAKE2b-256 4ead2b8850d35e8ca52ab7040ffaa3038252f78796ecc2d6ec9388332619b581

See more details on using hashes here.

File details

Details for the file cobra-0.5.7.win-amd64-py3.4.exe.

File metadata

File hashes

Hashes for cobra-0.5.7.win-amd64-py3.4.exe
Algorithm Hash digest
SHA256 a7a2ded14610d7a1300d13004731b54097ccadb713087ff483f04c94ef16255e
MD5 fbce2c7d51f38b5493ff967e77cf3e5b
BLAKE2b-256 5d2fe53b8ab7c7015ae2c3ea1f3d730b647bf279a060e8388a469f571577e02e

See more details on using hashes here.

File details

Details for the file cobra-0.5.7.win-amd64-py2.7.exe.

File metadata

File hashes

Hashes for cobra-0.5.7.win-amd64-py2.7.exe
Algorithm Hash digest
SHA256 1d0ad29a34932fbe318b58a273f5f5900eb1238d117f2766020138fda2ef2dbf
MD5 a955e46a7cad48d82ab10e99274ae9e5
BLAKE2b-256 f485edf727d689b199e793c9ac02dc9949d2a2ef314ec97679904ca936cc8256

See more details on using hashes here.

File details

Details for the file cobra-0.5.7.win32-py3.5.exe.

File metadata

File hashes

Hashes for cobra-0.5.7.win32-py3.5.exe
Algorithm Hash digest
SHA256 9e45ab26b160842c89d01973efb16130e2f005f73510097230d6ee49bf442b34
MD5 09db828822b0826bb9f32202a5d77e54
BLAKE2b-256 7706ca4f0f8b3971cfc7aa2b995653f28db0d9b5a6153208429e1df31d127bca

See more details on using hashes here.

File details

Details for the file cobra-0.5.7.win32-py3.4.exe.

File metadata

File hashes

Hashes for cobra-0.5.7.win32-py3.4.exe
Algorithm Hash digest
SHA256 cfb2dcd20a2de55d5e8c0456177448b074c3ceaeebcbccd5ea8cfe3c609e1dbf
MD5 99f0b6601837657e97221d737cc1c302
BLAKE2b-256 a2f758e46491ef7e99c425c260198c0bc3327124228739da1bbaae90bb728038

See more details on using hashes here.

File details

Details for the file cobra-0.5.7.win32-py2.7.exe.

File metadata

File hashes

Hashes for cobra-0.5.7.win32-py2.7.exe
Algorithm Hash digest
SHA256 e8e3e0f3b7ba17fcbb5a6064028bf800ff39785e1f5123e589d068d1bca60e3a
MD5 5c5286508fc41919dc26b86f1beb2097
BLAKE2b-256 f565652f79f45f0320e07333589554f7df33be38db223b9962493a1738d5ff17

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 6112bf5a68914b5a14631ece7bf80980b9cf0e3c2f9c58f189cc40790f5520db
MD5 701ad5c753d37a0b59b7db0270a29880
BLAKE2b-256 0d13fc4729aa8faa209f565a0da0775bf2927bd20ce031dc5bc44df9f8655185

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 8610d4faa1dea8ef4a53f0b8aa5bf42d324f424ea99c7a6a1d55b3ac0c72f4a6
MD5 1ce8922899f72746a1058186a8f006fd
BLAKE2b-256 51117a5ee6aa76a159ec9caefa852fe939d4853d102ecfbdb952a5a629fb93da

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b41aa970ba911240540f8db8e80afc63c296bb4ccd2846d97e4aebfa22831432
MD5 e68f1f05c6078f80ac4214087aea11d8
BLAKE2b-256 d1a512969088ce89aa3879991f45ed1179933af219e634f6c1b1d0b6307a4174

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 fc6a83ffc741ad7560ab0654569044e0824c5a1a6a69d1a897039d6c1bb95b96
MD5 cf4e8179d9afb0bb499c04f960ff91f1
BLAKE2b-256 8cdc7650efb338b8811ffac04e488db9de339826ba576e02b47d3d7dd85ba01d

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp34-cp34m-win_amd64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 e1a03cd59a2a263c6330282a4c220549050b4e1b18e5db00ea450976364619d3
MD5 b05d2f075f3182f0c8d6b5bc43372da3
BLAKE2b-256 7ca28513947b218f78409f1b819ca266ae061782a347bf2a56317f867ad2ebf2

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp34-cp34m-win32.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 be81c15b06b5028f16f1536a2ccfee0d57cbccb9ec261651db6702399fcf0419
MD5 4870cb588f1798e98753d74e40a904a5
BLAKE2b-256 1ffe645588792de87f0124399889ee67b294e1e3a09824df0e3e22127b59f950

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 69eba83b99d6282f619c1742b1ca0b7df8be8d14e4f2b6e5861f3b688f118ced
MD5 4231611872a1f27835c86543c564c459
BLAKE2b-256 b9c91aa39a2e00242c85fae14d62ebed9141bc5c164c14409316da3f0e274e30

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 f5b20624175b618ab42f9559584b18c9bb2294c779a4508c07adbeb6b80d6d45
MD5 aeafbd0903ed388ccb3ee9a3f27f9db6
BLAKE2b-256 72f83d0fceea0b0182569ecd29e0ebcce53e6a4fab6017cc3c2e1a783176cb1e

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 56453240d9223c3018d2406d9984066626c2f9ca4cb4de6ab10ff718b1ee2101
MD5 90ea1c9e2c82eb5b091c38be0a5f245d
BLAKE2b-256 1234ac41641784dba68bd4f30cee52ecb3dce058658d922c25171b584063498d

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 492ad352742ac3392ff1e534f1ed38bb1ee0224ead3af936325da1641cbdc0e8
MD5 4fdad7a77189908b545593dfeb7cb6b7
BLAKE2b-256 a857b880bffe2005a9168172214d9692eb5dbee3ef2a0b5e3e90e51007b59ffc

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 0c47ba69102a516ea1c6fff6b91a84d7bd8b8bb59c2120ed80a6fe1227f86d4c
MD5 9dfcc750121bda552810c2ad7b255bbd
BLAKE2b-256 66e99b1308938ce1ff4b21f5c483cd8ef71fc3919727140893389a974e003a5e

See more details on using hashes here.

File details

Details for the file cobra-0.5.7-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for cobra-0.5.7-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 f0ac2970d2f82c0f0bd99b7aa91790a375e73fe50192c52d34ee0c643bfa9e8a
MD5 26865146f37d8e0fa90f3ee65e22f16e
BLAKE2b-256 1ee6a946090f65904eb9892c4c3e9ad629ea92b83fad3c91bf14f5d0dccc3a5c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page