feat(toolkit): add classification and migration

Implement the standard/non-standard/not-macrolactone classification layer
and integrate it into analyzer, fragmenter, and CLI outputs.

Port the remaining legacy package capabilities into new visualization and
workflow modules, restore batch/statistics/SDF scripts on top of the flat
CSV workflow, and update active docs to the new package API.
This commit is contained in:
2026-03-18 23:56:41 +08:00
parent 9ccbcfcd04
commit c0ead42384
24 changed files with 1497 additions and 313 deletions

View File

@@ -102,19 +102,15 @@ notebook的最后一个单元格Section 9提供了详细的延伸分析建
notebook中包含了完整的代码示例可以直接运行或修改。主要功能
```python
# 1. 计算分子性质
props = calculate_properties(smiles)
from macro_lactone_toolkit import MacroLactoneAnalyzer
from macro_lactone_toolkit.workflows import fragment_csv, results_to_dataframe
# 2. 批量断裂
fragmenter = MacrolactoneFragmenter(ring_size=16)
batch_results = fragmenter.process_csv(csv_file)
analyzer = MacroLactoneAnalyzer()
classification = analyzer.classify_macrocycle(smiles, ring_size=16)
# 3. 统计分析
df_fragments = fragmenter.batch_to_dataframe(batch_results)
position_stats = df_fragments.groupby('cleavage_position').agg(...)
# 4. 绘图
sns.histplot(values, kde=True, ax=ax, bins=30)
batch_results = fragment_csv(csv_file, ring_size=16)
df_fragments = results_to_dataframe(batch_results)
position_stats = df_fragments.groupby("cleavage_position").agg(...)
```
## 关键洞察
@@ -174,10 +170,10 @@ sns.histplot(values, kde=True, ax=ax, bins=30)
## 参考
- `filter_molecules.ipynb` - 分子过滤和断裂逻辑
- `test_align_two_molecules.ipynb` - 绘图逻辑参考
- `src/macrolactone_fragmenter.py` - 封装的断裂器类
- `src/ring_visualization.py` - 可视化工具
- `scripts/batch_process_ring16.py` - 16 元环 flat workflow 入口
- `scripts/analyze_fragments.py` - 位置统计和图表输出
- `src/macro_lactone_toolkit/fragmenter.py` - 标准大环内酯裂解器
- `src/macro_lactone_toolkit/visualization.py` - 编号和碎片可视化工具
## 问题反馈
@@ -187,4 +183,3 @@ sns.histplot(values, kde=True, ax=ax, bins=30)
3. 查看输出目录是否有写入权限
4. 检查CSV文件路径是否正确