Skip to main content
Glama
taehojo
by taehojo

compare_alleles

Analyze effects of multiple genetic mutations at a specific genomic position to understand variant impacts and hotspot variations.

Instructions

Compare different alleles at the same position.

Useful for understanding effects of different mutations at a hotspot position.

Example: "Compare T>C vs T>G vs T>A at chr19:44908684"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chromosomeYes
positionYes
refYes
altsYes

Implementation Reference

  • Core handler function implementing the compare_alleles tool logic: compares multiple alternate alleles at the same genomic position by calling predict_variant_effect for each and compiling results.
    def compare_alleles(client, params: Dict[str, Any]) -> Dict[str, Any]:
        """
        Compare different alleles at the same position.
        """
        chromosome = params.get('chromosome')
        position = params.get('position')
        ref = params.get('ref')
        alts = params.get('alts', [])
    
        results = {}
        for alt in alts:
            try:
                var_params = {
                    'chromosome': chromosome,
                    'position': position,
                    'ref': ref,
                    'alt': alt
                }
                result = predict_variant_effect(client, var_params)
                results[f"{ref}>{alt}"] = {
                    'impact_level': result['interpretation']['impact_level'],
                    'expression_fc': result['predictions'].get('rna_seq', {}).get('fold_change', 0),
                    'clinical_sig': result['interpretation']['clinical_significance']
                }
            except Exception as e:
                print(f"Warning: Failed for allele {alt}: {e}", file=sys.stderr)
                results[f"{ref}>{alt}"] = {'error': str(e)}
    
        return {
            'position': f"{chromosome}:{position}",
            'reference': ref,
            'allele_comparisons': results
        }
  • MCP server tool handler for 'compare_alleles': dispatches to AlphaGenomeClient.compareAlleles and formats response.
    case 'compare_alleles': {
      const result = await getClient().compareAlleles(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • Tool schema definition including name, description, and input validation schema for compare_alleles.
    export const COMPARE_ALLELES_TOOL: Tool = {
      name: 'compare_alleles',
      description: `Compare different alleles at the same position.
    
    Useful for understanding effects of different mutations at a hotspot position.
    
    Example: "Compare T>C vs T>G vs T>A at chr19:44908684"`,
      inputSchema: {
        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]+$' },
          alts: {
            type: 'array',
            items: { type: 'string', pattern: '^[ATGCatgc]+$' },
            minItems: 2,
          },
        },
        required: ['chromosome', 'position', 'ref', 'alts'],
      },
    };
  • src/tools.ts:709-730 (registration)
    Registration of compare_alleles tool in the ALL_TOOLS array, used by MCP server for tool listing.
    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,
    ];
  • Client method that bridges to Python by calling the alphagenome_bridge.py with 'compare_alleles' action.
    async compareAlleles(params: any): Promise<any> {
      try {
        return await this.callPythonBridge('compare_alleles', params);
      } catch (error) {
        if (error instanceof ApiError) throw error;
        throw new ApiError(`Allele comparison failed: ${error}`, 500);
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/taehojo/alphagenome-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server