Skip to content

Commit

Permalink
commKinetics updates
Browse files Browse the repository at this point in the history
  • Loading branch information
freiburgermsu committed Sep 18, 2024
1 parent d198219 commit c485552
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modelseedpy/core/msmodelutl.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ def add_ms_reaction(self, rxn_dict, msdb_path=None, msdb_object=None, comp_trans
return output

def create_constraint(self, constraint, coef=None, sloppy=False, printing=False):
if printing: print(coef)
# if printing: print(coef)
self.model.add_cons_vars(constraint, sloppy=sloppy)
self.model.solver.update()
if coef: constraint.set_linear_coefficients(coef)
Expand Down
5 changes: 2 additions & 3 deletions modelseedpy/fbapkg/commkineticpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CommKineticPkg(BaseFBAPkg):
def __init__(self, model):
BaseFBAPkg.__init__(self, model, "community kinetics", {}, {"commKin": "string"})

def build_package(self, kinetic_coef, community_model, probs=None):
def build_package(self, kinetic_coef, community_model, probs={}):
self.validate_parameters({}, [], {"kinetic_coef": kinetic_coef, "community": community_model})
for species in self.parameters["community"].members:
if species.id+"_commKin" in self.model.constraints:
Expand All @@ -25,6 +25,5 @@ def build_constraint(self, species, probs):
for rxn in self.model.reactions:
rxnIndex = int(FBAHelper.rxn_compartment(rxn)[1:])
if (rxnIndex == species.index and rxn != species.primary_biomass):
val = 1 if not isinstance(probs, dict) else probs.get(rxn.id, 1)
coef[rxn.forward_variable] = coef[rxn.reverse_variable] = val
coef[rxn.forward_variable] = coef[rxn.reverse_variable] = probs.get(rxn.id, 1)
return BaseFBAPkg.build_constraint(self, "commKin", None, 0, coef, species.id)

0 comments on commit c485552

Please sign in to comment.