Metadata-Version: 2.4
Name: straindesign
Version: 1.19.1
Summary: Computational strain design package for the COBRApy framework
Author-email: Philipp Schneider <zgddtgt@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/klamt-lab/straindesign
Project-URL: Documentation, https://straindesign.readthedocs.io/en/latest/index.html
Project-URL: Source, https://github.com/klamt-lab/straindesign/
Project-URL: Bug Reports, https://github.com/klamt-lab/straindesign/issues
Keywords: metabolism,constraint-based,mixed-integer,strain design
Classifier: Intended Audience :: Science/Research
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cobra
Requires-Dist: scipy
Requires-Dist: matplotlib
Requires-Dist: psutil
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: optlang
Requires-Dist: swiglpk
Requires-Dist: pyscipopt
Dynamic: license-file

<a href="https://straindesign.readthedocs.io/en/latest/"><img src="https://raw.githubusercontent.com/klamt-lab/straindesign/host_gifs/docs/logo.svg" align="right" width="50" alt="StrainDesign logo"></a>

# StrainDesign

[![Current Release](https://img.shields.io/github/v/release/klamt-lab/straindesign.svg)](https://github.com/klamt-lab/straindesign/releases)
[![Current PyPI Version](https://img.shields.io/pypi/v/straindesign.svg)](https://pypi.org/project/straindesign/)
[![Current Anaconda Version](https://anaconda.org/cnapy/straindesign/badges/version.svg)](https://anaconda.org/cnapy/straindesign/)
[![Documentation Status](https://readthedocs.org/projects/straindesign/badge/?version=latest)](https://readthedocs.org/projects/straindesign/builds/)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/straindesign.svg)](https://pypi.org/project/straindesign/)
[![CI-test Status](https://github.com/klamt-lab/straindesign/workflows/CI-test/badge.svg)](https://github.com/klamt-lab/straindesign/actions/workflows/CI-test.yml)
[![License](https://img.shields.io/pypi/l/straindesign.svg)](https://github.com/klamt-lab/straindesign/blob/main/LICENSE)
[![Code style: YAPF](https://img.shields.io/badge/code%20style-yapf-blue)](https://github.com/google/yapf)

## A COBRApy<a href="#ref1"><sup>[1]</sup></a>-based package for computational design of metabolic networks

The comprehensive StrainDesign package for MILP-based strain design computation with the COBRApy toolbox supports MCS, MCS with nested optimization, OptKnock<a href="#ref2"><sup>[2]</sup></a>, RobustKnock<a href="#ref3"><sup>[3]</sup></a> and OptCouple<a href="#ref4"><sup>[4]</sup></a>, GPR-rule integration, gene and reaction knockouts and additions as well as regulatory interventions. The automatic lossless network and GPR compression allows strain design computations from genome-scale metabolic networks. Supported solvers are GLPK (available from COBRApy), CPLEX, Gurobi and SCIP<a href="#ref5"><sup>[5]</sup></a>.

To get started, check out the [StrainDesign documentation](https://straindesign.readthedocs.io/en/latest/). Guides and examples are provided as [Jupyter notebooks at docs/source/examples](https://github.com/klamt-lab/straindesign/tree/main/docs/source/examples).

<p>
  <img src="https://raw.githubusercontent.com/klamt-lab/straindesign/host_gifs/docs/puzzle.svg" width="200" alt="Network interventions">
  <img src="https://raw.githubusercontent.com/klamt-lab/straindesign/host_gifs/docs/network.svg" width="200" alt="Network">
  <img src="https://raw.githubusercontent.com/klamt-lab/straindesign/host_gifs/docs/plot.gif" width="340" alt="Flux-space animation">
</p>

The compression routine follows the approach of efmtool's compression function ([csb.ethz.ch/tools/software/efmtool.html](https://csb.ethz.ch/tools/software/efmtool.html)<a href="#ref6"><sup>[6]</sup></a>), reimplemented in pure Python with exact rational arithmetic.

## Installation

The StrainDesign package is available on pip and Anaconda. To install the latest release, run:

```bash
pip install straindesign
```

or

```bash
conda install -c cnapy straindesign
```

The StrainDesign package installation and operability is tested regularly in the most recent Windows, Ubuntu and Mac-OS distributions through continuous integration testing. Currently, these tests fail in Mac-OS due to conflicts within the cobrapy package in Mac-OS. If a workable cobrapy version is installed under Mac-OS, StrainDesign should work as well.

### Developer Installation

Download the repository and run

```bash
pip install -e .
```

in the main folder. Through the installation with `-e`, updates from a `git pull` are at once available in your Python environment without the need for a reinstallation.

## Install additional solvers

The cobra package is shipped with the GLPK solver. The more powerful commercial solvers IBM CPLEX and Gurobi may be used by cobra and the straindesign package. This makes sense in particular when using strain design algorithms like MCS, OptKnock etc. As another alternative solver, SCIP may be used. In the following, you will find installation instructions for the individual solvers.

### CPLEX

Together with Gurobi, CPLEX is the perfect choice for computing strain designs. Its stability and support of advanced features like indicator constraints and populating solution pools make it indispensible for genome-scale computations.

You will need an academic or commercial licence for CPLEX. Download and install the CPLEX suite and make sure that your CPLEX and Python versions are compatible. This step will not yet install CPLEX in your Python environment. Once the installation is completed, you may link your installation to your Python/conda environment. This is the next step.

Using the command line, navigate to your CPLEX installation path and into the Python folder. The path should look similar to `C:/Program Files/CPLEX210/python`. Make sure to activate the same Python/conda environment where `cobra` and `straindesign` are installed. Then call

```bash
python setup.py install
```

Now CPLEX should be available for your computations.

The official instructions can be found [here](https://www.ibm.com/docs/en/icos/22.1.2?topic=cplex-setting-up-python-api).

### Gurobi

Similar to CPLEX, Gurobi offers a fast MILP solver with the advanced features of indicator constraints and solution pooling. The installation steps are similar to the ones of CPLEX.

First, you will need an academic or commercial license and install the Gurobi solver software. Ensure that the versions of gurobi and Python are compatible, install Gurobi to your system and activate your license following the steps from the Gurobi manual. In the next step you will link your Gurobi installation to your Python/conda environment.

Using the command line, navigate to your Gurobi installation path and into the Python folder. The path should look similar to `C:/gurobi950/windows64`. Make sure to activate the same Python/conda environment where `cobra` and `straindesign` are installed. Then call

```bash
python setup.py install
```

If your `gurobipy` package does not work right away, additionally install the gurobi package from conda or PyPI via

```bash
conda install -c gurobi gurobi
```

or

```bash
python -m pip install gurobipy
```

Now Gurobi should be available for your computations.

The official instructions can be found [here](https://support.gurobi.com/hc/en-us/articles/360044290292-How-do-I-install-Gurobi-for-Python-).

### SCIP

Less powerful than CPLEX and Gurobi, the open source solver SCIP still offers the solution of MILPs with indicator constraints, which gives it an edge above GLPK in terms of stability. If you want to use SCIP, you may install it via conda or pip:

```bash
conda install -c conda-forge pyscipopt
```

or

```bash
python -m pip install pyscipopt
```

> [!WARNING]
> If you encounter program crashes with SCIP (a dependency of pyscipopt), make sure you use a version different from 8.0.1. You can, for instance, manually install version 8.0.0 through `conda install -c conda-forge scip=8.0.0`. Version 9.1.0 has been tested with StrainDesign successfully.

Official website: [github.com/scipopt/PySCIPOpt](https://github.com/scipopt/PySCIPOpt)

## CNApy integration

[![CNApy repository](https://img.shields.io/github/v/release/cnapy-org/cnapy.svg)](https://github.com/cnapy-org/cnapy)

CNApy, a GUI-featured toolbox for metabolic modeling, offers a graphical user interface for the modeling and design of metabolic networks. The software provides a dialog box for specifying strain design problems.

<img src="https://raw.githubusercontent.com/klamt-lab/straindesign/host_gifs/docs/snapshot.png" width="354" alt="CNApy screenshot">

## How to cite

<a id="ref0"></a>Schneider P., Bekiaris P. S., von Kamp A., Klamt S. — [StrainDesign: a comprehensive Python package for computational design of metabolic networks. Bioinformatics, btac632 (2022)](https://doi.org/10.1093/bioinformatics/btac632)

## References

<a id="ref1"></a>[1] Ebrahim, A., Lerman, J.A., Palsson, B.O. et al. — [COBRApy: COnstraints-Based Reconstruction and Analysis for Python. BMC Syst Biol 7, 74 (2013)](http://dx.doi.org/doi:10.1186/1752-0509-7-74)

<a id="ref2"></a>[2] Burgard, A. P., Pharkya, P., & Maranas, C. D. — [OptKnock: a bilevel programming framework for identifying gene knockout strategies for microbial strain optimization. Biotechnology and Bioengineering, 84(6), 647–657 (2003)](https://doi.org/10.1002/bit.10803)

<a id="ref3"></a>[3] Tepper N., Shlomi T. — [Predicting metabolic engineering knockout strategies for chemical production: accounting for competing pathways. Bioinformatics, Volume 26, Issue 4, Pages 536–543 (2010)](https://doi.org/10.1093/bioinformatics/btp704)

<a id="ref4"></a>[4] Jensen K., Broeken V., Lærke Hansen A.S., et al. — [OptCouple: Joint simulation of gene knockouts, insertions and medium modifications for prediction of growth-coupled strain designs. Metabolic Engineering Communications, Volume 8 (2019)](https://doi.org/10.1016/j.mec.2019.e00087)

<a id="ref5"></a>[5] Bestuzheva K., Besançon M., Chen W.K. et al. — [The SCIP Optimization Suite 8.0. Available at Optimization Online and as ZIB-Report 21-41 (2021)](https://doi.org/10.48550/arXiv.2112.08872)

<a id="ref6"></a>[6] Marco Terzer, Jörg Stelling — [Large-scale computation of elementary flux modes with bit pattern trees. Bioinformatics, Volume 24, Issue 19 (2008), Pages 2229–2235](https://doi.org/10.1093/bioinformatics/btn401)
