首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >reconstructor:兼容 COBRApy 的自动重建基因组级代谢模型工具

reconstructor:兼容 COBRApy 的自动重建基因组级代谢模型工具

作者头像
用户1075469
发布2026-06-24 12:13:08
发布2026-06-24 12:13:08
60
举报

最近小编在Nature Microbiology读到一篇文章,用了这个工具,比较感兴趣,于是学习分享一下啦!看到的文章是这个,研究生殖道微生物的,也是一个微生物领域的研究热点啦。

这里有个概念,基因组规模代谢网络重建 genome-scale metabolic network reconstructions (GENREs),和基因组规模代谢网络模型(Genome-scale metabolic model,GEM或 GSMM)应该是同一个概念的不同叫法啦!它是将一个生物体内所有已知的代谢反应和途径整合在一起,用一种标准化的计算机可读格式表示出来的数学模型,它能够反映这个生物体内部复杂的代谢网络,并可以用于数据模拟和预测。

文章中构建后的结果就如上图所示啦,主要是一些统计柱状图,当然还可以有一些比如交叉喂养的网络图和热图这样的展现形式,比如邓晔老师团队开发的inap2工具https://inap.denglab.org.cn/。

reconstructor的安装和使用测试

软件基于KEGG注释,从带注释的氨基酸FASTA文件自动构建GENRE的工具,其主要原理如下图所示:

安装和避坑

安装的命令是比较简单的,普通的Python模块的Pip安装即可: pip install reconstructor 无奈由于大家知道的开源软件的各种依赖陷阱,以及不太留好的国内网络环境,特别是github,处理了好一阵才解决。当然现在有AI agent的支持,解决问题轻松许多了,在咱人类的主导下,AI加持,处理问题就事半功倍了,前提是,现阶段咱得清楚AI做得对不对。 遇到的问题,python -m reconstructor --test yes --cpu 16这个命令会触发两个自动下载:

  1. 1. DIAMOND 二进制(~28MB,https://github.com/bbuchfink/diamond/releases/download/v{version}/diamond-linux64.tar.gz
  2. 2. DIAMOND 数据库 screened_kegg_prokaryotes_pep_db.dmnd(~1.6GB, https://github.com/emmamglass/reconstructor/releases/download/v0.0.1/screened_kegg_prokaryotes_pep_db.dmnd

前面一个还好说,比较小。数据库下载速度奇慢,各种中断,于是使用github镜像,AI试了多个镜像都不给力,于是我手动下载给到了AI,然后继续完成的。 DB 文件放好后,测试运行报错:

代码语言:javascript
复制
subprocess.CalledProcessError: Command '[...diamond, blastp, ...]'
died with <Signals.SIGSEGV: 11>.
reconstructor.errors.DiamondProcessError: Test 1 failed with an error

发现是diamond版本和数据库版本不兼容,于是替换了其版本,终于解决。 详细原因是数据库是用 diamond ~2.1.8(2022年8月同期版本)构建的。Diamond 2.1.14 对该旧版 DB 格式有回归 bug,在 alignment 输出阶段段错误。GitHub release notes 也显示 v2.1.21 修复了 "potential segmentation fault"。解决方案是下载 diamond v2.1.8 替换 2.1.14:

代码语言:javascript
复制
# 下载 v2.1.8(GitHub CDN 这次很快,3.4 MB/s)
aria2c -x16 -s16 -o diamond-2.1.8.tar.gz \
"https://github.com/bbuchfink/diamond/releases/download/v2.1.8/diamond-linux64.tar.gz"

# 替换二进制
rm /path/to/reconstructor/bin/diamond
tar xzf diamond-2.1.8.tar.gz -C /tmp/diamond218
cp /tmp/diamond218/diamond /path/to/reconstructor/bin/diamond
chmod +x /path/to/reconstructor/bin/diamond
python -m reconstructor --testyes --cpu 16
# 终于成功
Using DIAMOND v2.1.8 at /path/to/reconstructor/bin/diamond
Performing test 1 ... ✓ (672 reactions, 761 metabolites)
Performing test 2 ... ✓ (672 reactions, 761 metabolites)
Performing test 3 ... ✓ (903 reactions, 938 metabolites)
运行

先看看有什么选项python -m reconstructor -h:

当然也可以使用python API进行,适合大牛进行更灵活的分析。这里命令行运行个示例文件:

代码语言:javascript
复制
# 下载测试序列
 wget https://ghfast.top/https://github.com/csbl/reconstructor/blob/main/tests/resources/tiny_fasta.fa
#运行,最简单的方式
python -m reconstructor --input_file tiny_fasta.fa --file_type 1 --gram negative --media rich --cpu 36

Using Gram negative objective function
Using minimum objective flux fraction of 0.01 and maximum fraction of 0.5
Using 36 processor(s)

Loading GENRE construction databases...
[-----------------------------------------]
Aligning peptide sequences to KEGG database, may take some time...
Blast results will be saved to tiny_fasta.KEGGprot.out

blasting tiny_fasta.fa vs ~/miniconda3/lib/python3.12/site-packages/reconstructor/resources/screened_kegg_prokaryotes_pep_db.dmnd
finished blast
Creating draft GENRE from BLAST results...
Identifying new metabolism (Step 1 of 2)...
[-----------------------------------------]
{'rxn40643_c', 'rxn06043_c', 'rxn05232_c', 'rxn10271_c', 'rxn11355_c', ...
'rxn01423_c', 'rxn23808_c', 'rxn09472_c'}
Identifying new metabolism (Step 2 of 2)...
[-----------------------------------------]
        Draft reconstruction had 0 genes, 0 reactions, and 0 metabolites
        Gapfilled 253 reactions and 261 metabolites

        Final reconstruction has 253 reactions and 261 metabolites
        Final objective flux is 1000.0

Saving new GENRE to tiny_fasta.sbml

最后生成的是生成SBML格式的 GENRE。SBML 是一种 基于 XML 的表示格式,用于通信和 存储生物过程的计算模型。它可以 代表许多不同类别 的生物现象,包括代谢现象 网络、细胞信号通路、调控网络等,也可以用来可视化。 好的,今天就分享到这里啦,感谢您的观看,欢迎点赞、红心和转发!

参考

  • • Jenior ML, Glass EM, Papin JA. Reconstructor: a COBRApy compatible tool for automated genome-scale metabolic network reconstruction with parsimonious flux-based gap-filling. Bioinformatics. 2023 Jun 1;39(6):btad367. doi: 10.1093/bioinformatics/btad367. PMID: 37279743; PMCID: PMC10275916.
  • • Glass, E.M., Kolling, G.L. & Papin, J.A. Genome-scale metabolic modelling identifies vaginal microbiome members as potential probiotics. Nat Microbiol (2026). https://doi.org/10.1038/s41564-026-02380-w
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2026-06-23,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 微因 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • reconstructor的安装和使用测试
    • 安装和避坑
    • 运行
  • 参考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档