Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 278097646c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| appearance_order = np.argsort(first_indices) | ||
| remapped_indices = appearance_order[inverse_indices].astype(np.int32) |
There was a problem hiding this comment.
Compute asym_id rank mapping from first appearance order
appearance_order = np.argsort(first_indices) produces a permutation from rank → unique-id index, but inverse_indices contains unique-id indices, so appearance_order[inverse_indices] uses the wrong direction unless that permutation happens to be self-inverse. For inputs where chain IDs appear in an order different from numeric sort (e.g. asym_id=[20,30,10,...]), this maps residues to the wrong normalized chain indices, so chain A/B/C labeling can be incorrect relative to sequence order and downstream chain-specific analyses can be misassigned.
Useful? React with 👍 / 👎.
Motivation
protein.to_pdbare deterministic and 0-based because AlphaFold multimerasym_idvalues can be arbitrary positive integers and may change across runs.Description
_normalize_asym_idthat normalizesasym_idto contiguous 0-based indices using first-appearance order and handles both 1-based and 0-based encodings.fallback_feature_dictwhenasym_idis missing from the processed features to recover original values.asym_id - 1) with calls to_normalize_asym_idin both the existing-results reconstruction path and the main prediction path.Testing
pytest -q, and the test run completed successfully.Codex Task