用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/brycewang-stanford/Auto-Empirical-Research-Skills --skill ncbi-blast-api命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | ncbi-blast-api |
| description | Run sequence similarity searches via the NCBI BLAST REST API |
| metadata | {"openclaw":{"emoji":"🧪","category":"domains","subcategory":"biomedical","keywords":["BLAST","sequence alignment","NCBI","homology search","protein similarity","nucleotide search"],"source":"https://blast.ncbi.nlm.nih.gov/"}} |
BLAST (Basic Local Alignment Search Tool) is the most widely used bioinformatics tool, comparing nucleotide or protein sequences against databases to find regions of similarity. The NCBI BLAST REST API enables programmatic submission of searches, status polling, and result retrieval. Free, no authentication required (but rate-limited).
BLAST searches are asynchronous: submit → poll → retrieve.
# Nucleotide BLAST (blastn)
curl -X POST "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi" \
-d "CMD=Put&PROGRAM=blastn&DATABASE=nt&QUERY=ATGCGATCGATCG..."
# Protein BLAST (blastp)
curl -X POST "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi" \
-d "CMD=Put&PROGRAM=blastp&DATABASE=nr&QUERY=MKTLLLTLVVVTIVCL..."
# BLAST with specific parameters
curl -X POST "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi" \
-d "CMD=Put&PROGRAM=blastn&DATABASE=nt&QUERY=SEQUENCE&\
EXPECT=0.001&WORD_SIZE=11&HITLIST_SIZE=50"
# Poll for completion (returns XML with Status field)
curl "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Get&FORMAT_OBJECT=SearchInfo&RID=YOUR_RID"
# Get results in XML
curl "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Get&FORMAT_TYPE=XML&RID=YOUR_RID"
# Get results in JSON
curl "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Get&FORMAT_TYPE=JSON2_S&RID=YOUR_RID"
# Get results in tabular format
curl "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Get&FORMAT_TYPE=Tabular&RID=YOUR_RID"
| Program | Query → Database | Use case |
|---|---|---|
blastn | Nucleotide → Nucleotide | DNA/RNA similarity |
blastp | Protein → Protein | Protein homology |
blastx | Translated nuc → Protein | Find protein homologs of DNA |
tblastn | Protein → Translated nuc | Find DNA encoding similar protein |
tblastx | Translated nuc → Translated nuc | Compare at protein level |
| Database | Content |
|---|---|
nt | All GenBank nucleotide sequences |
nr | Non-redundant protein sequences |
refseq_rna | RefSeq RNA sequences |
refseq_protein | RefSeq protein sequences |
swissprot | UniProtKB/Swiss-Prot (curated) |
pdb | Protein Data Bank sequences |
| Parameter | Description | Default |
|---|---|---|
PROGRAM | BLAST program | Required |
DATABASE | Target database | Required |
QUERY | Sequence or accession | Required |
EXPECT | E-value threshold | 10 |
WORD_SIZE | Word size | 11 (blastn), 6 (blastp) |
HITLIST_SIZE | Max results | 100 |
MATRIX | Scoring matrix (protein) | BLOSUM62 |
FILTER | Low complexity filter | L |
ENTREZ_QUERY | Restrict to organism | Homo sapiens[ORGN] |
import time
import requests
from xml.etree import ElementTree
BLAST_URL = "https://blast.ncbi.nlm.nih.gov/blast/Blast.cgi"
def submit_blast(sequence: str, program: str = "blastn",
database: str = "nt",
evalue: float = 0.001) -> str:
"""Submit a BLAST search, return Request ID."""
resp = requests.post(BLAST_URL, data={
"CMD": "Put",
"PROGRAM": program,
"DATABASE": database,
"QUERY": sequence,
"EXPECT": evalue,
"HITLIST_SIZE": 50,
})
resp.raise_for_status()
for line in resp.text.split("\n"):
if "RID = " in line:
return line.split("=")[1].strip()
raise ValueError("No RID in response")
def wait_for_results(rid: str, poll_interval: int = 15,
max_wait: int = 300) -> bool:
"""Poll until BLAST search completes."""
elapsed = 0
while elapsed < max_wait:
resp = requests.get(BLAST_URL, params={
: ,
: ,
: rid,
})
resp.text:
resp.text:
RuntimeError()
time.sleep(poll_interval)
elapsed += poll_interval
TimeoutError()
() -> :
resp = requests.get(BLAST_URL, params={
: ,
: ,
: rid,
})
resp.raise_for_status()
root = ElementTree.fromstring(resp.text)
ns =
hits = []
hit root.():
hsps = hit.find()
hsp = hsps.find() hsps
hits.append({
: hit.findtext(, ),
: hit.findtext(, ),
: (hit.findtext(, )),
: (hsp.findtext(, ))
hsp ,
: (hsp.findtext(, ))
hsp ,
: (hsp.findtext(, ))
hsp ,
})
hits
rid = submit_blast(, program=)
()
wait_for_results(rid)
hits = get_results(rid)
h hits[:]:
()
()