关于 uniprot
此 skill 通过 HTTP 请求使用 UniProt REST API 获取蛋白质序列和注释,操作在本地执行。适用于需要搜索条目、查看结构域或变异信息,以及查找 PDB 交叉引用的工作流。
主要功能
- 01获取 FASTA 序列和 JSON 条目
- 02按查询词和物种搜索
- 03读取结构域注释
- 04收集天然变异和 PDB 引用
适用场景
- 01按基因或名称查找蛋白质条目
- 02查看蛋白质的结构域和变异
- 03查找条目关联的 PDB 结构
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ adaptyvbio/ protein-design-skills --skill uniprot安装后在 Claude Code 中输入/uniprot确认已加载。
详细介绍
UniProt 数据库访问
注意:此技能直接使用 UniProt REST API。无需部署 Modal——所有操作都通过 HTTP 请求在本地运行。
获取序列
按登录号
# FASTA format
curl "https://rest.uniprot.org/uniprotkb/P00533.fasta"
# JSON format with annotations
curl "https://rest.uniprot.org/uniprotkb/P00533.json"
使用 Python
import requests
def get_uniprot_sequence(accession):
"""Fetch sequence from UniProt."""
url = f"https://rest.uniprot.org/uniprotkb/{accession}.fasta"
response = requests.get(url)
if response.ok:
lines = response.text.strip().split('\n')
header = lines[0]
sequence = ''.join(lines[1:])
return header, sequence
return None, None
获取注释
完整条目
def get_uniprot_entry(accession):
"""Fetch full UniProt entry as JSON."""
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"Protein: {entry['proteinDescription']['recommendedName']['fullName']['value']}")
结构域边界
def get_domains(accession):
"""Extract domain annotations."""
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
# Example: EGFR domains
domains = get_domains("P00533")
# [{'name': 'Kinase', 'start': 712, 'end': 979}, ...]
搜索 UniProt
按基因名称
def search_uniprot(query, organism=None, limit=10):
"""Search UniProt by query."""
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']
# Search for human EGFR
results = search_uniprot("EGFR", organism=9606)
按序列相似性(BLAST)
# Use UniProt BLAST
# https://www.uniprot.org/blast
交叉引用
获取 PDB 结构
def get_pdb_references(accession):
"""Get PDB structures for UniProt entry."""
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
# Example: PDB structures for EGFR
pdbs = get_pdb_references("P00533")
常见用例
靶标选择
# 1. Find protein by name
results = search_uniprot("insulin receptor", organism=9606)
# 2. Get accession
accession = results[0]['primaryAccession'] # e.g., P06213
# 3. Get domains
domains = get_domains(accession)
# 4. Find PDB structure
pdbs = get_pdb_references(accession)
# 5. Download best structure for design
序列比对信息
def get_sequence_variants(accession):
"""Get natural variants from 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) 速率限制:在请求之间添加延迟 大型下载:使用带分页的 stream 端点
下一步:使用 esm 获取嵌入,或使用 chai / boltz 获取结构。
评论
支持 Markdown