OpenMS
Loading...
Searching...
No Matches
CometModification Struct Reference

Helper struct to represent a Comet variable modification entry. More...

#include <OpenMS/ANALYSIS/ID/CometModification.h>

Collaboration diagram for CometModification:
[legend]

Public Member Functions

 CometModification ()=default
 Default constructor.
 
 CometModification (const ResidueModification *mod, int binary_grp, int max_mods)
 Constructor from ResidueModification.
 
bool isMergeableWith (const CometModification &other) const
 Check if this modification can be merged with another.
 
void merge (const CometModification &other)
 Merge another modification into this one.
 
String toCometString (Size index) const
 Generate the Comet param file line format for the given 1-based index.
 

Static Public Member Functions

static std::vector< CometModificationmergeModifications (const std::vector< CometModification > &mods)
 Merge a vector of CometModifications, combining compatible entries.
 

Public Attributes

double mass {0.0}
 Modification mass difference.
 
String residues
 Residue(s) this modification applies to (e.g., "K", "KR", "n", "nKR")
 
int binary_group {0}
 Binary modification group (for SILAC etc.)
 
int max_mods_per_peptide {5}
 Maximum number of this modification per peptide.
 
int term_distance {-1}
 Terminal distance (-1 = no constraint, 0 = terminal only)
 
int nc_term {0}
 Terminal specificity: 0=protein N-term, 1=protein C-term, 2=peptide N-term, 3=peptide C-term.
 
bool required {false}
 Whether this modification is required.
 

Static Public Attributes

static constexpr double MASS_TOLERANCE = 1e-6
 Mass tolerance for comparing modification masses.
 

Detailed Description

Helper struct to represent a Comet variable modification entry.

This struct facilitates merging of modifications with the same mass and compatible term specificity. Comet supports specifying multiple residues in a single modification entry (e.g., "KR" for lysine and arginine), which significantly improves search performance.

Merging rules based on Comet's internal logic and documentation:

  • Modifications with the same mass and binary group can be merged
  • Amino acid mods can merge with each other (e.g., "K" + "R" -> "KR")
  • Peptide N-term and amino acids can be merged (e.g., "n" + "RST" -> "nRST")
  • Peptide C-term and amino acids can be merged (e.g., "c" + "KR" -> "cKR")
  • Protein terminal mods (nc_term 0 or 1) must remain separate
  • Peptide N-term and C-term cannot merge with each other

When terminal and amino acid mods merge, term_distance becomes -1 and nc_term becomes 0, because the terminal specificity is encoded by 'n'/'c' in the residue string (as per Comet documentation: e.g., "42.010565 nK 0 3 -1 0 0 0.0").

Constructor & Destructor Documentation

◆ CometModification() [1/2]

CometModification ( )
default

Default constructor.

◆ CometModification() [2/2]

CometModification ( const ResidueModification mod,
int  binary_grp,
int  max_mods 
)

Constructor from ResidueModification.

Member Function Documentation

◆ isMergeableWith()

bool isMergeableWith ( const CometModification other) const

Check if this modification can be merged with another.

◆ merge()

void merge ( const CometModification other)

Merge another modification into this one.

◆ mergeModifications()

static std::vector< CometModification > mergeModifications ( const std::vector< CometModification > &  mods)
static

Merge a vector of CometModifications, combining compatible entries.

◆ toCometString()

String toCometString ( Size  index) const

Generate the Comet param file line format for the given 1-based index.

Member Data Documentation

◆ binary_group

int binary_group {0}

Binary modification group (for SILAC etc.)

◆ mass

double mass {0.0}

Modification mass difference.

◆ MASS_TOLERANCE

constexpr double MASS_TOLERANCE = 1e-6
staticconstexpr

Mass tolerance for comparing modification masses.

◆ max_mods_per_peptide

int max_mods_per_peptide {5}

Maximum number of this modification per peptide.

◆ nc_term

int nc_term {0}

Terminal specificity: 0=protein N-term, 1=protein C-term, 2=peptide N-term, 3=peptide C-term.

◆ required

bool required {false}

Whether this modification is required.

◆ residues

String residues

Residue(s) this modification applies to (e.g., "K", "KR", "n", "nKR")

◆ term_distance

int term_distance {-1}

Terminal distance (-1 = no constraint, 0 = terminal only)