Files
2026-07-10 17:59:59 +08:00

161 lines
3.7 KiB
Markdown
Executable File

# Neo4j 知识图谱 Schema 设计
## 实体类型 (Nodes)
### 1. GeneFamily (基因家族)
```cypher
(:GeneFamily {
name: string, // 基因家族名称,如 "SPL"
full_name: string, // 全称,如 "SQUAMOSA PROMOTER BINDING PROTEIN-LIKE"
description: string, // 描述
pfam_ids: [string], // 相关Pfam ID
interpro_ids: [string] // 相关InterPro ID
})
```
### 2. Gene (基因)
```cypher
(:Gene {
id: string, // 基因ID,如 "FtSPL1"
name: string, // 基因名称
species: string, // 物种
chromosome: string, // 染色体位置
start: int, // 起始位置
end: int, // 终止位置
strand: string, // 正负链
sequence: string // 序列(可选)
})
```
### 3. Species (物种)
```cypher
(:Species {
name: string, // 物种名,如 "Solanum lycopersicum"
common_name: string, // 常用名,如 "Tomato"
taxonomy_id: string // NCBI Taxonomy ID
})
```
### 4. PhylogenyGroup (系统发育分组)
```cypher
(:PhylogenyGroup {
name: string, // 分组名,如 "Group_I"
gene_family: string, // 所属基因家族
description: string // 分组描述
})
```
### 5. Domain (蛋白结构域)
```cypher
(:Domain {
name: string, // 结构域名,如 "SBP"
pfam_id: string, // Pfam ID
description: string // 描述
})
```
### 6. Motif (Motif)
```cypher
(:Motif {
id: string, // Motif ID
name: string, // Motif名称
pattern: string // 序列模式
})
```
### 7. Publication (文献)
```cypher
(:Publication {
doi: string, // DOI
pmid: string, // PubMed ID
pmcid: string, // PMC ID
title: string, // 标题
authors: [string], // 作者列表
year: int, // 发表年份
journal: string // 期刊
})
```
## 关系类型 (Relationships)
### 1. BELONGS_TO (基因属于家族)
```cypher
(g:Gene)-[:BELONGS_TO]->(gf:GeneFamily)
```
### 2. FROM_SPECIES (基因来自物种)
```cypher
(g:Gene)-[:FROM_SPECIES]->(s:Species)
```
### 3. IN_GROUP (基因在分组中)
```cypher
(g:Gene)-[:IN_GROUP]->(pg:PhylogenyGroup)
```
### 4. HAS_DOMAIN (基因有结构域)
```cypher
(g:Gene)-[:HAS_DOMAIN {count: int, positions: [string]}]->(d:Domain)
```
### 5. HAS_MOTIF (基因有Motif)
```cypher
(g:Gene)-[:HAS_MOTIF {position: int, score: float}]->(m:Motif)
```
### 6. ORTHOLOG (直系同源)
```cypher
(g1:Gene)-[:ORTHOLOG {identity: float, coverage: float}]->(g2:Gene)
```
### 7. PARALOG (旁系同源)
```cypher
(g1:Gene)-[:PARALOG {identity: float, coverage: float}]->(g2:Gene)
```
### 8. COEXPRESSED (共表达)
```cypher
(g1:Gene)-[:COEXPRESSED {correlation: float, tissue: string}]->(g2:Gene)
```
### 9. CITED_IN (基因家族被文献引用)
```cypher
(gf:GeneFamily)-[:CITED_IN {confidence: float}]->(p:Publication)
```
## 索引设计
```cypher
// 基因ID索引
CREATE INDEX gene_id_idx FOR (g:Gene) ON (g.id);
// 基因家族名称索引
CREATE INDEX family_name_idx FOR (gf:GeneFamily) ON (gf.name);
// 物种名称索引
CREATE INDEX species_name_idx FOR (s:Species) ON (s.name);
// 文献DOI索引
CREATE INDEX publication_doi_idx FOR (p:Publication) ON (p.doi);
```
## Cypher 查询示例
### 查询某基因家族的所有基因
```cypher
MATCH (gf:GeneFamily {name: 'SPL'})<-[:BELONGS_TO]-(g:Gene)
RETURN g.id, g.name
```
### 查询某分组的所有基因
```cypher
MATCH (pg:PhylogenyGroup {name: 'Group_I'})<-[:IN_GROUP]-(g:Gene)
RETURN g.id, g.name
```
### 查询两个基因的共表达关系
```cypher
MATCH (g1:Gene {id: 'FtSPL1'})-[c:COEXPRESSED]-(g2:Gene {id: 'FtSPL2'})
RETURN c.correlation, c.tissue
```