Repository navigation
esmfold2: return each CCD ligand component as its own residue - #416
Open
daylight-00 wants to merge 1 commit into
Open
daylight-00 wants to merge 1 commit into
daylight-00 wants to merge 1 commit into
Conversation
`LigandInput(ccd=["NAG", "BMA"])` decoded as a single NAG residue holding both components' atoms, although the tokenizer keeps each component's residue_index. - Group non-polymer tokens by residue_index, the same groupby polymer residues already use. - SMILES, single-CCD ligands and polymers decode exactly as before. - Chains that differ after their first component no longer share an mmCIF entity.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The experimental output path and empty-CCD fallback still need correction.
Review effort: Lite
Findings: None
What changed in this PR
This PR updates ESMFold2 output construction so multi-component CCD ligands are returned as separate residues and distinct mmCIF entities.
Changes:
- Groups ligand components by
residue_index. - Preserves hetero flags and existing behavior for other ligand types.
- Adds regression tests for residue grouping and entity separation.
| File | Summary |
|---|---|
tests/models/esmfold2_output_test.py |
Adds coverage for multi-component ligand residues and entity mapping. |
esm/models/esmfold2/output.py |
Groups ligand components into separate residues and updates entity handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 ligand given as several CCD codes comes back from
fold()as one residue named after its first component:The tokenizer already keeps each component's
residue_index; only the output builder threw it away.residue_index, the same way atom-tokenized polymer residues (MSE, HYP, ...) already are. The two branches share one loop and differ only in the hetero flag.to_mmcif()keys entities on residue names, so["NAG", "NAG"]and["NAG", "BMA"]were written as the same entity. They no longer are.Tested with a new
tests/models/esmfold2_output_test.py(needs the CCD pickle): the two multi-component cases fail onmainand pass here, and the single-component case passes on both. No new failures inprepare_input_test.py,esmfold2_inputs_test.pyoresmfold2_cpu_only_test.py;ruffandtyare clean.