1.关于工具包:
平台:matlab和python
1)python平台:
优点:基础功能齐全+版本较新+易用+可视化强
缺点:高级功能不全,需要配合使用不同的工具包,版本兼容复杂,学习成本高+优化不好
(1)cobrapy(官方基本包)
下载链接:https://pypi.org/project/cobra/
学习文档:https://cobrapy.readthedocs.io/en/0.26.3/index.html
注:1.conda+vscode/pycharm
2.利用conda新建一个虚拟环境(python3.7以上)
conda create -n cobraenv python=3.7
3.推荐:在虚拟环境中安装cobrapy0.20.0以上
pip install cobra==0.26.3(最新版)
或者
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple cobra==0.26.3
4.gurobipy:https://pypi.org/project/gurobipy/
pip install gurobipy==10.0.2
或者
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gurobipy==10.0.2
(2)cameo(提供基本的应变设计,例如OptKnock,OptGene和FSEOF)
下载链接:https://pypi.org/project/cameo/
学习文档: https://cameo.bio/tutorials.html
注:1.conda+vscode/pycharm
2.利用conda新建一个虚拟环境(python3.7)
conda create -n cameoenv python=3.7
3.推荐:在虚拟环境中安装cobrapy0.20.0+cameo0.13.6
pip install cobra==0.20.0(最新版)
或者
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple cobra==0.20.0
pip install cameo==0.13.6
或者
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple cameo==0.13.6
4.gurobipy:https://pypi.org/project/gurobipy/
pip install gurobipy==10.0.2
或者
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gurobipy==10.0.2
(3)straindesign(提供各种高级应变设计):
下载链接和学习文档:https://straindesign.readthedocs.io/en/latest/index.html
注:1.conda+vscode/pycharm
2.利用conda新建一个虚拟环境(python3.7)
conda create -n straindesignenv python=3.7
3.推荐:在虚拟环境中安装+cobrapy0.26.3+straindesign1.10
pip install cobra==0.26.3(最新版)
或者
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple cobra==0.26.3
pip install straindesign==1.10
或者
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple straindesign==1.10
4.gurobipy:https://pypi.org/project/gurobipy/
pip install gurobipy==10.0.2
或者
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gurobipy==10.0.2
(4)FSEOF-cmd:
github仓库:https://straindesign.readthedocs.io/en/latest/index.html
(5)escher(可视化):
学习文档:https://escher.readthedocs.io/en/latest/index.html
(6)CNApy(啥都有):
下载链接:https://cnapy-org.github.io/CNApy/
2)matlab平台(最好配合python平台):
优点:功能齐全
缺点:版本太老(有些东西报错)+可视化不好+教程不基础
cobra toolbox(只需这个即可):
下载链接:https://cbb.sjtu.edu.cn/~zwang/sysbio/Lab4COBRA.htm
学习文档:https://opencobra.github.io/cobratoolbox/stable/installation.html
2.model:
必须是BIGG的格式:
网址链接:
3.以下说明基于python平台:
1)FBA:
内容链接:
[cobrapy] https://cobrapy.readthedocs.io/en/0.26.3/simulating.html
[cameo] https://cameo.bio/03-simulate-models.html
[straindesign] https://straindesign.readthedocs.io/en/latest/examples/JN_02_analysis.html
论文参考:
https://www.nature.com/articles/nbt.1614/
FBA Optimize
FBA algorithm uses a stoichiometric matrix () of size
(m compounds and n reactions) to represent metabolic reactions. The flux through these all of the reactions is represented by a vector
. The objective of FBA is to maximize or minimize an objective function:
where is a vector of weights.
The output of FBA is a particular flux distribution which is used of linear programming to solve the equation
given a set of upper and lower bounds on
that maximizes or minimizes the objective function.
For our model STC1515:
from pathlib import Path
from cobra.io import load_json_model
from cameo.flux_analysis import fba
# get load path
loadPath = Path(".") / ".." / "model" / "STC1515.json"
loadPath = loadPath.resolve()
# load model
model=load_json_model(str(loadPath))
# compute FBA algorithm
FBAsolution=fba(model=model,objective=model.reactions.EX_15ptnd_e)
FBAsolution
2)pFBA:
内容链接:
[cobrapy] https://cobrapy.readthedocs.io/en/0.26.3/simulating.html
[cameo] https://cameo.bio/03-simulate-models.html
[straindesign] https://straindesign.readthedocs.io/en/latest/examples/JN_02_analysis.html
论文参考:
https://pubmed.ncbi.nlm.nih.gov/20664636/
from pathlib import Path
from cobra.io import load_json_model
from cameo.flux_analysis import pfba
# get load path
loadPath = Path(".") / ".." / "model" / "STC1515.json"
loadPath = loadPath.resolve()
# load model
model=load_json_model(str(loadPath))
model.reactions.BIOMASS_Ec_iML1515_core_75p37M
# compute pFBA algorithm
pFBAsolution=pfba(model=model,objective=model.reactions.EX_15ptnd_e)
# get export path
resultPath = Path(".") / ".." / "result"
resultPath = resultPath.resolve()
# save result as csv
pFBAsolution.data_frame.to_csv(str(resultPath/"pfba.csv"))
3)FVA:
内容链接:
[cobrapy] https://cobrapy.readthedocs.io/en/0.26.3/simulating.html
[cameo] Analyzing models — cameo 0.13.6 documentation
[straindesign] https://straindesign.readthedocs.io/en/latest/examples/JN_02_analysis.html
论文参考:
[1] https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-11-489
[2] https://academic.oup.com/bioinformatics/article/31/13/2159/195895
from pathlib import Path
from cobra.io import load_json_model
from cobra.flux_analysis import flux_variability_analysis
# get load path
loadPath = Path(".") / ".." / "model" / "STC1515.json"
loadPath = loadPath.resolve()
# load model
model=load_json_model(str(loadPath))
# set objective reaction
model.objective = 'EX_15ptnd_e'
# compute FVA algorithm
FVAsolution=flux_variability_analysis(model,processes=4)
# get export path
resultPath = Path(".") / ".." / "result"
resultPath = resultPath.resolve()
# save result as csv
FVAsolution.to_csv(str(resultPath/"fva.csv"))
4)FSEOF:
内容链接:
https://cameo.bio/06-predict-gene-modulation-targets.html
论文参考:
[3] https://max.book118.com/html/2019/0215/7020105111002006.shtm
from pathlib import Path
from cameo.io import load_json_model
from cameo.strain_design import FSEOF
# get load path
loadPath = Path(".") / ".." / "model" / "STC1515.json"
loadPath = loadPath.resolve()
# load model
model=load_json_model(str(loadPath))
fseof = FSEOF(
model=model,
# enforced_reaction=model.reactions.EX_15ptnd_e,
primary_objective=model.reactions.BIOMASS_Ec_iML1515_core_75p37M,
)
fseof_solution=fseof.run(
target=model.reactions.EX_15ptnd_e,
max_enforced_flux=0.9,
number_of_results=20
)
# get export path
resultPath = Path(".") / ".." / "result"
resultPath = resultPath.resolve()
# save result as csv
fseof_solution.data_frame.to_csv(str(resultPath/'fseof.csv'))
5)OptKnock:
内容链接:
[cameo] https://cameo.bio/05-predict-gene-knockout-strategies.html#optknock
[straindesign] https://straindesign.readthedocs.io/en/latest/examples/JN_06_strain_design_nested.html#OptKnock
论文参考:
https://max.book118.com/html/2019/0215/7020105111002006.shtm
from pathlib import Path
from cameo.io import load_json_model
from cameo.strain_design import OptKnock
# get load path
loadPath = Path(".") / ".." / "model" / "STC1515.json"
loadPath = loadPath.resolve()
# load model
model=load_json_model(str(loadPath))
# Judgment as exchange reaction (including inlet and outlet)
exchange_reactions = [reaction for reaction in model.reactions if all(s<0 for s in reaction.metabolites.values())]
# Block all outlet reactions
for reaction in exchange_reactions:
reaction.upper_bound = 0.0
# Restore part of the export reaction
model.reactions.EX_15ptnd_e.upper_bound = 1000.0
model.reactions.EX_ac_e.upper_bound = 1000.0
model.reactions.EX_co2_e.upper_bound = 1000.0
model.reactions.EX_etoh_e.upper_bound = 1000.0
model.reactions.EX_for_e.upper_bound = 1000.0
model.reactions.EX_h2_e.upper_bound = 1000.0
model.reactions.EX_h2o2_e.upper_bound = 1000.0
model.reactions.EX_h2o_e.upper_bound = 1000.0
model.reactions.EX_h_e.upper_bound = 1000.0
model.reactions.EX_lac__D_e.upper_bound = 1000.0
model.reactions.EX_meoh_e.upper_bound = 1000.0
model.reactions.EX_o2_e.upper_bound = 1000.0
model.reactions.EX_succ_e.upper_bound = 1000.0
model.reactions.EX_tungs_e.upper_bound = 1000.0
model.reactions.DM_4crsol_c.upper_bound = 1000.0
model.reactions.DM_5drib_c.upper_bound = 1000.0
model.reactions.DM_aacald_c.upper_bound = 1000.0
model.reactions.DM_amob_c.upper_bound = 1000.0
model.reactions.DM_mththf_c.upper_bound = 1000.0
model.reactions.DM_oxam_c.upper_bound = 1000.0
# Carbon source inlet is set to glucose only
model.reactions.EX_co2_e.lower_bound = 0.0
# set exclude reactions
exclude_reactions = [reaction.id for reaction in model.reactions if model.genes.s0001 in reaction.genes]
exclude_reactions.append('LYSMO')
exclude_reactions.append('APENTAMAH2')
exclude_reactions.append('APTNAT')
exclude_reactions.append('ARND')
exclude_reactions.append('CARs')
exclude_reactions.append('ARND2')
# build optKnock solver
optknock = OptKnock(
model=model,
exclude_reactions=exclude_reactions,
remove_blocked=True,
fraction_of_optimum=0.1,
exclude_non_gene_reactions=True,
use_nullspace_simplification=True,
)
# run optknock solver
result = optknock.run(
max_knockouts = 1,
biomass=model.reactions.BIOMASS_Ec_iML1515_core_75p37M,
target=model.reactions.EX_15ptnd_e,
max_results = 1,
)
# check optknock
from cameo.visualization.plotting.with_plotly import PlotlyPlotter
plotter = PlotlyPlotter()
result.plot(plotter, 0)
# get export path
resultPath = Path(".") / ".." / "result"
resultPath = resultPath.resolve()
# save result as csv
result.data_frame.to_csv(str(resultPath/"optknock.csv"))