Complete reactions set
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import itertools
|
||||||
|
|
||||||
|
|
||||||
class SingleReaction:
|
class SingleReaction:
|
||||||
@@ -19,15 +20,19 @@ class SingleReaction:
|
|||||||
return "{" + ", ".join(self.products) + "}"
|
return "{" + ", ".join(self.products) + "}"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{" + f"{self.get_reactants()}, {self.get_inhibitors()} -> {self.get_products()}" + "};"
|
return (
|
||||||
|
"{"
|
||||||
|
+ f"{self.get_reactants()}, {self.get_inhibitors()} -> {self.get_products()}"
|
||||||
|
+ "};"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Reactions:
|
class Reactions:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reactions = set()
|
self.reactions = []
|
||||||
|
|
||||||
def add(self, reaction):
|
def add(self, reaction):
|
||||||
self.reactions.add(reaction)
|
self.reactions.append(reaction)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
ret = ""
|
ret = ""
|
||||||
@@ -54,10 +59,19 @@ class DRSGenerator:
|
|||||||
rcts.add(SingleReaction(["GF"], ["h", f"RTK{i}"], ["RTK"]))
|
rcts.add(SingleReaction(["GF"], ["h", f"RTK{i}"], ["RTK"]))
|
||||||
rcts.add(SingleReaction(["RTK"], [f"ENi:1_{i}"], [f"EN:1_{i}"]))
|
rcts.add(SingleReaction(["RTK"], [f"ENi:1_{i}"], [f"EN:1_{i}"]))
|
||||||
for j in range(1, self.x):
|
for j in range(1, self.x):
|
||||||
rcts.add(SingleReaction([f"EN:{j}_{i}"], [f"ENi:{j+1}_{i}"], [f"EN:{j+1}_{i}"]))
|
rcts.add(
|
||||||
|
SingleReaction([f"EN:{j}_{i}"], [f"ENi:{j+1}_{i}"], [f"EN:{j+1}_{i}"])
|
||||||
|
)
|
||||||
|
|
||||||
|
indices = list(range(1, self.y + 1))
|
||||||
|
for comb in itertools.combinations(indices, self.z):
|
||||||
|
reactants = []
|
||||||
|
for i in comb:
|
||||||
|
reactants.append(f"EN:{self.x}_{i}")
|
||||||
|
rcts.add(SingleReaction(reactants, ["h"], ["TF"]))
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
for i in range(1, self.y):
|
for i in range(1, self.y + 1):
|
||||||
self.generate_reactions_for_component(i)
|
self.generate_reactions_for_component(i)
|
||||||
|
|
||||||
for proc, reactions in self.reactions.items():
|
for proc, reactions in self.reactions.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user