Skip to content

[Proposal] Integrate AxoMEME as a hybrid MEME surrogate with fast MCP triage tool #147

Description

@stevenweaver

Summary

Integrate AxoMEME (a rapid deep-learning surrogate for MEME episodic-selection detection; veg/axomeme3) into Datamonkey3 as a hybrid feature with three surfaces sharing one inference core, plus a fast MCP tool for agent-driven triage.

AxoMEME predicts per-site MEME LRT statistics directly from an alignment + tree, without ML optimization. The value proposition is instant triage → confirm with a real MEME run, not replacing MEME.

Validation (why this is worth building)

Benchmarked against 188 real datamonkey MEME jobs (backup corpus, ground truth = each job's own .MEME.json):

Metric Median Mean
Spearman (pred LRT vs MEME LRT) 0.68 0.65
ROC AUC (calling MEME p≤0.05) 0.91 0.85
PR AUC 0.21 0.31

Accuracy generalizes to real, in-the-wild data. The rare-signal shape (high ROC, lower PR) means it's excellent at ranking selected sites but imprecise at the exact top — so it must be presented as triage, not a final caller.

Speed caveat (important): median server-side speedup vs MEME was only ~1.06× on CPU (grows with alignment size; IQR up to ~5×). The paper's ~1000× requires GPU and/or deep alignments. Design accordingly.

Architecture: one core, three surfaces

Surface Runs where Latency Consumer
1. Client ONNX Browser (ONNX Runtime Web) seconds, zero infra DM3 web app pre-screen
2. Server method SLURM (GPU ideally) seconds–min large alignments
3. MCP tool warm daemon (model preloaded) sub-second LLM agents / Claude

All three call one shared axomeme.predict(seqs, tree, max_species) core — different entry points, same logic. That refactor (extracting the logic from predict_regression_nexus_fasta.py's CLI main()) is the enabling step.

The key to "fast MCP": a warm daemon

Measured per-call cost is ~5s, but almost all of it is fixed startup (torch import + checkpoint load); the actual matrix math is <1s. Therefore:

Do NOT shell out to the CLI per MCP call — that pays the startup tax every time. Run a long-lived worker that loads the model once and serves inference over a socket. MCP call → warm worker → sub-100ms typical.

MCP tool contract

Add axomeme_scan as a tool on the existing DM3 MCP server (mcp.datamonkey.org/mcp) — reuse its auth; no new server.

{
  "name": "axomeme_scan",
  "description": "Rapid DL scan for episodic diversifying selection (MEME surrogate). Per-site predicted LRT + calls in <1s. Triage before a full MEME run.",
  "input_schema": {
    "alignment": "FASTA or NEXUS inline, OR a datamonkey job id",
    "tree":      "Newick (optional; uses embedded/estimated if omitted)",
    "threshold": "percentile for Tier-1 calls (default 98)"
  }
}
// returns: { n_sites, sites:[{site,pred_lrt,call,aa}], n_selected, elapsed_ms,
//            note:"surrogate — confirm hotspots with a full MEME run" }

The job id input is the hybrid payoff: an agent can chain pull job → scan → if hotspots, submit real MEME.

Example agent workflow

  1. User: "Is there positive selection in this HIV env alignment worth a full analysis?"
  2. Agent → axomeme_scan → 84ms → "8 Tier-1 sites: 140, 160, 275…"
  3. Agent: "Sites 140 & 160 are known antigenic — worth confirming. Launch the authoritative MEME?"
  4. User: "yes" → Agent → existing submit_meme MCP tool → job id → minutes later, rigorous result.
  5. Agent reconciles: "MEME confirmed 6 of 8; AxoMEME over-called 2."

AxoMEME MCP = instant triage; DM3 MCP = authoritative confirmation; chained by the agent.

Build plan (phased, each independently shippable)

  • Phase 0 — Refactor to library. Extract axomeme.predict() from the CLI. Enables everything. (~0.5d)
  • Phase 1 — Warm daemon. Wrap predict() in a preloaded socket server; benchmark sub-second warm latency. (the "fast" in fast MCP)
  • Phase 2 — MCP tool. Add axomeme_scan handler forwarding to the daemon on the existing DM3 MCP server; add job_id chaining.
  • Phase 3 — Client ONNX pre-screen in the web app (Manhattan plot before a MEME submit).
  • Phase 4 — SLURM method (GPU) for large alignments, sharing the core; render in the existing MEME result viewer (shared LRT/site schema).

Caveats to bake in

  • GPU for real speed — daemon should sit on a GPU node; CPU is fine only for small alignments.
  • Surrogate ≠ truth — every response carries the "confirm with MEME" note; triage-then-confirm, never replacement.
  • Large-alignment tail — a 2084-site job took ~28 min on CPU. Daemon needs a request timeout + size cap that falls back to "submit a SLURM job instead."

Open questions (need DM3-backend context)

  • DM3 MCP server's tool-registration mechanism (where/how to add axomeme_scan) — likely in veg/service-datamonkey.
  • Is a GPU partition reachable from the DM3 backend for the warm daemon?
  • Reuse of the MEME result renderer for AxoMEME output.

Validation artifacts (188-job pilot: metrics + speedup, SLURM harness) available on silverback under …/axomeme/validation/datamonkey-pilot/.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions