pappso::QCPSpectrum Class Reference

`#include <qcpspectrum.h>`

Inheritance diagram for pappso::QCPSpectrum:

## Protected Member Functions

| QCPSpectrum (MassSpectrumWidget *parent, bool visible)
| ~QCPSpectrum ()
void | clearData ()
void | rescale ()
void | setSpectrumP (const MassSpectrum *spectrum)
void | addMassDelta (const PeakIonIsotopeMatch &peak_ion_match)
void | addMs1IsotopePattern (const std::vector< pappso::PeptideNaturalIsotopeAverageSp > &isotope_mass_list, pappso_double intensity)
void | addPeakIonIsotopeMatch (const PeakIonIsotopeMatch &peak_ion_match)
void | highlightPrecursorPeaks (double precursor_mz, int charge, PrecisionPtr ms2_precision)
virtual void | mouseMoveEvent (QMouseEvent *event) override
virtual void | mousePressEvent (QMouseEvent *event) override
virtual void | mouseReleaseEvent (QMouseEvent *event) override
virtual void | keyPressEvent (QKeyEvent *event) override
virtual void | keyReleaseEvent (QKeyEvent *event) override

## Private Member Functions

void | getNearestPeakBetween (pappso_double mz, pappso_double mouse_mz_range) const
void | getMostIntensePeakBetween (pappso_double mz, pappso_double mouse_mz_range) const
Q_SLOT void | setMzRangeChanged (QCPRange range)

## Private Attributes

MassSpectrumWidget * | _parent
const MassSpectrum * | _p_spectrum = nullptr
QCPRange | _mz_range
QCPRange | _intensity_range
QCPRange | _mass_delta_range
QCPBars * | _p_peak_bars
QCPBars * | _p_peak_bars_isotope
QCPBars * | mp_peak_bars_precursor
std::map< PeptideIon, QCPBars * > | _map_ion_type_bars
QCPAxisRect * | _p_delta_axis_rect
QCPGraph * | _p_delta_graph
double | _bar_width = 0.5
bool | _click = false
bool | _control_key = false
pappso::pappso_double | _old_x
pappso::pappso_double | _old_y

## Friends

class | MassSpectrumWidget

## Detailed Description

Definition at line 45 of file qcpspectrum.h.

## Constructor & Destructor Documentation

## QCPSpectrum()

QCPSpectrum::QCPSpectrum | ( | MassSpectrumWidget * | parent,
|  | bool | visible
| ) |  |

protected

< Cter amino ions

< Cter amino ions + NH3 loss

< Cter amino ions + H2O loss

< Cter carbocations

Definition at line 37 of file qcpspectrum.cpp.

