diff --git a/modelseedpy/core/__init__.py b/modelseedpy/core/__init__.py index 59f32bf..f566f92 100755 --- a/modelseedpy/core/__init__.py +++ b/modelseedpy/core/__init__.py @@ -11,7 +11,7 @@ from modelseedpy.core.msatpcorrection import MSATPCorrection from modelseedpy.core.msgrowthphenotypes import MSGrowthPhenotypes, MSGrowthPhenotype from modelseedpy.core.msmodelutl import MSModelUtil -from modelseedpy.core.msminimalmedia import MSMinimalMedia +from modelseedpy.core.msminimalmedia import MSMinimalMedia, minimizeFlux_withGrowth, bioFlux_check from modelseedpy.core.optlanghelper import OptlangHelper from modelseedpy.core.mstemplate import MSTemplateBuilder from modelseedpy.core.msmodelreport import MSModelReport diff --git a/modelseedpy/core/fbahelper.py b/modelseedpy/core/fbahelper.py index 1bc1009..0872c2c 100755 --- a/modelseedpy/core/fbahelper.py +++ b/modelseedpy/core/fbahelper.py @@ -272,7 +272,7 @@ def IDRxnMets(rxn): return {met.id: stoich for met, stoich in rxn.items()} @staticmethod - def convert_kbase_media(kbase_media, uniform_uptake=None): + def convert_kbase_media(kbase_media, uniform_uptake=1000): if uniform_uptake is None: return {"EX_"+exID: -bound[0] for exID, bound in kbase_media.get_media_constraints().items()} return {"EX_"+exID: uniform_uptake for exID in kbase_media.get_media_constraints().keys()} diff --git a/modelseedpy/core/msminimalmedia.py b/modelseedpy/core/msminimalmedia.py index 1d235b2..be4c529 100644 --- a/modelseedpy/core/msminimalmedia.py +++ b/modelseedpy/core/msminimalmedia.py @@ -259,7 +259,7 @@ def _examine_permutations(model, exchange_ids_to_explore, variables, sol_dict, s @staticmethod def determine_min_media(model, minimization_method="minFlux", min_growth=None, environment=None, - interacting=True, solution_limit=5, printing=True): + interacting=True, printing=True): if minimization_method == "minFlux": return MSMinimalMedia.minimize_flux(model, min_growth, environment, interacting, printing) if minimization_method == "minComponents": diff --git a/modelseedpy/core/msmodelutl.py b/modelseedpy/core/msmodelutl.py index a454461..f0ca161 100644 --- a/modelseedpy/core/msmodelutl.py +++ b/modelseedpy/core/msmodelutl.py @@ -142,6 +142,7 @@ def __init__(self, model, copy=False, environment=None): self.test_objective = None self.reaction_scores = None self.score = None + # identify the forward biomass reaction try: objectiveVars = list(self.model.objective.variables) for var in objectiveVars: @@ -1674,9 +1675,10 @@ def add_kbase_media(self, kbase_media): def add_medium(self, media, uniform_uptake=None): # add the new media and its flux constraints - if media is None: return self.model.medium exIDs = [exRXN.id for exRXN in self.exchange_list()] if not hasattr(media, "items"): media = FBAHelper.convert_kbase_media(media) + elif not any(["EX_" in x for x in list(media.keys())]): + media = {"EX_"+k+"_e0":v for k,v in media.items()} self.model.medium = {ex: uptake for ex, uptake in media.items() if ex in exIDs} if uniform_uptake is not None: self.model.medium = dict(zip( list(self.model.medium.keys()), [uniform_uptake]*len(self.model.medium)))