33#include <unordered_set>
49 specglob::ExperimentalSpectrum(qmass_spectrum, precision_ptr)),
56 for(std::size_t iter = 0; iter <
m_aaCode.getSize(); iter++)
58 m_aapositions.push_back(std::make_shared<std::vector<AaPosition>>());
59 m_aapositions.back()->reserve(this->size() - 1);
64 for(std::size_t iter = 1; iter < this->size(); iter++)
89 double precursor_mass_error)
99 for(std::size_t iter = 0; iter <
m_aaCode.getSize(); iter++)
101 m_aapositions.push_back(std::make_shared<std::vector<AaPosition>>());
102 m_aapositions.back()->reserve(this->size() - 1);
107 for(std::size_t iter = 1; iter < this->size(); iter++)
113 this->back().peak_mz =
128 std::vector<double>::iterator iter1, iter2;
129 std::size_t peak1, peak2, next_l_peak;
133 for(iter1 = mass_list.begin(); iter1 != mass_list.end(); iter1++)
137 for(iter2 = iter1 + 1; iter2 != mass_list.end(); iter2++)
144 for(std::size_t iter = 1; iter < peak1;
182 for(uint8_t aa = 1; aa <
m_aaCode.getSize() + 1; ++aa)
184 qDebug() <<
m_aaCode.getAa(aa).getLetter();
188 qDebug() << iter->l_peak << this->at(iter->l_peak).peak_mz << iter->r_peak
189 << this->at(iter->r_peak).peak_mz << iter->l_support << iter->condition;
242 std::vector<specglob::ExperimentalSpectrumDataPoint> kept_peaks;
243 for(std::vector<specglob::ExperimentalSpectrumDataPoint>::iterator iter = this->begin();
249 kept_peaks.push_back(*iter);
253 this->assign(kept_peaks.begin(), kept_peaks.end());
258 uint8_t aa,
const std::size_t r_peak,
const std::size_t l_peak,
double l_mass,
bool l_support)
264 qDebug() <<
"l_peak" << l_peak <<
"r_peak" << r_peak <<
"l_mass" << l_mass <<
"l_support"
270 bool l_support)
const
288 condition += 2 << *(aa);
295const std::vector<pappso::specpeptidoms::AaPosition> &
302std::vector<pappso::specpeptidoms::AaPosition>
304 std::uint8_t aa_code, std::vector<std::size_t> &peaks_to_remove)
const
306 std::vector<AaPosition> aa_positions;
309 if(std::find(peaks_to_remove.begin(), peaks_to_remove.end(), aap.r_peak) ==
310 peaks_to_remove.end())
312 aa_positions.push_back(aap);
321 std::vector<double> mass_list;
324 mass_list.push_back(n.
peak_mz);
332 return this->at(indice).type;
350 if(std::max(r_peak, l_peak) > size())
353 QObject::tr(
"getMZShift : l_peak %1 or r_peak %2 greater than size %3")
358 return this->at(r_peak).peak_mz - this->at(l_peak).peak_mz;
367 QObject::tr(
"getMissingMass : peak %1 greater than size %2").arg(peak).arg(size()));
370 this->at(peak).peak_mz +
MHPLUS;
376 std::size_t counter = 0;
377 for(std::size_t iter = 0; iter < peak; iter++)
399 for(
auto aap = aa->get()->begin(); aap != aa->get()->end(); aap++)
410 std::size_t left_index, right_index;
418 right_index = this->size() - 1;
421 while(left_index < right_index)
424 if(mz_range.
contains(this->at(right_index).peak_mz))
428 qDebug() << left_index << right_index;
430 if(comp_mass - this->at(left_index).peak_mz - this->at(right_index).peak_mz >= 0)
collection of integer code for each amino acid 0 => null 1 to 20 => amino acid sorted by there mass (...
bool contains(pappso_double) const
Class representing a fully specified mass spectrum.
void preprocessSpectrum()
Preprocess the spectrum.
double getMZShift(std::size_t l_peak, std::size_t r_peak) const
Returns the mz difference between two peaks.
uint getPrecursorCharge() const
Returns the spectrum's precursor's charge.
SpOMSSpectrum(pappso::QualifiedMassSpectrum &qmass_spectrum, pappso::PrecisionPtr precision_ptr, const pappso::AaCode &aaCode)
double getMissingMass(std::size_t peak) const
Returns the missing mass between a peak and the precursor's mass (shift at the end).
std::vector< std::size_t > m_complementary_peak_indexes
std::vector< std::shared_ptr< std::vector< uint8_t > > > m_supported_peaks
uint32_t computeCondition(const std::size_t l_peak, bool l_support) const
Computes the "condition" integer, used to apply the three peaks rule.
void removeUnsupportedMasses()
Removes the unsupported peaks (without an amino acid to the left) from the spectrum.
double m_precursor_mass_error
void addAaPosition(uint8_t aa, const std::size_t r_peak, const std::size_t l_peak, double l_mass, bool l_support)
Adds an amino acid position to the data structure.
pappso::PrecisionPtr m_precision_ptr
pappso::QualifiedMassSpectrum m_qualifiedMassSpectrum
std::vector< std::shared_ptr< std::vector< AaPosition > > > m_aapositions
void correctPeakIndexes()
Reindexes the peaks after removal of the unsupported peaks.
void addSupportedPeak(std::size_t peak)
Add a peak to the supported peaks list.
void fillComplementaryPeakIndexes()
For each point of the spectrum, indicate the index of its complementary peak;.
std::vector< int > m_reindexed_peaks
std::size_t getComplementaryPeak(std::size_t peak) const
const std::vector< AaPosition > & getAaPositions(std::uint8_t aa_code) const
Returns the list of aa_positions for a given amino acid code.
specglob::ExperimentalSpectrumDataPointType peakType(std::size_t indice) const
Returns the type of one of the spectrum's peaks.
std::vector< double > getMassList() const
Returns the spectrum's list of masses.
double getPrecursorMass() const
const pappso::AaCode & m_aaCode
ExperimentalSpectrumDataPointType
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
const pappso_double MHPLUS(1.007276466879)
const pappso_double MPROTIUM(1.007825032241)
const pappso_double MASSOXYGEN(15.99491461956)
const PrecisionBase * PrecisionPtr