Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
4.2 KiB
Executable File
4.2 KiB
Executable File
2026-03-27 修订记录 - Promoter分析可视化完善
项目
bbav20311 - Promoter分析模块
今日完成内容
1. Promoter分析核心功能增强
1.1 unknown/Unnamed元件过滤
- 问题: PlantCARE输出包含大量"unknown"和"Unnamed__X"元件
- 解决: 在
parse_plantcare_output()中添加过滤逻辑 - 效果: 4,271 → 3,699有效元件(过滤572个)
- 输出:
plantCARE_output_filtered.tab,filtered_elements_stats.txt
1.2 启动子分析报告生成
- 新增:
generate_promoter_report()函数 - 内容:
- 分析概览、Top 20元件、13类别统计
- 生物学解读(激素、胁迫、TF结合等)
- 高级分析: 富集分析、共现模式、复杂度评分
- 输出:
{prefix}.promoter_report.md
1.3 高级分析功能
| 分析类型 | 函数 | 输出文件 | 结果 |
|---|---|---|---|
| 亚家族富集 | calculate_enrichment() |
{prefix}_enrichment_analysis.txt |
160个富集对 |
| 元件共现 | calculate_cooccurrence() |
{prefix}_cooccurrence_analysis.txt |
1,819个显著对 |
| 复杂度评分 | calculate_promoter_complexity() |
{prefix}_promoter_complexity.txt |
23个基因分析 |
2. 增强可视化 (8种图表)
2.1 最终版本V4
脚本: scripts/promoter_v4_final.R
| 编号 | 图表类型 | 说明 |
|---|---|---|
| 01 | 三合一组合 | 外部树图+7分类结构+红绿热图 |
| 02 | 7大分类细分 | 每类Top 10元件 |
| 03 | 全热图 | 全基因×全元件,红绿配色 |
| 04 | 堆叠图 | 7分类堆叠 |
2.2 关键改进
- 进化树图: 使用
pdftoppm将PDF转为PNG读取,保留原有样式 - 红绿配色: RdYlGn调色板
#d73027(深红) →#fc8d59(橙红) →#fee08b(黄)#d9ef8b(浅绿) →#91cf60(绿) →#1a9850(深绿)
- 图例: 热图右侧显示Count图例
2.3 7大分类定义
| 分类 | 颜色 | 包含元件 |
|---|---|---|
| Core promoter | #e41a1c | TATA, CAAT, Inr |
| Light response | #377eb8 | G-box, GT1, I-box |
| Hormone signaling | #4daf4a | ABRE, GA, JA, SA, Auxin, Ethylene |
| Stress response | #984ea3 | DRE, LTR, ARE, STRE |
| TF binding | #ff7f00 | MYB, MYC, WRKY |
| Development | #f781bf | RY, AAGAA, CAT |
| Other | #999999 | 未分类 |
3. 修改的文件
Python代码
apps/cli/run_promoter.py- 添加
should_filter_element() - 添加
categorize_element() - 添加
generate_promoter_report() - 添加
calculate_enrichment() - 添加
calculate_cooccurrence() - 添加
calculate_promoter_complexity()
- 添加
R代码
scripts/promoter_v4_final.R(最终版本)
修订记录文档
REVISION_PROMOTER_20250327.mdREVISION_PROMOTER_V2_20250327.mdREVISION_PROMOTER_V3_20250327.mdREVISION_PROMOTER_V4_20250327.mdREVISION_PROMOTER_V4_FINAL_20250327.md
4. 生物学发现 (Ft.SPL示例)
元件分布
- Core promoter: 2,565 (69.3%) - TATA-box(1,460), CAAT-box(852)
- Hormone signaling: 255 (6.9%)
- Light response: 188 (5.1%)
- Stress response: 177 (4.8%)
- TF binding: 196 (5.3%)
共现模式
- CAAT-box + MYB: 23基因
- CAAT-box + TATA-box: 23基因
- Hub元件: Box 4, CAAT-box, MYB (各75连接)
复杂度
- 平均: 241.4分
- 最高: FtPinG0006337300 (361.44分)
- 所有基因均为"Very High"复杂度
5. 运行方式
# Python分析
python apps/cli/run_promoter.py \
--input-dir input/job_xxx \
--workspace workspace/job_xxx \
--prefix Ft.SPL
# R可视化
Rscript scripts/promoter_v4_final.R \
[树PDF] [分组文件] [启动子文件] [描述文件] [输出前缀]
测试状态
✅ Syntax check: PASSED
✅ Filter function: 572 elements filtered
✅ Categorization: 13 categories assigned
✅ Report generation: SUCCESS
✅ Enrichment analysis: 160 pairs
✅ Co-occurrence analysis: 1,819 pairs
✅ Complexity scoring: 23 genes
✅ R visualization: 8/8 files generated
✅ External tree PDF reading: SUCCESS
✅ Red-green color scheme: RdYlGn applied
时间
- 开始: 2026-03-27 10:56
- 完成: 2026-03-27 20:30
- 总时长: ~10小时
备注
- 使用test4py311环境运行R脚本
- 需要R包: tidyverse, ggtree, treeio, ape, patchwork, aplot, RColorBrewer
- 系统依赖: pdftoppm (用于PDF转PNG)