[ PROMPT_NODE_26608 ]
Gene Database API 参考
[ SKILL_DOCUMENTATION ]
# NCBI Gene API 参考
本文档提供了以编程方式访问 NCBI Gene 数据库的详细 API 文档。
## 目录
1. [E-utilities API](#e-utilities-api)
2. [NCBI Datasets API](#ncbi-datasets-api)
3. [身份验证和速率限制](#authentication-and-rate-limits)
4. [错误处理](#error-handling)
---
## E-utilities API
E-utilities (Entrez Programming Utilities) 为 NCBI 的 Entrez 数据库提供了稳定的接口。
### 基础 URL
https://eutils.ncbi.nlm.nih.gov/entrez/eutils/
### 通用参数
- `db` - 数据库名称(基因数据库使用 `gene`)
- `api_key` - 用于更高速率限制的 API 密钥
- `retmode` - 返回格式 (json, xml, text)
- `retmax` - 返回的最大记录数
### ESearch - 搜索数据库
搜索匹配文本查询的基因。
**端点:** `esearch.fcgi`
**参数:**
- `db=gene` (必需) - 要搜索的数据库
- `term` (必需) - 搜索查询
- `retmax` - 最大结果数 (默认: 20)
- `retmode` - json 或 xml (默认: xml)
- `usehistory=y` - 将结果存储在历史服务器上,适用于大数据集
**查询语法:**
- 基因符号: `BRCA1[gene]` 或 `BRCA1[gene name]`
- 生物体: `human[organism]` 或 `9606[taxid]`
- 组合术语: `BRCA1[gene] AND human[organism]`
- 疾病: `muscular dystrophy[disease]`
- 染色体: `17q21[chromosome]`
- GO 术语: `GO:0006915[biological process]`
**请求示例:**
bash
curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=gene&term=BRCA1[gene]+AND+human[organism]&retmode=json"
**响应格式 (JSON):**
{
"esearchresult": {
"count": "1",
"retmax": "1",
"retstart": "0",
"idlist": ["672"],
"translationset": [],
"querytranslation": "BRCA1[Gene Name] AND human[Organism]"
}
}
### ESummary - 文档摘要
检索基因 ID 的文档摘要。
**端点:** `esummary.fcgi`
**参数:**
- `db=gene` (必需) - 数据库
- `id` (必需) - 逗号分隔的基因 ID(最多 500 个)
- `retmode` - json 或 xml (默认: xml)
**请求示例:**
bash
curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=gene&id=672&retmode=json"
**响应格式 (JSON):**
{
"result": {
"672": {
"uid": "672",
"name": "BRCA1",
"description": "BRCA1 DNA repair associated",
"organism": {
"scientificname": "Homo sapiens",
"commonname": "human",
"taxid": 9606
},
"chromosome": "17",