compare_expression_profiles
Compare protein expression profiles across tissues, brain regions, blood cells, or single-cell data to analyze biological differences between multiple genes.
Instructions
Compare expression profiles between multiple proteins
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| genes | Yes | Array of gene symbols to compare (2-10) | |
| expressionType | No | Type of expression data to compare (default: tissue) | |
| format | No | Output format (default: json) |
Implementation Reference
- src/index.ts:1257-1303 (handler)Executes the tool by validating input with isValidBatchArgs, fetching expression data (tissue, brain, blood, or default tissue) for each gene, compiling comparisons, and returning JSON or error.
private async handleCompareExpressionProfiles(args: any) { if (!isValidBatchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid comparison arguments'); } try { const expressionType = (args as any).expressionType || 'tissue'; const comparisons = []; for (const gene of args.genes) { let expressionData; switch (expressionType) { case 'tissue': expressionData = await this.fetchTissueExpression(gene); break; case 'brain': expressionData = await this.fetchBrainExpression(gene); break; case 'blood': expressionData = await this.fetchBloodExpression(gene); break; default: expressionData = await this.fetchTissueExpression(gene); } comparisons.push({ gene, expressionData }); } return { content: [ { type: 'text', text: JSON.stringify({ expressionComparison: comparisons }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error comparing expression profiles: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } } - src/index.ts:639-647 (schema)JSON Schema defining the input parameters: genes (array 2-10 strings), expressionType (enum), format (json/tsv). Required: genes.
inputSchema: { type: 'object', properties: { genes: { type: 'array', items: { type: 'string' }, description: 'Array of gene symbols to compare (2-10)', minItems: 2, maxItems: 10 }, expressionType: { type: 'string', enum: ['tissue', 'brain', 'blood', 'single_cell'], description: 'Type of expression data to compare (default: tissue)' }, format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' }, }, required: ['genes'], }, - src/index.ts:636-648 (registration)Tool registration in the ListTools response, including name, description, and input schema.
{ name: 'compare_expression_profiles', description: 'Compare expression profiles between multiple proteins', inputSchema: { type: 'object', properties: { genes: { type: 'array', items: { type: 'string' }, description: 'Array of gene symbols to compare (2-10)', minItems: 2, maxItems: 10 }, expressionType: { type: 'string', enum: ['tissue', 'brain', 'blood', 'single_cell'], description: 'Type of expression data to compare (default: tissue)' }, format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' }, }, required: ['genes'], }, }, - src/index.ts:703-704 (registration)Dispatch case in the CallToolRequest handler that routes to the specific handler function.
case 'compare_expression_profiles': return this.handleCompareExpressionProfiles(args); - src/index.ts:117-130 (helper)Input validation function reused for batch operations and this tool's args validation.
const isValidBatchArgs = ( args: any ): args is { genes: string[]; format?: string; columns?: string[] } => { return ( typeof args === 'object' && args !== null && Array.isArray(args.genes) && args.genes.length > 0 && args.genes.length <= 100 && args.genes.every((gene: any) => typeof gene === 'string' && gene.length > 0) && (args.format === undefined || ['json', 'tsv'].includes(args.format)) && (args.columns === undefined || Array.isArray(args.columns)) ); };