关于 monarch-database
monarch-database 是围绕 Monarch Initiative 多物种整合知识库的研究技能,面向遗传学与罕见病研究。它通过 API 支持表型、基因、疾病及模式生物之间的关联查询。
主要功能
- 01按 HPO 表型查找候选基因
- 02查询疾病与基因关联
- 03检索基因相关表型
- 04查找并搜索 HPO 术语
- 05比较疾病表型相似度
- 06跨物种查询直系同源基因
适用场景
- 01根据患者表型筛选罕见病候选基因
- 02比较两种疾病的表型特征
- 03为人类疾病寻找动物模型
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ leonchaox/ qinyan-academic-skills --skill monarch-database安装后在 Claude Code 中输入/monarch-database确认已加载。
附带文件references/phenotype_ontology.md
详细介绍
Monarch Initiative 数据库
概述
Monarch Initiative(https://monarchinitiative.org/)是一个跨物种集成知识库,整合人类和模式生物中的基因、疾病与表型信息。它汇集了 40 多个来源的数据,包括 OMIM、ORPHANET、HPO(人类表型本体)、ClinVar、MGI(小鼠基因组信息学)、ZFIN(斑马鱼)、RGD(大鼠)、FlyBase 和 WormBase。
Monarch 支持:
- 跨物种映射表型,以识别候选疾病基因
- 查找与某种疾病或表型相关的所有基因
- 发现人类疾病的模式生物
- 浏览 HPO 层级结构,进行表型本体查询
主要资源:
- Monarch 门户:https://monarchinitiative.org/
- Monarch API v3:https://api-v3.monarchinitiative.org/v3/
- API 文档:https://api-v3.monarchinitiative.org/v3/docs
- HPO 浏览器:https://hpo.jax.org/
何时使用此技能
以下情况可使用 Monarch:
- 罕见病基因发现:患者的表型(HPO 术语)与哪些基因相关?
- 表型相似性:两种疾病的表型特征是否相似?
- 跨物种建模:是否有针对目标疾病的小鼠或斑马鱼模型?
- HPO 术语查询:检索 HPO 术语名称、定义和本体层级结构
- 疾病-表型映射:列出与特定疾病相关的所有 HPO 术语
- 基因-表型关联:某个基因中的变异会导致哪些表型?
- 直系同源基因-表型映射:利用动物模型表型推断人类基因功能
核心功能
1. Monarch API v3
基础 URL:https://api-v3.monarchinitiative.org/v3/
import requests
BASE_URL = "https://api-v3.monarchinitiative.org/v3"
def monarch_get(endpoint, params=None):
"""Make a GET request to the Monarch API."""
url = f"{BASE_URL}/{endpoint}"
response = requests.get(url, params=params, headers={"Accept": "application/json"})
response.raise_for_status()
return response.json()
2. 表型到基因关联(Pheno2Gene)
def get_genes_for_phenotypes(hpo_ids, limit=50, offset=0):
"""
Find genes associated with a list of HPO phenotype terms.
Core use case: rare disease differential diagnosis.
Args:
hpo_ids: List of HPO term IDs (e.g., ["HP:0001250", "HP:0004322"])
limit: Maximum number of results
"""
params = {
"terms": hpo_ids,
"limit": limit,
"offset": offset
}
return monarch_get("semsim/termset-pairwise-similarity/analyze", params)
def phenotype_to_gene(hpo_ids):
"""
Return genes whose phenotypes match the given HPO terms.
Uses semantic similarity scoring.
"""
# Use the /association endpoint for direct phenotype-gene links
all_genes = []
for hpo_id in hpo_ids:
data = monarch_get("association/all", {
"subject": hpo_id,
"predicate": "biolink:has_phenotype",
"category": "biolink:GeneToPhenotypicFeatureAssociation",
"limit": 50
})
for assoc in data.get("items", []):
all_genes.append({
"phenotype_id": hpo_id,
"gene_id": assoc.get("object", {}).get("id"),
"gene_name": assoc.get("object", {}).get("name"),
"evidence": assoc.get("evidence_type")
})
return all_genes
# Example: Find genes associated with seizures and short stature
hpo_terms = ["HP:0001250", "HP:0004322"] # Seizures, Short stature
genes = phenotype_to_gene(hpo_terms)
3. 疾病到基因关联
def get_genes_for_disease(disease_id, limit=100):
"""
Get all genes associated with a disease.
Disease IDs: OMIM:146300, MONDO:0007739, ORPHANET:558, etc.
"""
params = {
"object": disease_id,
"category": "biolink:DiseaseToDiseaseAssociation",
"limit": limit
}
# Use the gene-disease association endpoint
gene_params = {
"subject": disease_id,
"category": "biolink:GeneToPhenotypicFeatureAssociation",
"limit": limit
}
data = monarch_get("association/all", {
"object": disease_id,
"predicate": "biolink:has_phenotype",
"limit": limit
})
return data
def get_disease_genes(disease_id, limit=100):
"""Get genes causally linked to a disease."""
data = monarch_get("association/all", {
"subject_category": "biolink:Gene",
"object": disease_id,
"predicate": "biolink:causes",
"limit": limit
})
return data.get("items", [])
# MONDO disease IDs (preferred over OMIM for cross-ontology queries)
# MONDO:0007739 - Huntington disease
# MONDO:0009061 - Cystic fibrosis
# OMIM:104300 - Alzheimer disease, susceptibility to, type 1
4. 基因到表型和疾病
def get_phenotypes_for_gene(gene_id, limit=100):
"""
Get all phenotypes associated with a gene.
Gene IDs: HGNC:7884, NCBIGene:4137, etc.
"""
data = monarch_get("association/all", {
"subject": gene_id,
"predicate": "biolink:has_phenotype",
"limit": limit
})
return data.get("items", [])
def get_diseases_for_gene(gene_id, limit=100):
"""Get diseases caused by variants in a gene."""
data = monarch_get("association/all", {
"subject": gene_id,
"object_category": "biolink:Disease",
"limit": limit
})
return data.get("items", [])
# Example: What diseases does BRCA1 cause?
brca1_diseases = get_diseases_for_gene("HGNC:1100")
for assoc in brca1_diseases:
print(f" {assoc.get('object', {}).get('name')} ({assoc.get('object', {}).get('id')})")
5. HPO 术语查询
def get_hpo_term(hpo_id):
"""Fetch information about an HPO term."""
return monarch_get(f"entity/{hpo_id}")
def search_hpo_terms(query, limit=20):
"""Search for HPO terms by name."""
params = {
"q": query,
"category": "biolink:PhenotypicFeature",
"limit": limit
}
return monarch_get("search", params)
# Example: look up the HPO term for seizures
seizure_term = get_hpo_term("HP:0001250")
print(f"Name: {seizure_term.get('name')}")
print(f"Definition: {seizure_term.get('description')}")
# Search for related terms
epilepsy_terms = search_hpo_terms("epilepsy")
for term in epilepsy_terms.get("items", [])[:5]:
print(f" {term['id']}: {term['name']}")
6. 语义相似性(疾病比较)
def compare_disease_phenotypes(disease_id_1, disease_id_2):
"""
Compare two diseases by semantic similarity of their phenotype profiles.
Returns similarity score using HPO hierarchy.
"""
params = {
"subjects": [disease_id_1],
"objects": [disease_id_2],
"metric": "ancestor_information_content"
}
return monarch_get("semsim/compare", params)
# Example: Compare Dravet syndrome with CDKL5-deficiency disorder
similarity = compare_disease_phenotypes("MONDO:0100135", "MONDO:0014917")
7. 跨物种直系同源基因
def get_orthologs(gene_id, species=None):
"""
Get orthologs of a human gene in model organisms.
Useful for finding animal models of human diseases.
"""
params = {"limit": 50}
if species:
params["subject_taxon"] = species
data = monarch_get("association/all", {
"subject": gene_id,
"predicate": "biolink:orthologous_to",
"limit": 50
})
return data.get("items", [])
# NCBI Taxonomy IDs for common model organisms:
# Mouse: 10090 (Mus musculus)
# Zebrafish: 7955 (Danio rerio)
# Fruit fly: 7227 (Drosophila melanogaster)
# C. elegans: 6239
# Rat: 10116 (Rattus norvegicus)
8. 完整工作流:罕见病基因优先级排序
import requests
import pandas as pd
def rare_disease_gene_finder(patient_hpo_terms, candidate_gene_ids=None, top_n=20):
"""
Find genes that match a patient's HPO phenotype profile.
Args:
patient_hpo_terms: List of HPO IDs from clinical assessment
candidate_gene_ids: Optional list to restrict search
top_n: Number of top candidates to return
"""
BASE_URL = "https://api-v3.monarchinitiative.org/v3"
# 1. Find genes associated with each phenotype
gene_phenotype_counts = {}
for hpo_id in patient_hpo_terms:
data = requests.get(
f"{BASE_URL}/association/all",
params={
"object": hpo_id,
"subject_category": "biolink:Gene",
"limit": 100
}
).json()
for item in data.get("items", []):
gene_id = item.get("subject", {}).get("id")
gene_name = item.get("subject", {}).get("name")
if gene_id:
if gene_id not in gene_phenotype_counts:
gene_phenotype_counts[gene_id] = {"name": gene_name, "count": 0, "phenotypes": []}
gene_phenotype_counts[gene_id]["count"] += 1
gene_phenotype_counts[gene_id]["phenotypes"].append(hpo_id)
# 2. Rank by number of matching phenotypes
ranked = sorted(gene_phenotype_counts.items(),
key=lambda x: -x[1]["count"])[:top_n]
results = []
for gene_id, info in ranked:
results.append({
"gene_id": gene_id,
"gene_name": info["name"],
"matching_phenotypes": info["count"],
"total_patient_phenotypes": len(patient_hpo_terms),
"phenotype_overlap": info["count"] / len(patient_hpo_terms),
"matching_hpo_terms": info["phenotypes"]
})
return pd.DataFrame(results)
# Example usage
patient_phenotypes = [
"HP:0001250", # Seizures
"HP:0004322", # Short stature
"HP:0001252", # Hypotonia
"HP:0000252", # Microcephaly
"HP:0001263", # Global developmental delay
]
candidates = rare_disease_gene_finder(patient_phenotypes)
print(candidates[["gene_name", "matching_phenotypes", "phenotype_overlap"]].to_string())
查询工作流
工作流 1:基于 HPO 的鉴别诊断
- 从临床记录或遗传咨询中提取 HPO 术语
- 在 Monarch 中运行表型到基因查询
- 按匹配表型的数量为候选基因排序
- 与 gnomAD(约束评分)和 ClinVar(变异证据)进行交叉比对
- 优先考虑 pLI 值较高且有已知致病变异的基因
工作流 2:疾病模型发现
- 确定目标基因或疾病
- 在 Monarch 中查询跨物种直系同源基因
- 在模式生物数据库中查找表型关联
- 确定能够重现人类疾病特征的实验模型
工作流 3:新基因的表型注释
- 对于功能未知的基因,查询所有已知的表型关联
- 映射到 HPO 层级结构,以了解受影响的身体系统
- 与 OMIM 和 ORPHANET 交叉比对,查找疾病关联
常见标识符前缀
| 前缀 | 命名空间 | 示例 |
|---|---|---|
HP: | 人类表型本体 | HP:0001250(癫痫发作) |
MONDO: | Monarch 疾病本体 | MONDO:0007739 |
OMIM: | OMIM 疾病 | OMIM:104300 |
ORPHANET: | Orphanet 罕见病 | ORPHANET:558 |
HGNC: | HGNC 基因符号 | HGNC:7884 |
NCBIGene: | NCBI 基因 ID | NCBIGene:4137 |
ENSEMBL: | Ensembl 基因 | ENSEMBL:ENSG... |
MGI: | 小鼠基因 | MGI:1338833 |
ZFIN: | 斑马鱼基因 | ZFIN:ZDB-GENE... |
最佳实践
- 疾病使用 MONDO ID — 它们统一了 OMIM/ORPHANET/MESH 标识符
- 表型使用 HPO ID — 这是临床表型描述的标准
- 处理分页:大型查询可能需要使用 offset 参数进行迭代
- 语义相似度优于精确匹配:HPO 祖先术语可以涵盖相关表型
- 使用 ClinVar 和 OMIM 进行交叉验证:Monarch 汇总了许多来源,质量不一
- 基因使用 HGNC ID:与基因符号相比,在不同数据库版本间更加稳定
更多资源
- Monarch 门户:https://monarchinitiative.org/
- API v3 文档:https://api-v3.monarchinitiative.org/v3/docs
- HPO 浏览器:https://hpo.jax.org/
- MONDO 本体:https://mondo.monarchinitiative.org/
- 引用:Shefchek KA 等(2020),Nucleic Acids Research。PMID: 31701156
- Phenomizer(基于 HPO 的诊断):https://compbio.charite.de/phenomizer/
评论
支持 Markdown