Source: https://github.com/aipoch/medical-research-skills
Ensembl Database Skill
When to Use
- Use this skill when you need access ensembl rest api for vertebrate genomic data; use when you need gene/id lookups, sequence retrieval, variant effect prediction (vep), or homology/assembly coordinate mapping in a reproducible workflow.
- Use this skill when a evidence insight task needs a packaged method instead of ad-hoc freeform output.
- Use this skill when the user expects a concrete deliverable, validation step, or file-based result.
- Use this skill when
scripts/query_ensembl.py is the most direct path to complete the request.
- Use this skill when you need the
ensembl-database package behavior rather than a generic answer.
Key Features
- Scope-focused workflow aligned to: Access Ensembl REST API for vertebrate genomic data; use when you need gene/ID lookups, sequence retrieval, variant effect prediction (VEP), or homology/assembly coordinate mapping.
- Packaged executable path(s):
scripts/query_ensembl.py.
- Reference material available in
references/ for task-specific guidance.
- Structured execution path designed to keep outputs consistent and reviewable.
Dependencies
Python: 3.10+. Repository baseline for current packaged skills.
Third-party packages: not explicitly version-pinned in this skill package. Add pinned versions if this skill needs stricter environment control.
Example Usage
cd "20260316/scientific-skills/Evidence Insight/ensembl-database"
python -m py_compile scripts/query_ensembl.py
python scripts/query_ensembl.py --help
Example run plan:
- Confirm the user input, output path, and any required config values.
- Edit the in-file
CONFIG block or documented parameters if the script uses fixed settings.
- Run
python scripts/query_ensembl.py with the validated inputs.
- Review the generated output and return the final artifact with any assumptions called out.
Implementation Details
- Execution model: validate the request, choose the packaged workflow, and produce a bounded deliverable.
- Input controls: confirm the source files, scope limits, output format, and acceptance criteria before running any script.
- Primary implementation surface:
scripts/query_ensembl.py.
- Reference guidance:
references/ contains supporting rules, prompts, or checklists.
- Parameters to clarify first: input path, output path, scope filters, thresholds, and any domain-specific constraints.
- Output discipline: keep results reproducible, identify assumptions explicitly, and avoid undocumented side effects.
1. When to Use
- Gene-centric queries: When you need to resolve a gene symbol or region to Ensembl identifiers and basic annotations (e.g.,
BRCA2 in human).
- Sequence extraction: When you need DNA/cDNA/protein sequences for a known Ensembl gene/transcript/protein ID in FASTA or JSON.
- Variant interpretation: When you need to predict functional consequences of variants using VEP from HGVS notation.
- Comparative genomics: When you need ortholog/paralog relationships across vertebrate species.
- Assembly/coordinate mapping: When you need to map coordinates between assemblies (e.g., GRCh37 ↔ GRCh38).
2. Key Features
- Query Ensembl REST endpoints for:
- Gene lookup by symbol, Ensembl ID, or genomic region
- Sequence retrieval (DNA, cDNA, protein) in FASTA/JSON
- Variant Effect Predictor (VEP) analysis from HGVS inputs
- Homology retrieval (orthologs/paralogs)
- Assembly/coordinate mapping between common human assemblies
- CLI helper script for repeatable queries:
scripts/query_ensembl.py (wrapper around an ensembl_rest client)
- Reference documentation for endpoints:
3. Dependencies
- Python
>=3.8
ensembl_rest (Python client; version depends on your environment)
- Network access to
https://rest.ensembl.org
4. Example Usage
CLI: Gene lookup by symbol
python scripts/query_ensembl.py --action lookup --species human --symbol BRCA2
CLI: Retrieve sequence by Ensembl ID
python scripts/query_ensembl.py --action sequence --id ENSG00000139618
CLI: Variant effect prediction (VEP) by HGVS
python scripts/query_ensembl.py --action vep --species human --hgvs "ENST00000380152.8:c.68_69delAG"
5. Implementation Details
Script entry point
- Tool:
scripts/query_ensembl.py
- Purpose: Provide a simple command-line interface that dispatches to Ensembl REST calls via an
ensembl_rest client.
Core parameters
--action: Operation selector.
- Supported values:
lookup, sequence, vep
--species: Target species name used by Ensembl REST (e.g., human).
--symbol: Gene symbol used for lookup actions (e.g., BRCA2).
--id: Ensembl stable ID used for sequence retrieval (e.g., ENSG..., ENST..., ENSP...).
--hgvs: HGVS notation string used for VEP (e.g., ENST...:c.123A>G).
Data types and outputs
- Lookup: Returns gene/transcript metadata as provided by Ensembl REST.
- Sequence: Returns DNA/cDNA/protein sequence; format depends on the endpoint/options (commonly FASTA or JSON).
- VEP: Returns consequence annotations and (when available) population frequency fields as provided by Ensembl VEP REST responses.
Endpoint reference
For the exact REST paths, required parameters, and response schemas, see:
1---2name: ensembl-database3description: Access Ensembl REST API for vertebrate genomic data; use when you need gene/ID lookups, sequence retrieval, variant effect prediction (VEP), or homology/assembly coordinate mapping.4license: MIT5---6> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)78# Ensembl Database Skill910## When to Use1112- Use this skill when you need access ensembl rest api for vertebrate genomic data; use when you need gene/id lookups, sequence retrieval, variant effect prediction (vep), or homology/assembly coordinate mapping in a reproducible workflow.13- Use this skill when a evidence insight task needs a packaged method instead of ad-hoc freeform output.14- Use this skill when the user expects a concrete deliverable, validation step, or file-based result.15- Use this skill when `scripts/query_ensembl.py` is the most direct path to complete the request.16- Use this skill when you need the `ensembl-database` package behavior rather than a generic answer.1718## Key Features1920- Scope-focused workflow aligned to: Access Ensembl REST API for vertebrate genomic data; use when you need gene/ID lookups, sequence retrieval, variant effect prediction (VEP), or homology/assembly coordinate mapping.21- Packaged executable path(s): `scripts/query_ensembl.py`.22- Reference material available in `references/` for task-specific guidance.23- Structured execution path designed to keep outputs consistent and reviewable.2425## Dependencies2627- `Python`: `3.10+`. Repository baseline for current packaged skills.28- `Third-party packages`: `not explicitly version-pinned in this skill package`. Add pinned versions if this skill needs stricter environment control.2930## Example Usage3132```bash33cd "20260316/scientific-skills/Evidence Insight/ensembl-database"34python -m py_compile scripts/query_ensembl.py35python scripts/query_ensembl.py --help36```3738Example run plan:391. Confirm the user input, output path, and any required config values.402. Edit the in-file `CONFIG` block or documented parameters if the script uses fixed settings.413. Run `python scripts/query_ensembl.py` with the validated inputs.424. Review the generated output and return the final artifact with any assumptions called out.4344## Implementation Details4546- Execution model: validate the request, choose the packaged workflow, and produce a bounded deliverable.47- Input controls: confirm the source files, scope limits, output format, and acceptance criteria before running any script.48- Primary implementation surface: `scripts/query_ensembl.py`.49- Reference guidance: `references/` contains supporting rules, prompts, or checklists.50- Parameters to clarify first: input path, output path, scope filters, thresholds, and any domain-specific constraints.51- Output discipline: keep results reproducible, identify assumptions explicitly, and avoid undocumented side effects.5253## 1. When to Use5455- **Gene-centric queries**: When you need to resolve a gene symbol or region to Ensembl identifiers and basic annotations (e.g., `BRCA2` in human).56- **Sequence extraction**: When you need DNA/cDNA/protein sequences for a known Ensembl gene/transcript/protein ID in FASTA or JSON.57- **Variant interpretation**: When you need to predict functional consequences of variants using **VEP** from HGVS notation.58- **Comparative genomics**: When you need ortholog/paralog relationships across vertebrate species.59- **Assembly/coordinate mapping**: When you need to map coordinates between assemblies (e.g., GRCh37 ↔ GRCh38).6061## 2. Key Features6263- Query Ensembl REST endpoints for:64 - **Gene lookup** by symbol, Ensembl ID, or genomic region65 - **Sequence retrieval** (DNA, cDNA, protein) in FASTA/JSON66 - **Variant Effect Predictor (VEP)** analysis from HGVS inputs67 - **Homology** retrieval (orthologs/paralogs)68 - **Assembly/coordinate mapping** between common human assemblies69- CLI helper script for repeatable queries:70 - `scripts/query_ensembl.py` (wrapper around an `ensembl_rest` client)71- Reference documentation for endpoints:72 - `references/api_endpoints.md`73 - Ensembl REST base URL: https://rest.ensembl.org7475## 3. Dependencies7677- Python `>=3.8`78- `ensembl_rest` (Python client; version depends on your environment)79- Network access to `https://rest.ensembl.org`8081## 4. Example Usage8283### CLI: Gene lookup by symbol8485```bash86python scripts/query_ensembl.py --action lookup --species human --symbol BRCA287```8889### CLI: Retrieve sequence by Ensembl ID9091```bash92python scripts/query_ensembl.py --action sequence --id ENSG0000013961893```9495### CLI: Variant effect prediction (VEP) by HGVS9697```bash98python scripts/query_ensembl.py --action vep --species human --hgvs "ENST00000380152.8:c.68_69delAG"99```100101## 5. Implementation Details102103### Script entry point104105- **Tool**: `scripts/query_ensembl.py`106- **Purpose**: Provide a simple command-line interface that dispatches to Ensembl REST calls via an `ensembl_rest` client.107108### Core parameters109110- `--action`: Operation selector.111 - Supported values: `lookup`, `sequence`, `vep`112- `--species`: Target species name used by Ensembl REST (e.g., `human`).113- `--symbol`: Gene symbol used for lookup actions (e.g., `BRCA2`).114- `--id`: Ensembl stable ID used for sequence retrieval (e.g., `ENSG...`, `ENST...`, `ENSP...`).115- `--hgvs`: HGVS notation string used for VEP (e.g., `ENST...:c.123A>G`).116117### Data types and outputs118119- **Lookup**: Returns gene/transcript metadata as provided by Ensembl REST.120- **Sequence**: Returns DNA/cDNA/protein sequence; format depends on the endpoint/options (commonly FASTA or JSON).121- **VEP**: Returns consequence annotations and (when available) population frequency fields as provided by Ensembl VEP REST responses.122123### Endpoint reference124125For the exact REST paths, required parameters, and response schemas, see:126- `references/api_endpoints.md`127- https://rest.ensembl.org