Loading...
Searching...
No Matches
pappso::specglob::ExperimentalSpectrum Class Reference

`#include <experimentalspectrum.h>`

Inheritance diagram for pappso::specglob::ExperimentalSpectrum:

## Public Member Functions

| ExperimentalSpectrum (const pappso::QualifiedMassSpectrum &qmass_spectrum, pappso::PrecisionPtr precision_ptr)
| ExperimentalSpectrum (const pappso::QualifiedMassSpectrum &qmass_spectrum, pappso::PrecisionPtr precision_ptr, double precursor_mass_error)
| ExperimentalSpectrum (const ExperimentalSpectrum &other)
virtual | ~ExperimentalSpectrum ()
std::vector< double > | getMassList () const
double | getSymetricMz (double mz) const
| compute the symmetric mass for debuggin purpose
double | getTargetMzSum () const
double | getPrecursorMass () const
std::vector< double > | getMassList (ExperimentalSpectrumDataPointType type) const
QString | toString () const
const pappso::QualifiedMassSpectrum & | getQualifiedMassSpectrum () const
std::vector< ExperimentalSpectrumDataPoint >::const_reverse_iterator | reverseFindDiffMz (std::size_t start_position, const pappso::MzRange &targeted_mass_range) const
| find the peak for wich mass difference from rbegin corresponds to aaTheoMass Find if a peak back in the peak list has a mass difference that corresponds to the targeted mass

## Private Member Functions

void | createSymetricPeakList ()
| add symmetric peaks to the spectrum Create a SymetricPeakList that contain symmetric peaks and the information if a peak is the initial peak, the symmetric peak, or both if already exist. assuming fragment ion charge is 1
void | createSymetricPeakList (double precursor_mass_error)
std::vector< pappso::DataPoint >::const_iterator | findMz (double mz)
| find the correspondin mz in the mass spectrum (given the precision)

## Private Attributes

pappso::QualifiedMassSpectrum | m_qualifiedMassSpectrum
double | m_targetMzSum
double | m_precursorMass
pappso::PrecisionPtr | m_precisionPtr

## Detailed Description

Todo
  write docs

Definition at line 63 of file experimentalspectrum.h.

## Constructor & Destructor Documentation

## ExperimentalSpectrum() [1/3]

pappso::specglob::ExperimentalSpectrum::ExperimentalSpectrum | ( | const pappso::QualifiedMassSpectrum & | qmass_spectrum,
|  | pappso::PrecisionPtr | precision_ptr )

Default constructor

Definition at line 45 of file experimentalspectrum.cpp.

: std::vector<ExperimentalSpectrumDataPoint>()
{
m_qualifiedMassSpectrum = qmass_spectrum;
m_precisionPtr = precision_ptr;
createSymetricPeakList();
}
pappso::specglob::ExperimentalSpectrum::m_precisionPtr
pappso::PrecisionPtr m_precisionPtr
Definition experimentalspectrum.h:141
pappso::specglob::ExperimentalSpectrum::createSymetricPeakList
void createSymetricPeakList()
add symmetric peaks to the spectrum Create a SymetricPeakList that contain symmetric peaks and the in...
Definition experimentalspectrum.cpp:77
pappso::specglob::ExperimentalSpectrum::m_qualifiedMassSpectrum
pappso::QualifiedMassSpectrum m_qualifiedMassSpectrum
Definition experimentalspectrum.h:138

References createSymetricPeakList(), m_precisionPtr, and m_qualifiedMassSpectrum.

Referenced by ExperimentalSpectrum().

## ExperimentalSpectrum() [2/3]

pappso::specglob::ExperimentalSpectrum::ExperimentalSpectrum | ( | const pappso::QualifiedMassSpectrum & | qmass_spectrum,
|  | pappso::PrecisionPtr | precision_ptr,
|  | double | precursor_mass_error )

specpeptidoms post-processing constructor

Definition at line 54 of file experimentalspectrum.cpp.

: std::vector<ExperimentalSpectrumDataPoint>()
{
m_qualifiedMassSpectrum = qmass_spectrum;
m_precisionPtr = precision_ptr;
createSymetricPeakList(precursor_mass_error);
}

References createSymetricPeakList(), m_precisionPtr, and m_qualifiedMassSpectrum.

## ExperimentalSpectrum() [3/3]

