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 ExperimentalSpectrum &other)
virtual | ~ExperimentalSpectrum ()
std::vector< double > | getMassList () const
double | getSymetricMz (double mz) const
| compute the symetric 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 symetric 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
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/2]

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:133
pappso::specglob::ExperimentalSpectrum::createSymetricPeakList
void createSymetricPeakList()
add symetric peaks to the spectrum Create a SymetricPeakList that contain symmetric peaks and the inf...
Definition experimentalspectrum.cpp:68
pappso::specglob::ExperimentalSpectrum::m_qualifiedMassSpectrum
pappso::QualifiedMassSpectrum m_qualifiedMassSpectrum
Definition experimentalspectrum.h:130

References createSymetricPeakList(), m_precisionPtr, and m_qualifiedMassSpectrum.

## ExperimentalSpectrum() [2/2]

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

Copy constructor

Parameters

  other | TODO

Definition at line 55 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:131

References m_precisionPtr, m_qualifiedMassSpectrum, and m_targetMzSum.

## ~ExperimentalSpectrum()

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

virtual

Destructor

Definition at line 63 of file experimentalspectrum.cpp.

{
}

## Member Function Documentation

## createSymetricPeakList()

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

private

add symetric 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 68 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;
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 symetric_current_mz = getSymetricMz(current_mz);
auto itpair_symetric = findMz(symetric_current_mz);
if(itpair_symetric != 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::symetric,
symetric_current_mz,
0});
qDebug() << "current_mz=" << current_mz << " symetrics";
}
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.symetric_mz < b.symetric_mz);
});
std::size_t i = 0;
for(auto &data_point : *this)
{
data_point.indice = i;
i++;
}
}
pappso::MassSpectrumId::getNativeId
const QString & getNativeId() const
Definition massspectrumid.cpp:99
pappso::PappsoException
Definition pappsoexception.h:42
pappso::QualifiedMassSpectrum::getMassSpectrumCstSPtr
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.
Definition qualifiedmassspectrum.cpp:141
pappso::QualifiedMassSpectrum::getPrecursorCharge
uint getPrecursorCharge(bool *ok=nullptr) const
get precursor charge
Definition qualifiedmassspectrum.cpp:339
pappso::QualifiedMassSpectrum::getMassSpectrumId
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
Definition qualifiedmassspectrum.cpp:157
pappso::QualifiedMassSpectrum::getPrecursorMz
pappso_double getPrecursorMz(bool *ok=nullptr) const
get precursor mz
Definition qualifiedmassspectrum.cpp:238
pappso::specglob::ExperimentalSpectrum::getSymetricMz
double getSymetricMz(double mz) const
compute the symetric mass for debuggin purpose
Definition experimentalspectrum.cpp:198
pappso::specglob::ExperimentalSpectrum::m_precursorMass
double m_precursorMass
Definition experimentalspectrum.h:132
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:160
pappso::specglob::ExperimentalSpectrumDataPointType::symetric
@ symetric
new peak : computed symetric mass from a corresponding native peak
pappso::specglob::ExperimentalSpectrumDataPointType::synthetic
@ synthetic
does not correspond to existing peak, for computational purpose
pappso::specglob::ExperimentalSpectrumDataPointType::native
@ native
pappso::specglob::ExperimentalSpectrumDataPointType::both
@ both
both, the ion and the complement exists in the original spectrum
pappso::PeptideIonNter::a
@ a
pappso::PeptideIonNter::b
@ b
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(), pappso::QualifiedMassSpectrum::getMassSpectrumCstSPtr(), pappso::QualifiedMassSpectrum::getMassSpectrumId(), pappso::MassSpectrumId::getNativeId(), pappso::QualifiedMassSpectrum::getPrecursorCharge(), pappso::QualifiedMassSpectrum::getPrecursorMz(), getSymetricMz(), m_precursorMass, m_qualifiedMassSpectrum, m_targetMzSum, pappso::MASSH2O(), pappso::MHPLUS(), pappso::MPROTIUM(), pappso::specglob::native, pappso::specglob::symetric, and pappso::specglob::synthetic.

Referenced by ExperimentalSpectrum().

## 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 160 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::MzRange
Definition mzrange.h:46
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:71
pappso::PrecisionUnit::mz
@ mz

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

Referenced by createSymetricPeakList().

## getMassList() [1/2]

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

Definition at line 186 of file experimentalspectrum.cpp.

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

## getMassList() [2/2]

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

Definition at line 204 of file experimentalspectrum.cpp.

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

## getPrecursorMass()

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

Definition at line 229 of file experimentalspectrum.cpp.

{
return m_precursorMass;
}

References m_precursorMass.

## getQualifiedMassSpectrum()

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

Definition at line 278 of file experimentalspectrum.cpp.

{
return m_qualifiedMassSpectrum;
}

References m_qualifiedMassSpectrum.

## getSymetricMz()

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

compute the symetric mass for debuggin purpose

Definition at line 198 of file experimentalspectrum.cpp.

{
return m_targetMzSum - mz;
}

References m_targetMzSum, and pappso::mz.

Referenced by createSymetricPeakList().

## getTargetMzSum()

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

Definition at line 180 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 235 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->symetric_mz;
double eperimentalMzReference = itrbegin->symetric_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->symetric_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 217 of file experimentalspectrum.cpp.

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

## Member Data Documentation

## m_precisionPtr

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

private

Definition at line 133 of file experimentalspectrum.h.

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

## m_precursorMass

double pappso::specglob::ExperimentalSpectrum::m_precursorMass

private

Definition at line 132 of file experimentalspectrum.h.

Referenced by createSymetricPeakList(), and getPrecursorMass().

## m_qualifiedMassSpectrum

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

private

Definition at line 130 of file experimentalspectrum.h.

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

## m_targetMzSum

double pappso::specglob::ExperimentalSpectrum::m_targetMzSum

private

Definition at line 131 of file experimentalspectrum.h.

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

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

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