2

在某些数据集中,我有时会观察到我想将其纳入我的模拟的固定通量比。我怎么能在 CBMPy 中做到这一点?

例如,我有来自这里的模型,现在想将琥珀酸流出和丙酮酸流出的比率限制为 2.0。我知道如何对个人反应设置限制:

import cbmpy

# downloaded from http://bigg.ucsd.edu/models/e_coli_core
ecoli = cbmpy.CBRead.readSBML3FBC('e_coli_core.xml')

ecoli.setReactionBounds('R_EX_pyr_e', 1.0, 1000.0)
ecoli.setReactionBounds('R_EX_succ_e', 2.0, 1000.0)

# solve the model
cbmpy.doFBA(ecoli)

# get all reaction values
solution = ecoli.getReactionValues()
print(solution['R_EX_pyr_e'])
print(solution['R_EX_succ_e'])

对于这种情况,比率是正确的,但我如何将它添加为所有条件都满足的约束?

4

1 回答 1

1

这确实是通量平衡分析 (FBA) 中的常用方法,您可以使用该功能addUserConstraint来完成此操作。

整个代码示例可能如下所示(解释如下):

import cbmpy as cbm

# downloaded from http://bigg.ucsd.edu/models/e_coli_core
ecoli = cbm.CBRead.readSBML3FBC('e_coli_core.xml')

# make a clone of the original model
ecoli_ratio = ecoli.clone()

# add the desired user constraint; explanation follows below
ecoli_ratio.addUserConstraint("pyr_succ_ratio", fluxes=[(1.0, 'R_EX_pyr_e' ),(-0.5, 'R_EX_succ_e')], operator='=', rhs=0.0)

# now we have to set only one flux bound; if you think it is naturally excreted, this step is not needed
ecoli_ratio.setReactionBounds('R_EX_succ_e', 4.0, cbm.INF)

cbm.doFBA(ecoli_ratio)
solution = ecoli_ratio.getReactionValues()
print("{}: {}".format("succinate excretion rate", solution['R_EX_succ_e']))
print("{}: {}".format("pyruvate excretion rate", solution['R_EX_pyr_e']))

这将打印

succinate excretion rate: 4.0
pyruvate excretion rate: 2.0

如您所见,该比率2.0符合要求。

多一点解释:

约束是

J_succ / J_pyr = 2.0

可以重写为

J_succ = 2.0 J_pyr

最后

J_pyr - 0.5 J_succ = 0

这正是我们传递给fluxesin 的内容addUserConstraint

fluxes=[(1.0, 'R_EX_pyr_e' ),(-0.5, 'R_EX_succ_e')], operator='=', rhs=0.0)

您可以通过打印检查用户定义的约束:

print(ecoli_ratio.user_constraints)
{'pyr_succ_ratio': {'operator': 'E', 'rhs': 0.0, 'fluxes': [(1.0, 'R_EX_pyr_e'), (-0.5, 'R_EX_succ_e')]}}

由于这是一本字典,您只需执行以下操作即可删除约束:

del ecoli_ratio.user_constraints['pyr_succ_ratio']
print(ecoli_ratio.user_constraints)
{}

但我强烈建议您每次对模型进行重大更改时创建一个克隆。

于 2018-05-16T20:52:40.463 回答