Commit d58da3f6 authored by St. Elmo's avatar St. Elmo
Browse files

test

parent 30ae7c69
......@@ -9,7 +9,7 @@
"basic_analysis.md",
"sampling_tools.md",
"thermo_tools.md",
"brenda_tools.jl"
"brenda_tools.md"
]
Depth=1
```
......
py"""
from equilibrator_api import ComponentContribution, Q_
cc = ComponentContribution()
def pygetdg0(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.standard_dg(rxn).value.magnitude]
errs += [cc.standard_dg(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
def pygetdgprime(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.standard_dg_prime(rxn).value.magnitude]
errs += [cc.standard_dg_prime(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
def pygetdgprimephys(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.physiological_dg_prime(rxn).value.magnitude]
errs += [cc.physiological_dg_prime(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
return bals, mags, errs
"""
\ No newline at end of file
"""
buildrxnstring(rxn)
build_rxn_string(rxn::Reaction, compoundtype="kegg")
Get rxn in string format for Equilibrator.
"""
......@@ -35,12 +35,12 @@ end
"""
gibbs_arr = mapGibbs(rxns; dgtype="zero", ph=7.0, ionic_str="100 mM")
map_gibbs_rxns(rxns::Array{Reaction, 1}; dgtype="zero", ph=7.0, ionic_str="100 mM", usekegg=true)
Return an dict of rxn.id => ΔG of the specified dgtype.
Return a dict of rxn.id => ΔG of the specified dgtype.
"""
function map_gibbs_rxns(rxns::Array{Reaction, 1}; dgtype="zero", ph=7.0, ionic_str="100 mM", usekegg=true)
include("equilibrator_pycall.jl")
if usekegg
rxns_strings = [build_rxn_string(rxn, "kegg") for rxn in rxns]
else
......@@ -67,7 +67,7 @@ function map_gibbs_rxns(rxns::Array{Reaction, 1}; dgtype="zero", ph=7.0, ionic_s
end
"""
map_gibbs_external(fluxres, gibbs)
map_gibbs_external(fluxres::Dict{String, Float64}, gibbs)
Calculate the Gibbs free energy change taking only the external fluxes into account.
NB: you need to account for the biomass function separately.
......@@ -89,7 +89,7 @@ function map_gibbs_external(fluxres::Dict{String, Float64}, gibbs)
end
"""
map_gibbs_internal(fluxres, gibbs, biomassid="BIOMASS")
map_gibbs_internal(fluxres, gibbs, biomassid="BIOMASS")
Calculate the Gibbs free energy change taking only the internal fluxes into account.
NB: you need to account for the biomass function separately. NB:
......@@ -114,7 +114,7 @@ function map_gibbs_internal(fluxres::Dict{String, Float64}, gibbs, biomassid="BI
end
"""
save_gibbs(path, gibbs)
save_gibbs(path, gibbs)
Save gibbs dict. Saved as String => [mag, err]
"""
......@@ -129,7 +129,7 @@ function save_gibbs(path, gibbs)
end
"""
load_Gibbs(path)
load_Gibbs(path)
Load Gibbs dict. Loads String => [mag, err]
"""
......
......@@ -5,68 +5,68 @@ Equilibrator's python API.
"""
function __init__()
# Get Gibbs reaction energies from Equilibrator's python API.
py"""
from equilibrator_api import ComponentContribution, Q_
cc = ComponentContribution()
# py"""
# from equilibrator_api import ComponentContribution, Q_
# cc = ComponentContribution()
def pygetdg0(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.standard_dg(rxn).value.magnitude]
errs += [cc.standard_dg(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
# def pygetdg0(fs, ph, ionic):
# cc.p_h = Q_(ph) # set pH
# cc.ionic_strength = Q_(ionic) # set I
# bals = []
# mags = []
# errs = []
# for f in fs:
# try:
# rxn = cc.parse_reaction_formula(f)
# isbal = rxn.is_balanced()
# bals += [isbal]
# mags += [cc.standard_dg(rxn).value.magnitude]
# errs += [cc.standard_dg(rxn).error.magnitude]
# except:
# bals += [False]
# mags += [0.0]
# errs += [0.0]
return bals, mags, errs
# return bals, mags, errs
def pygetdgprime(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.standard_dg_prime(rxn).value.magnitude]
errs += [cc.standard_dg_prime(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
# def pygetdgprime(fs, ph, ionic):
# cc.p_h = Q_(ph) # set pH
# cc.ionic_strength = Q_(ionic) # set I
# bals = []
# mags = []
# errs = []
# for f in fs:
# try:
# rxn = cc.parse_reaction_formula(f)
# isbal = rxn.is_balanced()
# bals += [isbal]
# mags += [cc.standard_dg_prime(rxn).value.magnitude]
# errs += [cc.standard_dg_prime(rxn).error.magnitude]
# except:
# bals += [False]
# mags += [0.0]
# errs += [0.0]
return bals, mags, errs
# return bals, mags, errs
def pygetdgprimephys(fs, ph, ionic):
cc.p_h = Q_(ph) # set pH
cc.ionic_strength = Q_(ionic) # set I
bals = []
mags = []
errs = []
for f in fs:
try:
rxn = cc.parse_reaction_formula(f)
isbal = rxn.is_balanced()
bals += [isbal]
mags += [cc.physiological_dg_prime(rxn).value.magnitude]
errs += [cc.physiological_dg_prime(rxn).error.magnitude]
except:
bals += [False]
mags += [0.0]
errs += [0.0]
# def pygetdgprimephys(fs, ph, ionic):
# cc.p_h = Q_(ph) # set pH
# cc.ionic_strength = Q_(ionic) # set I
# bals = []
# mags = []
# errs = []
# for f in fs:
# try:
# rxn = cc.parse_reaction_formula(f)
# isbal = rxn.is_balanced()
# bals += [isbal]
# mags += [cc.physiological_dg_prime(rxn).value.magnitude]
# errs += [cc.physiological_dg_prime(rxn).error.magnitude]
# except:
# bals += [False]
# mags += [0.0]
# errs += [0.0]
return bals, mags, errs
"""
# return bals, mags, errs
# """
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment