libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::PeptideSpectrumMatch Class Reference

#include <peptidespectrummatch.h>

Public Types

typedef std::list< PeakIonMatch >::const_iterator const_iterator

Public Member Functions

 PeptideSpectrumMatch (const MassSpectrum &spectrum, const pappso::PeptideSp &peptideSp, unsigned int parent_charge, PrecisionPtr precision, const std::list< Enums::PeptideIon > &ion_type_list)
 PeptideSpectrumMatch (const MassSpectrum &spectrum, const PeptideFragmentIonListBase &peptide_fragment_ion_list, unsigned int parent_charge, PrecisionPtr precision, const std::list< Enums::PeptideIon > &ion_type_list)
 PeptideSpectrumMatch (const MassSpectrum &spectrum, std::vector< PeptideFragmentIonSp > &v_peptide_fragment_ion, std::vector< unsigned int > &v_peptide_fragment_ion_charge, PrecisionPtr precision)
 PeptideSpectrumMatch (const PeptideSpectrumMatch &other)
virtual ~PeptideSpectrumMatch ()
bool contains (const PeptideFragmentIon *peptideFragmentIonSp, unsigned int z) const
unsigned int size () const
const_iterator begin () const
const_iterator end () const
unsigned int countTotalMatchedIons () const
const std::array< unsigned int, PEPTIDE_ION_TYPE_COUNT > & getIonTypeCountArray () const

Private Member Functions

void privMatchIonList (const MassSpectrum &spectrum, const PeptideFragmentIonListBase &fragmentIonList, unsigned int max_charge, const std::list< Enums::PeptideIon > &ion_type_list)
virtual std::list< DataPoint >::iterator getBestPeakIterator (std::list< DataPoint > &peak_list, const PeptideFragmentIonSp &ion, unsigned int charge) const

Private Attributes

PrecisionPtr _precision
std::list< PeakIonMatch_peak_ion_match_list
std::array< unsigned int, PEPTIDE_ION_TYPE_COUNT_ion_type_count = {{0}}

Detailed Description

Definition at line 43 of file peptidespectrummatch.h.

Member Typedef Documentation

◆ const_iterator

typedef std::list<PeakIonMatch>::const_iterator pappso::PeptideSpectrumMatch::const_iterator

Definition at line 69 of file peptidespectrummatch.h.

Constructor & Destructor Documentation

◆ PeptideSpectrumMatch() [1/4]

pappso::PeptideSpectrumMatch::PeptideSpectrumMatch ( const MassSpectrum & spectrum,
const pappso::PeptideSp & peptideSp,
unsigned int parent_charge,
PrecisionPtr precision,
const std::list< Enums::PeptideIon > & ion_type_list )

Definition at line 151 of file peptidespectrummatch.cpp.

156 : _precision(precision)
157{
158 PeptideFragmentIonListBase fragmentIonList(peptideSp, ion_type_list);
159 privMatchIonList(spectrum, fragmentIonList, parent_charge, ion_type_list);
160 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
161 << " _ion_type_count[PeptideIon::y]="
162 << _ion_type_count[(std::int8_t)Enums::PeptideIon::y];
163}
std::array< unsigned int, PEPTIDE_ION_TYPE_COUNT > _ion_type_count
void privMatchIonList(const MassSpectrum &spectrum, const PeptideFragmentIonListBase &fragmentIonList, unsigned int max_charge, const std::list< Enums::PeptideIon > &ion_type_list)
@ y
Cter amino ions.
Definition types.h:295

References _ion_type_count, _precision, privMatchIonList(), and pappso::Enums::y.

Referenced by PeptideSpectrumMatch().

◆ PeptideSpectrumMatch() [2/4]

pappso::PeptideSpectrumMatch::PeptideSpectrumMatch ( const MassSpectrum & spectrum,
const PeptideFragmentIonListBase & peptide_fragment_ion_list,
unsigned int parent_charge,
PrecisionPtr precision,
const std::list< Enums::PeptideIon > & ion_type_list )

Definition at line 138 of file peptidespectrummatch.cpp.

143 : _precision(precision)
144{
145 privMatchIonList(spectrum, fragmentIonList, max_charge, ion_type_list);
146 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
147 << " _ion_type_count[PeptideIon::y]="
148 << _ion_type_count[(std::int8_t)Enums::PeptideIon::y];
149}

References _ion_type_count, _precision, privMatchIonList(), and pappso::Enums::y.

◆ PeptideSpectrumMatch() [3/4]

pappso::PeptideSpectrumMatch::PeptideSpectrumMatch ( const MassSpectrum & spectrum,
std::vector< PeptideFragmentIonSp > & v_peptide_fragment_ion,
std::vector< unsigned int > & v_peptide_fragment_ion_charge,
PrecisionPtr precision )

Definition at line 95 of file peptidespectrummatch.cpp.

100 : _precision(precision)
101{
102 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
103 // throw PappsoException(QObject::tr("v_peptideIsotopeList.size() %1 !=
104 // v_peptideIonList.size()
105 // %2").arg(v_peptideIsotopeList.size()).arg(v_peptideIonList.size()));
106 if(v_peptide_fragment_ion.size() != v_peptide_fragment_ion_charge.size())
107 {
108 throw PappsoException(QObject::tr("v_peptide_fragment_ion.size() != "
109 "v_peptide_fragment_ion_charge.size() %2")
110 .arg(v_peptide_fragment_ion.size())
111 .arg(v_peptide_fragment_ion_charge.size()));
112 }
113
114
115 auto ionIt = v_peptide_fragment_ion.begin();
116 auto chargeIt = v_peptide_fragment_ion_charge.begin();
117 std::list<DataPoint> peak_list(spectrum.begin(), spectrum.end());
118
119 while(ionIt != v_peptide_fragment_ion.end())
120 {
121 std::list<DataPoint>::iterator it_peak = getBestPeakIterator(peak_list, *ionIt, *chargeIt);
122 if(it_peak != peak_list.end())
123 {
124 _peak_ion_match_list.push_back(PeakIonMatch(*it_peak, *ionIt, *chargeIt));
125 _ion_type_count[(std::int8_t)ionIt->get()->getPeptideIonType()]++;
126 peak_list.erase(it_peak);
127 }
128
129 ionIt++;
130 chargeIt++;
131 }
132 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
133 << " _ion_type_count[PeptideIon::y]="
134 << _ion_type_count[(std::int8_t)Enums::PeptideIon::y];
135}
virtual std::list< DataPoint >::iterator getBestPeakIterator(std::list< DataPoint > &peak_list, const PeptideFragmentIonSp &ion, unsigned int charge) const
std::list< PeakIonMatch > _peak_ion_match_list

References _ion_type_count, _peak_ion_match_list, _precision, getBestPeakIterator(), and pappso::Enums::y.

◆ PeptideSpectrumMatch() [4/4]

pappso::PeptideSpectrumMatch::PeptideSpectrumMatch ( const PeptideSpectrumMatch & other)

Definition at line 166 of file peptidespectrummatch.cpp.

167 : _precision(other._precision), _peak_ion_match_list(other._peak_ion_match_list)
168{
169}

References PeptideSpectrumMatch(), _peak_ion_match_list, and _precision.

◆ ~PeptideSpectrumMatch()

pappso::PeptideSpectrumMatch::~PeptideSpectrumMatch ( )
virtual

Definition at line 205 of file peptidespectrummatch.cpp.

206{
207}

Member Function Documentation

◆ begin()

PeptideSpectrumMatch::const_iterator pappso::PeptideSpectrumMatch::begin ( ) const

Definition at line 217 of file peptidespectrummatch.cpp.

218{
219 return _peak_ion_match_list.begin();
220}

References _peak_ion_match_list.

◆ contains()

bool pappso::PeptideSpectrumMatch::contains ( const PeptideFragmentIon * peptideFragmentIonSp,
unsigned int z ) const

Definition at line 240 of file peptidespectrummatch.cpp.

241{
242 auto it = _peak_ion_match_list.begin();
243 while(it != _peak_ion_match_list.end())
244 {
245 const PeakIonMatch &ref = *it;
246 if((ref.getCharge() == z) && (ref.getPeptideFragmentIonSp().get() == peptideFragmentIonSp))
247 {
248 return true;
249 }
250 it++;
251 }
252 return false;
253}

References _peak_ion_match_list, pappso::PeakIonMatch::getCharge(), pappso::PeakIonMatch::getPeptideFragmentIonSp(), and pappso::z.

◆ countTotalMatchedIons()

unsigned int pappso::PeptideSpectrumMatch::countTotalMatchedIons ( ) const

Definition at line 228 of file peptidespectrummatch.cpp.

229{
230 return std::accumulate(_ion_type_count.begin(), _ion_type_count.end(), 0);
231}

References _ion_type_count.

◆ end()

PeptideSpectrumMatch::const_iterator pappso::PeptideSpectrumMatch::end ( ) const

Definition at line 222 of file peptidespectrummatch.cpp.

223{
224 return _peak_ion_match_list.end();
225}

References _peak_ion_match_list.

◆ getBestPeakIterator()

