libpappsomspp
Library for mass spectrometry
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< PeptideIon > &ion_type_list)
 
 PeptideSpectrumMatch (const MassSpectrum &spectrum, const PeptideFragmentIonListBase &peptide_fragment_ion_list, unsigned int parent_charge, PrecisionPtr precision, const std::list< 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< 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< PeptideIon > &  ion_type_list 
)

Definition at line 146 of file peptidespectrummatch.cpp.

152 : _precision(precision)
153{
154 PeptideFragmentIonListBase fragmentIonList(peptideSp, ion_type_list);
155 privMatchIonList(spectrum, fragmentIonList, parent_charge, ion_type_list);
156 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
157 << " _ion_type_count[PeptideIon::y]="
158 << _ion_type_count[(std::int8_t)PeptideIon::y];
159}
void privMatchIonList(const MassSpectrum &spectrum, const PeptideFragmentIonListBase &fragmentIonList, unsigned int max_charge, const std::list< PeptideIon > &ion_type_list)
std::array< unsigned int, PEPTIDE_ION_TYPE_COUNT > _ion_type_count
@ y
Cter amino ions.

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

◆ PeptideSpectrumMatch() [2/4]

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

Definition at line 132 of file peptidespectrummatch.cpp.

138 : _precision(precision)
139{
140 privMatchIonList(spectrum, fragmentIonList, max_charge, ion_type_list);
141 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
142 << " _ion_type_count[PeptideIon::y]="
143 << _ion_type_count[(std::int8_t)PeptideIon::y];
144}

References _ion_type_count, privMatchIonList(), and pappso::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 86 of file peptidespectrummatch.cpp.

91 : _precision(precision)
92{
93 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
94 // throw PappsoException(QObject::tr("v_peptideIsotopeList.size() %1 !=
95 // v_peptideIonList.size()
96 // %2").arg(v_peptideIsotopeList.size()).arg(v_peptideIonList.size()));
97 if(v_peptide_fragment_ion.size() != v_peptide_fragment_ion_charge.size())
98 {
99 throw PappsoException(
100 QObject::tr("v_peptide_fragment_ion.size() != "
101 "v_peptide_fragment_ion_charge.size() %2")
102 .arg(v_peptide_fragment_ion.size())
103 .arg(v_peptide_fragment_ion_charge.size()));
104 }
105
106
107 auto ionIt = v_peptide_fragment_ion.begin();
108 auto chargeIt = v_peptide_fragment_ion_charge.begin();
109 std::list<DataPoint> peak_list(spectrum.begin(), spectrum.end());
110
111 while(ionIt != v_peptide_fragment_ion.end())
112 {
113 std::list<DataPoint>::iterator it_peak =
114 getBestPeakIterator(peak_list, *ionIt, *chargeIt);
115 if(it_peak != peak_list.end())
116 {
117 _peak_ion_match_list.push_back(
118 PeakIonMatch(*it_peak, *ionIt, *chargeIt));
119 _ion_type_count[(std::int8_t)ionIt->get()->getPeptideIonType()]++;
120 peak_list.erase(it_peak);
121 }
122
123 ionIt++;
124 chargeIt++;
125 }
126 qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
127 << " _ion_type_count[PeptideIon::y]="
128 << _ion_type_count[(std::int8_t)PeptideIon::y];
129}
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, getBestPeakIterator(), and pappso::y.

◆ PeptideSpectrumMatch() [4/4]

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

Definition at line 162 of file peptidespectrummatch.cpp.

163 : _precision(other._precision),
164 _peak_ion_match_list(other._peak_ion_match_list)
165{
166}

◆ ~PeptideSpectrumMatch()

pappso::PeptideSpectrumMatch::~PeptideSpectrumMatch ( )
virtual

Definition at line 202 of file peptidespectrummatch.cpp.

203{
204}

Member Function Documentation

◆ begin()

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

Definition at line 214 of file peptidespectrummatch.cpp.

215{
216 return _peak_ion_match_list.begin();
217}

References _peak_ion_match_list.

◆ contains()

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

Definition at line 237 of file peptidespectrummatch.cpp.

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

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

◆ countTotalMatchedIons()

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

Definition at line 225 of file peptidespectrummatch.cpp.

226{
227 return std::accumulate(_ion_type_count.begin(), _ion_type_count.end(), 0);
228}

References _ion_type_count.

◆ end()

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

Definition at line 219 of file peptidespectrummatch.cpp.

220{
221 return _peak_ion_match_list.end();
222}

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 169 of file peptidespectrummatch.cpp.

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

References _precision.

Referenced by PeptideSpectrumMatch(), and privMatchIonList().

◆ getIonTypeCountArray()

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

Definition at line 231 of file peptidespectrummatch.cpp.

232{
233 return _ion_type_count;
234}

References _ion_type_count.

◆ privMatchIonList()

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

Definition at line 45 of file peptidespectrummatch.cpp.

50{
51
52 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
53 // << " ion_type_list.size()=" << ion_type_list.size();
54 std::list<DataPoint> peak_list(spectrum.begin(), spectrum.end());
55 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
56 // << " peak_list.size()=" << peak_list.size();
57
58 for(auto ion_type : ion_type_list)
59 {
60 auto ion_list = fragmentIonList.getPeptideFragmentIonSp(ion_type);
61 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
62 // << " ion_list.size()=" << ion_list.size();
63 for(unsigned int charge = 1; charge <= max_charge; charge++)
64 {
65 for(auto &&ion : ion_list)
66 {
67 std::list<DataPoint>::iterator it_peak =
68 getBestPeakIterator(peak_list, ion, charge);
69
70 if(it_peak != peak_list.end())
71 {
72
73 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " <<
74 // __LINE__
75 // << " peak FOUND";
76 _peak_ion_match_list.push_back(
77 PeakIonMatch(*it_peak, ion, charge));
78 _ion_type_count[(std::int8_t)ion->getPeptideIonType()]++;
79 peak_list.erase(it_peak);
80 }
81 }
82 }
83 }
84}

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

Referenced by PeptideSpectrumMatch().

◆ size()

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

Definition at line 208 of file peptidespectrummatch.cpp.

209{
210 return _peak_ion_match_list.size();
211}

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

Definition at line 92 of file peptidespectrummatch.h.

Referenced by getBestPeakIterator().


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