Skip to main content

COBRApy - Constraint-Based Reconstruction and Analysis in Python

Current PyPI Version Supported Python Versions GNU Lesser General Public License 2 or later Code of Conduct GitHub Actions CI/CD Status Codecov Documentation Status Gitter Chat Room Black Zenodo DOI

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 and can also be downloaded.

Please use the Google Group for help. By writing a well formulated question, with sufficient detail, you are much more likely to quickly receive a good answer! Please refer to these StackOverflow guidelines on how to ask questions. Alternatively, you can use gitter.im for quick questions and discussions about COBRApy (faster response times). Please keep in mind that answers are provided on a volunteer basis.

More information about opencobra is available at the website.

If you use COBRApy in a scientific publication, please cite doi:10.1186/1752-0509-7-74

Installation

Use pip to install COBRApy from PyPI (we recommend doing this inside a virtual environment):

pip install cobra

If you want to load MATLAB models, you will need additional dependencies. Please install:

pip install cobra[array]

For further information, please follow the detailed installation instructions.

Contributing

Contributions are always welcome! Please read the contributing guidelines to get started.

License

The COBRApy source is released under both the GPL and LGPL licenses version 2 or later. You may choose which license you choose to use the software under.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License or the GNU Lesser 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.

Installation of COBRApy

For installation help, please use the Google Group. For usage instructions, please see the documentation.

We only test against Python 3.7+, however, Python 3.4 or higher work mostly. For Windows users and possibly also Mac OS users, we recommend using the Anaconda Python distribution.

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

  1. We highly recommend that you create a Python virtual environment.

  2. Install COBRApy when an environment is active by running pip install cobra in the terminal.

Microsoft Windows

If you heed our recommendation to use Anaconda, you can open an Anaconda shell and install COBRApy from the conda-forge channel.

conda install -c conda-forge cobra

Installation for development

Get the detailed contribution instructions for contributing to COBRApy.

Solvers

COBRApy uses optlang to interface the mathematical solvers used to optimize the created COBRA models. At the time of writing the supported solvers are:

Download files

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

Source Distribution

cobra-0.32.1.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cobra-0.32.1-py2.py3-none-any.whl (1.2 MB view details)

Uploaded Python 2Python 3

File details

Details for the file cobra-0.32.1.tar.gz.

File metadata

  • Download URL: cobra-0.32.1.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cobra-0.32.1.tar.gz
Algorithm Hash digest
SHA256 0efd20239ad820e1da0abf4f61284fe2098119de0b99509d543c2f32ae499b3a
MD5 1bdebd5d84e2f98582343c84db658266
BLAKE2b-256 fbdbd3d521e7ffbef8f62a7c442438b5c4d9ce0611e5f03c603c6545118dda6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cobra-0.32.1.tar.gz:

Publisher: release.yml on opencobra/cobrapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cobra-0.32.1-py2.py3-none-any.whl.

File metadata

  • Download URL: cobra-0.32.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cobra-0.32.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6ebfc29503224371ff5390ce0ce347b738415bd37a2dfb8a9683591c6e5535dc
MD5 d11b01362af8a56e397b64766c0f234c
BLAKE2b-256 c3240f45e6bf6ace0529133752c2295e5643dd579f7f02c416c9563ff922367b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cobra-0.32.1-py2.py3-none-any.whl:

Publisher: release.yml on opencobra/cobrapy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.32.1 This release

2 files

0.32.0

2 files

0.31.1

2 files

0.30.0

2 files

0.29.1

2 files

0.29.0

2 files

0.28.0

2 files

0.27.0

2 files

0.26.3

2 files

0.26.2

2 files

0.26.0

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.22.1

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.0

2 files

0.18.1

2 files

0.17.1

2 files

0.17.0

2 files

0.16.0

2 files

0.15.4

2 files

0.15.3

2 files

0.15.2

2 files

0.15.1

2 files

0.15.0

2 files

0.14.2

2 files

0.14.1

2 files

0.14.0

2 files

0.13.4

2 files

0.13.3

2 files

0.13.2

2 files

0.13.1

2 files

0.13.0

2 files

0.12.1

2 files

0.12.0

2 files

0.11.3

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.1

2 files

0.10.0

2 files

0.9.1

17 files

0.9.0

17 files

0.8.2

17 files

0.8.1

16 files

0.8.0

16 files

0.7.0

16 files

0.6.2

16 files

0.6.1

16 files

0.6.0

16 files

0.5.11

24 files

0.5.10

20 files

0.5.9

17 files

0.5.8

18 files

0.5.7

18 files

0.5.6

18 files

0.5.4

18 files

0.5.3.post3

6 files

0.5.3

12 files

0.5.2

18 files

0.4.1

26 files

0.4.0

16 files

0.3.2

9 files

0.3.1

9 files

0.3.0

8 files

0.2.1

4 files

0.2.0

4 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page