Skip to content

Commit

Permalink
Merge pull request #91 from aebrahim/v0.3_dev
Browse files Browse the repository at this point in the history
0.3.0b1
  • Loading branch information
aebrahim committed Jun 4, 2014
2 parents f1c050c + caf1517 commit 5f8d5e1
Show file tree
Hide file tree
Showing 87 changed files with 79,973 additions and 4,418 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ gurobi.log
documentation
cobra.egg-info
build/
dist/
.DS_Store
setuptools-*egg
setuptools-*.tar.gz
cobra/solvers/cglpk.c
cobra/solvers/cglpk.so
cobra/solvers/cglpk*so
glpk.h
libglpk.a
.idea/
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/cobrapy.iml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/dictionaries/danie.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/encodings.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/misc.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/modules.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/other.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/scopes/scope_settings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/testrunner.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/vcs.xml

This file was deleted.

17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
language: python
#python:
# - "2.6"
# - "2.7"
python:
- "2.7"
- "3.3"
- "3.4"
# command to install dependencies
virtualenv:
system_site_packages: true
before_install:
- sudo apt-get install libglpk-dev python-scipy libgmp-dev
- sudo apt-get install libglpk-dev libgmp-dev
- export PIP_OPTS="-f https://pypi.drosophi.la --no-index"
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then pip install glpk $PIP_OPTS; fi
- pip install python-libsbml-experimental cython numpy scipy $PIP_OPTS
install:
- ln -s /usr/lib/python2.7/dist-packages/scipy ~/virtualenv/python2.7/lib/python2.7/site-packages/
- pip install http://clostridium.ucsd.edu/python_libsbml_experimental-5.9.2-cp27-none-linux_x86_64.whl
- pip install glpk cython
- python setup.py develop
# # command to run tests
script: python setup.py test
173 changes: 44 additions & 129 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,168 +1,83 @@
Installation instructions for Python and Jython are detailed below. The
Python instructions will be approrpriate for most users. For installation
help, please use the [Google Group](http://groups.google.com/group/cobra-pie).
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/)

--------------------------------------------------------------------------------

# Python
All releases require Python 2.7 to be installed before proceeding.
All releases require Python 2.7 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](http://www.python.org/download/releases/2.7.6/).

Generally, installation should follow these steps:
Python 3 support is still considered experimental.

1. Install cobrapy (either the stable, development, or hacking version).
2. Install an appropriate solver
3. Install optional dependencies
4. Test your installation
#Installation of cobrapy

## Stable version installation
On Mac OS X or GNU/Linux, first [install pip]
(http://pip.readthedocs.org/en/latest/installing.html).
Afterwards, run this command in a terminal:

## Stable version installation in Python
On Mac OS X or GNU/Linux, use easy_install (or pip if you have it) by running
the following command in a terminal.

sudo easy_install cobra
sudo pip install cobra

For Windows, download and install the appropriate 32 bit or 64 bit installer,
both of which can be downloaded from the [python package
index](https://pypi.python.org/pypi/cobra/).

## Development version installation in Python
Use easy_install (or pip if you have it)

sudo easy_install https://github.com/opencobra/cobrapy/archive/master.zip
## Hacking version installation
Use pip to install [Cython](http://cython.org/). Install libglpk using your
package manger. This would be ```brew install glpk``` on a Mac and
```sudo apt-get install libglpk-dev``` on debian-based systems (including
Ubuntu and Mint). This can also be installed by compiling GLPK from source.

## Hacking version installation in Python
First, clone the git repository using your preferred mothod. Cloning from your
Clone the git repository using your preferred mothod. Cloning from your
own [github fork](https://help.github.com/articles/fork-a-repo) is recommended!
Afterwards, open a terminal, enter the cobrapy repository and run the following command:
Afterwards, open a terminal, enter the cobrapy repository and run the following
command:

python setup.py develop --user

If the command fails with an error about the --user option not being recognized,
it means setuptools is not installed. Either install setuptools before
trying again, or instead run ```sudo python setup.py develop```
# 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, from binary installers, or from package managers.

1. [libsbml](http://sbml.org) >= 5.10 to read/write SBML files
* [Windows installer](http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsbml)
* Use ```sudo pip install python-libsbml-experimental``` on Mac/Linux
2. [numpy](http://numpy.org) >= 1.6.1 for double_deletion_analysis
* [Windows installer](http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)
3. [scipy](http://scipy.org) >= 0.11 for ArrayBasedModel and saving to *.mat files.
* [Windows 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 cobrapy supports these linear
programming solvers:

* ILOG/CPLEX
[Academic](https://www.ibm.com/developerworks/university/academicinitiative/)
[Commercial](http://www.ibm.com/software/integration/optimization/cplex-optimizer/)
* [gurobi](http://gurobi.com)
* GLPK through [pyGLPK](http://tfinley.net/software/pyglpk/)

## Installation of a Solver in Python
Currently cobrapy supports three linear programming solvers: ILOG/CPLEX,
Gurobi, and GLPK (through [pyGLPK](http://tfinley.net/software/pyglpk/)).
ILOG/CPLEX and Gurobi are commercial software packages that, currently,
provide free licenses for academics and support both linear and quadratic
programming. GLPK is an opensource linear programming solver; however, it
does not support quadratic programming and is not as robust as the
commercial solvers when it comes to mixed-integer linear programming.

### Installation of a commercial solver in Python
See the linked instructions for each solver
* [ILOG/CPLEX Academic](https://www.ibm.com/developerworks/university/academicinitiative/)
* [ILOG/CPLEX Commercial](http://www.ibm.com/software/integration/optimization/cplex-optimizer/)
* [Gurobi Academic & Commercial](http://gurobi.com)

### Installation of pyGLPK in Python
Please note that pyGLPK is not the same as python-glpk.

#### GNU/Linux Installation of pyGLPK in Python
1. Install the glpk and gmp library packages. You will need the development
versions if they are available. You will also need development headers for
Python itself. For example, Ubuntu and Debian Wheezy (7.0) users would type the following into the
command line:
```
sudo apt-get install libglpk-dev libgmp-dev python-dev python-setuptools
```
Debian Squeeze (6.0) users will need to build libgmp from source.

2. install pyglpk with easy_install using the following command in the terminal:
```
sudo easy_install glpk
```

#### MAC OS X Installation of pyGLPK in Python
1. Install homebrew if you don't have it. This may require downloading Xcode
from the AppStore and Command Line Tools for XCode from
https://developer.apple.com/devcenter/mac/index.action. If you're already
using macports then just use that to install glpk.
```
brew install glpk
```

2. install pyglpk with easy_install using the following command in the terminal:
```
sudo easy_install glpk
```

#### Windows Installation of pyGLPK in Python
Download and install the executable from [here](https://sourceforge.net/projects/opencobra/files/python/cobra/extras/pyGLPK/).

## Installation of Optional Dependencies
Installation instructions are not provided for these libraries. However,
many of them can be easily built on GNU/Linux with easy_install. On windows,
many can downloaded from [this site](http://www.lfd.uci.edu/~gohlke/pythonlibs/).

1. [libsbml](http://sbml.org) >= 4.0 to read/write SBML files
* [Windows installer](http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsbml)
2. [numpy](http://numpy.org) >= 1.6.1 and [scipy](http://scipy.org) >= 0.11 for
ArrayBasedModel, double_deletion analysis, and saving to MAT formats.
* Windows installers for
[numpy](http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) and
[scipy](http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy)
3. [Parallel Python](http://parallelpython.org) for parallel processing.
4. [MATLAB](http://mathworks.com) and
[mlabwrap](http://mlabwrap.sourceforge.net) for connecting to the COBRA
Toolbox for MATLAB.
* Installation is tricky on most platforms.



## Testing your installation
# Testing your installation
1. Start python
2. Type the following into the Python shell

```python
from cobra.test import test_all
test_all()
```

--------------------------------------------------------------------------------


#INSTALLATION - Jython
All releases require Jython (2.5+). JSBML (http://sbml.org) is required for reading / writing SBML files.
NOTE: ArrayBasedModel, double_deletion analysis, saving to MAT formats, parallel processing, and connecting to the
COBRA Toolbox for MATLAB are currently unavailable when using Jython.

I. Releases - Hosted on http://opencobra.sourceforge.net
A. Download the most recent bzipped archive.
B. Unzip the archive and make sure that the toplevel directory is in your Java CLASSPATH.
C. Install a linear programming solver (Section III).

II. Development Code - Hosted on github
NOTE: Not intended for general users. Some functions require advanced capabilities / settings. Unless you're
willing to deal with headaches and heartaches it's better to install one of the releases.
1. git pull https://github.com/opencobra/cobrapy.git
2. Add the cobrapy directory to your Java CLASSPATH.
3. Install a linear programming solver (Section III).

III. Installation of linear programming solvers
On Jython, cobrapy currently supports two linear programming solvers: ILOG/CPLEX and Gurobi.

A. ILOG/CPLEX and Gurobi are commercial software packages that, currently, provide free licenses for academics and
support both linear and quadratic programming.
1. Please download the software from their respective sites, install according to their instructions, and make
sure that their Java jars are in your Java CLASSPATH.
2. Current links are listed below. If they don't work then search using google.
* [ILOG/CPLEX Academic](https://www.ibm.com/developerworks/university/academicinitiative/)
* [ILOG/CPLEX Commercial](http://www.ibm.com/software/integration/optimization/cplex-optimizer/)
* [Gurobi Academic & Commercial](http://gurobi.com)

B. GLPK: We are exploring the possibility of using GLPK through [GLPK for Java](http://glpk-java.sourceforge.net);
however, we've encountered irregular memory errors that we'll need to trace before listing it as a supported solver.
Advanced users may try http://glpk-java.sourceforge.net at their own risk.

IV. Test your installation.
A. Start Jython
B. Enter: from cobra.test import test_all
C. Enter: test_all()
17 changes: 0 additions & 17 deletions TODO

This file was deleted.

2 changes: 1 addition & 1 deletion cobra/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0.dev
0.3.0b1
35 changes: 15 additions & 20 deletions cobra/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import sys
from version import get_version
# set the warning format to be on a single line
import warnings as _warnings
def _warn_format(message, category, filename, lineno, file=None, line=None):
return "%s:%s %s: %s\n" % (filename, lineno, category.__name__, message)
_warnings.formatwarning = _warn_format

from .version import get_version
__version__ = get_version()
from os import name as __name
from core import Object, Formula, Metabolite, Gene, Reaction, Model, DictList, Species
if __name == 'java':
#raise Exception("Experimental modules of numpy/scipy for java that are" +\
#"not yet ready for prime time.")
#import oven.danielhyduke.jython.numpy as numpy
#import oven.danielhyduke.jython.scipy as scipy
from warnings import warn
warn("COBRA for Python is not optimized for JAVA. If it's slow or crashes consider increasing JVM memory")
else:
try:
from core import ArrayBasedModel
except Exception, e:
from warnings import warn
warn("cobra.ArrayBasedModel class is unavailable: %s"%repr(e))
from .core import Object, Formula, Metabolite, Gene, Reaction, Model, DictList, Species
from . import io, flux_analysis

try:
from .core import ArrayBasedModel
except ImportError:
None

del __name, get_version
__doc__ = """
"""
del get_version
Loading

0 comments on commit 5f8d5e1

Please sign in to comment.