Skip to content

Solved issue #201 - #210

Open
gdkwxn wants to merge 2 commits into
masterfrom
pc_res
Open

Solved issue #201#210
gdkwxn wants to merge 2 commits into
masterfrom
pc_res

Conversation

@gdkwxn

@gdkwxn gdkwxn commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Solved issue #201, I updated the code to output a CSV file containing information regarding problematic chains in a structure

gdkwxn added 2 commits August 1, 2026 22:48
…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
Copilot AI lite review requested due to automatic review settings August 9, 2026 05:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:chain pairs.

💡 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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gdkwxn please take a look at this suggestion and implement it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants