Repository navigation
Write one chain ID per chain in summary confidences - #5
Merged
Merged
Conversation
StructureConfidenceSummary.chain_ids is documented as [num_chains] chain IDs in the same order as the chain-level arrays, but from_inference_result filled it with the per-token chain IDs from metadata['token_chain_ids'], so a two-chain prediction of five tokens wrote five IDs next to two chain_ptm values. Upstream main has the same code. The chain-level arrays (chain_ptm, chain_iptm, chain_pair_iptm, chain_pair_pae_min) are indexed by unique asym ID in ascending order, and featurisation assigns asym IDs to chains in order of their first token, so the per-token chain IDs deduplicated in order of first occurrence follow exactly that order. A chain that comes first in the input therefore comes first even when its ID does not sort first. Add confidence_types_test.py, which assigns asym IDs with the featurisation helper, computes the chain-level arrays with the functions the model uses, and checks that chain_ids has one entry per chain and labels each chain's pTM, for two and three chains, a chain order that is not alphabetical and a single-token chain. It runs on CPU without model parameters, so add it to CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 3 tasks
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.
Summary
chain_idsin summary confidences now has one ID per chain, in the order of the chain-level arrays (chain_ptm,chain_iptm,chain_pair_iptm,chain_pair_pae_min).v3.0.4 added the field, documented as "[num_chains] Chain IDs in the same order as the chain-level ...". But it was built from
token_chain_ids, one ID per token: a two-chain input gave five IDs next to twochain_ptmvalues. Upstreammainstill has this.np.unique(asym_id), i.e. ascending asym ID, and featurisation numbers chains in order of each chain's first token. Sotoken_chain_ids, deduplicated in order of first appearance, gives exactly that order (list(dict.fromkeys(...)), with a comment saying why).Validation
src/alphafold3/model/confidence_types_test.py(absltest; added to CI):AAABB→[A,B],BBBAA→[B,A],CCABBBB→[C,A,B].chain_ptm, and the JSON output.['B','B','B','A','A'] != ['B','A'], and passes with the fix: 3/3 in the AF3 image on jax 0.10.2.fused_triangle_test.py: 90/90 unchanged.🤖 Generated with Claude Code