Fix loading input JSON written by AlphaFold 3 <= 3.0.3 - #710
Open
mooreneural wants to merge 1 commit into
Open
Conversation
Templates written before 3.0.4 serialize an empty query_to_template_map as "templateIndices": null. The write side was fixed in 62136ec, but the read side passes the null into zip(), raising TypeError. Reading older input JSON is supported (JSON_VERSIONS is (1, 2, 3, 4)). Also add strict=True so mismatched queryIndices/templateIndices lengths are rejected rather than silently truncated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A user has an input JSON saved by an earlier version of AlphaFold 3. They upgrade to 3.0.4, re-run the same file, and it crashes with:
Nothing in the error points at the input file or at the version change, so there is no obvious way to work out what went wrong.
Cause:
Templates written by AlphaFold 3 3.0.0 through 3.0.3 serialize an empty query_to_template_map as "templateIndices": null. The write side was fixed in 62136ec, but the read side still passes that null straight into zip():
JSON_VERSIONS is (1, 2, 3, 4), so reading input JSON produced by earlier versions is supported, and every release before 3.0.4 wrote null.
Also in this change:
Adding strict=True. Without it, queryIndices and templateIndices of different lengths are silently truncated rather than rejected, so a malformed input folds against a wrong template alignment and returns a structure with no error raised. The same file already uses strict=True on lines 1194 and 1352.
The two changes are safe together: the old code serialized keys() and values() of the same dict, so null could only ever occur alongside an empty queryIndices, meaning the lengths always match for legacy files.
Verified:
raising TypeError.
residues.
Happy to drop the strict=True half if you would rather keep this purely to the backwards compatibility fix.