#!/usr/bin/env python #This script regenerates pickles of cobra Models. Should be #performed after updating core classes to prevent subtle bugs. from cPickle import load, dump from cobra import Model from cobra.version import get_version from cobra.io import read_sbml_model, read_legacy_sbml from cobra.test import create_test_model model_names = ['salmonella', 'iJO1366', 'Yersinia_pestis_CO92_iPC815'] for model_name in model_names: model_pickle = model_name + '.pickle' old_model = create_test_model(model_pickle) if model_name == "iJO1366": new_model = read_legacy_sbml(model_name + '.xml') else: new_model = read_sbml_model(model_name + '.xml') [setattr(x, 'name', old_model.genes.get_by_id(x.id).name) for x in new_model.genes] if hasattr(old_model, 'media_compositions'): new_model.media_compositions = old_model.media_compositions new_model._cobra_version = get_version() dump(new_model, open(model_pickle, 'w'))
from os.path import isfile from cobra import Model from cobra.version import get_version from cobra.io import read_sbml_model, read_legacy_sbml from cobra.test import create_test_model model_names = ['salmonella', 'iJO1366', 'Yersinia_pestis_CO92_iPC815'] for model_name in model_names: # read in old pickle and model from sbml model_pickle = model_name + '.pickle' if model_name == "iJO1366": new_model = read_legacy_sbml(model_name + '.xml') else: new_model = read_sbml_model(model_name + '.xml') # update other attributes if isfile(model_name + ".genes"): with open(model_name + ".genes") as infile: gene_names = load(infile) for gene in new_model.genes: gene.name = gene_names[gene.id] if isfile(model_name + ".media"): with open(model_name + ".media", "rb") as infile: new_model.media_compositions = load(infile) new_model._cobra_version = get_version() # write out new pickle with open(model_pickle, 'wb') as outfile: dump(new_model, outfile, protocol=2)
# The master toctree document. master_doc = 'index' # General information about the project. project = u'cobra' copyright = u'2016, Daniel Robert Hyduke and Ali Ebrahim' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. from cobra.version import get_version, read_release_version version = read_release_version() # The full version, including alpha/beta/rc tags. release = get_version() # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build', 'version.py', '.ipynb_checkpoints'] pygments_style = 'sphinx' # -- Options for HTML output -------------------------------------------------- mathjax_path = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' # -- Options for LaTeX output -------------------------------------------------- latex_elements = {
# The master toctree document. master_doc = 'index' # General information about the project. project = u'cobra' copyright = u'2015, Daniel Robert Hyduke and Ali Ebrahim' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. from cobra.version import get_version, read_release_version version = read_release_version() # The full version, including alpha/beta/rc tags. release = get_version() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build', 'version.py']
import ez_setup ez_setup.use_setuptools() from setuptools import setup, find_packages from cobra.version import get_version __version = get_version() setup( name = "cobra", version = __version, packages = find_packages(exclude=['cobra.oven', 'cobra.oven*']), #scripts = [''], #put in numpy, scipy, libsbml, and pyglpk setup_requires = [], #install_requires = ['numpy>=1.6', 'scipy>=0.10'], #leave blank because it tries to build scipy/numpy on os x when they are #installed by the superpack. And these are not really essential for core functions. install_requires = [], extras_require = { 'parallel': ['pp>=1.6.0'], 'matlab': ["mlabwrap>=1.1"], 'R': ["rpy2>=2.2.2"] }, package_data = { '': ['test/data/*', 'examples/*py', 'mlab/matlab_scripts/*m']}, author = "Daniel Robert Hyduke", author_email = "*****@*****.**", description = "COBRApy is a package for constraints-based modeling of biological networks",
try: import setuptools except ImportError: import ez_setup ez_setup.use_setuptools() from setuptools import setup, find_packages from sys import argv import warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") from cobra.version import get_version __version = get_version(pep440=True) setup_kwargs = {} # for running parallel tests due to a bug in python 2.7.3 # http://bugs.python.org/issue15881#msg170215 try: import multiprocessing except: None # cython is optional for building. The c file can be used directly. However, # to run sdist, the c file must be generated, which requires cython. try: from Cython.Build import cythonize except ImportError: cythonize = None if "sdist" in argv: raise Exception("cython required for sdist")
import ez_setup ez_setup.use_setuptools() from setuptools import setup, find_packages from cobra.version import get_version __version = get_version() setup_kwargs = {} try: from Cython.Build import cythonize from distutils.extension import Extension from distutils.command.build_ext import build_ext from os.path import isfile, abspath, dirname from platform import system class FailBuild(build_ext): """allow building of the C extension to fail""" def run(self): try: build_ext.run(self) except: None def build_extension(self, ext): try: build_ext.build_extension(self, ext) except: None sources = ["cobra/solvers/cglpk.pyx"] build_args = {}