pappso::specglob::ExperimentalSpectrum::ExperimentalSpectrum | ( | const ExperimentalSpectrum & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 64 of file experimentalspectrum.cpp.

: std::vector<ExperimentalSpectrumDataPoint>(other)
{
m_targetMzSum = other.m_targetMzSum;
m_qualifiedMassSpectrum = other.m_qualifiedMassSpectrum;
m_precisionPtr = other.m_precisionPtr;
}
pappso::specglob::ExperimentalSpectrum::m_targetMzSum
double m_targetMzSum
Definition experimentalspectrum.h:139

References ExperimentalSpectrum(), m_precisionPtr, m_qualifiedMassSpectrum, and m_targetMzSum.

## ~ExperimentalSpectrum()

pappso::specglob::ExperimentalSpectrum::~ExperimentalSpectrum | ( |  | ) |

virtual

Destructor

Definition at line 72 of file experimentalspectrum.cpp.

{
}

## Member Function Documentation

## createSymetricPeakList() [1/2]

void pappso::specglob::ExperimentalSpectrum::createSymetricPeakList | ( |  | ) |

private

add symmetric peaks to the spectrum Create a SymetricPeakList that contain symmetric peaks and the information if a peak is the initial peak, the symmetric peak, or both if already exist. assuming fragment ion charge is 1

Definition at line 77 of file experimentalspectrum.cpp.

{
createSymetricPeakList(0);
}

References createSymetricPeakList().

Referenced by ExperimentalSpectrum(), ExperimentalSpectrum(), and createSymetricPeakList().

## createSymetricPeakList() [2/2]

void pappso::specglob::ExperimentalSpectrum::createSymetricPeakList | ( | double | precursor_mass_error | ) |

private

Definition at line 83 of file experimentalspectrum.cpp.

{
bool ok;
auto charge = m_qualifiedMassSpectrum.getPrecursorCharge(&ok);
if(!ok)
{
throw pappso::PappsoException(
QObject::tr("precursor charge is not defined in spectrum %1")
.arg(m_qualifiedMassSpectrum.getMassSpectrumId().getNativeId()));
}
double mz_prec = m_qualifiedMassSpectrum.getPrecursorMz(&ok);
if(!ok)
{
throw pappso::PappsoException(
QObject::tr("precursor m/z is not defined in spectrum %1")
.arg(m_qualifiedMassSpectrum.getMassSpectrumId().getNativeId()));
}
// compute precursor mass given the charge state
m_precursorMass = mz_prec * (double)charge - precursor_mass_error;
m_precursorMass -= pappso::MHPLUS * (double)charge;
m_targetMzSum = m_precursorMass + pappso::MHPLUS + pappso::MHPLUS;
std::vector<double> mz_list = m_qualifiedMassSpectrum.getMassSpectrumCstSPtr().get()->xValues();
std::size_t mz_current_indice = 0;
auto itend = m_qualifiedMassSpectrum.getMassSpectrumCstSPtr().get()->end();
for(std::vector<pappso::DataPoint>::const_iterator it =
m_qualifiedMassSpectrum.getMassSpectrumCstSPtr().get()->begin();
it != itend;
it++)
{
double current_mz = it->x;
double symmetric_current_mz = getSymetricMz(current_mz);
auto itpair_symmetric = findMz(symmetric_current_mz);
if(itpair_symmetric != itend)
{
// there is a counterpart
push_back({ExperimentalSpectrumDataPointType::both, it->x, 0});
qDebug() << "current_mz=" << current_mz << " both";
}
else
{
// there is no counterpart
push_back({ExperimentalSpectrumDataPointType::native, it->x, 0});
push_back({ExperimentalSpectrumDataPointType::symmetric, symmetric_current_mz, 0});
qDebug() << "current_mz=" << current_mz << " symmetrics";
}
mz_current_indice++;
}
// we add a peak with NT mass (1.0078) if it is not detected, to give better
// chance to align the first amino acid in b if it is present
if(findMz(pappso::MPROTIUM) == itend)
{
push_back({ExperimentalSpectrumDataPointType::synthetic, pappso::MPROTIUM, 0});
}
// We add the B peak corresponding to the precursor (complete peptide)
double precusorBion = m_targetMzSum - pappso::MASSH2O - pappso::MPROTIUM;
if(findMz(precusorBion) == itend)
{
push_back({ExperimentalSpectrumDataPointType::synthetic, precusorBion, 0});
}
std::sort(begin(),
end(),
[](const ExperimentalSpectrumDataPoint &a, const ExperimentalSpectrumDataPoint &b) {
return (a.peak_mz < b.peak_mz);
});
std::size_t i = 0;
for(auto &data_point : *this)
{
data_point.indice = i;
i++;
}
}
pappso::specglob::ExperimentalSpectrum::getSymetricMz
double getSymetricMz(double mz) const
compute the symmetric mass for debuggin purpose
Definition experimentalspectrum.cpp:207
pappso::specglob::ExperimentalSpectrum::m_precursorMass
double m_precursorMass
Definition experimentalspectrum.h:140
pappso::specglob::ExperimentalSpectrum::findMz
std::vector< pappso::DataPoint >::const_iterator findMz(double mz)
find the correspondin mz in the mass spectrum (given the precision)
Definition experimentalspectrum.cpp:169
pappso::specglob::ExperimentalSpectrumDataPointType::synthetic
@ synthetic
does not correspond to existing peak, for computational purpose
Definition types.h:85
pappso::specglob::ExperimentalSpectrumDataPointType::native
@ native
Definition types.h:79
pappso::specglob::ExperimentalSpectrumDataPointType::both
@ both
both, the ion and the complement exists in the original spectrum
Definition types.h:83
pappso::specglob::ExperimentalSpectrumDataPointType::symmetric
@ symmetric
new peak : computed symmetric mass from a corresponding native peak
Definition types.h:81
pappso::PeptideIonNter::a
@ a
Definition peptide.h:77
pappso::PeptideIonNter::b
@ b
Definition peptide.h:74
pappso::MHPLUS
const pappso_double MHPLUS(1.007276466879)
pappso::MPROTIUM
const pappso_double MPROTIUM(1.007825032241)
pappso::MASSH2O
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)

