Get Sequence
ensembl_get_sequenceFetch the DNA, cDNA, CDS, or protein sequence for a gene, transcript, protein, or genomic region. Returns a window of the sequence — the first 10,000 characters by default — with its stable ID, molecule type, and full length. When more follows the window, truncated is true and nextOffset is the offset to request next; walking nextOffset reconstructs the whole sequence, and max_length 0 returns everything from offset to the end. The type parameter selects which sequence is fetched: genomic (default, includes introns), cdna (spliced transcript), cds (coding sequence only), protein. For region mode, set id to a region — either species:chr:start-end (e.g. homo_sapiens:13:32315086-32400268) or a bare chr:start-end with species set (e.g. id 13:32315086-32400268, species homo_sapiens), spanning at most 10,000,000 bases; a :-1 suffix (13:32315086-32315100:-1) returns the reverse-strand sequence. Regions return genomic DNA only. Protein sequences require a transcript or protein stable ID (ENST…/ENSP…), not a gene ID — use ensembl_lookup_gene and its canonicalTranscript field first; expand_transcripts=true also supplies transcript biotypes and MANE Select accessions.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id": "<id>"
},
"name": "ensembl_get_sequence"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Ensembl stable ID (ENSG…, ENST…, ENSP…) or a genomic region for region mode — an id containing a colon is a region. A version suffix on a stable ID (ENST00000380152.8) is dropped before the request. Region accepts species:chr:start-end (e.g. homo_sapiens:13:32315086-32400268) or a bare chr:start-end (e.g. 13:32315086-32400268) when the species field is set. Coordinates are whole numbers; start..end works as well as start-end, and a :1 or :-1 suffix picks the strand (13:32315086-32315100:-1 returns the reverse complement). A region needs start at or below end, within the sequence region, and spans at most 10,000,000 bases. Name chromosomes as Ensembl does (13, X, MT; chr13 also works); the mitochondrion is MT in vertebrates, mitochondrion_genome in Drosophila, and MtDNA in C. elegans. M and chrM are accepted only where Ensembl resolves them to the mitochondrion (Drosophila, for one); elsewhere they fail as invalid_region naming the mitochondrion of the species. | |
| type | No | Sequence type to retrieve. genomic: full genomic DNA including introns (default). cdna: spliced transcript sequence (requires ENST… ID). cds: coding sequence only, no UTRs (requires ENST… ID with coding transcript). protein: amino acid sequence (requires ENST… or ENSP… ID). Region ids are genomic-only — request cdna, cds, or protein from a transcript or protein stable ID. A protein ID (ENSP…) serves only its protein; a non-coding transcript has no protein or cds. | genomic |
| offset | No | 0-based character offset where the returned window starts, counted in the resolved sequence (including any expand_5prime/expand_3prime flank). Default 0. Pass nextOffset from a truncated response to fetch the following window; an offset at or past the end returns an empty window. | |
| species | No | Species in Ensembl internal format (e.g. homo_sapiens). Required for a bare chr:start-end region. For the species:chr:start-end form the species in id takes precedence and this field is ignored. Unused for stable ID lookups — Ensembl infers species from the ID prefix. | |
| max_length | No | Maximum number of characters in the returned window. Default 10000. Set to 0 to return everything from offset to the end, uncapped. | |
| expand_3prime | No | Number of base pairs to extend downstream (3' direction) of the requested feature. Default 0. Only applies to genomic sequences and region queries; on a :-1 region it extends the lower coordinate. | |
| expand_5prime | No | Number of base pairs to extend upstream (5' direction) of the requested feature. Default 0. Only applies to genomic sequences and region queries; on a :-1 region it extends the higher coordinate. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | The stable ID or region used for the lookup. | |
| seq | No | The requested window of the sequence: at most max_length characters starting at offset. DNA sequences use IUPAC nucleotide codes (ACGT + ambiguity codes); protein sequences use single-letter amino acid codes. Empty when offset is at or past the end. | |
| type | No | Sequence type returned (genomic, cdna, cds, or protein). | |
| error | No | Present when the call failed. Absent on success. | |
| length | No | Full sequence length in characters, not the window size — nucleotides for genomic/cdna/cds, amino-acid residues for protein. Includes any expand_5prime/expand_3prime flank. | |
| notice | No | Guidance about the window: how to continue when truncated, or why it is empty when the offset is past the end. | |
| offset | No | 0-based character offset where this window starts. | |
| truncated | No | True when more sequence follows this window; request nextOffset to continue. | |
| nextOffset | No | Offset of the first character after this window — pass it as offset to fetch the next window. Present only when truncated. | |
| description | No | Sequence description from Ensembl, if provided. |