std::list< DataPoint >::iterator pappso::PeptideSpectrumMatch::getBestPeakIterator ( std::list< DataPoint > & peak_list,
const PeptideFragmentIonSp & ion,
unsigned int charge ) const
privatevirtual

Definition at line 172 of file peptidespectrummatch.cpp.

175{
176 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
177 // << " peak_list.size()=" << peak_list.size();
178 std::list<DataPoint>::iterator itpeak = peak_list.begin();
179 std::list<DataPoint>::iterator itend = peak_list.end();
180 std::list<DataPoint>::iterator itselect = peak_list.end();
181
182 pappso_double best_intensity = 0;
183
184 while(itpeak != itend)
185 {
186
187 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
188 // << " itpeak->x=" << itpeak->x;
189 if(ion.get()->matchPeak(_precision, itpeak->x, charge))
190 {
191 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
192 // << " ion.get()->matchPeak";
193 if(itpeak->y > best_intensity)
194 {
195 best_intensity = itpeak->y;
196 itselect = itpeak;
197 }
198 }
199 itpeak++;
200 }
201
202 return (itselect);
203}
double pappso_double
A type definition for doubles.
Definition types.h:60

References _precision.

Referenced by PeptideSpectrumMatch(), and privMatchIonList().

◆ getIonTypeCountArray()

const std::array< unsigned int, PEPTIDE_ION_TYPE_COUNT > & pappso::PeptideSpectrumMatch::getIonTypeCountArray ( ) const

Definition at line 234 of file peptidespectrummatch.cpp.

235{
236 return _ion_type_count;
237}

References _ion_type_count.

◆ privMatchIonList()

void pappso::PeptideSpectrumMatch::privMatchIonList ( const MassSpectrum & spectrum,
const PeptideFragmentIonListBase & fragmentIonList,
unsigned int max_charge,
const std::list< Enums::PeptideIon > & ion_type_list )
private

Definition at line 45 of file peptidespectrummatch.cpp.

49{
50
51 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
52 // << " ion_type_list.size()=" << ion_type_list.size();
53 std::list<DataPoint> peak_list(spectrum.begin(), spectrum.end());
54 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
55 // << " peak_list.size()=" << peak_list.size();
56 std::list<Enums::PeptideIon> ion_type_list(ion_type_list_in);
57
58 ion_type_list.sort([](const Enums::PeptideIon &iona, const Enums::PeptideIon &ionb) {
59 if(iona == Enums::PeptideIon::b)
60 return true;
61 if(ionb == Enums::PeptideIon::b)
62 return false;
63 if(iona == Enums::PeptideIon::y)
64 return true;
65 if(ionb == Enums::PeptideIon::y)
66 return false;
67 return iona > ionb;
68 });
69 for(auto ion_type : ion_type_list)
70 {
71 auto ion_list = fragmentIonList.getPeptideFragmentIonSp(ion_type);
72 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
73 // << " ion_list.size()=" << ion_list.size();
74 for(unsigned int charge = 1; charge <= max_charge; charge++)
75 {
76 for(auto &&ion : ion_list)
77 {
78 std::list<DataPoint>::iterator it_peak = getBestPeakIterator(peak_list, ion, charge);
79
80 if(it_peak != peak_list.end())
81 {
82
83 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " <<
84 // __LINE__
85 // << " peak FOUND";
86 _peak_ion_match_list.push_back(PeakIonMatch(*it_peak, ion, charge));
87 _ion_type_count[(std::int8_t)ion->getPeptideIonType()]++;
88 peak_list.erase(it_peak);
89 }
90 }
91 }
92 }
93}
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
@ b
Nter acylium ions.
Definition types.h:287

References _ion_type_count, _peak_ion_match_list, pappso::Enums::b, getBestPeakIterator(), pappso::PeptideFragmentIonListBase::getPeptideFragmentIonSp(), and pappso::Enums::y.

Referenced by PeptideSpectrumMatch(), and PeptideSpectrumMatch().

◆ size()

unsigned int pappso::PeptideSpectrumMatch::size ( ) const

Definition at line 211 of file peptidespectrummatch.cpp.

212{
213 return _peak_ion_match_list.size();
214}

References _peak_ion_match_list.

Member Data Documentation

◆ _ion_type_count

std::array<unsigned int, PEPTIDE_ION_TYPE_COUNT> pappso::PeptideSpectrumMatch::_ion_type_count = {{0}}
private

◆ _peak_ion_match_list

std::list<PeakIonMatch> pappso::PeptideSpectrumMatch::_peak_ion_match_list
private

◆ _precision

PrecisionPtr pappso::PeptideSpectrumMatch::_precision
private

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