Skip to content

Commit

Permalink
CommScores associated edits
Browse files Browse the repository at this point in the history
  • Loading branch information
freiburgermsu committed Sep 13, 2024
1 parent fc33219 commit 5149cc3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modelseedpy/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modelseedpy/core/fbahelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}
2 changes: 1 addition & 1 deletion modelseedpy/core/msminimalmedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 3 additions & 1 deletion modelseedpy/core/msmodelutl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit 5149cc3

Please sign in to comment.