Skip to content

Commit 71e8cb8

Browse files
committed
Updating so that a reversibility report is generated for different databases
1 parent 7db8496 commit 71e8cb8

File tree

3 files changed

+44077
-2
lines changed

3 files changed

+44077
-2
lines changed

Scripts/Thermodynamics/Estimate_Reaction_Reversibility.py

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/usr/bin/env python
22
from BiochemPy import Reactions
33
from math import log
4+
import sys
45
reactions_helper = Reactions()
56
reactions_dict = reactions_helper.loadReactions()
67

8+
DB_Level = ''
9+
if(len(sys.argv)>1 and (sys.argv[1] == 'EQ' or sys.argv[1] == 'GF')):
10+
DB_Level = sys.argv[1]
11+
712
#Constants
813
TEMPERATURE=298.15
914
GAS_CONSTANT=0.0019858775
@@ -48,7 +53,18 @@
4853
rxn_dg = reactions_dict[rxn]['deltag']
4954
rxn_dge = reactions_dict[rxn]['deltagerr']
5055

51-
if(rxn_dg == 10000000 or rxn_dg is None or "GFC" not in reactions_dict[rxn]["notes"]):
56+
# Here, if I'm specifying either GF or EQ,
57+
# Then I want to check that I should estimate for this reaction
58+
# (I.e. either "GFC" or "EQC")
59+
# Otherwise its labeled as incomplete
60+
DB_Rxn=True
61+
if(len(DB_Level)>0):
62+
DB_Rxn=False
63+
for entry in reactions_dict[rxn]["notes"]:
64+
if(DB_Level in entry and entry == DB_Level+"C"):
65+
DB_Rxn=True
66+
67+
if(rxn_dg == 10000000 or rxn_dg is None or DB_Level is False):
5268

5369
thermoreversibility = "?"
5470
reversibility_report[rxn]=["Incomplete",reactions_dict[rxn]["reversibility"],thermoreversibility]
@@ -237,7 +253,11 @@
237253
reversibility_report[rxn]=["default",reactions_dict[rxn]["reversibility"],thermoreversibility]
238254
reactions_dict[rxn]['reversibility']=thermoreversibility
239255

240-
with open("Estimated_Reaction_Reversibility_Report.txt","w") as fh:
256+
file_name="Estimated_Reaction_Reversibility_Report"
257+
if(len(DB_Level)>0):
258+
file_name+="_"+DB_Level
259+
file_name+=".txt"
260+
with open(file_name,"w") as fh:
241261
for rxn in sorted(reversibility_report):
242262
fh.write(rxn+"\t"+"\t".join(reversibility_report[rxn])+"\n")
243263
fh.close()

0 commit comments

Comments
 (0)