: QCustomPlot(parent)
{
qDebug() << "QCPSpectrum::QCPSpectrum begin";
setFocusPolicy(Qt::ClickFocus);
_parent = parent;
_mz_range.lower = 0;
_mz_range.upper = 0;
_intensity_range.lower = 0;
_intensity_range.upper = 0;
_mass_delta_range.upper = -100;
_mass_delta_range.lower = 100;
// make axis rects' left side line up:
QCPMarginGroup *group = new QCPMarginGroup(this);
this->axisRect()->setMarginGroup(QCP::msLeft | QCP::msRight, group);
_p_peak_bars = new QCPBars(xAxis, yAxis);
_p_peak_bars->setWidthType(QCPBars::WidthType::wtAbsolute);
_p_peak_bars->setWidth(_bar_width);
_p_peak_bars->setPen(QPen(Qt::black, 1));
_p_peak_bars->setVisible(true);
_p_peak_bars_isotope = new QCPBars(xAxis, yAxis);
_p_peak_bars_isotope->setWidthType(QCPBars::WidthType::wtAbsolute);
_p_peak_bars_isotope->setWidth(_bar_width * 10);
QColor red(Qt::red);
red.setAlpha(100);
_p_peak_bars_isotope->setPen(QPen(red, 1));
_p_peak_bars_isotope->setBrush(QBrush(red));
mp_peak_bars_precursor = new QCPBars(xAxis, yAxis);
mp_peak_bars_precursor->setWidthType(QCPBars::WidthType::wtAbsolute);
mp_peak_bars_precursor->setWidth(_bar_width * 1.5);
mp_peak_bars_precursor->setPen(QPen(Qt::cyan, 1));
mp_peak_bars_precursor->setVisible(true);
connect(this->xAxis,
SIGNAL(rangeChanged(QCPRange)),
this,
SLOT(setMzRangeChanged(QCPRange)));
std::vector<PeptideIon> all_ion_list = {
PeptideIon::b,
PeptideIon::bstar,
PeptideIon::bo,
PeptideIon::a,
PeptideIon::astar,
PeptideIon::ao,
PeptideIon::bp,
PeptideIon::c,
PeptideIon::y, ///< Cter amino ions
PeptideIon::ystar, ///< Cter amino ions + NH3 loss
PeptideIon::yo, ///< Cter amino ions + H2O loss
PeptideIon::z, ///< Cter carbocations
PeptideIon::yp,
PeptideIon::x};
qDebug() << "SpectrumWidget::setVisibleMassDelta 5";
for(PeptideIon ion_type : all_ion_list)
{
QCPBars *p_peak_bars = new QCPBars(xAxis, yAxis);
p_peak_bars->setWidthType(QCPBars::WidthType::wtAbsolute);
p_peak_bars->setWidth(_bar_width);
p_peak_bars->setPen(
QPen(PeptideFragmentIon::getPeptideIonColor(ion_type), 1));
p_peak_bars->setVisible(true);
_map_ion_type_bars.insert(
std::pair<PeptideIon, QCPBars *>(ion_type, p_peak_bars));
}
qDebug() << "SpectrumWidget::setVisibleMassDelta visible ?";
setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
if(visible)
{
_p_delta_axis_rect = new QCPAxisRect(this);
this->plotLayout()->addElement(1, 0, _p_delta_axis_rect);
_p_delta_axis_rect->axis(QCPAxis::atBottom)->setLayer("axes");
_p_delta_axis_rect->axis(QCPAxis::atBottom)->grid()->setLayer("grid");
_p_delta_axis_rect->axis(QCPAxis::atLeft)->setLabel("mass delta");
// bring bottom and main axis rect closer together:
this->plotLayout()->setRowSpacing(0);
_p_delta_axis_rect->setAutoMargins(QCP::msLeft | QCP::msRight |
QCP::msBottom);
_p_delta_axis_rect->setMargins(QMargins(0, 0, 0, 0));
this->setAutoAddPlottableToLegend(false);
_p_delta_graph = new QCPGraph(_p_delta_axis_rect->axis(QCPAxis::atBottom),
_p_delta_axis_rect->axis(QCPAxis::atLeft));
_p_delta_graph->setLineStyle(QCPGraph::LineStyle::lsNone);
_p_delta_graph->setScatterStyle(
QCPScatterStyle(QCPScatterStyle::ssDisc, 4.0));
_p_delta_axis_rect->setMarginGroup(QCP::msLeft | QCP::msRight, group);
_p_delta_axis_rect->setMaximumSize(QSize(QWIDGETSIZE_MAX, 100));
//_p_delta_axis_rect->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom );
_p_delta_axis_rect->setRangeDrag(Qt::Horizontal | Qt::Vertical);
_p_delta_axis_rect->setRangeZoom(Qt::Vertical);
connect(_p_delta_axis_rect->axis(QCPAxis::atBottom),
SIGNAL(rangeChanged(QCPRange)),
this,
SLOT(setMzRangeChanged(QCPRange)));
}
else
{
_p_delta_axis_rect = nullptr;
}
qDebug() << "QCPSpectrum::QCPSpectrum end";
}
pappso::PeptideFragmentIon::getPeptideIonColor
static const QColor getPeptideIonColor(PeptideIon ion_type)
Definition: peptidefragmention.cpp:204
pappso::QCPSpectrum::_p_delta_graph
QCPGraph * _p_delta_graph
Definition: qcpspectrum.h:92
pappso::QCPSpectrum::_mz_range
QCPRange _mz_range
Definition: qcpspectrum.h:84
pappso::QCPSpectrum::_p_delta_axis_rect
QCPAxisRect * _p_delta_axis_rect
Definition: qcpspectrum.h:91
pappso::QCPSpectrum::_p_peak_bars
QCPBars * _p_peak_bars
Definition: qcpspectrum.h:87
pappso::QCPSpectrum::_parent
MassSpectrumWidget * _parent
Definition: qcpspectrum.h:82
pappso::QCPSpectrum::_mass_delta_range
QCPRange _mass_delta_range
Definition: qcpspectrum.h:86
pappso::QCPSpectrum::_intensity_range
QCPRange _intensity_range
Definition: qcpspectrum.h:85
pappso::QCPSpectrum::mp_peak_bars_precursor
QCPBars * mp_peak_bars_precursor
Definition: qcpspectrum.h:89
pappso::QCPSpectrum::_map_ion_type_bars
std::map< PeptideIon, QCPBars * > _map_ion_type_bars
Definition: qcpspectrum.h:90
pappso::QCPSpectrum::_p_peak_bars_isotope
QCPBars * _p_peak_bars_isotope
Definition: qcpspectrum.h:88
pappso::QCPSpectrum::_bar_width
double _bar_width
Definition: qcpspectrum.h:93
pappso::QCPSpectrum::setMzRangeChanged
Q_SLOT void setMzRangeChanged(QCPRange range)
Definition: qcpspectrum.cpp:219
pappso::PeptideIon
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition: types.h:385
pappso::PeptideIon::a
@ a
Nter aldimine ions.
pappso::PeptideIon::y
@ y
Cter amino ions.
pappso::PeptideIon::c
@ c
Nter amino ions.
pappso::PeptideIon::astar
@ astar
Nter aldimine ions + NH3 loss.
pappso::PeptideIon::bp
@ bp
pappso::PeptideIon::yp
@ yp
pappso::PeptideIon::ystar
@ ystar
Cter amino ions + NH3 loss.
pappso::PeptideIon::yo
@ yo
Cter amino ions + H2O loss.
pappso::PeptideIon::bstar
@ bstar
Nter acylium ions + NH3 loss.
pappso::PeptideIon::b
@ b
Nter acylium ions.
pappso::PeptideIon::x
@ x
Cter acylium ions.
pappso::PeptideIon::bo
@ bo
Nter acylium ions + H2O loss.
pappso::PeptideIon::ao
@ ao
Nter aldimine ions + H2O loss.
pappso::PeptideIon::z
@ z
Cter carbocations.

References _bar_width, _intensity_range, _map_ion_type_bars, _mass_delta_range, _mz_range, _p_delta_axis_rect, _p_delta_graph, _p_peak_bars, _p_peak_bars_isotope, _parent, pappso::a, pappso::ao, pappso::astar, pappso::b, pappso::bo, pappso::bp, pappso::bstar, pappso::c, pappso::PeptideFragmentIon::getPeptideIonColor(), mp_peak_bars_precursor, setMzRangeChanged(), pappso::x, pappso::y, pappso::yo, pappso::yp, pappso::ystar, and pappso::z.

## ~QCPSpectrum()

QCPSpectrum::~QCPSpectrum | ( |  | ) |

protected

Definition at line 154 of file qcpspectrum.cpp.

{
}

## Member Function Documentation

## addMassDelta()

void QCPSpectrum::addMassDelta | ( | const PeakIonIsotopeMatch & | peak_ion_match | ) |

protected

Definition at line 427 of file qcpspectrum.cpp.

{
if(_p_delta_axis_rect != nullptr)
{
// observed - theoretical
double diff =
peak_ion_match.getPeak().x -
peak_ion_match.getPeptideNaturalIsotopeAverageSp().get()->getMz();
_p_delta_graph->addData(peak_ion_match.getPeak().x, diff);
if(diff > _mass_delta_range.upper)
_mass_delta_range.upper = diff;
if(diff < _mass_delta_range.lower)
_mass_delta_range.lower = diff;
_p_delta_axis_rect->axis(QCPAxis::AxisType::atLeft)
->setRange(_mass_delta_range);
}
}
pappso::PeakIonIsotopeMatch::getPeptideNaturalIsotopeAverageSp
virtual const PeptideNaturalIsotopeAverageSp & getPeptideNaturalIsotopeAverageSp() const
Definition: peakionisotopematch.cpp:49
pappso::PeakIonMatch::getPeak
const DataPoint & getPeak() const
Definition: peakionmatch.h:55
pappso::DataPoint::x
pappso_double x
Definition: datapoint.h:22

References _mass_delta_range, _p_delta_axis_rect, _p_delta_graph, pappso::PeakIonMatch::getPeak(), pappso::PeakIonIsotopeMatch::getPeptideNaturalIsotopeAverageSp(), and pappso::DataPoint::x.

Referenced by pappso::MassSpectrumWidget::plot().

## addMs1IsotopePattern()

void QCPSpectrum::addMs1IsotopePattern | ( | const std::vector< pappso::PeptideNaturalIsotopeAverageSp > & | isotope_mass_list,
|  | pappso_double | intensity
| ) |  |

protected

Definition at line 455 of file qcpspectrum.cpp.

{
pappso_double total_intensity =
((pappso_double)1.0 / isotope_mass_list.at(0).get()->getIntensityRatio()) *
intensity;
for(PeptideNaturalIsotopeAverageSp peptide : isotope_mass_list)
{
_p_peak_bars_isotope->addData(peptide.get()->getMz(),
peptide.get()->getIntensityRatio() *
total_intensity);
}
}
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition: types.h:48
pappso::PeptideNaturalIsotopeAverageSp
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
Definition: peptidenaturalisotopeaverage.h:37

References _p_peak_bars_isotope.

Referenced by pappso::MassSpectrumWidget::plot().

## addPeakIonIsotopeMatch()

void QCPSpectrum::addPeakIonIsotopeMatch | ( | const PeakIonIsotopeMatch & | peak_ion_match | ) |

protected

Definition at line 448 of file qcpspectrum.cpp.

{
_map_ion_type_bars[peak_ion_match.getPeptideIonType()]->addData(
peak_ion_match.getPeak().x, peak_ion_match.getPeak().y);
}
pappso::PeakIonMatch::getPeptideIonType
PeptideIon getPeptideIonType() const
Definition: peakionmatch.h:67
pappso::DataPoint::y
pappso_double y
Definition: datapoint.h:23

References _map_ion_type_bars, pappso::PeakIonMatch::getPeak(), pappso::PeakIonMatch::getPeptideIonType(), pappso::DataPoint::x, and pappso::DataPoint::y.

Referenced by pappso::MassSpectrumWidget::plot().

## clearData()

void QCPSpectrum::clearData | ( |  | ) |

protected

Definition at line 244 of file qcpspectrum.cpp.

{
qDebug();
_p_peak_bars->setData(QVector<double>(), QVector<double>());
_p_peak_bars->data().clear();
qDebug();
_p_peak_bars_isotope->setData(QVector<double>(), QVector<double>());
_p_peak_bars_isotope->data().clear();
qDebug();
mp_peak_bars_precursor->setData(QVector<double>(), QVector<double>());
mp_peak_bars_precursor->data().clear();
for(std::pair<PeptideIon, QCPBars *> pair_ion_bar : _map_ion_type_bars)
{
pair_ion_bar.second->setData(QVector<double>(), QVector<double>());
pair_ion_bar.second->data().clear();
}
// this->clearPlottables();
// this->clearItems();
if(_p_delta_axis_rect != nullptr)
{
_p_delta_graph->setData(QVector<double>(), QVector<double>());
_p_delta_graph->data().clear();
}
_mz_range.lower = 0;
_mz_range.upper = 0;
_mass_delta_range.upper = -100;
_mass_delta_range.lower = 100;
qDebug();
}

