libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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< Enums::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.

37 : QCustomPlot(parent)
38{
39 qDebug() << "QCPSpectrum::QCPSpectrum begin";
40
41 setFocusPolicy(Qt::ClickFocus);
42 _parent = parent;
43 _mz_range.lower = 0;
44 _mz_range.upper = 0;
45 _intensity_range.lower = 0;
46 _intensity_range.upper = 0;
47 _mass_delta_range.upper = -100;
48 _mass_delta_range.lower = 100;
49
50
51 // make axis rects' left side line up:
52 QCPMarginGroup *group = new QCPMarginGroup(this);
53 this->axisRect()->setMarginGroup(QCP::msLeft | QCP::msRight, group);
54
55
56 _p_peak_bars = new QCPBars(xAxis, yAxis);
57 _p_peak_bars->setWidthType(QCPBars::WidthType::wtAbsolute);
58 _p_peak_bars->setWidth(_bar_width);
59 _p_peak_bars->setPen(QPen(Qt::black, 1));
60 _p_peak_bars->setVisible(true);
61
62 _p_peak_bars_isotope = new QCPBars(xAxis, yAxis);
63 _p_peak_bars_isotope->setWidthType(QCPBars::WidthType::wtAbsolute);
64 _p_peak_bars_isotope->setWidth(_bar_width * 10);
65 QColor red(Qt::red);
66 red.setAlpha(100);
67 _p_peak_bars_isotope->setPen(QPen(red, 1));
68 _p_peak_bars_isotope->setBrush(QBrush(red));
69
70 mp_peak_bars_precursor = new QCPBars(xAxis, yAxis);
71 mp_peak_bars_precursor->setWidthType(QCPBars::WidthType::wtAbsolute);
72 mp_peak_bars_precursor->setWidth(_bar_width * 1.5);
73 mp_peak_bars_precursor->setPen(QPen(Qt::cyan, 1));
74 mp_peak_bars_precursor->setVisible(true);
75
76 connect(this->xAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(setMzRangeChanged(QCPRange)));
77
78
79 std::vector<Enums::PeptideIon> all_ion_list = {
88 Enums::PeptideIon::y, ///< Cter amino ions
89 Enums::PeptideIon::ystar, ///< Cter amino ions + NH3 loss
90 Enums::PeptideIon::yo, ///< Cter amino ions + H2O loss
91 Enums::PeptideIon::z, ///< Cter carbocations
94 qDebug() << "SpectrumWidget::setVisibleMassDelta 5";
95
96 for(Enums::PeptideIon ion_type : all_ion_list)
97 {
98 QCPBars *p_peak_bars = new QCPBars(xAxis, yAxis);
99 p_peak_bars->setWidthType(QCPBars::WidthType::wtAbsolute);
100 p_peak_bars->setWidth(_bar_width);
101 p_peak_bars->setPen(QPen(PeptideFragmentIon::getPeptideIonColor(ion_type), 1));
102
103 p_peak_bars->setVisible(true);
104 _map_ion_type_bars.insert(std::pair<Enums::PeptideIon, QCPBars *>(ion_type, p_peak_bars));
105 }
106 qDebug() << "SpectrumWidget::setVisibleMassDelta visible ?";
107 setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
108 if(visible)
109 {
110
111 _p_delta_axis_rect = new QCPAxisRect(this);
112 this->plotLayout()->addElement(1, 0, _p_delta_axis_rect);
113 _p_delta_axis_rect->axis(QCPAxis::atBottom)->setLayer("axes");
114 _p_delta_axis_rect->axis(QCPAxis::atBottom)->grid()->setLayer("grid");
115 _p_delta_axis_rect->axis(QCPAxis::atLeft)->setLabel("mass delta");
116 // bring bottom and main axis rect closer together:
117 this->plotLayout()->setRowSpacing(0);
118 _p_delta_axis_rect->setAutoMargins(QCP::msLeft | QCP::msRight | QCP::msBottom);
119 _p_delta_axis_rect->setMargins(QMargins(0, 0, 0, 0));
120 this->setAutoAddPlottableToLegend(false);
121 _p_delta_graph = new QCPGraph(_p_delta_axis_rect->axis(QCPAxis::atBottom),
122 _p_delta_axis_rect->axis(QCPAxis::atLeft));
123 _p_delta_graph->setLineStyle(QCPGraph::LineStyle::lsNone);
124 _p_delta_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 4.0));
125
126 _p_delta_axis_rect->setMarginGroup(QCP::msLeft | QCP::msRight, group);
127 _p_delta_axis_rect->setMaximumSize(QSize(QWIDGETSIZE_MAX, 100));
128
129
130 //_p_delta_axis_rect->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom );
131 _p_delta_axis_rect->setRangeDrag(Qt::Horizontal | Qt::Vertical);
132 _p_delta_axis_rect->setRangeZoom(Qt::Vertical);
133
134
135 connect(_p_delta_axis_rect->axis(QCPAxis::atBottom),
136 SIGNAL(rangeChanged(QCPRange)),
137 this,
138 SLOT(setMzRangeChanged(QCPRange)));
139 }
140 else
141 {
142 _p_delta_axis_rect = nullptr;
143 }
144 qDebug() << "QCPSpectrum::QCPSpectrum end";
145}
static const QColor getPeptideIonColor(Enums::PeptideIon ion_type)
QCPGraph * _p_delta_graph
Definition qcpspectrum.h:92
QCPAxisRect * _p_delta_axis_rect
Definition qcpspectrum.h:91
QCPBars * _p_peak_bars
Definition qcpspectrum.h:87
MassSpectrumWidget * _parent
Definition qcpspectrum.h:82
QCPRange _mass_delta_range
Definition qcpspectrum.h:86
QCPRange _intensity_range
Definition qcpspectrum.h:85
QCPBars * mp_peak_bars_precursor
Definition qcpspectrum.h:89
std::map< Enums::PeptideIon, QCPBars * > _map_ion_type_bars
Definition qcpspectrum.h:90
QCPBars * _p_peak_bars_isotope
Definition qcpspectrum.h:88
Q_SLOT void setMzRangeChanged(QCPRange range)
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
@ a
Nter aldimine ions.
Definition types.h:290
@ y
Cter amino ions.
Definition types.h:295
@ c
Nter amino ions.
Definition types.h:294
@ astar
Nter aldimine ions + NH3 loss.
Definition types.h:291
@ ystar
Cter amino ions + NH3 loss.
Definition types.h:296
@ yo
Cter amino ions + H2O loss.
Definition types.h:297
@ bstar
Nter acylium ions + NH3 loss.
Definition types.h:288
@ b
Nter acylium ions.
Definition types.h:287
@ x
Cter acylium ions.
Definition types.h:300
@ bo
Nter acylium ions + H2O loss.
Definition types.h:289
@ ao
Nter aldimine ions + H2O loss.
Definition types.h:292
@ z
Cter carbocations.
Definition types.h:298

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::Enums::a, pappso::Enums::ao, pappso::Enums::astar, pappso::Enums::b, pappso::Enums::bo, pappso::Enums::bp, pappso::Enums::bstar, pappso::Enums::c, pappso::PeptideFragmentIon::getPeptideIonColor(), MassSpectrumWidget, mp_peak_bars_precursor, setMzRangeChanged(), pappso::Enums::x, pappso::Enums::y, pappso::Enums::yo, pappso::Enums::yp, pappso::Enums::ystar, and pappso::Enums::z.

