Conversation
…etter - added more identifiers in gap_letter (a,b..AA, AB.. - Added warning message for when a structure has to get additional identifiers (AA, AB)
…hat includes information about problematic chains in a structure
There was a problem hiding this comment.
Pull request overview
This PR aims to address residue renumbering failures when the “gap tracker” exceeds the available alternate identifier set by introducing a generated gap-label scheme and surfacing warnings for structures/chains with many gaps during MSA-based renumbering.
Changes:
- Added
get_gap_letter()to generate gap alternate identifiers beyond the previous fixed list. - Added tracking/reporting of structures/chains that require multi-character alternate identifiers.
- Added a warning output file listing affected
structure:chainpairs.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+222
to
226
| for freq in gaps: # accepted gap percentage based on user defined occupancy threshold | ||
|
|
||
| # Changing the functionality of gap_letter | ||
| #freq_tracker = 1 | ||
| #gap_tracker = 0 |
Comment on lines
+110
to
+131
| def get_gap_letter(n): | ||
| """ | ||
| Convert a 0-based index into a spreadsheet-style alphabet label. | ||
|
|
||
| Cycles through all single uppercase letters (A-Z) and lowercase letters | ||
| (a-z) before moving into multi-letter combinations (AA, AB, ..., zz, AAA...). | ||
|
|
||
| Parameters: | ||
| n (int): The 0-based index to convert. | ||
|
|
||
| Returns: | ||
| str: The corresponding alphabetic label. | ||
| """ | ||
| alphabet = string.ascii_uppercase + string.ascii_lowercase | ||
|
|
||
| label = "" | ||
| n += 1 | ||
| while n > 0: | ||
| n, remainder = divmod(n - 1, 52) | ||
| label = alphabet[remainder] + label | ||
|
|
||
| return label |
Owner
There was a problem hiding this comment.
@gdkwxn please look at this suggestion and implement it
Comment on lines
+306
to
+315
| print(f"\nWARNING: Some structures were affected by large gaps in most of the MSA (>62 positions), " | ||
| f"resulting in residue renumbering that requires two-character alternate identifiers. This may lead " | ||
| f"to problems when opening the structure with molecular visualization software. These structures " | ||
| f"will be saved in residue_warning_structures.txt in the format 'structure:chain'\n") | ||
|
|
||
| with open(f"residue_warning_structures.txt", "w+") as f: | ||
| f.write("structure:chain\n") | ||
| for structure in big_structures_warning: | ||
| for chain in big_structures_warning[structure]: | ||
| f.write(f"{structure}:{chain}\n") |
Owner
There was a problem hiding this comment.
@gdkwxn please take a look at this suggestion and implement it
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.
Solved issue #201, I updated the code to output a CSV file containing information regarding problematic chains in a structure