Support direct CIF/mmCIF template inputs for inference#312
Open
taivu1998 wants to merge 1 commit into
Open
Conversation
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
Adds inference support for directly supplied local CIF/mmCIF template files, addressing issue #263.
Users can now set
proteinChain.templatesPathto a.cifor.mmciffile and optionally provideproteinChain.templateChainIdwhen the file contains multiple protein chains. The direct structure is parsed, chain-selected, aligned to the query sequence, and converted into the existing template feature contract used by searched.a3m/.hhrtemplates and embedded JSON templates.Root Cause
The inference template dispatcher only accepted embedded template JSON plus search-derived
.a3mand.hhrfiles. A user-supplied CIF/mmCIF structure path fell through toUnsupported template format, and preprocessing could silently replace missing explicit template paths with automatic template-search output instead of honoring the user's intended custom template.Changes
TemplateHitFeaturizer.parse_cif_template..cifand.mmcifpaths with clear errors for ambiguous or missing chains.templatesPathis missing instead of silently replacing it..cif,.mmcif,.json,.a3m,.hhr, andtemplateChainId.Validation
uvx ruff check protenix/data/template/template_parser.py protenix/data/template/template_utils.py protenix/data/template/template_featurizer.py protenix/data/template/template_path.py protenix/data/inference/infer_dataloader.py runner/template_search.py runner/batch_inference.py tests/test_custom_cif_templates.pypython3.11 -m py_compile protenix/data/template/template_parser.py protenix/data/template/template_utils.py protenix/data/template/template_featurizer.py protenix/data/template/template_path.py protenix/data/inference/infer_dataloader.py runner/template_search.py runner/batch_inference.py tests/test_custom_cif_templates.pygit diff --checkuvx --python 3.11 --with pytest --with numpy --with rdkit --with biopython --with biotite --with requests --with typing-extensions pytest tests/test_custom_cif_templates.py -q(9 passed)uvx --python 3.11 --with pytest --with numpy --with rdkit --with biopython --with biotite --with requests --with typing-extensions pytest tests/test_custom_cif_templates.py tests/test_json_template_parser.py tests/test_fetch_remote_cif.py -q(19 passed)