Skip to content

Commit

Permalink
updated version number
Browse files Browse the repository at this point in the history
  • Loading branch information
VonAlphaBisZulu committed Sep 27, 2024
1 parent d22b57f commit 83e3e3c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = '1.12' %}
{% set version = '1.13' %}

package:
name: straindesign
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
author = "Philipp Schneider"

# The full version, including alpha/beta/rc tags
release = "1.12"
release = "1.13"

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="straindesign",
version="1.12",
version="1.13",
url="https://github.com/klamt-lab/straindesign.git",
description="Computational strain design package for the COBRApy framework",
long_description=
Expand Down
5 changes: 3 additions & 2 deletions straindesign/efmtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
_java_executable = ''
except:
_java_executable = ''

if _java_executable == '':
_java_executable = os.path.join(os.environ.get('JAVA_HOME', ''), "bin", "java")
try:
Expand All @@ -73,7 +73,8 @@
_java_executable = ''
if _java_executable == '':
_java_executable = os.path.join(str(jpype.jSystem.getProperty("java.home")), "bin", "java")



def basic_columns_rat(mx, tolerance=0): # mx is ch.javasoft.smx.impl.DefaultBigIntegerRationalMatrix
"""efmtool: Translate matrix coefficients to rational numbers"""
if type(mx) is numpy.ndarray:
Expand Down
10 changes: 5 additions & 5 deletions straindesign/solver_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class MILP_LP(object):
"""

def __init__(self, **kwargs):
allowed_keys = {
allowed_keys = {
'c', 'A_ineq', 'b_ineq', 'A_eq', 'b_eq', 'lb', 'ub', 'vtype', 'indic_constr', 'M', SOLVER, 'skip_checks', 'tlim', SEED
}
# set all keys passed in kwargs
Expand All @@ -115,14 +115,14 @@ def __init__(self, **kwargs):
if key not in kwargs.keys():
setattr(self, key, None)
# Select solver (either by choice or automatically cplex > gurobi > glpk)
if getattr(self,SOLVER) is None:
if getattr(self, SOLVER) is None:
if len(avail_solvers) > 0:
setattr(self,SOLVER,list(avail_solvers)[0])
setattr(self, SOLVER, list(avail_solvers)[0])
else:
raise Exception('No solver available. Please ensure that one of the following '\
'solvers is avaialable in your Python environment: CPLEX, Gurobi, SCIP, GLPK')
elif getattr(self,SOLVER) not in avail_solvers:
raise Exception("Selected solver '" + getattr(self,SOLVER) + "' is not installed / set up correctly.")
elif getattr(self, SOLVER) not in avail_solvers:
raise Exception("Selected solver '" + getattr(self, SOLVER) + "' is not installed / set up correctly.")
# Copy parameters to object
if self.A_ineq is not None:
numvars = self.A_ineq.shape[1]
Expand Down
7 changes: 4 additions & 3 deletions straindesign/strainDesignProblem.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,13 +499,14 @@ def link_z(self):

logging.info(' Bounding MILP.')
if processes > 1 and num_Ms > 1000:
with SDPool(processes, initializer=worker_init,
initargs=(M_A, M_A_ineq, M_b_ineq, M_A_eq, M_b_eq, M_lb, M_ub, getattr(self,SOLVER), getattr(self,SEED))) as pool:
with SDPool(processes,
initializer=worker_init,
initargs=(M_A, M_A_ineq, M_b_ineq, M_A_eq, M_b_eq, M_lb, M_ub, getattr(self, SOLVER), getattr(self, SEED))) as pool:
chunk_size = num_Ms // processes
for i, value in pool.imap_unordered(worker_compute, range(num_Ms), chunksize=chunk_size):
max_Ax[i] = value
else:
worker_init(M_A, M_A_ineq, M_b_ineq, M_A_eq, M_b_eq, M_lb, M_ub, getattr(self,SOLVER), getattr(self,SEED))
worker_init(M_A, M_A_ineq, M_b_ineq, M_A_eq, M_b_eq, M_lb, M_ub, getattr(self, SOLVER), getattr(self, SEED))
for i in range(num_Ms):
_, max_Ax[i] = worker_compute(i)

Expand Down
3 changes: 3 additions & 0 deletions tests/test_01_load_models_and_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ def model_small_example():
"""Load example model with two substrates."""
return read_sbml_model(dirname(abspath(__file__)) + "/model_small_example.xml")


@pytest.fixture
def model_core():
"""Load example core model. Large enough to test strain design with multiprocessing"""
return read_sbml_model(dirname(abspath(__file__)) + "/iMLcore.xml")


def test_import_sd():
import straindesign


def test_solver_availability(curr_solver):
"""Test solver availability."""
assert (curr_solver in sd.avail_solvers)
Expand Down
13 changes: 3 additions & 10 deletions tests/test_06_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,15 @@
import straindesign as sd
import logging


@pytest.mark.timeout(600)
def test_mcs_larger_model(curr_solver,model_core):
def test_mcs_larger_model(curr_solver, model_core):
logging.basicConfig(level=logging.INFO)
modules = [sd.SDModule(model_core, SUPPRESS, constraints=["EX_etoh_e <= 0.5"])]
modules += [sd.SDModule(model_core, SUPPRESS, constraints=["EX_etoh_e <= 0.5"])]
modules += [sd.SDModule(model_core, SUPPRESS, constraints=["EX_etoh_e <= 0.5"])]
# modules += [sd.SDModule(model_core, SUPPRESS, constraints=["EX_etoh_e <= 0.5"])]
modules += [sd.SDModule(model_core, PROTECT, constraints=["BIOMASS_Ec_iML1515_core_75p37M >= 0.1"])]
sd_setup = {
MODULES: modules,
MAX_COST: 4,
MAX_SOLUTIONS: 0,
SOLUTION_APPROACH: ANY,
SOLVER: curr_solver,
'compress': False
}
sd_setup = {MODULES: modules, MAX_COST: 4, MAX_SOLUTIONS: 0, SOLUTION_APPROACH: ANY, SOLVER: curr_solver, 'compress': False}
solution = sd.compute_strain_designs(model_core, sd_setup=sd_setup)
assert (len(solution.get_reaction_sd()) == 0)

0 comments on commit 83e3e3c

Please sign in to comment.