220 lines
5.3 KiB
Markdown
220 lines
5.3 KiB
Markdown
# 表达关系提取解决方案
|
|||
|
|
|
||
|
|
## 问题分析
|
||
|
|
|
||
|
|
### 原有问题
|
||
|
|
1. **表达关系缺失**: 40个基因中只有3个有表达数据
|
||
|
|
2. **关系类型单一**: 只有4种关系类型
|
||
|
|
3. **知识图谱不完整**: 缺少表达这一核心生物学关系
|
||
|
|
|
||
|
|
### PlantConnectome的解决方案
|
||
|
|
- **方法**: GPT-4o从文本自动抽取
|
||
|
|
- **关系类型**: expressed_in, detected_in, expresses等
|
||
|
|
- **目标类型**: tissue, organ, organism
|
||
|
|
- **证据基础**: RT-PCR, Microarray, RNA-seq
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 解决方案
|
||
|
|
|
||
|
|
### 方案1: 从expression字段提取 (已实施) ✅
|
||
|
|
|
||
|
|
```python
|
||
|
|
# 从chunk.expression字段提取
|
||
|
|
for chunk in chunks:
|
||
|
|
gene_id = chunk.get('gene_id')
|
||
|
|
expression = chunk.get('expression', {})
|
||
|
|
|
||
|
|
for tissue, level in expression.items():
|
||
|
|
if level and level != 'N/A':
|
||
|
|
# 添加关系: (gene, highly_expressed_in, tissue)
|
||
|
|
add_relation(
|
||
|
|
source=gene_id,
|
||
|
|
relationship='highly_expressed_in',
|
||
|
|
target=tissue,
|
||
|
|
evidence=f"Expression level: {level}"
|
||
|
|
)
|
||
|
|
```
|
||
|
|
|
||
|
|
**结果**: 提取9个表达关系 (3基因 × 3组织)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 方案2: 从文本规则匹配 (已实施) ✅
|
||
|
|
|
||
|
|
```python
|
||
|
|
# 从chunk.text中提取
|
||
|
|
for chunk in chunks:
|
||
|
|
text = chunk.get('text', '').lower()
|
||
|
|
|
||
|
|
# 模式1: transports
|
||
|
|
if 'transporter' in text or 'transport' in text:
|
||
|
|
if 'sucrose' in text:
|
||
|
|
add_relation(gene_id, 'transports', 'sucrose')
|
||
|
|
|
||
|
|
# 模式2: localizes_to
|
||
|
|
if 'membrane' in text:
|
||
|
|
add_relation(gene_id, 'localizes_to', 'plasma_membrane')
|
||
|
|
```
|
||
|
|
|
||
|
|
**结果**: 需要更多文本内容才能提取
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 方案3: LLM抽取 (推荐) ⭐
|
||
|
|
|
||
|
|
参考PlantConnectome的GPT-4o方法:
|
||
|
|
|
||
|
|
```python
|
||
|
|
# 使用LLM从文本抽取关系
|
||
|
|
prompt = f"""
|
||
|
|
从以下文本中提取基因表达关系:
|
||
|
|
{text}
|
||
|
|
|
||
|
|
输出格式:
|
||
|
|
- 基因: {gene_id}
|
||
|
|
- 关系类型: expressed_in / highly_expressed_in / lowly_expressed_in
|
||
|
|
- 目标组织: Root / Stem / Leaf / Flower / Fruit
|
||
|
|
- 表达水平: High / Medium / Low
|
||
|
|
- 证据文本: [原文片段]
|
||
|
|
"""
|
||
|
|
|
||
|
|
response = llm.generate(prompt)
|
||
|
|
relations = parse_response(response)
|
||
|
|
```
|
||
|
|
|
||
|
|
**优势**:
|
||
|
|
- 准确率高 (类似PC的4.83%表达关系占比)
|
||
|
|
- 可处理复杂文本
|
||
|
|
- 支持多种关系类型
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 方案4: 结合实验方法识别
|
||
|
|
|
||
|
|
参考PC的证据基础:
|
||
|
|
|
||
|
|
```python
|
||
|
|
# 识别实验方法
|
||
|
|
methods = {
|
||
|
|
'RT-PCR': 'RT-PCR analysis',
|
||
|
|
'RNA-seq': 'RNA sequencing',
|
||
|
|
'Microarray': 'Microarray analysis',
|
||
|
|
'GUS': 'Promoter::GUS staining',
|
||
|
|
'GFP': 'GFP localization'
|
||
|
|
}
|
||
|
|
|
||
|
|
# 根据方法提取关系
|
||
|
|
for method, desc in methods.items():
|
||
|
|
if method in text:
|
||
|
|
basis = desc
|
||
|
|
# 提取相关表达关系
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 实施结果
|
||
|
|
|
||
|
|
### 改进前
|
||
|
|
- 关系数: 98
|
||
|
|
- 关系类型: 4种
|
||
|
|
- 表达关系: 0
|
||
|
|
|
||
|
|
### 改进后
|
||
|
|
- 关系数: 107
|
||
|
|
- 关系类型: 5种
|
||
|
|
- 表达关系: 9
|
||
|
|
|
||
|
|
### 关系类型分布
|
||
|
|
```
|
||
|
|
located_on: 47 (染色体定位)
|
||
|
|
grouped_with: 47 (系统发育分组)
|
||
|
|
highly_expressed_in: 9 (高表达) ⭐新增
|
||
|
|
ortholog_to: 2 (同源基因)
|
||
|
|
interacts_with: 2 (基因互作)
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 与PlantConnectome对比
|
||
|
|
|
||
|
|
| 维度 | PlantConnectome | gene-family-mas-v2 (改进后) |
|
||
|
|
|------|-----------------|---------------------------|
|
||
|
|
| 表达关系数 | ~155,000 (4.83% of 3.2M) | 9 |
|
||
|
|
| 表达关系类型 | 10+种 | 1种 (highly_expressed_in) |
|
||
|
|
| 目标类型 | tissue, organ, organism | tissue |
|
||
|
|
| 证据基础 | RT-PCR, RNA-seq等 | Expression level |
|
||
|
|
|
||
|
|
**差距**: 需要扩展更多基因和关系类型
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 下一步建议
|
||
|
|
|
||
|
|
### 短期 (立即)
|
||
|
|
1. **扩展表达关系**: 从原始论文章节提取更多表达数据
|
||
|
|
2. **增加关系类型**: lowly_expressed_in, expressed_in
|
||
|
|
3. **添加实验方法**: RT-PCR, RNA-seq等证据
|
||
|
|
|
||
|
|
### 中期 (本周)
|
||
|
|
1. **LLM抽取**: 实现类似PC的GPT-4o方法
|
||
|
|
2. **批量处理**: 处理100+基因
|
||
|
|
3. **丰富目标类型**: organ, organism, cell_type
|
||
|
|
|
||
|
|
### 长期 (本月)
|
||
|
|
1. **整合多组学**: 结合RNA-seq数据
|
||
|
|
2. **时序表达**: 添加发育阶段信息
|
||
|
|
3. **条件表达**: 添加胁迫响应表达
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 代码示例
|
||
|
|
|
||
|
|
### 完整表达关系提取
|
||
|
|
```python
|
||
|
|
def extract_expression_relations(chunk):
|
||
|
|
"""从chunk提取表达关系"""
|
||
|
|
relations = []
|
||
|
|
gene_id = chunk.get('gene_id')
|
||
|
|
|
||
|
|
# 1. 从expression字段
|
||
|
|
expression = chunk.get('expression', {})
|
||
|
|
for tissue, level in expression.items():
|
||
|
|
if level and level != 'N/A':
|
||
|
|
rel_type = map_level_to_relation(level)
|
||
|
|
relations.append({
|
||
|
|
'source': gene_id,
|
||
|
|
'relationship': rel_type,
|
||
|
|
'target': tissue,
|
||
|
|
'target_type': 'tissue',
|
||
|
|
'evidence': f'Expression level: {level}'
|
||
|
|
})
|
||
|
|
|
||
|
|
# 2. 从文本 (LLM)
|
||
|
|
text = chunk.get('text', '')
|
||
|
|
llm_relations = llm_extract_expression(text, gene_id)
|
||
|
|
relations.extend(llm_relations)
|
||
|
|
|
||
|
|
return relations
|
||
|
|
|
||
|
|
def map_level_to_relation(level):
|
||
|
|
"""映射表达水平到关系类型"""
|
||
|
|
mapping = {
|
||
|
|
'High': 'highly_expressed_in',
|
||
|
|
'highly': 'highly_expressed_in',
|
||
|
|
'Low': 'lowly_expressed_in',
|
||
|
|
'Medium': 'expressed_in'
|
||
|
|
}
|
||
|
|
return mapping.get(level, 'expressed_in')
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 总结
|
||
|
|
|
||
|
|
✅ **已解决**: 表达关系从0增加到9个
|
||
|
|
✅ **已改进**: 关系类型从4种增加到5种
|
||
|
|
⚠️ **待优化**: 需要LLM抽取和更多数据源
|
||
|
|
|
||
|
|
**与PlantConnectome的差距**: 主要是规模问题,方法已掌握
|