References _map_ion_type_bars, _mass_delta_range, _mz_range, _p_delta_axis_rect, _p_delta_graph, _p_peak_bars, _p_peak_bars_isotope, and mp_peak_bars_precursor.

Referenced by pappso::MassSpectrumWidget::clearData().

## getMostIntensePeakBetween()

void QCPSpectrum::getMostIntensePeakBetween | ( | pappso_double | mz,
|  | pappso_double | mouse_mz_range
| ) |  | const

private

Definition at line 395 of file qcpspectrum.cpp.

{
/*qDebug() << "QCPSpectrum::getNearestPeakBetween begin " << mz << " "
<< mouse_mz_range;*/
const DataPoint *p_peak_match;
p_peak_match = nullptr;
pappso_double min = mz - mouse_mz_range;
pappso_double max = mz + mouse_mz_range;
for(const DataPoint &peak : *_p_spectrum)
{
if((peak.x > min) && (peak.x < max))
{
if(p_peak_match == nullptr)
{
p_peak_match = &peak;
}
else
{
if(p_peak_match->y < peak.y)
{
p_peak_match = &peak;
}
}
}
}
_parent->peakChangeEvent(p_peak_match);
// qDebug() << "QCPSpectrum::getNearestPeakBetween end";
}
pappso::MassSpectrumWidget::peakChangeEvent
void peakChangeEvent(const DataPoint *p_peak_match)
Definition: massspectrumwidget.cpp:371
pappso::QCPSpectrum::_p_spectrum
const MassSpectrum * _p_spectrum
Definition: qcpspectrum.h:83
pappso::PrecisionUnit::mz
@ mz
pappso::XicExtractMethod::max
@ max
maximum of intensities
pappso::DataPoint
Definition: datapoint.h:21

References _p_spectrum, _parent, pappso::max, pappso::mz, pappso::MassSpectrumWidget::peakChangeEvent(), and pappso::DataPoint::y.

Referenced by mouseMoveEvent().

## getNearestPeakBetween()

void QCPSpectrum::getNearestPeakBetween | ( | pappso_double | mz,
|  | pappso_double | mouse_mz_range
| ) |  | const

private

Definition at line 362 of file qcpspectrum.cpp.

{
/*qDebug() << "QCPSpectrum::getNearestPeakBetween begin " << mz << " "
<< mouse_mz_range;*/
const DataPoint *p_peak_match;
p_peak_match = nullptr;
pappso_double min = mz - mouse_mz_range;
pappso_double max = mz + mouse_mz_range;
for(const DataPoint &peak : *_p_spectrum)
{
if((peak.x > min) && (peak.x < max))
{
if(p_peak_match == nullptr)
{
p_peak_match = &peak;
}
else
{
if(fabs(mz - peak.x) < fabs(mz - p_peak_match->x))
{
p_peak_match = &peak;
}
}
}
}
_parent->peakChangeEvent(p_peak_match);
// qDebug() << "QCPSpectrum::getNearestPeakBetween end";
}

References _p_spectrum, _parent, pappso::max, pappso::mz, pappso::MassSpectrumWidget::peakChangeEvent(), and pappso::DataPoint::x.

## highlightPrecursorPeaks()

void pappso::QCPSpectrum::highlightPrecursorPeaks | ( | double | precursor_mz,
|  | int | charge,
|  | PrecisionPtr | ms2_precision
| ) |  |

protected

Definition at line 471 of file qcpspectrum.cpp.

{
MzRange range(precursor_mz, ms2_precision);
double precursor_mz_c13 = precursor_mz + (DIFFC12C13 / charge);
MzRange range_c13(precursor_mz_c13, ms2_precision);
for(const DataPoint &peak : *_p_spectrum)
{
if(((peak.x > range.lower()) && (peak.x < range.upper())) ||
((peak.x > range_c13.lower()) && (peak.x < range_c13.upper())))
{
mp_peak_bars_precursor->addData(peak.x, peak.y);
QCPItemText *text_label = new QCPItemText(this);
text_label->setVisible(true);
text_label->setPositionAlignment(Qt::AlignBottom | Qt::AlignHCenter);
text_label->position->setType(QCPItemPosition::ptPlotCoords);
text_label->position->setCoords(peak.x, peak.y);
// place position at center/top of axis rect
text_label->setFont(QFont(font().family(), 8));
text_label->setText("precursor");
text_label->setColor(Qt::cyan);
}
}
}
pappso::MzRange
Definition: mzrange.h:46
pappso::DIFFC12C13
const pappso_double DIFFC12C13(1.0033548378)

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

## keyPressEvent()

void QCPSpectrum::keyPressEvent | ( | QKeyEvent * | event | ) |

override protected virtual

Definition at line 277 of file qcpspectrum.cpp.

{
if(event->key() == Qt::Key_Control)
{
_control_key = true;
}
qDebug() << "QCPSpectrum::keyPressEvent end";
}
pappso::QCPSpectrum::_control_key
bool _control_key
Definition: qcpspectrum.h:95

References _control_key.

## keyReleaseEvent()

void QCPSpectrum::keyReleaseEvent | ( | QKeyEvent * | event | ) |

override protected virtual

Definition at line 287 of file qcpspectrum.cpp.

{
if(event->key() == Qt::Key_Control)
{
_control_key = false;
}
qDebug() << "QCPSpectrum::keyReleaseEvent end";
}

References _control_key.

## mouseMoveEvent()

void QCPSpectrum::mouseMoveEvent | ( | QMouseEvent * | event | ) |

override protected virtual

Definition at line 319 of file qcpspectrum.cpp.

{
pappso::pappso_double x = xAxis->pixelToCoord(event->x());
if(_click)
{
/* qDebug() << "QCPSpectrum::mouseMoveEvent begin "
<< xAxis->pixelToCoord(event->x()) << " "
<< yAxis->pixelToCoord(event->y());*/
pappso::pappso_double y = yAxis->pixelToCoord(event->y());
if(y < 0)
{
y = 0;
}
if(_control_key)
{
if(y > 0)
{
this->yAxis->scaleRange(_old_y / y, 0);
}
}
else
{
this->xAxis->moveRange(xAxis->pixelToCoord(_old_x) -
xAxis->pixelToCoord(event->x()));
}
_old_x = event->x();
_old_y = y;
replot();
// qDebug() << "QCPSpectrum::mouseMoveEvent end";
}
else
{
if(_p_spectrum != nullptr)
{
pappso::pappso_double mouse_mz_range =
xAxis->pixelToCoord(10) - xAxis->pixelToCoord(8);
getMostIntensePeakBetween(x, mouse_mz_range);
_parent->mzChangeEvent(x);
}
}
}
pappso::MassSpectrumWidget::mzChangeEvent
void mzChangeEvent(pappso_double mz) const
Definition: massspectrumwidget.cpp:365
pappso::QCPSpectrum::_old_x
pappso::pappso_double _old_x
Definition: qcpspectrum.h:96
pappso::QCPSpectrum::getMostIntensePeakBetween
void getMostIntensePeakBetween(pappso_double mz, pappso_double mouse_mz_range) const
Definition: qcpspectrum.cpp:395
pappso::QCPSpectrum::_click
bool _click
Definition: qcpspectrum.h:94
pappso::QCPSpectrum::_old_y
pappso::pappso_double _old_y
Definition: qcpspectrum.h:97
pappso::PeptideIonCter::y
@ y
pappso::PeptideIonCter::x
@ x

References _click, _control_key, _old_x, _old_y, _p_spectrum, _parent, getMostIntensePeakBetween(), pappso::MassSpectrumWidget::mzChangeEvent(), pappso::x, and pappso::y.

## mousePressEvent()

void QCPSpectrum::mousePressEvent | ( | QMouseEvent * | event | ) |

