get_gene_ontology
Retrieve Gene Ontology annotations for a gene to understand its biological processes, cellular components, and molecular functions using GTEx genomics data.
Instructions
Get Gene Ontology annotations for a gene
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gencodeId | Yes | GENCODE gene ID (e.g., ENSG00000223972.5) | |
| ontologyType | No | GO ontology type (optional) |
Implementation Reference
- Implements the core logic for the 'get_gene_ontology' tool: validates gene ID, fetches gene info via API, generates inferred GO annotations across three categories (biological process, cellular component, molecular function), and returns formatted text output with external resource links.async getGeneOntology(args: any) { if (!args.geneId || typeof args.geneId !== 'string') { throw new Error('geneId parameter is required and must be a GENCODE gene ID'); } // First get gene information to validate the gene exists const geneResult = await this.apiClient.getGenes( [args.geneId], 'v26', 'GRCh38/hg38' ); if (geneResult.error) { return { content: [{ type: "text", text: `Error retrieving gene information for GO annotation: ${geneResult.error}` }], isError: true }; } const genes = geneResult.data || []; if (genes.length === 0) { return { content: [{ type: "text", text: `Gene not found: ${args.geneId}. Please check that this is a valid GENCODE gene ID.` }] }; } const gene = genes[0]; // Note: GTEx API doesn't directly provide GO annotations // This is a simplified implementation that provides basic gene information // In a real implementation, this would integrate with GO databases let output = `**Gene Ontology Information**\n`; output += `Gene: **${gene.geneSymbol}** (${gene.gencodeId})\n`; output += `Location: ${gene.chromosome}:${gene.start.toLocaleString()}-${gene.end.toLocaleString()}\n`; output += `Gene Type: ${gene.geneType}\n`; if (gene.description) { output += `Description: ${gene.description}\n`; } output += '\n'; // Provide mock GO categories based on gene type and name output += `**Gene Ontology Categories:**\n`; if (args.ontologyType) { output += `Filtered by: ${args.ontologyType}\n`; } // Basic categorization based on gene information const biologicalProcesses = this.inferBiologicalProcesses(gene); const cellularComponents = this.inferCellularComponents(gene); const molecularFunctions = this.inferMolecularFunctions(gene); if (!args.ontologyType || args.ontologyType === 'biological_process') { output += `\n**Biological Process:**\n`; biologicalProcesses.forEach((process, index) => { output += ` ${index + 1}. ${process}\n`; }); } if (!args.ontologyType || args.ontologyType === 'cellular_component') { output += `\n**Cellular Component:**\n`; cellularComponents.forEach((component, index) => { output += ` ${index + 1}. ${component}\n`; }); } if (!args.ontologyType || args.ontologyType === 'molecular_function') { output += `\n**Molecular Function:**\n`; molecularFunctions.forEach((func, index) => { output += ` ${index + 1}. ${func}\n`; }); } output += `\n**Note:** This is a simplified GO annotation based on gene characteristics. `; output += `For comprehensive GO annotations, please use dedicated GO databases like AmiGO, QuickGO, or the Gene Ontology Consortium website.\n`; if (gene.entrezGeneId) { output += `\n**External Resources:**\n`; output += `• Entrez Gene: https://www.ncbi.nlm.nih.gov/gene/${gene.entrezGeneId}\n`; output += `• AmiGO: http://amigo.geneontology.org/amigo/gene_product/UniProtKB:${gene.geneSymbol}\n`; } return { content: [{ type: "text", text: output }] }; }
- src/index.ts:773-778 (registration)Routes 'get_gene_ontology' tool calls to the referenceHandlers.getGeneOntology method, mapping input parameters gencodeId and ontologyType.if (name === "get_gene_ontology") { return await referenceHandlers.getGeneOntology({ gencodeId: args?.gencodeId, ontologyType: args?.ontologyType }); }
- src/index.ts:564-582 (schema)Defines the tool schema including name, description, and inputSchema with required gencodeId and optional ontologyType enum for the listTools response.{ name: "get_gene_ontology", description: "Get Gene Ontology annotations for a gene", inputSchema: { type: "object", properties: { gencodeId: { type: "string", description: "GENCODE gene ID (e.g., ENSG00000223972.5)" }, ontologyType: { type: "string", description: "GO ontology type (optional)", enum: ["biological_process", "cellular_component", "molecular_function"] } }, required: ["gencodeId"] } },
- Helper method that infers GO Biological Process terms from gene description, symbol, and type; called by the main handler.private inferBiologicalProcesses(gene: any): string[] { const processes = ['cellular process', 'metabolic process']; const description = gene.description?.toLowerCase() || ''; const symbol = gene.geneSymbol?.toLowerCase() || ''; if (description.includes('transcription') || symbol.includes('tf')) { processes.push('transcription, DNA-templated', 'regulation of gene expression'); } if (description.includes('kinase') || symbol.includes('kinase')) { processes.push('protein phosphorylation', 'signal transduction'); } if (description.includes('receptor') || symbol.includes('receptor')) { processes.push('cell surface receptor signaling pathway', 'response to stimulus'); } if (description.includes('enzyme') || gene.geneType === 'protein_coding') { processes.push('catalytic activity', 'enzyme-mediated process'); } return processes; }
- Helper method that infers GO Cellular Component terms from gene description, symbol, and type; called by the main handler.private inferCellularComponents(gene: any): string[] { const components = ['cell', 'intracellular']; const description = gene.description?.toLowerCase() || ''; const symbol = gene.geneSymbol?.toLowerCase() || ''; if (description.includes('membrane') || description.includes('receptor')) { components.push('plasma membrane', 'integral component of membrane'); } if (description.includes('nuclear') || description.includes('transcription')) { components.push('nucleus', 'nucleoplasm'); } if (description.includes('mitochondrial') || symbol.startsWith('mt-')) { components.push('mitochondrion', 'mitochondrial matrix'); } if (description.includes('cytoplasm') || gene.geneType === 'protein_coding') { components.push('cytoplasm', 'cytosol'); } return components; }