skills/43-wentorai-research-plugins/skills/domains/biomedical/ncbi-blast-api/SKILL.md
Run sequence similarity searches via the NCBI BLAST REST API
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research ncbi-blast-apiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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={
"CMD": "Get",
"FORMAT_OBJECT": "SearchInfo",
"RID": rid,
})
if "Status=READY" in resp.text:
return True
if "Status=FAILED" in resp.text:
raise RuntimeError("BLAST search failed")
time.sleep(poll_interval)
elapsed += poll_interval
raise TimeoutError(f"BLAST timed out after {max_wait}s")
def get_results(rid: str) -> list:
"""Retrieve BLAST results as parsed hits."""
resp = requests.get(BLAST_URL, params={
"CMD": "Get",
"FORMAT_TYPE": "XML",
"RID": rid,
})
resp.raise_for_status()
root = ElementTree.fromstring(resp.text)
ns = ""
hits = []
for hit in root.iter(f"{ns}Hit"):
hsps = hit.find(f"{ns}Hit_hsps")
hsp = hsps.find(f"{ns}Hsp") if hsps is not None else None
hits.append({
"accession": hit.findtext(f"{ns}Hit_accession", ""),
"description": hit.findtext(f"{ns}Hit_def", ""),
"length": int(hit.findtext(f"{ns}Hit_len", "0")),
"evalue": float(hsp.findtext(f"{ns}Hsp_evalue", "999"))
if hsp is not None else 999,
"identity": float(hsp.findtext(f"{ns}Hsp_identity", "0"))
if hsp is not None else 0,
"score": float(hsp.findtext(f"{ns}Hsp_bit-score", "0"))
if hsp is not None else 0,
})
return hits
# Example: BLAST a short DNA sequence
rid = submit_blast("ATGCGATCGATCGATCGATCGATCG", program="blastn")
print(f"Submitted BLAST search: {rid}")
wait_for_results(rid)
hits = get_results(rid)
for h in hits[:5]:
print(f"{h['accession']}: {h['description'][:60]}...")
print(f" E-value: {h['evalue']:.2e} | Identity: {h['identity']}")
development
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.