Ncbi Sequence Fetch
Google DeepMindOfficialPublished by Google DeepMind
- Skill
- Tool integration
- Science and research
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The ncbi-sequence-fetch skill provides a structured interface to NCBI's Entrez E-utilities for retrieving biological sequence data. It supports multiple retrieval methods including direct accession lookups, CDS translation, gene and locus-based searches, PubMed-linked sequence extraction, and patent sequence retrieval. The tool outputs structured JSON data and includes a fallback mechanism for searching by organism and sequence length.
What it does
- Fetches protein and nucleotide sequences by accession number.
- Translates CDS and nucleotide records into protein sequences.
- Searches NCBI databases using gene names, locus tags, or free-text queries.
- Extracts protein sequences linked to specific PubMed articles.
- Retrieves sequences from patent records using patent numbers or keywords.
- Performs organism-based searches filtered by sequence length.
When to use it
- When you need to obtain protein or nucleotide FASTA data from NCBI.
- When you have a gene name or locus tag but lack a direct accession number.
- When you need to extract sequences associated with a specific research publication.
- When you need to retrieve sequences cited in patent documentation.
- When you need to translate nucleotide CDS records into protein sequences.
Advantages
- Automates complex E-utility workflows into simple command-line subcommands.
- Provides consistent JSON output for downstream data processing.
- Includes built-in rate limit management for NCBI API interactions.
- Supports a wide range of search strategies from direct lookups to last-resort length matching.
Usage examples
- “Fetch the protein sequence for accession XP_022033624.”
- The tool retrieves the protein FASTA record and saves it as a JSON file.
- “Find proteins linked to PubMed ID 24896089.”
- The tool follows the link from the PubMed article to the associated protein records and returns the sequences.
- “Search for the WRR4B gene in Arabidopsis thaliana.”
- The tool queries the NCBI Protein database and returns matching sequences for the specified gene and organism.
- “Translate the nucleotide sequence MK034466 to protein.”
- The tool fetches the record and performs a CDS translation, returning the resulting protein sequence.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/google-deepmind/ncbi-sequence-fetch/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip ncbi-sequence-fetch.zip -d .agents/skills
Documentation by Google DeepMind
NCBI Sequence Fetch
Prerequisites
uv: Read theuvskill and follow its Setup instructions to ensureuvis installed and on PATH.User Notification: If .licenses/ncbi_sequence_fetch_LICENSE.txt does not already exist in the workspace root directory then (1) prominently notify the user to check the terms at https://www.ncbi.nlm.nih.gov/ and https://www.ncbi.nlm.nih.gov/home/about/policies/, then (2) create the file recording the notification text and timestamp.
.envfile: Make sure the.envfile exists in your home directory. Create one if it does not exist.NCBI_API_KEY(optional): Raises the NCBI rate limit from 3 to 10 requests/second. The skill works without it, but a key is recommended if the user plans many queries or encounters a 429 error. You can register for a key for free at https://www.ncbi.nlm.nih.gov/account/settings/. You MUST use the safe credentials protocol in thecredentialsskill to check for and request this key if this skill looks relevant to the user's request.
Core Rules
Use the Wrapper: ALWAYS execute the provided helper scripts to query the database rather than accessing the database directly. The scripts automatically enforce the required rate limit gracefully.
API Key Support: If the user provides an
NCBI_API_KEYin their environment, the query speed limits are automatically increased significantly.Notification: If this skill is used, ensure this is mentioned in the output.
Overview
Wraps NCBI's Entrez E-utilities (efetch, esearch, elink, esummary) for retrieving protein and nucleotide sequences. Provides 10 subcommands covering the full range of sequence retrieval workflows:
fetch-protein— Direct protein accession lookup (GenPept, RefSeq)fetch-nucleotide— Direct nucleotide accession lookupcds-translate— Fetch CDS and translate to protein (3 methods)search— Free-text search of any NCBI databaseelink— Follow cross-database links (PubMed→Protein, etc.)gene-protein— Search protein by gene name + organismlocus-protein— Search protein by locus tag + organismpubmed-proteins— Find proteins linked to a PubMed articlepatent-search— Extract protein sequences from patentsorganism-length— Last-resort search by organism + exact AA length
Utility Scripts
scripts/ncbi_fetch.py — Single script with subcommands.
All subcommands write structured JSON output. Use --output FILE to save to a
file, or omit it to print to stdout. A human-readable summary is always printed
to stdout.
1. Fetch Protein by Accession
Fetches protein FASTA from NCBI by accession (XP_, NP_, GenPept, etc.)
uv run scripts/ncbi_fetch.py fetch-protein XP_022033624 -o /tmp/result.json
uv run scripts/ncbi_fetch.py fetch-protein NP_001234567 ABC12345.12. Fetch Nucleotide by Accession
Fetches nucleotide FASTA from NCBI by accession.
uv run scripts/ncbi_fetch.py fetch-nucleotide MK034466 -o /tmp/result.json3. CDS Translate
Fetches a CDS/nucleotide accession and translates to protein sequence. Tries
three approaches in order: 1. NCBI's pre-translated CDS protein (fasta_cds_aa)
GenBank XML CDS annotation translations 3. Raw nucleotide → 6-frame ORF finding
uv run scripts/ncbi_fetch.py cds-translate MK034466 -o /tmp/result.json
uv run scripts/ncbi_fetch.py cds-translate HQ662330 --target-length 1043If the accession is a genomic record (not mRNA/CDS), the tool will report
is_genomic: true so you can fall back to a homology-based approach instead.
4. Search Any Database
Free-text search using Entrez query syntax. Supports all NCBI databases.
# Search protein database
uv run scripts/ncbi_fetch.py search "WRR4B[Gene Name] AND Arabidopsis[Organism]" \
--database protein --retmax 5 --fetch-sequences
# Search nucleotide database
uv run scripts/ncbi_fetch.py search "Rz2[Gene Name] AND Beta vulgaris[Organism]" \
--database nuccore --retmax 10
# Search with patent filter
uv run scripts/ncbi_fetch.py search "disease resistance AND Solanum[Organism] AND patent[Properties]" \
--database protein --fetch-sequences
# Search by sequence length
uv run scripts/ncbi_fetch.py search '"Oryza sativa"[Organism] AND 1043[SLEN]' \
--database protein --fetch-sequences --retmax 505. Cross-Database Links (elink)
Follow NCBI's cross-database links (e.g., PubMed article → linked proteins).
uv run scripts/ncbi_fetch.py elink 24896089 --dbfrom pubmed --db protein \
--fetch-sequences -o /tmp/linked.json6. Gene + Organism Search
Searches for protein sequences by gene name and organism. Searches NCBI Protein
with [Gene Name] and [Organism] qualifiers.
uv run scripts/ncbi_fetch.py gene-protein WRR4B --organism "Arabidopsis thaliana"
uv run scripts/ncbi_fetch.py gene-protein Pikh-2 --organism "Oryza sativa" \
--target-length 1043 -o /tmp/result.json7. Locus Tag Search
Searches by locus tag in both NCBI Protein and Nuccore databases. Extracts CDS translations from GenBank XML when direct protein hits aren't available.
uv run scripts/ncbi_fetch.py locus-protein At1g56540 --organism "Arabidopsis thaliana"
uv run scripts/ncbi_fetch.py locus-protein Niben101Scf02422g02015.1 \
--organism "Nicotiana benthamiana" -o /tmp/result.json8. PubMed-Linked Proteins
Finds protein sequences linked to a PubMed article. Searches NCBI Protein by PMID, follows elink PubMed→Protein, and extracts CDS translations from linked Nuccore records.
uv run scripts/ncbi_fetch.py pubmed-proteins 30692254 --identifier WRR4B
uv run scripts/ncbi_fetch.py pubmed-proteins 24896089 --identifier "K2" \
-o /tmp/result.json9. Patent Sequence Search
Two modes:
By patent number — fetches all protein sequences from a specific patent:
bash uv run scripts/ncbi_fetch.py patent-search --patent-number US10123456 -o /tmp/patent.json
By keywords — searches NCBI Protein with patent[Properties] filter: bash uv run scripts/ncbi_fetch.py patent-search --keywords WRR4B Albugo --organism "Arabidopsis thaliana" -o /tmp/patent.json
[!IMPORTANT] Patent convention: In molecular biology patents, SEQ ID NO: 1 is typically the DNA sequence and SEQ ID NO: 2 is the primary protein. Higher SEQ ID NOs are variants or related sequences. Prefer Sequence 2 when selecting the primary protein of interest.
10. Organism + Length Search
Last-resort search when only organism and expected protein length are known.
Uses NCBI's [SLEN] filter for exact length matching.
uv run scripts/ncbi_fetch.py organism-length \
--organism "Arabidopsis thaliana" --length 1048 --retmax 50 \
-o /tmp/result.json[!NOTE] This often returns multiple candidates. Use the JSON output headers to identify the correct protein.
Workflow
Standard Sequence Retrieval Cascade
When trying to find a protein sequence, follow this priority order:
Direct accession —
fetch-proteinwith GenPept/RefSeq accessionCDS translation —
cds-translatewith nucleotide/CDS accessionPubMed-linked —
pubmed-proteinswith PMID + gene nameLocus lookup —
locus-proteinwith locus tag + organismGene + organism —
gene-proteinwith gene name + organismPatent search —
patent-searchwith patent number or keywordsOrganism + length —
organism-lengthas last resort
Interpreting Results
All subcommands return JSON with a
resultsarrayEach result has
sequence(AA string),length, andheader/metadataWhen multiple results are returned, select by:
Closest match to expected length (
target_length)Header relevance (matching gene name, "disease resistance" keywords)
Source priority (RefSeq > GenPept > patent)
Reference
NCBI E-utilities docs: https://www.ncbi.nlm.nih.gov/books/NBK25499/
Entrez search syntax: https://www.ncbi.nlm.nih.gov/books/NBK49540/
Database list: protein, nuccore, gene, pubmed, pmc, biosample, etc.
Common accession formats:
XP_/NP_— NCBI RefSeq proteinAAAtoAZZ+ digits — GenPept (translated GenBank)MK,MN,HQ, etc. + digits — GenBank nucleotideENSG,ENST,ENSP— Ensembl (useensembl-databaseskill instead)Q,P,O+ digits — UniProt (useuniprot-databaseskill instead)
Files
- ATTRIBUTION.mdAdded by AutoGineer920 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md8.9 KiB
- references/citation.bib1.8 KiB
- scripts/ncbi_fetch.pyScript35.1 KiB
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an API key, Needs Python
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Google DeepMind
- Publisher
- Google DeepMind (Official)
- Source
- google-deepmind/science-skills · skills/ncbi_sequence_fetch · commit 4de6786
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google DeepMind.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download ncbi-sequence-fetch.zip