libpappsomspp
Library for mass spectrometry
pappso::MorpheusScore Class Reference

#include <morpheusscore.h>

Public Member Functions

 MorpheusScore (const MassSpectrum &spectrum, pappso::PeptideSp peptideSp, unsigned int parent_charge, PrecisionPtr precision, std::vector< PeptideIon > ion_list, RawFragmentationMode fragmentation_mode)
 
 ~MorpheusScore ()
 
pappso::pappso_double getMorpheusScore () const
 

Private Attributes

pappso::pappso_double _morpheus_score
 

Detailed Description

Definition at line 40 of file morpheusscore.h.

Constructor & Destructor Documentation

◆ MorpheusScore()

pappso::MorpheusScore::MorpheusScore ( const MassSpectrum spectrum,
pappso::PeptideSp  peptideSp,
unsigned int  parent_charge,
PrecisionPtr  precision,
std::vector< PeptideIon ion_list,
RawFragmentationMode  fragmentation_mode 
)

Definition at line 39 of file morpheusscore.cpp.

45 {
46  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
47  PeptideRawFragmentMasses calc_mass_list_proline(*peptide_sp.get(),
48  fragmentation_mode);
49 
50  std::vector<pappso_double> ion_products;
51  unsigned int charge = parent_charge;
52  while(charge > 0)
53  {
54  for(PeptideIon &ion : ion_list)
55  {
56  calc_mass_list_proline.pushBackIonMz(ion_products, ion, charge);
57  }
58  charge--;
59  }
60 
61 
62  // compute the number of matched peaks
63  unsigned int number_of_matched_peaks = 0;
64 
65  std::sort(ion_products.begin(), ion_products.end());
66 
67 
68  // compute ratio of matched peaks on total peaks
69  std::vector<pappso_double>::const_iterator it_theoretical =
70  ion_products.begin();
71  std::vector<pappso_double>::const_iterator it_theoretical_end =
72  ion_products.end();
73  std::vector<DataPoint>::const_iterator it_spectrum = spectrum.begin();
74  std::vector<DataPoint>::const_iterator it_spectrum_end = spectrum.end();
75  pappso::pappso_double sum_intensities = 0;
76  pappso::pappso_double sum_matched_intensities = 0;
77  // unsigned int peak_number = spectrum.size();
78  while((it_spectrum != it_spectrum_end) &&
79  (it_theoretical != it_theoretical_end))
80  {
81  sum_intensities += it_spectrum->y;
82  MzRange peak_range(it_spectrum->x, precision);
83 
84  while((it_theoretical != it_theoretical_end) &&
85  (*it_theoretical < peak_range.lower()))
86  {
87  it_theoretical++;
88  }
89  while((it_theoretical != it_theoretical_end) &&
90  peak_range.contains(*it_theoretical))
91  {
92  sum_matched_intensities += it_spectrum->y;
93  number_of_matched_peaks++;
94  it_theoretical++;
95  }
96  it_spectrum++;
97  }
98  while(it_spectrum != it_spectrum_end)
99  {
100  sum_intensities += it_spectrum->y;
101  it_spectrum++;
102  }
103 
104 
105  // compute the sum of matching peak intensities
106 
107  // morpheus score = number of matched peaks + matching intensities ratio
108 
109  _morpheus_score = (pappso_double)number_of_matched_peaks +
110  (sum_matched_intensities / sum_intensities);
111 
112  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
113 }
pappso::pappso_double _morpheus_score
Definition: morpheusscore.h:54
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition: types.h:386
double pappso_double
A type definition for doubles.
Definition: types.h:49

References _morpheus_score, pappso::MzRange::contains(), pappso::MzRange::lower(), and pappso::PeptideRawFragmentMasses::pushBackIonMz().

◆ ~MorpheusScore()

pappso::MorpheusScore::~MorpheusScore ( )

Definition at line 115 of file morpheusscore.cpp.

116 {
117 }

Member Function Documentation

◆ getMorpheusScore()

pappso::pappso_double pappso::MorpheusScore::getMorpheusScore ( ) const

Definition at line 120 of file morpheusscore.cpp.

121 {
122  return _morpheus_score;
123 }

References _morpheus_score.

Member Data Documentation

◆ _morpheus_score

pappso::pappso_double pappso::MorpheusScore::_morpheus_score
private

Definition at line 54 of file morpheusscore.h.

Referenced by MorpheusScore(), and getMorpheusScore().


The documentation for this class was generated from the following files: