Beta
chematic for Python
chematic 的 Python 包构建在与 Rust crate 和 WebAssembly 版本相同的 Rust 核心之上, 面向 Python 用户已经熟悉的工作方式 —— notebook、pandas 的 DataFrame、 对结构文件目录的批处理任务,提供行为与 RDKit 对应功能一致的操作子集。它并不是 RDKit 的完全替代品:RDKit 的部分功能 (高级反应处理、完整的 3D 工具集、大多数插件)尚未实现。
安装
pip install chematic已在 PyPI 上发布版本 1.0.13, 分类为 Beta,支持的 Python 版本为 3.9–3.13。 仓库中的快速上手 notebook提供了可直接运行的示例。
Jupyter 与 notebook
典型的使用流程是解析一个结构、查看其内容,并在 notebook 中内联渲染:
import chematic
mol = chematic.parse_smiles("CC(=O)OC1=CC=CC=C1C(=O)O")
mol.canonical_smiles()
mol.molecular_weight()
mol.depict_svg()这只是用于说明 API 大致形态的示例,并不保证长期稳定 —— 在依赖具体方法名之前, 请查阅API 参考文档确认当前的准确名称。
pandas 与批量分析
无论是筛选 DataFrame 中一整列 SMILES,还是遍历一个目录下的 SDF 文件, chematic 的描述符与指纹计算都只是普通的 Python 函数,不需要服务器或数据库 —— 这与浏览器版和Rust 版使用的是同一套底层逻辑,因此批处理脚本和 notebook 单元格调用的是完全相同的代码。
这里所说的"RDKit 兼容子集"是什么意思
The physicochemical core (molecular weight, LogP, TPSA, H-bond donor/acceptor counts, aromatic ring count) matches RDKit at 100% agreement on a 4,999-molecule ChEMBL corpus.An extended descriptor family (Kappa shape indices, BertzCT, BalabanJ, BCUT2D, VSA descriptors, MQN, SA Score) diverges substantially from RDKit at corpus scale and should not be assumed validated just because it is one of the 194 values Mol.descriptors() returns.
Mol.descriptors() 总共返回 194 个数值 —— 这个数字同时包含了已验证的核心部分和上述存在偏差的扩展描述符家族,因此 "194 个描述符"和"194 个已验证的描述符" 并不是同一个说法。完整的分类说明与验证方法请参见验证页面。