Skip to content

Conversation

@GeorgWa
Copy link
Collaborator

@GeorgWa GeorgWa commented Dec 6, 2025

Changes were made with a script generated by an AI, not directly

Summary

  • Add modification format constants to alphabase.constants.modification:
    • SEPARATOR (;) - separator between multiple values
    • MOD_SITE_SEPARATOR (@) - separator between mod name and site
    • MOD_TERM_SEPARATOR (^) - separator for AA-specific terminal mods
    • ANY_N_TERM, ANY_C_TERM, PROTEIN_N_TERM, PROTEIN_C_TERM - terminal site constants
    • ANY_N_TERM_SPECIFIC, ANY_C_TERM_SPECIFIC, PROTEIN_N_TERM_SPECIFIC, PROTEIN_C_TERM_SPECIFIC - AA-specific terminal constants
  • Replace hardcoded string literals with these constants across 15 files

GeorgWa and others added 2 commits December 6, 2025 22:54
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>
@GeorgWa GeorgWa changed the title Add modification format constants and replace hardcoded values Shameless Claude modification constants added Dec 6, 2025
@GeorgWa GeorgWa requested review from Copilot and mschwoer and removed request for mschwoer December 6, 2025 22:01
Copy link

Copilot AI left a 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, and MOD_TERM_SEPARATOR constants 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.

Copy link
Contributor

@mschwoer mschwoer left a 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 = ";"
Copy link
Contributor

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"
Copy link
Contributor

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 ?

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