search_transcripts
Find gene transcripts and isoforms using GENCODE IDs to analyze gene expression patterns and identify specific transcript variants in genomics research.
Instructions
Search for gene transcripts and isoforms
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gencodeId | Yes | GENCODE gene ID (e.g., ENSG00000223972.5) | |
| transcriptType | No | Transcript type filter (optional) |
Implementation Reference
- The handler function getTranscripts in ReferenceHandlers class that implements the core logic for the search_transcripts tool: validates input, calls GTEx API for transcripts, sorts and formats the results with summaries.async getTranscripts(args: any) { if (!args.geneId || typeof args.geneId !== 'string') { throw new Error('geneId parameter is required and must be a GENCODE gene ID'); } const result = await this.apiClient.getTranscripts( args.geneId, args.gencodeVersion || 'v26', args.genomeBuild || 'GRCh38/hg38' ); if (result.error) { return { content: [{ type: "text", text: `Error retrieving transcripts: ${result.error}` }], isError: true }; } const transcripts = result.data || []; if (transcripts.length === 0) { return { content: [{ type: "text", text: `No transcripts found for gene: ${args.geneId}` }] }; } let output = `**Transcripts for ${transcripts[0]?.geneSymbol} (${args.geneId})**\n`; output += `Found ${transcripts.length} transcripts\n`; output += `Genome: ${transcripts[0]?.genomeBuild}, GENCODE: ${transcripts[0]?.gencodeVersion}\n\n`; // Sort transcripts by start position const sortedTranscripts = transcripts.sort((a, b) => a.start - b.start); sortedTranscripts.forEach((transcript, index) => { output += `${(index + 1).toString().padStart(2)}. **${transcript.transcriptId}**\n`; output += ` • Location: ${transcript.chromosome}:${transcript.start.toLocaleString()}-${transcript.end.toLocaleString()} (${transcript.strand})\n`; output += ` • Length: ${(transcript.end - transcript.start + 1).toLocaleString()} bp\n`; output += ` • Type: ${transcript.featureType}\n`; output += ` • Source: ${transcript.source}\n`; }); // Calculate gene span and summary const geneStart = Math.min(...sortedTranscripts.map(t => t.start)); const geneEnd = Math.max(...sortedTranscripts.map(t => t.end)); const geneLengths = sortedTranscripts.map(t => t.end - t.start + 1); const avgLength = geneLengths.reduce((sum, len) => sum + len, 0) / geneLengths.length; output += `\n**Gene Summary:**\n`; output += ` • Gene span: ${(geneEnd - geneStart + 1).toLocaleString()} bp\n`; output += ` • Total transcripts: ${transcripts.length}\n`; output += ` • Average transcript length: ${Math.round(avgLength).toLocaleString()} bp\n`; output += ` • Longest transcript: ${Math.max(...geneLengths).toLocaleString()} bp\n`; output += ` • Shortest transcript: ${Math.min(...geneLengths).toLocaleString()} bp\n`; return { content: [{ type: "text", text: output }] }; }
- src/index.ts:546-562 (schema)The input schema definition for the search_transcripts tool, specifying parameters gencodeId (required) and optional transcriptType filter.name: "search_transcripts", description: "Search for gene transcripts and isoforms", inputSchema: { type: "object", properties: { gencodeId: { type: "string", description: "GENCODE gene ID (e.g., ENSG00000223972.5)" }, transcriptType: { type: "string", description: "Transcript type filter (optional)", enum: ["protein_coding", "lncRNA", "pseudogene", "miRNA"] } }, required: ["gencodeId"] }
- src/index.ts:768-772 (registration)The tool dispatch/registration in the main CallToolRequestSchema handler that routes 'search_transcripts' calls to referenceHandlers.getTranscripts with mapped arguments.if (name === "search_transcripts") { return await referenceHandlers.getTranscripts({ geneId: args?.gencodeId }); }