◆ ~QCPSpectrum()

QCPSpectrum::~QCPSpectrum ( )
protected

Definition at line 146 of file qcpspectrum.cpp.

147{
148}

Member Function Documentation

◆ addMassDelta()

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

Definition at line 440 of file qcpspectrum.cpp.

441{
442 if(_p_delta_axis_rect != nullptr)
443 {
444 // observed - theoretical
445 double diff = peak_ion_match.getPeak().x -
446 peak_ion_match.getPeptideNaturalIsotopeAverageSp().get()->getMz();
447 _p_delta_graph->addData(peak_ion_match.getPeak().x, diff);
448
449 if(diff > _mass_delta_range.upper)
450 _mass_delta_range.upper = diff;
451 if(diff < _mass_delta_range.lower)
452 _mass_delta_range.lower = diff;
453
454 _p_delta_axis_rect->axis(QCPAxis::AxisType::atLeft)->setRange(_mass_delta_range);
455 }
456}
virtual const PeptideNaturalIsotopeAverageSp & getPeptideNaturalIsotopeAverageSp() const
const DataPoint & getPeak() const
pappso_double x
Definition datapoint.h:24

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

◆ addMs1IsotopePattern()

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

Definition at line 466 of file qcpspectrum.cpp.

469{
470 pappso_double total_intensity =
471 ((pappso_double)1.0 / isotope_mass_list.at(0).get()->getIntensityRatio()) * intensity;
472 for(PeptideNaturalIsotopeAverageSp peptide : isotope_mass_list)
473 {
474 _p_peak_bars_isotope->addData(peptide.get()->getMz(),
475 peptide.get()->getIntensityRatio() * total_intensity);
476 }
477}
double pappso_double
A type definition for doubles.
Definition types.h:60
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp

References _p_peak_bars_isotope.

◆ addPeakIonIsotopeMatch()

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

Definition at line 459 of file qcpspectrum.cpp.

460{
461 _map_ion_type_bars[peak_ion_match.getPeptideIonType()]->addData(peak_ion_match.getPeak().x,
462 peak_ion_match.getPeak().y);
463}
Enums::PeptideIon getPeptideIonType() const
pappso_double y
Definition datapoint.h:25

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

◆ clearData()

void QCPSpectrum::clearData ( )
protected

Definition at line 234 of file qcpspectrum.cpp.

235{
236 qDebug();
237 _p_peak_bars->setData(QVector<double>(), QVector<double>());
238 _p_peak_bars->data().clear();
239 qDebug();
240 _p_peak_bars_isotope->setData(QVector<double>(), QVector<double>());
241 _p_peak_bars_isotope->data().clear();
242 qDebug();
243 mp_peak_bars_precursor->setData(QVector<double>(), QVector<double>());
244 mp_peak_bars_precursor->data().clear();
245 for(std::pair<Enums::PeptideIon, QCPBars *> pair_ion_bar : _map_ion_type_bars)
246 {
247 pair_ion_bar.second->setData(QVector<double>(), QVector<double>());
248 pair_ion_bar.second->data().clear();
249 }
250 // this->clearPlottables();
251 // this->clearItems();
252 if(_p_delta_axis_rect != nullptr)
253 {
254 _p_delta_graph->setData(QVector<double>(), QVector<double>());
255 _p_delta_graph->data().clear();
256 }
257
258 _mz_range.lower = 0;
259 _mz_range.upper = 0;
260
261 _mass_delta_range.upper = -100;
262 _mass_delta_range.lower = 100;
263 qDebug();
264}

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.

◆ getMostIntensePeakBetween()

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

Definition at line 409 of file qcpspectrum.cpp.

410{
411 /*qDebug() << "QCPSpectrum::getNearestPeakBetween begin " << mz << " "
412 << mouse_mz_range;*/
413 const DataPoint *p_peak_match;
414 p_peak_match = nullptr;
415 pappso_double min = mz - mouse_mz_range;
416 pappso_double max = mz + mouse_mz_range;
417
418 for(const DataPoint &peak : *_p_spectrum)
419 {
420 if((peak.x > min) && (peak.x < max))
421 {
422 if(p_peak_match == nullptr)
423 {
424 p_peak_match = &peak;
425 }
426 else
427 {
428 if(p_peak_match->y < peak.y)
429 {
430 p_peak_match = &peak;
431 }
432 }
433 }
434 }
435 _parent->peakChangeEvent(p_peak_match);
436 // qDebug() << "QCPSpectrum::getNearestPeakBetween end";
437}
const MassSpectrum * _p_spectrum
Definition qcpspectrum.h:83
@ max
maximum of intensities
Definition types.h:280

References _p_spectrum, _parent, and pappso::DataPoint::y.

Referenced by mouseMoveEvent().

◆ getNearestPeakBetween()

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

Definition at line 377 of file qcpspectrum.cpp.

378{
379 /*qDebug() << "QCPSpectrum::getNearestPeakBetween begin " << mz << " "
380 << mouse_mz_range;*/
381 const DataPoint *p_peak_match;
382 p_peak_match = nullptr;
383 pappso_double min = mz - mouse_mz_range;
384 pappso_double max = mz + mouse_mz_range;
385
386 for(const DataPoint &peak : *_p_spectrum)
387 {
388 if((peak.x > min) && (peak.x < max))
389 {
390 if(p_peak_match == nullptr)
391 {
392 p_peak_match = &peak;
393 }
394 else
395 {
396 if(fabs(mz - peak.x) < fabs(mz - p_peak_match->x))
397 {
398 p_peak_match = &peak;
399 }
400 }
401 }
402 }
403 _parent->peakChangeEvent(p_peak_match);
404 // qDebug() << "QCPSpectrum::getNearestPeakBetween end";
405}

References _p_spectrum, _parent, and pappso::DataPoint::x.

◆ highlightPrecursorPeaks()

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

Definition at line 480 of file qcpspectrum.cpp.

