compare_variants
Compare two genetic variants to determine their regulatory impacts, expression changes, splicing alterations, and relative severity for variant analysis.
Instructions
Compare two variants side-by-side.
Direct comparison of regulatory impacts between two variants.
Returns:
Impact levels for both variants
Expression and splicing changes
Which variant is more severe
Perfect for: comparing candidate variants, understanding relative severity.
Example: "Compare rs429358 vs rs7412"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| variant1 | Yes | ||
| variant2 | Yes |
Implementation Reference
- scripts/alphagenome_bridge.py:323-350 (handler)Core handler function that executes the compare_variants tool logic by predicting effects for two variants using predict_variant_effect and comparing their impacts.def compare_variants(client, params: Dict[str, Any]) -> Dict[str, Any]: """ Compare two variants side-by-side. """ variant1 = params.get('variant1') variant2 = params.get('variant2') result1 = predict_variant_effect(client, variant1) result2 = predict_variant_effect(client, variant2) return { 'variant1': { 'id': result1['variant'], 'impact': result1['interpretation']['impact_level'], 'expression_fc': result1['predictions'].get('rna_seq', {}).get('fold_change', 0), 'splice_delta': result1['predictions'].get('splice', {}).get('delta', 0) }, 'variant2': { 'id': result2['variant'], 'impact': result2['interpretation']['impact_level'], 'expression_fc': result2['predictions'].get('rna_seq', {}).get('fold_change', 0), 'splice_delta': result2['predictions'].get('splice', {}).get('delta', 0) }, 'comparison': { 'more_severe': result1['variant'] if abs(result1['predictions'].get('rna_seq', {}).get('fold_change', 0)) > abs(result2['predictions'].get('rna_seq', {}).get('fold_change', 0)) else result2['variant'] } }
- src/tools.ts:246-286 (schema)Input schema and metadata definition for the compare_variants tool, specifying structure for variant1 and variant2 inputs.export const COMPARE_VARIANTS_TOOL: Tool = { name: 'compare_variants', description: `Compare two variants side-by-side. Direct comparison of regulatory impacts between two variants. Returns: - Impact levels for both variants - Expression and splicing changes - Which variant is more severe Perfect for: comparing candidate variants, understanding relative severity. Example: "Compare rs429358 vs rs7412"`, inputSchema: { type: 'object', properties: { variant1: { type: 'object', properties: { chromosome: { type: 'string', pattern: '^chr([1-9]|1[0-9]|2[0-2]|X|Y)$' }, position: { type: 'number', minimum: 1 }, ref: { type: 'string', pattern: '^[ATGCatgc]+$' }, alt: { type: 'string', pattern: '^[ATGCatgc]+$' }, }, required: ['chromosome', 'position', 'ref', 'alt'], }, variant2: { type: 'object', properties: { chromosome: { type: 'string', pattern: '^chr([1-9]|1[0-9]|2[0-2]|X|Y)$' }, position: { type: 'number', minimum: 1 }, ref: { type: 'string', pattern: '^[ATGCatgc]+$' }, alt: { type: 'string', pattern: '^[ATGCatgc]+$' }, }, required: ['chromosome', 'position', 'ref', 'alt'], }, }, required: ['variant1', 'variant2'], }, };
- src/tools.ts:709-730 (registration)Registration of the compare_variants tool (COMPARE_VARIANTS_TOOL) in the ALL_TOOLS array, which is served via the MCP listTools endpoint.export const ALL_TOOLS: Tool[] = [ PREDICT_VARIANT_TOOL, BATCH_SCORE_TOOL, ASSESS_PATHOGENICITY_TOOL, PREDICT_TISSUE_SPECIFIC_TOOL, COMPARE_VARIANTS_TOOL, PREDICT_SPLICE_IMPACT_TOOL, PREDICT_EXPRESSION_IMPACT_TOOL, ANALYZE_GWAS_LOCUS_TOOL, COMPARE_ALLELES_TOOL, BATCH_TISSUE_COMPARISON_TOOL, PREDICT_TF_BINDING_IMPACT_TOOL, PREDICT_CHROMATIN_IMPACT_TOOL, COMPARE_PROTECTIVE_RISK_TOOL, BATCH_PATHOGENICITY_FILTER_TOOL, COMPARE_VARIANTS_SAME_GENE_TOOL, PREDICT_ALLELE_SPECIFIC_EFFECTS_TOOL, ANNOTATE_REGULATORY_CONTEXT_TOOL, BATCH_MODALITY_SCREEN_TOOL, GENERATE_VARIANT_REPORT_TOOL, EXPLAIN_VARIANT_IMPACT_TOOL, ];
- src/index.ts:161-166 (handler)MCP server handler that dispatches compare_variants tool calls to the AlphaGenomeClient.case 'compare_variants': { const result = await getClient().compareVariants(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/alphagenome-client.ts:268-275 (helper)Client proxy method that invokes the Python bridge for compare_variants action.async compareVariants(params: any): Promise<any> { try { return await this.callPythonBridge('compare_variants', params); } catch (error) { if (error instanceof ApiError) throw error; throw new ApiError(`Variant comparison failed: ${error}`, 500); } }