Skip to content

test(rf3): add MSA input tests#364

Open
woodsh17 wants to merge 2 commits into
productionfrom
rf3-msa-tests
Open

test(rf3): add MSA input tests#364
woodsh17 wants to merge 2 commits into
productionfrom
rf3-msa-tests

Conversation

@woodsh17

Copy link
Copy Markdown
Member

Summary

Adds tests for the MSA (multiple sequence alignment) input that rf3 accepts at
inference. There was no coverage of the MSA input path and no example that
documents the expected .a3m format.

  • Layer 1 — a3m format-contract unit tests (checkpoint-free).
    models/rf3/tests/test_msa_format.py pins the ColabFold-style .a3m format
    and how atomworks.parse_a3m reads it, using a small self-documenting
    fixture (query + 3 homologs) that exercises every parsing rule:

    • MSA shape (N, L) with the query as row 0 and uniform column width;
    • lowercase insertions are stripped and counted; - gaps are kept as columns;
    • TaxID= taxonomy IDs are parsed from headers (the key that pairs homologs
      across chains for multimers), including the query sentinel and the
      empty-header case;
    • a query-only alignment parses to depth 1 rather than crashing.
  • Layer 2 — end-to-end fold integration tests (checkpoint-gated).
    models/rf3/tests/integration/test_msa_fold.py feeds pre-computed MSAs
    through rf3 fold across chain counts (monomer / homodimer / heteromer) and
    both input modes (JSON msa_path and CIF _msa_paths_by_chain_id):

    • monomer via JSON msa_path;
    • monomer via CIF _msa_paths_by_chain_id;
    • homodimer (two identical chains sharing one a3m), asserts iptm > 0;
    • heteromer (two distinct chains, each with its own a3m, sharing a TaxID to
      form a genuine paired MSA), asserts iptm > 0;
    • the raise_if_missing_msa_for_protein_of_length_n guard: errors when a
      protein above the length threshold has no MSA, and stays quiet when present.

    A msa_fold_dir fixture batches the four folds into one model load;
    msa_present_flag_dir and an assert_valid_plddt helper are added alongside.

Test data

All inputs use short synthetic sequences (~12 residues) with hand-built a3m
files: these tests exercise MSA format and plumbing, not structure quality, so
a real complex — which is far slower on CPU — is unnecessary. The CIF-mode
input was generated by folding the synthetic monomer once and attaching the
_msa_paths_by_chain_id header (the same construction as the existing
*_from_file.cif inputs).

woodsh17 added 2 commits July 10, 2026 21:25
Checkpoint-free tests pinning the ColabFold-style a3m format rf3 expects at
inference, parsed via atomworks parse_a3m. A self-documenting minimal a3m
fixture exercises the query row, lowercase insertion stripping, gap columns,
and TaxID header parsing (the key that drives multimer MSA pairing). Doubles
as executable documentation of a valid rf3 MSA input.
Feed pre-computed MSAs through rf3 fold across chain counts (monomer,
homodimer, heteromer) and both input modes (JSON msa_path and CIF
_msa_paths_by_chain_id). Inputs are short synthetic sequences with hand-built
a3m files so the suite folds quickly on CPU; the heteromer uses a distinct a3m
per chain with a shared TaxID to form a genuine paired MSA. Multi-chain cases
assert iptm > 0. Two tests pin the raise_if_missing_msa_for_protein_of_length_n
guard: it errors when a long protein lacks an MSA and stays quiet when present.

Adds msa_fold_dir and msa_present_flag_dir fixtures and an assert_valid_plddt
helper to the integration conftest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant