Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bio-entrez-fetch

БесплатноЗапускает вложенные скриптыНе проверен

Retrieve records from NCBI databases using Biopython Bio.Entrez (EFetch, ESummary). Use when downloading sequences, fetching GenBank/GenPept records, getting…

gabrielmoreiraот gabrielmoreira★ 23 звезды на GitHub

Об этом скилле

Version Compatibility

Reference examples tested with: BioPython 1.83+, Entrez Direct 21.0+

Before using code patterns, verify installed versions match. If versions differ:

  • Python: pip show biopython then help(Bio.Entrez.efetch) to check signatures
  • CLI: efetch -version then efetch -help to confirm flags

If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.

Entrez Fetch

"Download a record by accession from NCBI" -> EFetch returns the full record content in a chosen format (FASTA, GenBank, XML, MEDLINE, etc.). ESummary returns a lightweight "docsum" object — much faster when only metadata is needed.

The agent's first decision is always: does this workflow need the full record, or just metadata? ESummary is 5-10x cheaper than EFetch for the equivalent record set. For "tell me the organism, length, and definition line for 10,000 accessions", ESummary wins by an order of magnitude.

  • Python: Entrez.efetch(db=..., id=..., rettype=..., retmode=...) (BioPython)
  • CLI: efetch -db nucleotide -id NM_007294 -format gb (Entrez Direct, NBK179288)
  • R: entrez_fetch(db=..., id=..., rettype=...) (rentrez)

Required Setup

from Bio import Entrez, SeqIO
Entrez.email = '[email protected]'
Entrez.api_key = 'optional_api_key'  # raises rate to 10 req/sec

Decision matrix: rettype + retmode per database

The combinations are not orthogonal — each (db, rettype, retmode) triple is enabled or disabled by NCBI server-side. Wrong combinations return either silent empty responses or HTTP 400. The triples below are the safe, current set.

nucleotide / protein

rettype retmode Returns Use when
fasta text FASTA Just need sequence + defline
gb (nuc) / gp (prot) text Full flat file Need annotations, features, references
gbwithparts text GB with CONTIG sequences inlined Whole-genome shotgun assemblies; default gb returns CONTIG records requiring a chase to resolve
fasta_cds_na text CDS-only nucleotide Extract coding regions from annotated GB
fasta_cds_aa text CDS-translated AA Get translated proteins from GB record in one call
xml (== gb XML) xml INSDSeq XML Programmatic parsing; the schema is unversioned and shifts
acc text Accession.version per line Just resolve UID -> accession
seqid text Internal seq-id Rarely needed

pubmed

rettype retmode Returns Use when
abstract text Title + authors + abstract Reading abstracts
medline text MEDLINE flat Parsing with Bio.Medline
xml xml Full PubMed XML Programmatic — get MeSH, grants, PMC link
(omitted) (omitted) Defaults to XML EFetch default for pubmed is XML — pass retmode='xml' explicitly for clarity

gene

rettype retmode Returns Use when
gene_table text Tabular per-transcript layout Exon coordinates
xml xml Full Entrez Gene XML Everything else — name, synonyms, GeneRIFs, locus

sra

rettype retmode Returns Use when
runinfo text CSV of run metadata Convert SRA UID -> SRR accession + Run metrics
xml xml Full SRA XML hierarchy Need BioSample/BioProject linkage in one call

taxonomy

rettype retmode Returns Use when
xml xml (default) TaxNode XML Lineage, parent, common name

gds (GEO)

rettype retmode Returns Use when
(default — no rettype) text Plaintext SOFT-style summary Quick metadata; for full series matrix go to FTP

EFetch for GDS records is intentionally minimal — full GEO downloads go via the FTP mirror or GEOparse. See geo-data skill.

GI deprecation (still bites in 2026)

NCBI stopped issuing new GI numbers for major nucleotide/protein submissions starting 2017. Records submitted after the cutoff have only accession.version identifiers. Many older scripts assume id=<numeric_gi>; passing a modern accession string also works, but mixing the two in one comma-separated id list is the bug.

Rules:

  • For modern code, always pass accession.version strings.
  • A bare accession without .version resolves to the latest version — fine for exploratory work, dangerous for reproducibility.
  • Old id=12345 GI lookups still work for records issued before 2017, but a search returning a UID that looks like a GI may actually be the legacy GI for an old record — assume UID is an opaque identifier.
  • EFetch accepts comma-separated IDs of mixed types but the URL has a ~2000 char practical limit; chunk large ID lists into batches.

ESummary vs EFetch triage

Need ESummary EFetch (text) EFetch (xml)
Title, organism, length yes overkill overkill
Autho
Полный SKILL.md на GitHub

Установить bio-entrez-fetch в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/fetch_pubmed.pyexamples/fetch_sequences.pyexamples/fetch_summaries.pyusage-guide.md

FAQ

Что делает скилл bio-entrez-fetch?

Retrieve records from NCBI databases using Biopython Bio.Entrez (EFetch, ESummary). Use when downloading sequences, fetching GenBank/GenPept records, getting document summaries, parsing nested XML, navigating GI deprecation, choosing between rettype+retmode combinations, and parsing into Biopython SeqRecord/SwissProt objects. Covers nucleotide, protein, gene, pubmed, sra, gds, taxonomy, snp, clinvar.

Как установить скилл bio-entrez-fetch?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bio-entrez-fetch запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить bio-entrez-fetch с