名称: uniprot 描述: > 访问UniProt数据库,用于检索蛋白质序列和注释信息。 使用此技能的场景:(1) 通过登录号查找蛋白质序列,(2) 查找功能注释,(3) 获取结构域边界,(4) 查找同源蛋白和变异体,(5) 交叉引用PDB结构。
如需检索结构信息,请使用pdb技能。 如需进行序列设计,请使用proteinmpnn技能。 许可证: MIT 类别: 实用工具 标签: [数据库, 序列, 注释]
UniProt数据库访问
注意: 此技能直接使用UniProt REST API。无需Modal部署 - 所有操作均通过HTTP请求在本地运行。
获取序列
通过登录号
# FASTA格式
curl "https://rest.uniprot.org/uniprotkb/P00533.fasta"
# JSON格式(含注释)
curl "https://rest.uniprot.org/uniprotkb/P00533.json"
使用Python
import requests
def get_uniprot_sequence(accession):
"""从UniProt获取序列。"""
url = f"https://rest.uniprot.org/uniprotkb/{accession}.fasta"
response = requests.get(url)
if response.ok:
lines = response.text.strip().split('
')
header = lines[0]
sequence = ''.join(lines[1:])
return header, sequence
return None, None
获取注释信息
完整条目
def get_uniprot_entry(accession):
"""以JSON格式获取完整的UniProt条目。"""
url = f"https://rest.uniprot.org/uniprotkb/{accession}.json"
response = requests.get(url)
return response.json() if response.ok else None
entry = get_uniprot_entry("P00533")
print(f"蛋白质: {entry['proteinDescription']['recommendedName']['fullName']['value']}")
结构域边界
def get_domains(accession):
"""提取结构域注释。"""
entry = get_uniprot_entry(accession)
domains = []
for feature in entry.get('features', []):
if feature['type'] == 'Domain':
domains.append({
'name': feature.get('description', ''),
'start': feature['location']['start']['value'],
'end': feature['location']['end']['value']
})
return domains
# 示例:EGFR结构域
domains = get_domains("P00533")
# [{'name': '激酶', 'start': 712, 'end': 979}, ...]
搜索UniProt
通过基因名称
def search_uniprot(query, organism=None, limit=10):
"""通过查询词搜索UniProt。"""
url = "https://rest.uniprot.org/uniprotkb/search"
params = {
"query": query,
"format": "json",
"size": limit
}
if organism:
params["query"] += f" AND organism_id:{organism}"
response = requests.get(url, params=params)
return response.json()['results']
# 搜索人类EGFR
results = search_uniprot("EGFR", organism=9606)
通过序列相似性(BLAST)
# 使用UniProt BLAST
# https://www.uniprot.org/blast
交叉引用
获取PDB结构
def get_pdb_references(accession):
"""获取UniProt条目对应的PDB结构。"""
entry = get_uniprot_entry(accession)
pdbs = []
for xref in entry.get('uniProtKBCrossReferences', []):
if xref['database'] == 'PDB':
pdbs.append({
'pdb_id': xref['id'],
'method': xref.get('properties', [{}])[0].get('value', ''),
'chains': xref.get('properties', [{}])[1].get('value', '')
})
return pdbs
# 示例:EGFR的PDB结构
pdbs = get_pdb_references("P00533")
常见用例
靶标选择
# 1. 通过名称查找蛋白质
results = search_uniprot("胰岛素受体", organism=9606)
# 2. 获取登录号
accession = results[0]['primaryAccession'] # 例如:P06213
# 3. 获取结构域
domains = get_domains(accession)
# 4. 查找PDB结构
pdbs = get_pdb_references(accession)
# 5. 下载最佳结构用于设计
序列比对信息
def get_sequence_variants(accession):
"""从UniProt获取天然变异体。"""
entry = get_uniprot_entry(accession)
variants = []
for feature in entry.get('features', []):
if feature['type'] == 'Natural variant':
variants.append({
'position': feature['location']['start']['value'],
'original': feature.get('alternativeSequence', {}).get('originalSequence', ''),
'variant': feature.get('alternativeSequence', {}).get('alternativeSequences', [''])[0],
'description': feature.get('description', '')
})
return variants
API参考
| 端点 | 描述 |
|---|---|
/uniprotkb/{id}.fasta |
FASTA序列 |
/uniprotkb/{id}.json |
完整条目JSON |
/uniprotkb/search |
搜索条目 |
/uniprotkb/stream |
批量下载 |
故障排除
条目未找到: 检查登录号格式(例如:P00533) 速率限制: 在请求之间添加延迟 大型下载: 使用流式端点配合分页
下一步: 使用esm技能获取序列嵌入,或使用colabfold技能进行结构预测。