override protected virtual

Definition at line 297 of file qcpspectrum.cpp.

{
/*qDebug() << "QCPSpectrum::mousePressEvent begin "
<< xAxis->pixelToCoord(event->x()) << " "
<< yAxis->pixelToCoord(event->y());*/
_click = true;
_old_x = event->x();
_old_y = yAxis->pixelToCoord(event->y());
if(_old_y < 0)
_old_y = 0;
/* qDebug() << "QCPSpectrum::mousePressEvent end";*/
}

References _click, _old_x, and _old_y.

## mouseReleaseEvent()

void QCPSpectrum::mouseReleaseEvent | ( | QMouseEvent * | event | ) |

override protected virtual

Definition at line 310 of file qcpspectrum.cpp.

{
/*qDebug() << "QCPSpectrum::mouseReleaseEvent begin "
<< xAxis->pixelToCoord(event->x()) << " "
<< yAxis->pixelToCoord(event->y());*/
_click = false;
// qDebug() << "QCPSpectrum::mouseReleaseEvent end";
}

References _click.

## rescale()

void QCPSpectrum::rescale | ( |  | ) |

protected

Definition at line 190 of file qcpspectrum.cpp.

{
_p_peak_bars->setVisible(true);
//_p_peak_bars->rescaleAxes(false);
// this->rescaleAxes(false);
if(_mz_range.lower < 0)
{
_mz_range.lower = 0;
}
if(_mz_range.upper < 0)
{
_mz_range.upper = 1000;
}
else
{
xAxis->setRange(_mz_range);
yAxis->setRange(_intensity_range);
if(_p_delta_axis_rect != nullptr)
{
_p_delta_axis_rect->axis(QCPAxis::AxisType::atLeft)
->setRange(_mass_delta_range);
}
}
}

References _intensity_range, _mass_delta_range, _mz_range, _p_delta_axis_rect, and _p_peak_bars.

Referenced by pappso::MassSpectrumWidget::rescale().

## setMzRangeChanged()

void QCPSpectrum::setMzRangeChanged | ( | QCPRange | range | ) |

private

Definition at line 219 of file qcpspectrum.cpp.

{
qDebug() << "QCPSpectrum::setMzRangeChanged _mz_range.lower"
<< _mz_range.lower;
if(_mz_range.lower > 0)
{
if(range.lower < _mz_range.lower)
{
range.lower = _mz_range.lower;
}
if(range.upper > _mz_range.upper)
{
range.upper = _mz_range.upper;
}
}
xAxis->setRange(range);
if(_p_delta_axis_rect != nullptr)
{
_p_delta_axis_rect->axis(QCPAxis::atBottom)->setRange(range);
}
}

References _mz_range, and _p_delta_axis_rect.

Referenced by QCPSpectrum().

## setSpectrumP()

void QCPSpectrum::setSpectrumP | ( | const MassSpectrum * | spectrum | ) |

protected

Definition at line 159 of file qcpspectrum.cpp.

{
_mass_delta_range.upper = -100;
_mass_delta_range.lower = 100;
// generate basic peaks:
_p_spectrum = spectrum;
if((spectrum != nullptr) && (spectrum->size() != 0))
{
// throw PappsoException(QObject::tr("Error in
// SpectrumWidget::setSpectrumSp :\n_spectrum_sp.get() == nullptr"));
//}
_p_peak_bars->setVisible(true);
for(const DataPoint &peak : *spectrum)
{
_p_peak_bars->addData(peak.x, peak.y);
}
_mz_range.lower = spectrum->front().x - 1;
_mz_range.upper = spectrum->back().x + 1;
_intensity_range.lower = 0;
_intensity_range.upper = spectrum->maxY();
}
else
{
_mz_range.lower = 0;
_mz_range.upper = 0;
_intensity_range.lower = 0;
_intensity_range.upper = 0;
}
}

References _intensity_range, _mass_delta_range, _mz_range, _p_peak_bars, and _p_spectrum.

Referenced by pappso::MassSpectrumWidget::clearData().

