Skip to content

fix: fail on unknown molecule types - #367

Open
YashBhardwaj21 wants to merge 1 commit into
aqlaboratory:mainfrom
YashBhardwaj21:fix/a3-molecule-type-validation
Open

fix: fail on unknown molecule types#367
YashBhardwaj21 wants to merge 1 commit into
aqlaboratory:mainfrom
YashBhardwaj21:fix/a3-molecule-type-validation

Conversation

@YashBhardwaj21

Copy link
Copy Markdown

Summary

Addresses A3 from #278 by making molecule type assignment fail when referenced CCD components have missing or unrecognized _chem_comp.type metadata.

Changes

  • Validate that all components referenced by the structure are present in _chem_comp.
  • Raise ValueError for referenced components with unrecognized _chem_comp.type values.
  • Preserve case-insensitive matching of _chem_comp.type.
  • Remove the silent fallback to MoleculeType.LIGAND.
  • Add regression tests for missing components, unknown types, case-insensitive matching, OTHER, multiple invalid components, and unreferenced invalid components.

Related Issues

Addresses A3 from #278.

Testing

  • python -m pytest openfold3/tests/core/data/primitives/structure/test_labels.py
  • python -m ruff format --check openfold3/core/data/primitives/structure/labels.py openfold3/tests/core/data/primitives/structure/test_labels.py
  • python -m ruff check openfold3/core/data/primitives/structure/labels.py openfold3/tests/core/data/primitives/structure/test_labels.py

All tests and Ruff checks pass.

@jandom jandom added the safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing. label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-test Internal only label used to indicate PRs that are ready for automated CI testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants