cleanup
This commit is contained in:
@@ -4,9 +4,11 @@ from colour import *
|
||||
from rs.reaction_system import ReactionSystem
|
||||
|
||||
class ParameterSet(object):
|
||||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
|
||||
class ReactionSystemWithConcentrationsParam(ReactionSystem):
|
||||
|
||||
def __init__(self):
|
||||
@@ -24,12 +26,13 @@ class ReactionSystemWithConcentrationsParam(ReactionSystem):
|
||||
name = ""
|
||||
def_max_conc = -1
|
||||
if type(e) is tuple and len(e) == 2:
|
||||
name,def_max_conc = e
|
||||
name, def_max_conc = e
|
||||
elif type(e) is str:
|
||||
name = e
|
||||
print("\nWARNING: no maximal concentration level specified for:", e, "\n")
|
||||
else:
|
||||
raise RuntimeError("Bad entity type when adding background set element")
|
||||
raise RuntimeError(
|
||||
"Bad entity type when adding background set element")
|
||||
|
||||
self.assume_not_in_bgset(name)
|
||||
self.background_set.append(name)
|
||||
@@ -73,7 +76,8 @@ class ReactionSystemWithConcentrationsParam(ReactionSystem):
|
||||
|
||||
def has_non_zero_concentration(self, elem):
|
||||
if elem[1] < 1:
|
||||
raise RuntimeError("Unexpected concentration level in state: " + str(elem))
|
||||
raise RuntimeError(
|
||||
"Unexpected concentration level in state: " + str(elem))
|
||||
|
||||
def process_rip(self, R, I, P, ignore_empty_R=False):
|
||||
"""Chcecks concentration levels and converts entities names into their ids"""
|
||||
@@ -85,26 +89,26 @@ class ReactionSystemWithConcentrationsParam(ReactionSystem):
|
||||
for r in R:
|
||||
self.is_valid_entity_with_concentration(r)
|
||||
self.has_non_zero_concentration(r)
|
||||
entity,level = r
|
||||
reactants.append((self.get_entity_id(entity),level))
|
||||
entity, level = r
|
||||
reactants.append((self.get_entity_id(entity), level))
|
||||
if self.max_concentration < level:
|
||||
self.max_concentration = level
|
||||
inhibitors = []
|
||||
for i in I:
|
||||
self.is_valid_entity_with_concentration(i)
|
||||
self.has_non_zero_concentration(i)
|
||||
entity,level = i
|
||||
inhibitors.append((self.get_entity_id(entity),level))
|
||||
entity, level = i
|
||||
inhibitors.append((self.get_entity_id(entity), level))
|
||||
if self.max_concentration < level:
|
||||
self.max_concentration = level
|
||||
products = []
|
||||
for p in P:
|
||||
self.is_valid_entity_with_concentration(p)
|
||||
self.has_non_zero_concentration(p)
|
||||
entity,level = p
|
||||
products.append((self.get_entity_id(entity),level))
|
||||
entity, level = p
|
||||
products.append((self.get_entity_id(entity), level))
|
||||
|
||||
return reactants,inhibitors,products
|
||||
return reactants, inhibitors, products
|
||||
|
||||
def add_reaction(self, R, I, P):
|
||||
"""Adds a reaction
|
||||
|
||||
Reference in New Issue
Block a user