Skip to content

Fall back to the query sequence for empty custom MSAs (#770) - #865

Open
AtharvaTilewale wants to merge 1 commit into
sokrypton:mainfrom
AtharvaTilewale:fix/770-paired-only-custom-msa
Open

AtharvaTilewale wants to merge 1 commit into
sokrypton:mainfrom
AtharvaTilewale:fix/770-paired-only-custom-msa

Conversation

@AtharvaTilewale

@AtharvaTilewale AtharvaTilewale commented Oct 24, 2026 •

Copy link
Copy Markdown

Problem

A custom a3m for a complex that contains only paired sequences (every row has residues in every segment, no unpaired block) aborts prediction with

Could not generate input features ...: MSA 0 must contain at least one sequence.

both in colabfold_batch and in the notebook. Reported in #770.

Root cause

unserialize_msa routes every row that has residues in more than one segment to the paired chunks, so for a paired-only a3m the unpaired MSA comes back as a list of empty strings (['', '']), not as None.
generate_input_feature only falls back to the single-sequence MSA when unpaired_msa is None, so it passes '' to build_monomer_feature and pipeline.make_msa_features raises MSA 0 must contain at least one sequence.

What the fix does

Treat an empty MSA entry like None in generate_input_feature, i.e. use >{101 + sequence_index}\n{sequence} for that chain. The same guard is applied to the paired MSA in the multimer branch, which has the symmetric problem for an a3m with only unpaired sequences.

Validation

Added tests/test_paired_only_custom_msa in tests/test_msa.py: it builds a paired-only heterodimer a3m, runs it through unserialize_msa (asserting the unpaired MSA really is ['', '']) and then through generate_input_feature with a multimer model type.

Pre-patch (git stash push colabfold/batch.py, test kept):

$ pytest tests/test_msa.py::test_paired_only_custom_msa -q
    raise ValueError(f'MSA {msa_index} must contain at least one sequence.')
E   ValueError: MSA 0 must contain at least one sequence.
1 failed

Post-patch:

$ pytest tests/test_msa.py -q
2 passed

$ pytest -q
29 passed, 20 skipped, 7 errors

The 7 errors are tests/test_colabfold.py prediction tests, which need network access to download parameters/MSAs; they error identically on unmodified main in this environment (baseline there is 28 passed, 20 skipped, 7 errors).

Fixes #770

Disclosure: this change was prepared with AI assistance and validated locally as described above.

A custom a3m that contains only paired sequences makes unserialize_msa
return a list of empty strings for the unpaired MSA instead of None, so
generate_input_feature passed "" to build_monomer_feature and
make_msa_features raised "MSA 0 must contain at least one sequence".
Treat an empty entry like None and use the query sequence instead, for
both the unpaired and the paired MSA.

Fixes sokrypton#770
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.

Bug parsing custom MSAs containing only paired sequences

1 participant