OpenMS
OpenSearchModificationAnalysis Class Reference

Utility class for analyzing modification patterns in open search results. More...

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

Classes

struct  FuzzyDoubleComparator
 Comparator for approximate comparison of double values. More...
 
struct  ModificationPattern
 Stores details of a modification pattern found in the data. More...
 
struct  ModificationSummary
 Data structure for modification summary output. More...
 

Public Types

using DeltaMassHistogram = std::map< double, double, FuzzyDoubleComparator >
 Type definitions for delta mass analysis. More...
 
using DeltaMassToChargeCount = std::map< double, int, FuzzyDoubleComparator >
 

Public Member Functions

 OpenSearchModificationAnalysis ()=default
 Default constructor. More...
 
 ~OpenSearchModificationAnalysis ()=default
 Destructor. More...
 
std::pair< DeltaMassHistogram, DeltaMassToChargeCountanalyzeDeltaMassPatterns (const PeptideIdentificationList &peptide_ids, bool use_smoothing=false, bool debug=false) const
 Analyze delta mass patterns from peptide identifications. More...
 
std::vector< ModificationSummarymapDeltaMassesToModifications (const DeltaMassHistogram &delta_mass_histogram, const DeltaMassToChargeCount &charge_histogram, PeptideIdentificationList &peptide_ids, double precursor_mass_tolerance=5.0, bool precursor_mass_tolerance_unit_ppm=true, const String &output_file="") const
 Map delta masses to known modifications and annotate peptides. More...
 
std::vector< ModificationSummaryanalyzeModifications (PeptideIdentificationList &peptide_ids, double precursor_mass_tolerance=5.0, bool precursor_mass_tolerance_unit_ppm=true, bool use_smoothing=false, const String &output_file="") const
 Complete analysis workflow: analyze patterns and map to modifications. More...
 

Private Member Functions

void writeModificationSummary_ (const std::vector< ModificationSummary > &modifications, const String &output_file) const
 Write modification summary table to file. More...
 

Static Private Member Functions

static double gaussian_ (double x, double sigma)
 Gaussian function for smoothing. More...
 
static DeltaMassHistogram smoothDeltaMassHistogram_ (const DeltaMassHistogram &histogram, double sigma=0.001)
 Smooth delta mass histogram using Gaussian kernel density estimation. More...
 
static DeltaMassHistogram findPeaksInHistogram_ (const DeltaMassHistogram &histogram, double count_threshold=0.0, double snr=2.0)
 Find peaks in delta mass histogram based on count threshold and signal-to-noise ratio. More...
 

Detailed Description

Utility class for analyzing modification patterns in open search results.

This class provides functionality to analyze delta mass patterns from open search peptide identifications, identify common modifications, and map them to known modifications from the ModificationsDB. Originally extracted from SageAdapter.


Class Documentation

◆ OpenMS::OpenSearchModificationAnalysis::ModificationPattern

struct OpenMS::OpenSearchModificationAnalysis::ModificationPattern

Stores details of a modification pattern found in the data.

Collaboration diagram for OpenSearchModificationAnalysis::ModificationPattern:
[legend]
Class Members
double count Number of peptides with this modification.
vector< double > masses Masses associated with the modification.
int num_charge_states Number of different charge states observed.

◆ OpenMS::OpenSearchModificationAnalysis::ModificationSummary

struct OpenMS::OpenSearchModificationAnalysis::ModificationSummary

Data structure for modification summary output.

Collaboration diagram for OpenSearchModificationAnalysis::ModificationSummary:
[legend]
Class Members
int count Modification rate (number of occurrences)
vector< double > masses Masses associated with the modification.
String name Modification name.
int num_charge_states Number of charge states.

Member Typedef Documentation

◆ DeltaMassHistogram

using DeltaMassHistogram = std::map<double, double, FuzzyDoubleComparator>

Type definitions for delta mass analysis.

◆ DeltaMassToChargeCount

using DeltaMassToChargeCount = std::map<double, int, FuzzyDoubleComparator>

Constructor & Destructor Documentation

◆ OpenSearchModificationAnalysis()

Default constructor.

◆ ~OpenSearchModificationAnalysis()

Destructor.

Member Function Documentation

◆ analyzeDeltaMassPatterns()

std::pair<DeltaMassHistogram, DeltaMassToChargeCount> analyzeDeltaMassPatterns ( const PeptideIdentificationList peptide_ids,
bool  use_smoothing = false,
bool  debug = false 
) const

Analyze delta mass patterns from peptide identifications.

Parameters
peptide_idsList of peptide identifications containing delta mass information
use_smoothingWhether to apply smoothing to the delta mass histogram
debugEnable debug output
Returns
Pair containing delta mass histogram and charge state counts

◆ analyzeModifications()

std::vector<ModificationSummary> analyzeModifications ( PeptideIdentificationList peptide_ids,
double  precursor_mass_tolerance = 5.0,
bool  precursor_mass_tolerance_unit_ppm = true,
bool  use_smoothing = false,
const String output_file = "" 
) const

Complete analysis workflow: analyze patterns and map to modifications.

Parameters
peptide_idsList of peptide identifications (modified in-place)
precursor_mass_toleranceMass tolerance for mapping
precursor_mass_tolerance_unit_ppmWhether tolerance is in ppm (true) or Da (false)
use_smoothingWhether to apply smoothing to delta mass histogram
output_fileOptional file path for writing modification summary table
Returns
List of modification summaries found

◆ findPeaksInHistogram_()

static DeltaMassHistogram findPeaksInHistogram_ ( const DeltaMassHistogram histogram,
double  count_threshold = 0.0,
double  snr = 2.0 
)
staticprivate

Find peaks in delta mass histogram based on count threshold and signal-to-noise ratio.

◆ gaussian_()

static double gaussian_ ( double  x,
double  sigma 
)
staticprivate

Gaussian function for smoothing.

◆ mapDeltaMassesToModifications()

std::vector<ModificationSummary> mapDeltaMassesToModifications ( const DeltaMassHistogram delta_mass_histogram,
const DeltaMassToChargeCount charge_histogram,
PeptideIdentificationList peptide_ids,
double  precursor_mass_tolerance = 5.0,
bool  precursor_mass_tolerance_unit_ppm = true,
const String output_file = "" 
) const

Map delta masses to known modifications and annotate peptides.

Parameters
delta_mass_histogramHistogram of delta masses
charge_histogramCharge state counts for each delta mass
peptide_idsList of peptide identifications to annotate (modified in-place)
precursor_mass_toleranceMass tolerance for mapping
precursor_mass_tolerance_unit_ppmWhether tolerance is in ppm (true) or Da (false)
output_fileOptional file path for writing modification summary table
Returns
List of modification summaries found

◆ smoothDeltaMassHistogram_()

static DeltaMassHistogram smoothDeltaMassHistogram_ ( const DeltaMassHistogram histogram,
double  sigma = 0.001 
)
staticprivate

Smooth delta mass histogram using Gaussian kernel density estimation.

◆ writeModificationSummary_()

void writeModificationSummary_ ( const std::vector< ModificationSummary > &  modifications,
const String output_file 
) const
private

Write modification summary table to file.