483{
484 MzRange range(precursor_mz, ms2_precision);
485 double precursor_mz_c13 = precursor_mz + (DIFFC12C13 / charge);
486 MzRange range_c13(precursor_mz_c13, ms2_precision);
487
488 for(const DataPoint &peak : *_p_spectrum)
489 {
490 if(((peak.x > range.lower()) && (peak.x < range.upper())) ||
491 ((peak.x > range_c13.lower()) && (peak.x < range_c13.upper())))
492 {
493 mp_peak_bars_precursor->addData(peak.x, peak.y);
494 QCPItemText *text_label = new QCPItemText(this);
495 text_label->setVisible(true);
496 text_label->setPositionAlignment(Qt::AlignBottom | Qt::AlignHCenter);
497 text_label->position->setType(QCPItemPosition::ptPlotCoords);
498 text_label->position->setCoords(peak.x, peak.y);
499 // place position at center/top of axis rect
500 text_label->setFont(QFont(font().family(), 8));
501 text_label->setText("precursor");
502 text_label->setColor(Qt::cyan);
503 }
504 }
505}
const pappso_double DIFFC12C13(1.0033548378)

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

◆ keyPressEvent()

void QCPSpectrum::keyPressEvent ( QKeyEvent * event)
overrideprotectedvirtual

Definition at line 267 of file qcpspectrum.cpp.

268{
269 if(event->key() == Qt::Key_Control)
270 {
271 _control_key = true;
272 }
273 qDebug() << "QCPSpectrum::keyPressEvent end";
274}

References _control_key.

◆ keyReleaseEvent()

void QCPSpectrum::keyReleaseEvent ( QKeyEvent * event)
overrideprotectedvirtual

Definition at line 277 of file qcpspectrum.cpp.

278{
279 if(event->key() == Qt::Key_Control)
280 {
281 _control_key = false;
282 }
283 qDebug() << "QCPSpectrum::keyReleaseEvent end";
284}

References _control_key.

◆ mouseMoveEvent()

void QCPSpectrum::mouseMoveEvent ( QMouseEvent * event)
overrideprotectedvirtual

Definition at line 315 of file qcpspectrum.cpp.

316{
317
318#if QT_VERSION < 0x060000
319 pappso::pappso_double x = xAxis->pixelToCoord(event->x());
320#else
321 pappso::pappso_double x = xAxis->pixelToCoord(event->position().x());
322#endif
323 if(_click)
324 {
325 /* qDebug() << "QCPSpectrum::mouseMoveEvent begin "
326 << xAxis->pixelToCoord(event->x()) << " "
327 << yAxis->pixelToCoord(event->y());*/
328
329#if QT_VERSION < 0x060000
330 pappso::pappso_double y = yAxis->pixelToCoord(event->y());
331#else
332 pappso::pappso_double y = yAxis->pixelToCoord(event->position().y());
333#endif
334 if(y < 0)
335 {
336 y = 0;
337 }
338 if(_control_key)
339 {
340 if(y > 0)
341 {
342 this->yAxis->scaleRange(_old_y / y, 0);
343 }
344 }
345 else
346 {
347
348#if QT_VERSION < 0x060000
349 this->xAxis->moveRange(xAxis->pixelToCoord(_old_x) - xAxis->pixelToCoord(event->x()));
350#else
351 this->xAxis->moveRange(xAxis->pixelToCoord(_old_x) -
352 xAxis->pixelToCoord(event->position().x()));
353#endif
354 }
355
356#if QT_VERSION < 0x060000
357 _old_x = event->x();
358#else
359 _old_x = event->position().x();
360#endif
361 _old_y = y;
362 replot();
363 // qDebug() << "QCPSpectrum::mouseMoveEvent end";
364 }
365 else
366 {
367 if(_p_spectrum != nullptr)
368 {
369 pappso::pappso_double mouse_mz_range = xAxis->pixelToCoord(10) - xAxis->pixelToCoord(8);
370 getMostIntensePeakBetween(x, mouse_mz_range);
371 _parent->mzChangeEvent(x);
372 }
373 }
374}
pappso::pappso_double _old_x
Definition qcpspectrum.h:96
void getMostIntensePeakBetween(pappso_double mz, pappso_double mouse_mz_range) const
pappso::pappso_double _old_y
Definition qcpspectrum.h:97

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

◆ mousePressEvent()

void QCPSpectrum::mousePressEvent ( QMouseEvent * event)
overrideprotectedvirtual

Definition at line 287 of file qcpspectrum.cpp.

288{
289 /*qDebug() << "QCPSpectrum::mousePressEvent begin "
290 << xAxis->pixelToCoord(event->x()) << " "
291 << yAxis->pixelToCoord(event->y());*/
292 _click = true;
293
294#if QT_VERSION < 0x060000
295 _old_x = event->x();
296 _old_y = yAxis->pixelToCoord(event->y());
297#else
298 _old_x = event->position().x();
299 _old_y = yAxis->pixelToCoord(event->position().y());
300#endif
301 if(_old_y < 0)
302 _old_y = 0;
303 /* qDebug() << "QCPSpectrum::mousePressEvent end";*/
304}

References _click, _old_x, and _old_y.

◆ mouseReleaseEvent()

void QCPSpectrum::mouseReleaseEvent ( QMouseEvent * event)
overrideprotectedvirtual

Definition at line 306 of file qcpspectrum.cpp.

307{
308 /*qDebug() << "QCPSpectrum::mouseReleaseEvent begin "
309 << xAxis->pixelToCoord(event->x()) << " "
310 << yAxis->pixelToCoord(event->y());*/
311 _click = false;
312 // qDebug() << "QCPSpectrum::mouseReleaseEvent end";
313}

References _click.

◆ rescale()

void QCPSpectrum::rescale ( )
protected

Definition at line 182 of file qcpspectrum.cpp.

183{
184 _p_peak_bars->setVisible(true);
185
186 //_p_peak_bars->rescaleAxes(false);
187 // this->rescaleAxes(false);
188
189
190 if(_mz_range.lower < 0)
191 {
192 _mz_range.lower = 0;
193 }
194 if(_mz_range.upper < 0)
195 {
196 _mz_range.upper = 1000;
197 }
198 else
199 {
200 xAxis->setRange(_mz_range);
201 yAxis->setRange(_intensity_range);
202 if(_p_delta_axis_rect != nullptr)
203 {
204 _p_delta_axis_rect->axis(QCPAxis::AxisType::atLeft)->setRange(_mass_delta_range);
205 }
206 }
207}

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

◆ setMzRangeChanged()

void QCPSpectrum::setMzRangeChanged ( QCPRange range)
private

Definition at line 210 of file qcpspectrum.cpp.

211{
212 qDebug() << "QCPSpectrum::setMzRangeChanged _mz_range.lower" << _mz_range.lower;
213 if(_mz_range.lower > 0)
214 {
215 if(range.lower < _mz_range.lower)
216 {
217 range.lower = _mz_range.lower;
218 }
219 if(range.upper > _mz_range.upper)
220 {
221 range.upper = _mz_range.upper;
222 }
223 }
224
225 xAxis->setRange(range);
226
227 if(_p_delta_axis_rect != nullptr)
228 {
229 _p_delta_axis_rect->axis(QCPAxis::atBottom)->setRange(range);
230 }
231}

References _mz_range, and _p_delta_axis_rect.

Referenced by QCPSpectrum().

◆ setSpectrumP()

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

Definition at line 151 of file qcpspectrum.cpp.

152{
153 _mass_delta_range.upper = -100;
154 _mass_delta_range.lower = 100;
155 // generate basic peaks:
156 _p_spectrum = spectrum;
157 if((spectrum != nullptr) && (spectrum->size() != 0))
158 {
159 // throw PappsoException(QObject::tr("Error in
160 // SpectrumWidget::setSpectrumSp :\n_spectrum_sp.get() == nullptr"));
161 //}
162 _p_peak_bars->setVisible(true);
163 for(const DataPoint &peak : *spectrum)
164 {
165 _p_peak_bars->addData(peak.x, peak.y);
166 }
167 _mz_range.lower = spectrum->front().x - 1;
168 _mz_range.upper = spectrum->back().x + 1;
169 _intensity_range.lower = 0;
170 _intensity_range.upper = spectrum->maxY();
171 }
172 else
173 {
174 _mz_range.lower = 0;
175 _mz_range.upper = 0;
176 _intensity_range.lower = 0;
177 _intensity_range.upper = 0;
178 }
179}

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

◆ MassSpectrumWidget

friend class MassSpectrumWidget
friend

Definition at line 49 of file qcpspectrum.h.

References MassSpectrumWidget.

Referenced by QCPSpectrum(), and MassSpectrumWidget.

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<Enums::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

◆ _parent

MassSpectrumWidget* pappso::QCPSpectrum::_parent
private

◆ mp_peak_bars_precursor

QCPBars* pappso::QCPSpectrum::mp_peak_bars_precursor
private

Definition at line 89 of file qcpspectrum.h.

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


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