References pappso::a, pappso::b, pappso::specglob::both, findMz(), getSymetricMz(), m_precursorMass, m_qualifiedMassSpectrum, m_targetMzSum, pappso::MASSH2O(), pappso::MHPLUS(), pappso::MPROTIUM(), pappso::specglob::native, pappso::specglob::symmetric, and pappso::specglob::synthetic.

## findMz()

std::vector< pappso::DataPoint >::const_iterator pappso::specglob::ExperimentalSpectrum::findMz | ( | double | mz | ) |

private

find the correspondin mz in the mass spectrum (given the precision)

Definition at line 169 of file experimentalspectrum.cpp.

{
pappso::MzRange mz_range(mz, m_precisionPtr);
auto itend = m_qualifiedMassSpectrum.getMassSpectrumCstSPtr().get()->end();
auto it =
findFirstEqualOrGreaterX(m_qualifiedMassSpectrum.getMassSpectrumCstSPtr().get()->begin(),
m_qualifiedMassSpectrum.getMassSpectrumCstSPtr().get()->end(),
mz_range.lower());
if(it != itend)
{
if(it->x <= mz_range.upper())
{
return it;
}
}
return itend;
}
pappso::findFirstEqualOrGreaterX
std::vector< DataPoint >::iterator findFirstEqualOrGreaterX(std::vector< DataPoint >::iterator begin, std::vector< DataPoint >::iterator end, const double &value)
find the first element in which X is equal or greater than the value searched important : it implies ...
Definition trace.cpp:65

References pappso::findFirstEqualOrGreaterX(), pappso::MzRange::lower(), m_precisionPtr, m_qualifiedMassSpectrum, and pappso::MzRange::upper().

Referenced by createSymetricPeakList().

## getMassList() [1/2]

std::vector< double > pappso::specglob::ExperimentalSpectrum::getMassList | ( |  | ) | const

Definition at line 195 of file experimentalspectrum.cpp.

{
std::vector<double> mass_list;
for(const ExperimentalSpectrumDataPoint &n : *this)
{
mass_list.push_back(n.peak_mz);
}
return mass_list;
}

References pappso::specglob::ExperimentalSpectrumDataPoint::peak_mz.

## getMassList() [2/2]

std::vector< double > pappso::specglob::ExperimentalSpectrum::getMassList | ( | ExperimentalSpectrumDataPointType | type | ) | const

Definition at line 213 of file experimentalspectrum.cpp.

{
std::vector<double> mass_list;
for(const ExperimentalSpectrumDataPoint &n : *this)
{
if(n.type == type)
mass_list.push_back(n.peak_mz);
}
return mass_list;
}

References pappso::specglob::ExperimentalSpectrumDataPoint::peak_mz, and pappso::specglob::ExperimentalSpectrumDataPoint::type.

## getPrecursorMass()

double pappso::specglob::ExperimentalSpectrum::getPrecursorMass | ( |  | ) | const

Definition at line 237 of file experimentalspectrum.cpp.

{
return m_precursorMass;
}

References m_precursorMass.

## getQualifiedMassSpectrum()

const pappso::QualifiedMassSpectrum & pappso::specglob::ExperimentalSpectrum::getQualifiedMassSpectrum | ( |  | ) | const

Definition at line 284 of file experimentalspectrum.cpp.

{
return m_qualifiedMassSpectrum;
}

References m_qualifiedMassSpectrum.

## getSymetricMz()

double pappso::specglob::ExperimentalSpectrum::getSymetricMz | ( | double | mz | ) | const

compute the symmetric mass for debuggin purpose