## Friends And Related Function Documentation

## MassSpectrumWidget

friend class MassSpectrumWidget

friend

Definition at line 49 of file qcpspectrum.h.

## Member Data Documentation

## _bar_width

double pappso::QCPSpectrum::_bar_width = 0.5

private

Definition at line 93 of file qcpspectrum.h.

Referenced by QCPSpectrum().

## _click

bool pappso::QCPSpectrum::_click = false

private

Definition at line 94 of file qcpspectrum.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

## _control_key

bool pappso::QCPSpectrum::_control_key = false

private

Definition at line 95 of file qcpspectrum.h.

Referenced by keyPressEvent(), keyReleaseEvent(), and mouseMoveEvent().

## _intensity_range

QCPRange pappso::QCPSpectrum::_intensity_range

private

Definition at line 85 of file qcpspectrum.h.

Referenced by QCPSpectrum(), rescale(), and setSpectrumP().

## _map_ion_type_bars

std::map<PeptideIon, QCPBars *> pappso::QCPSpectrum::_map_ion_type_bars

private

Definition at line 90 of file qcpspectrum.h.

Referenced by QCPSpectrum(), addPeakIonIsotopeMatch(), and clearData().

## _mass_delta_range

QCPRange pappso::QCPSpectrum::_mass_delta_range

private

Definition at line 86 of file qcpspectrum.h.

Referenced by QCPSpectrum(), addMassDelta(), clearData(), rescale(), and setSpectrumP().

## _mz_range

QCPRange pappso::QCPSpectrum::_mz_range

private

Definition at line 84 of file qcpspectrum.h.

Referenced by QCPSpectrum(), clearData(), rescale(), setMzRangeChanged(), and setSpectrumP().

## _old_x

pappso::pappso_double pappso::QCPSpectrum::_old_x

private

Definition at line 96 of file qcpspectrum.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

## _old_y

pappso::pappso_double pappso::QCPSpectrum::_old_y

private

Definition at line 97 of file qcpspectrum.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

## _p_delta_axis_rect

QCPAxisRect* pappso::QCPSpectrum::_p_delta_axis_rect

private

Definition at line 91 of file qcpspectrum.h.

Referenced by QCPSpectrum(), addMassDelta(), clearData(), rescale(), and setMzRangeChanged().

## _p_delta_graph

QCPGraph* pappso::QCPSpectrum::_p_delta_graph

private

Definition at line 92 of file qcpspectrum.h.

Referenced by QCPSpectrum(), addMassDelta(), and clearData().

## _p_peak_bars

QCPBars* pappso::QCPSpectrum::_p_peak_bars

private

Definition at line 87 of file qcpspectrum.h.

Referenced by QCPSpectrum(), clearData(), rescale(), and setSpectrumP().

## _p_peak_bars_isotope

QCPBars* pappso::QCPSpectrum::_p_peak_bars_isotope

private

Definition at line 88 of file qcpspectrum.h.

Referenced by QCPSpectrum(), addMs1IsotopePattern(), and clearData().

## _p_spectrum

const MassSpectrum* pappso::QCPSpectrum::_p_spectrum = nullptr

private

Definition at line 83 of file qcpspectrum.h.

Referenced by getMostIntensePeakBetween(), getNearestPeakBetween(), mouseMoveEvent(), and setSpectrumP().

## _parent

MassSpectrumWidget* pappso::QCPSpectrum::_parent

private

Definition at line 82 of file qcpspectrum.h.

Referenced by QCPSpectrum(), getMostIntensePeakBetween(), getNearestPeakBetween(), and mouseMoveEvent().

## mp_peak_bars_precursor

QCPBars* pappso::QCPSpectrum::mp_peak_bars_precursor

private

Definition at line 89 of file qcpspectrum.h.

Referenced by QCPSpectrum(), and clearData().

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

- pappsomspp/widget/massspectrumwidget/qcpspectrum.h
- pappsomspp/widget/massspectrumwidget/qcpspectrum.cpp