Skip to content

ESMFold2: fetch MSAs from a ColabFold server (esm ships no client — we must) #96

Description

@wilke

Ask

Let ESMFold2 obtain an MSA from a server when the user hasn't uploaded one, so
msa_mode: server works for it the way it does for Boltz / OpenFold / Chai.

Split out of #95, which covers the uploaded-A3M path.

Why it needs us rather than the tool

Boltz, OpenFold and Chai each ship their own MSA-server client, so we just pass
--use-msa-server and they fetch. The esm package has no such client — no
ColabFold, no MMseqs, no HTTP fetching anywhere in esm/utils/msa/ or
esm/models/esmfold2/. It consumes an MSA object you hand it.

So for ESMFold2 we have to do the fetching and pass the result as an A3M.
Until that exists, ESMFold2 stays excluded from the --use-msa-server
passthrough (#94) — passing a flag its CLI does not define makes click exit 2
and kills the job.

We already have most of the client

scripts/_colabfold_api_msa.py does exactly this today: submit to
{API_BASE}/ticket/msa, poll {API_BASE}/ticket/{id}, download and untar from
{API_BASE}/result/download/{id}, with a 10s poll interval and a 30-minute cap.
It was written as a fallback for when colabfold_search isn't installed.

The work is largely promotion, not invention:

  1. Move it from scripts/ into the package (e.g.
    predict_structure/msa_server.py) so adapters and runners can import it.
    It is currently a standalone script with a main().
  2. Wire it into the ESMFold2 path: when use_msa_server is set and no
    --msa was supplied, fetch per protein chain, write A3M, feed it through the
    ESMFold2: wire up MSA input — the model supports it and we discard it #95 upload path.
  3. Add --use-msa-server / --msa-server-url to the esmfold2 subcommand, and
    remove esmfold2 from the exclusion list in App-PredictStructure.pl. The
    guard test added in Fix #75: stop passing --use-msa-server to ESMFold2, which has no such option #94 keys off whether the subcommand exposes the flag, so
    it will follow automatically.

Open question — which server?

_colabfold_api_msa.py hardcodes the public https://api.colabfold.com.
Today's matrix run confirms the server path works end-to-end from the compute
nodes (B02, O02, C02 all passed), but nothing in this repo records a
self-hosted ColabFold/MMseqs endpoint — only placeholders
(mmseqs.example.com, my-mmseqs-server.com) — and nothing is listening on
coconut. Confirm whether we are meant to use our own server, and its
address
, before wiring this. If we have one, msa_server_url should default
to it rather than the public API, for all tools and not just ESMFold2.

Relevant: the public API is rate-limited and shared; a batch matrix run against
it is not polite and not reliable.

Multimer pairing

For complexes, ESMFold2 pairs rows across chains by a key= tag in the A3M
header. ColabFold emits OX=<organism_id>; upstream's tutorial says to rewrite
OX= to key= so rows sharing an organism get paired. Single-chain jobs do not
need this. Worth handling here since server-fetched MSAs are exactly where
multimer pairing matters.

Acceptance

  • predict-structure esmfold2 --protein x.fasta --use-msa-server fetches and
    folds with an MSA, no uploaded file
  • A matrix case with tool: esmfold2 and no msa_file exercises it
  • Multi-chain jobs get per-chain MSAs, paired
  • Failure to reach the server degrades to a clear error, not a silent
    single-sequence fold — the ESMFold2: wire up MSA input — the model supports it and we discard it #95 failure mode

Related

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

    deferredIntentionally postponed; carries a review date

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions