Command Palette

Search for a command to run...

Назад к скиллам
скилл № 40691

bio-biomart-queries

Bulk-query Ensembl BioMart (and other BioMart instances) for cross-database ID mapping, gene/transcript/exon coordinates, and ortholog tables. Use when…

БесплатноЗапускает вложенные скрипты
BioTender-maxот BioTender-max★ 235 звёзд на GitHub

Установить bio-biomart-queries в Claude Code и Claude Desktop

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

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

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

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

Version Compatibility

Reference examples tested with: pybiomart 0.9+, R biomaRt 2.58+ (Bioconductor); Ensembl BioMart (release 110+)

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

  • Python: pip show pybiomart
  • R: packageVersion('biomaRt')

The BioMart XML query format is stable across Ensembl releases; the underlying mart names and attribute IDs can change between Ensembl releases. For published work, pin the Ensembl release via useEnsembl(version=110).

BioMart Queries

"Bulk-convert IDs / pull coordinate tables / extract ortholog wide tables" -> BioMart is the right answer for any Ensembl-rooted query producing >5,000 rows. It is a separate service from the Ensembl REST API, with separate rate behavior and a different query model (XML-based, batch-oriented). For one-off lookups (<100 records), Ensembl REST is more convenient; for bulk anything, BioMart wins.

The single most important fact: BioMart returns a flat table from a single query. There is no per-record loop, no rate-limit cascade, no async polling. One XML query in; one TSV out.

  • Python: pybiomart (https://github.com/jrderuiter/pybiomart) is the lightest client
  • R: biomaRt Bioconductor (Durinck et al. 2009 Nat Protoc 4:1184) is the canonical client
  • CLI: curl against the XML endpoint works but is rarely used directly
  • Web: https://www.ensembl.org/biomart/martview for interactive query design

Installation

pip install pybiomart pandas
# R:
# BiocManager::install('biomaRt')

BioMart hierarchy

Level Examples
Mart ENSEMBL_MART_ENSEMBL (genes), ENSEMBL_MART_SNP (variants), ENSEMBL_MART_MOUSE (mouse-specific)
Dataset hsapiens_gene_ensembl, mmusculus_gene_ensembl, etc. (per species)
Attribute Fields to return: ensembl_gene_id, external_gene_name, chromosome_name, etc.
Filter Constraints on the query: chromosome_name = 17, biotype = protein_coding, etc.

A query is: pick a mart, pick a dataset, list attributes to return, list filters to constrain. BioMart returns a single TSV.

Discovery:

from pybiomart import Server
server = Server(host='http://www.ensembl.org')
print(server.marts)                                          # list marts
mart = server['ENSEMBL_MART_ENSEMBL']
print(mart.datasets)                                         # list datasets (species)
ds = mart['hsapiens_gene_ensembl']
print(ds.attributes)                                         # list attributes
print(ds.filters)                                            # list filters

Decision matrix: BioMart vs Ensembl REST

Question BioMart Ensembl REST
Bulk ID mapping (>5000 IDs) yes (1 query) rate-limited cascade
Single-gene lookup overkill yes
Coordinate tables for thousands of genes yes rate-limited
Ortholog wide-table across species yes (multi-species mart) per-gene loop
VEP variant annotation no yes (or local VEP)
Sequence retrieval partial yes
Real-time no (batch) yes (per-record)
Reproducibility (version pin) useEnsembl(version=110) archive URL e110.rest.ensembl.org

For >5K rows, BioMart is the right tool. For real-time per-record lookups, REST.

Common attribute selectors

Attribute Returns
ensembl_gene_id Stable Ensembl Gene ID
ensembl_gene_id_version With .N version suffix
external_gene_name HGNC symbol (or species-equivalent)
hgnc_id, hgnc_symbol HGNC permanent ID and symbol
entrezgene_id NCBI Gene ID
refseq_mrna, refseq_peptide RefSeq accessions
uniprotswissprot, uniprotsptrembl UniProt accessions
chromosome_name, start_position, end_position, strand Gene coordinates
transcript_count, exon_count Counts
biotype protein_coding, lncRNA, miRNA, etc.
description Free-text gene description
go_id, name_1006, namespace_1003 GO term ID, name, namespace

Common filter selectors

Filter Constraint
ensembl_gene_id List of Gene IDs
external_gene_name List of symbols
entrezgene_id List of NCBI Gene IDs
chromosome_name One or more chromosomes
start / end Coordinate range
biotype One or more biotypes
with_<source> Boolean: has cross-ref to <source> (e.g. with_hpa = has Human Protein Atlas)

Code patterns

Bulk ID mapping: Ensembl Gene -> HGNC + RefSeq + UniProt

Goal: Convert 5,000 Ensembl Gene IDs to HGNC symbols, RefSeq mRNA accessions, and UniProt accessions in one query.

Approach: pybiomart query with three attributes; ID list as a filter; returns one TSV.

Reference (pybiomart 0.9+, Ensembl release 110+):

from pybiomart import Server
import pandas as pd

server = Server(host='http://www.ensembl.org')
mart = server['ENSEMBL_MART_ENSEMBL']
ds = mart['hsapiens_gene_ensembl']

ensembl_ids = ['ENSG
Полный SKILL.md на GitHub

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

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

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

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

  • examples/bulk_id_mapping.py
  • examples/coordinate_table.sh
  • examples/ortholog_table.py
  • usage-guide.md

FAQ

Что делает скилл bio-biomart-queries?

Bulk-query Ensembl BioMart (and other BioMart instances) for cross-database ID mapping, gene/transcript/exon coordinates, and ortholog tables. Use when batch-converting Ensembl IDs to other namespaces (HGNC, RefSeq, UniProt, Entrez), pulling gene coordinate tables for thousands of genes, building ortholog wide-tables across species, or replacing slow Ensembl REST loops with one-shot bulk export. Encodes BioMart's XML query format, R biomaRt vs Python pybiomart trade-off, mart-vs-dataset hierarchy, and the URL endpoint that's BioMart-specific (separate from rest.ensembl.org).

Как установить скилл bio-biomart-queries?

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

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

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

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

Сравнить bio-biomart-queries с