Definition at line 207 of file experimentalspectrum.cpp.

{
return m_targetMzSum - mz;
}
pappso::Enums::PrecisionUnit::mz
@ mz
Definition types.h:101

References m_targetMzSum.

Referenced by createSymetricPeakList().

## getTargetMzSum()

double pappso::specglob::ExperimentalSpectrum::getTargetMzSum | ( |  | ) | const

Definition at line 189 of file experimentalspectrum.cpp.

{
return m_targetMzSum;
}

References m_targetMzSum.

## reverseFindDiffMz()

std::vector< ExperimentalSpectrumDataPoint >::const_reverse_iterator pappso::specglob::ExperimentalSpectrum::reverseFindDiffMz | ( | std::size_t | start_position,
|  | const pappso::MzRange & | targeted_mass_range ) const

find the peak for wich mass difference from rbegin corresponds to aaTheoMass Find if a peak back in the peak list has a mass difference that corresponds to the targeted mass

Parameters

  start_position | reverse iterator on the reference peak to look for mass difference from
  targeted_mass_range | the mass difference to look forconst pappso::PeptideSp peptide_sp

Returns
  a reverse iterator on the peak (found) or the end of the search (not found)

Definition at line 243 of file experimentalspectrum.cpp.

{
qDebug() << "start_position" << start_position << " lookfor=" << aaTheoMzRange.getMz();
std::vector<ExperimentalSpectrumDataPoint>::const_reverse_iterator itrbegin =
rbegin() + (size() - 1 - start_position);
qDebug() << itrbegin->indice << "mz=" << itrbegin->peak_mz;
double eperimentalMzReference = itrbegin->peak_mz;
auto itrend = this->rend();
// We check all row from j to 0
qDebug();
for(auto itr = itrbegin + 1; itr != itrend; ++itr)
{
qDebug() << itr->indice;
double experimentalMzDifference = eperimentalMzReference - itr->peak_mz;
if(experimentalMzDifference > aaTheoMzRange.upper())
{
// if we pass the mass of the theoretical amino acid, we stop to not
// over
// calculate
qDebug() << experimentalMzDifference << ">" << aaTheoMzRange.upper();
return itrend;
}
else if(experimentalMzDifference < aaTheoMzRange.lower())
{
continue;
}
qDebug() << itr->indice << " diff=" << experimentalMzDifference;
// if we found that j-k give an amino acid, we keep k value
return itr;
}
qDebug() << "rend";
return itrend; // a value of -1 to show that
// there is no k value
}

References pappso::MzRange::getMz(), pappso::MzRange::lower(), and pappso::MzRange::upper().

Referenced by pappso::specglob::SpectralAlignment::fillMatricesWithScores().

## toString()

QString pappso::specglob::ExperimentalSpectrum::toString | ( |  | ) | const

Definition at line 226 of file experimentalspectrum.cpp.

{
QStringList all_element;
for(const ExperimentalSpectrumDataPoint &n : *this)
{
all_element << QString("%1 %2").arg(n.peak_mz).arg((std::uint8_t)n.type);
}
return QString("[%1]").arg(all_element.join("] ["));
}

References pappso::specglob::ExperimentalSpectrumDataPoint::peak_mz, and pappso::specglob::ExperimentalSpectrumDataPoint::type.

## Member Data Documentation

## m_precisionPtr

pappso::PrecisionPtr pappso::specglob::ExperimentalSpectrum::m_precisionPtr

private

Definition at line 141 of file experimentalspectrum.h.

Referenced by ExperimentalSpectrum(), ExperimentalSpectrum(), ExperimentalSpectrum(), and findMz().

## m_precursorMass

double pappso::specglob::ExperimentalSpectrum::m_precursorMass

private

Definition at line 140 of file experimentalspectrum.h.

Referenced by createSymetricPeakList(), and getPrecursorMass().

## m_qualifiedMassSpectrum

pappso::QualifiedMassSpectrum pappso::specglob::ExperimentalSpectrum::m_qualifiedMassSpectrum

private

Definition at line 138 of file experimentalspectrum.h.

Referenced by ExperimentalSpectrum(), ExperimentalSpectrum(), ExperimentalSpectrum(), createSymetricPeakList(), findMz(), and getQualifiedMassSpectrum().

## m_targetMzSum

double pappso::specglob::ExperimentalSpectrum::m_targetMzSum

private

Definition at line 139 of file experimentalspectrum.h.

Referenced by ExperimentalSpectrum(), createSymetricPeakList(), getSymetricMz(), and getTargetMzSum().

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

- pappsomspp/core/processing/specglob/experimentalspectrum.h
- pappsomspp/core/processing/specglob/experimentalspectrum.cpp