Skip to content

Commit d164850

Browse files
committed
atp method
1 parent 6febe1a commit d164850

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

modelseedpy/core/fbahelper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def rxn_compartment(reaction):
239239
cytosol = comp
240240
else:
241241
othercomp = comp
242-
if othercomp != None:
242+
if othercomp is not None:
243243
return othercomp
244244
return cytosol
245245

modelseedpy/core/msatpcorrection.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
class MSATPCorrection:
1616

17-
def __init__(self, model, core_template, atp_medias,compartment="c0", max_gapfilling=None, gapfilling_delta=0):
17+
def __init__(self, model, core_template, atp_medias,compartment="c0",
18+
max_gapfilling=None, gapfilling_delta=0, atp_hydrolysis_id=None):
1819
"""
1920
2021
:param model:
@@ -23,11 +24,15 @@ def __init__(self, model, core_template, atp_medias,compartment="c0", max_gapfil
2324
:param atp_objective:
2425
:param max_gapfilling:
2526
:param gapfilling_delta:
27+
:param atp_hydrolysis_id: ATP Hydrolysis reaction ID, if None it will perform a SEED reaction search
2628
"""
2729
self.model = model
2830
self.compartment = compartment
29-
output = FBAHelper.add_atp_hydrolysis(self.model,compartment)
30-
self.atp_hydrolysis = output["reaction"]
31+
if atp_hydrolysis_id and atp_hydrolysis_id in self.model.reactions:
32+
self.atp_hydrolysis = self.model.reactions.get_by_id(atp_hydrolysis_id)
33+
else:
34+
output = FBAHelper.add_atp_hydrolysis(self.model, compartment)
35+
self.atp_hydrolysis = output["reaction"]
3136
self.atp_medias = atp_medias
3237
self.max_gapfilling = max_gapfilling
3338
self.gapfilling_delta = gapfilling_delta
@@ -123,6 +128,8 @@ def evaluate_growth_media(self):
123128
if solution.objective_value == 0 or solution.status != 'optimal':
124129
self.media_gapfill_stats[media] = self.msgapfill.run_gapfilling(media, self.atp_hydrolysis.id)
125130
#IF gapfilling fails - need to activate and penalize the noncore and try again
131+
elif solution.objective_value > 0 or solution.status == 'optimal':
132+
self.media_gapfill_stats[media] = {'reversed': {}, 'new': {}}
126133

127134
def determine_growth_media(self):
128135
"""

0 commit comments

Comments
 (0)