-
Notifications
You must be signed in to change notification settings - Fork 13
Shameless Claude modification constants added #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Define modification format constants in alphabase.constants.modification: - SEPARATOR, MOD_SITE_SEPARATOR - ANY_N_TERM, ANY_C_TERM, PROTEIN_N_TERM, PROTEIN_C_TERM - ANY_N_TERM_SPECIFIC, ANY_C_TERM_SPECIFIC, PROTEIN_N_TERM_SPECIFIC, PROTEIN_C_TERM_SPECIFIC Replace hardcoded ";" with SEPARATOR across 12 files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
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 introduces modification format constants to improve code maintainability by replacing hardcoded string literals with named constants. The changes define separators and terminal modification site constants in alphabase.constants.modification, then apply them consistently across the codebase.
- Adds
SEPARATOR,MOD_SITE_SEPARATOR, andMOD_TERM_SEPARATORconstants for delimiters - Adds constants for terminal modification sites (
ANY_N_TERM,ANY_C_TERM,PROTEIN_N_TERM,PROTEIN_C_TERM) and their AA-specific variants - Replaces hardcoded string literals (
;,@,^,"Any_N-term", etc.) with these constants across 15 files
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| alphabase/constants/modification.py | Defines all new modification format constants with documentation |
| alphabase/spectral_library/translate.py | Uses SEPARATOR and MOD_SITE_SEPARATOR for parsing modifications |
| alphabase/smiles/peptide.py | Uses SEPARATOR for splitting modification strings |
| alphabase/smiles/adding_smiles.py | Uses MOD_SITE_SEPARATOR and MOD_TERM_SEPARATOR for parsing PTM format |
| alphabase/psm_reader/utils.py | Uses SEPARATOR and MOD_SITE_SEPARATOR throughout utility functions |
| alphabase/psm_reader/sage_reader.py | Uses all separator constants for modification translation |
| alphabase/psm_reader/pfind_reader.py | Uses terminal site constants and separators for pFind format conversion |
| alphabase/psm_reader/msfragger_reader.py | Uses terminal constants and separators for MSFragger parsing |
| alphabase/psm_reader/modification_mapper.py | Uses PROTEIN_N_TERM constant for modification mapping |
| alphabase/psm_reader/maxquant_reader.py | Uses SEPARATOR for joining modification lists |
| alphabase/psm_reader/alphapept_reader.py | Uses SEPARATOR for joining parsed modifications |
| alphabase/protein/fasta.py | Uses all constants for FASTA processing and modification handling |
| alphabase/peptide/precursor.py | Uses SEPARATOR for splitting modification strings |
| alphabase/peptide/mass_calc.py | Uses SEPARATOR for mass calculations |
| alphabase/peptide/fragment.py | Uses SEPARATOR for fragment ion calculations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mschwoer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes were made with a script generated by an AI, not directly
should I be more worried not or less :-D
|
|
||
| # Modification format constants | ||
| #: Separator between multiple values (e.g., "Phospho@S;Oxidation@M", "prot1;prot2") | ||
| SEPARATOR: str = ";" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this name be more specific?
| #: Separator for AA-specific terminal mods (e.g., "Q^Any_N-term") | ||
| MOD_TERM_SEPARATOR: str = "^" | ||
| #: Any N-terminal modification site | ||
| ANY_N_TERM: str = "Any_N-term" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could these be gathered in ConstantsClasses?
e.g. TerminalKeys.ANY_C_TERM ?
Changes were made with a script generated by an AI, not directly
Summary
alphabase.constants.modification:SEPARATOR(;) - separator between multiple valuesMOD_SITE_SEPARATOR(@) - separator between mod name and siteMOD_TERM_SEPARATOR(^) - separator for AA-specific terminal modsANY_N_TERM,ANY_C_TERM,PROTEIN_N_TERM,PROTEIN_C_TERM- terminal site constantsANY_N_TERM_SPECIFIC,ANY_C_TERM_SPECIFIC,PROTEIN_N_TERM_SPECIFIC,PROTEIN_C_TERM_SPECIFIC- AA-specific terminal constants