Fix/rfd3 duplicate cif atom ids#248
Open
DeltaDesign wants to merge 2 commits intoRosettaCommons:productionfrom
Open
Fix/rfd3 duplicate cif atom ids#248DeltaDesign wants to merge 2 commits intoRosettaCommons:productionfrom
DeltaDesign wants to merge 2 commits intoRosettaCommons:productionfrom
Conversation
…#148) PadTokensWithVirtualAtoms copies CB's atom_id to virtual atom slots. After cleanup removes the virtual atoms, sidechain atoms retain the duplicated atom_id. The CIF writer uses these values for _atom_site.id, producing non-conformant output with duplicate IDs. Strip atom_id before CIF serialization so the writer auto-generates unique sequential 1..N IDs. Two sites: - _cleanup_virtual_atoms_and_assign_atom_name_elements: strips after filtering virtual atoms (covers Python API consumers) - RFD3Output._strip_atom_id: strips in dump() before every to_cif_file() call (covers trajectories and cleanup_virtual_atoms=False) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Fixes #148.
What changed and why
PadTokensWithVirtualAtomscopies the central atom (CB) to create virtual atom positions, including CB'satom_idannotation. After cleanup removes the virtual atoms, sidechain atoms retain CB's duplicatedatom_id. The CIF writer uses these values for_atom_site.id, producing non-conformant output with duplicate IDs._atom_site.iduniqueness is required by the mmCIF dictionary specification — downstream parsers (PyMOL, ChimeraX, Phenix) may silently drop or misassign atoms when IDs collide.The fix strips
atom_idbefore CIF serialization so the writer auto-generates unique sequential 1..N IDs. Two sites:_cleanup_virtual_atoms_and_assign_atom_name_elements— strips after filtering virtual atoms (covers Python API consumers)RFD3Output._strip_atom_id— strips indump()before everyto_cif_file()call (covers trajectories andcleanup_virtual_atoms=Falsepath)How tested
Two new tests in
models/rfd3/tests/test_cif_duplicate_ids.py:test_cleanup_strips_atom_id— verifies cleanup removes the duplicated annotationtest_cif_output_has_unique_ids— verifies CIF output has unique sequential_atom_site.idvaluesruff checkpasses on all 3 changed files.