Allow restraints w.r.t. entity name-based subchains; fix parsing with empty comments#379
Merged
Allow restraints w.r.t. entity name-based subchains; fix parsing with empty comments#379
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enables using entity names as subchain identifiers for restraints and fixes handling of empty comment fields during restraint parsing.
- Introduces
entity_name_as_subchainflag throughout raw input loading, chain creation, and feature context pipelines - Updates
_parse_rowto default empty comments to""instead ofNaN - Adds tests covering manual chain naming and subchain ID assignment
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_restraints.py | Expanded imports and added test_restraints_with_manual_chain_names to verify restraint loading |
| tests/test_inference_dataset.py | Added test_entity_names_as_subchain to check subchain IDs with/without entity_name_as_subchain |
| chai_lab/data/parsing/restraints.py | Changed parsing in _parse_row to map NaN comments to empty strings |
| chai_lab/data/dataset/inference_dataset.py | Added entity_name_as_subchain parameter to raw_inputs_to_entitites_data and load_chains_from_raw |
| chai_lab/chai1.py | Propagated entity_name_as_subchain flag into make_all_atom_feature_context and chain loading |
Comments suppressed due to low confidence (4)
chai_lab/data/dataset/inference_dataset.py:94
- Update the docstring to document the new
entity_name_as_subchainparameter and its effect onsource_pdb_chain_idandsubchain_id.
def raw_inputs_to_entitites_data(
chai_lab/data/dataset/inference_dataset.py:180
- Extend the docstring to explain the
entity_name_as_subchainflag and how it alters chain IDs when loading raw inputs.
def load_chains_from_raw(
chai_lab/chai1.py:339
- Add documentation for the new
entity_name_as_subchainargument in the function signature, describing its behavior.
def make_all_atom_feature_context(
tests/test_restraints.py:44
- Add a unit test to verify that
parse_pairwise_tablecorrectly setscommentto an empty string when the CSV comment cell isNaN.
def test_restraints_with_manual_chain_names(entity_name_as_subchain: bool):
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.
Description
Allow restraints to be specified w.r.t. fasta-based chain naming.
Motivation
Like in #378 this allows for more consistent and predictable chain naming behavior, streamlining post hoc analysis.
Test plan
Added tests to ensure that fasta and restraint parsing have expected compatibility combinations (e.g., if they are mismatched they shouldn't load, if they are matched they should load).