libpappsomspp
Library for mass spectrometry
pappso::MassSpecTracePlotWidget Class Reference

#include <massspectraceplotwidget.h>

Inheritance diagram for pappso::MassSpecTracePlotWidget:
pappso::BaseTracePlotWidget pappso::BasePlotWidget

Signals

void keyPressEventSignal (const MassSpecTracePlotContext &context)
 
void massDeconvolutionSignal (const MassSpecTracePlotContext &context)
 
void resolvingPowerComputationSignal (const MassSpecTracePlotContext &context)
 
void mouseReleaseEventSignal (const MassSpecTracePlotContext &context)
 
void newKeyPressEventSignal (pappso::DataPoint context)
 
void testKeyPressEventSignal (pappso::MassSpecTracePlotContext context)
 
- Signals inherited from pappso::BasePlotWidget
void setFocusSignal ()
 
void lastCursorHoveredPointSignal (const QPointF &pointf)
 
void plotRangesChangedSignal (const BasePlotContext &context)
 
void xAxisMeasurementSignal (const BasePlotContext &context, bool with_delta)
 
void keyPressEventSignal (const BasePlotContext &context)
 
void keyReleaseEventSignal (const BasePlotContext &context)
 
void mouseReleaseEventSignal (const BasePlotContext &context)
 
void plottableSelectionChangedSignal (QCPAbstractPlottable *plottable_p, bool selected)
 
void integrationRequestedSignal (const BasePlotContext &context)
 
void plottableDestructionRequestedSignal (BasePlotWidget *base_plot_widget_p, QCPAbstractPlottable *plottable_p, const BasePlotContext &context)
 

Public Member Functions

 MassSpecTracePlotWidget (QWidget *parent=0)
 
 MassSpecTracePlotWidget (QWidget *parent, const QString &x_axis_label, const QString &y_axis_label)
 
virtual ~MassSpecTracePlotWidget ()
 
void setChargeMinimalFractionalPart (double charge_fractional_part)
 
double getChargeMinimalFractionalPart () const
 
void setChargeStateEnvelopePeakSpan (int interval)
 
int getChargeStateEnvelopePeakSpan () const
 
bool deconvolute ()
 Deconvolute the mass peaks into charge and molecular mass. More...
 
bool deconvoluteIsotopicCluster ()
 Deconvolute the mass peaks into charge and molecular mass. More...
 
bool deconvoluteChargedState (int span=1)
 Deconvolute the mass peaks into charge and molecular mass. More...
 
bool computeResolvingPower ()
 
virtual void keyPressEvent (QKeyEvent *event) override
 Set the m_pressedKeyCode to the key code in event. More...
 
virtual void keyReleaseEvent (QKeyEvent *event) override
 Handle specific key codes and trigger respective actions. More...
 
virtual void mouseMoveHandler (QMouseEvent *event) override
 Handle mouse movements, in particular record all the last visited points. More...
 
virtual void mousePressHandler (QMouseEvent *event) override
 Record the clicks of the mouse. More...
 
virtual void mouseReleaseHandler (QMouseEvent *event) override
 React to the release of the mouse buttons. More...
 
virtual void mouseMoveHandlerNotDraggingCursor () override
 
virtual void mouseMoveHandlerDraggingCursor () override
 
const MassSpecTracePlotContextrefreshBaseContext () const
 
- Public Member Functions inherited from pappso::BaseTracePlotWidget
 BaseTracePlotWidget (QWidget *parent=0)
 
 BaseTracePlotWidget (QWidget *parent, const QString &x_axis_label, const QString &y_axis_label)
 
virtual ~BaseTracePlotWidget ()
 Destruct this BaseTracePlotWidget instance. More...
 
virtual void setGraphData (int graph_index, const std::vector< double > &keys, const std::vector< double > &values)
 
virtual void setGraphData (QCPGraph *graph_p, const std::vector< double > &keys, const std::vector< double > &values)
 
virtual void clearGraphData (int graph_index)
 
virtual void axisDoubleClickHandler (QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event) override
 
virtual void axisRescale () override
 RANGE-related functions. More...
 
virtual void axisReframe () override
 
virtual void axisZoom () override
 
virtual void axisPan () override
 
virtual QCPGraph * addTrace (const pappso::Trace &trace, const QColor &color)
 
virtual bool findIntegrationLowerRangeForKey (int index, double key, QCPRange &range)
 Find a minimal integration range starting at an existing data point. More...
 
std::vector< double > getValuesX (int index) const
 
std::vector< double > getValuesY (int index) const
 
QCPRange getValueRangeOnKeyRange (QCPAbstractPlottable *plottable_p, bool &ok)
 
QCPRange getValueRangeOnKeyRange (int index, bool &ok)
 
double getYatX (double x, QCPGraph *graph_p)
 
double getYatX (double x, int index=0)
 
pappso::Trace toTrace (int index) const
 
pappso::Trace toTrace (const QCPGraph *graph_p) const
 
pappso::Trace toTrace (const QCPRange &x_axis_range, int index) const
 
pappso::Trace toTrace (const QCPRange &x_axis_range, const QCPGraph *graph_p) const
 
- Public Member Functions inherited from pappso::BasePlotWidget
 BasePlotWidget (QWidget *parent)
 
 BasePlotWidget (QWidget *parent, const QString &x_axis_label, const QString &y_axis_label)
 
virtual ~BasePlotWidget ()
 Destruct this BasePlotWidget instance. More...
 
virtual bool setupWidget ()
 
virtual void setPen (const QPen &pen)
 
virtual const QPen & getPen () const
 
virtual void setPlottingColor (QCPAbstractPlottable *plottable_p, const QColor &new_color)
 
virtual void setPlottingColor (int index, const QColor &new_color)
 
virtual QColor getPlottingColor (QCPAbstractPlottable *plottable_p) const
 
virtual QColor getPlottingColor (int index=0) const
 
virtual void setAxisLabelX (const QString &label)
 
virtual void setAxisLabelY (const QString &label)
 
virtual void resetAxesRangeHistory ()
 
virtual void updateAxesRangeHistory ()
 Create new axis range history items and append them to the history. More...
 
virtual void restorePreviousAxesRangeHistory ()
 Go up one history element in the axis history. More...
 
virtual void restoreAxesRangeHistory (std::size_t index)
 Get the axis histories at index index and update the plot ranges. More...
 
virtual void spaceKeyReleaseEvent (QKeyEvent *event)
 
virtual void directionKeyPressEvent (QKeyEvent *event)
 
virtual void directionKeyReleaseEvent (QKeyEvent *event)
 
virtual void mousePseudoButtonKeyPressEvent (QKeyEvent *event)
 
virtual void mousePseudoButtonKeyReleaseEvent (QKeyEvent *event)
 
virtual void mouseReleaseHandlerLeftButton ()
 
virtual void mouseReleaseHandlerRightButton ()
 
virtual void mouseMoveHandlerLeftButtonDraggingCursor ()
 
virtual void mouseMoveHandlerRightButtonDraggingCursor ()
 
bool isClickOntoXAxis (const QPointF &mousePoint)
 
bool isClickOntoYAxis (const QPointF &mousePoint)
 
int dragDirection ()
 MOUSE-related EVENTS. More...
 
virtual void moveMouseCursorGraphCoordToGlobal (QPointF plot_coordinates)
 
virtual void moveMouseCursorPixelCoordToGlobal (QPointF local_coordinates)
 
virtual void horizontalMoveMouseCursorCountPixels (int pixel_count)
 
virtual QPointF horizontalGetGraphCoordNewPointCountPixels (int pixel_count)
 
virtual void verticalMoveMouseCursorCountPixels (int pixel_count)
 
virtual QPointF verticalGetGraphCoordNewPointCountPixels (int pixel_count)
 
virtual QCPRange getRangeX (bool &found_range, int index) const
 MOUSE MOVEMENTS mouse/keyboard-triggered. More...
 
virtual QCPRange getRangeY (bool &found_range, int index) const
 
QCPRange getRange (PlotAxis axis, RangeType range_type, bool &found_range) const
 
virtual QCPRange getInnermostRangeX (bool &found_range) const
 
virtual QCPRange getOutermostRangeX (bool &found_range) const
 
virtual QCPRange getInnermostRangeY (bool &found_range) const
 
virtual QCPRange getOutermostRangeY (bool &found_range) const
 
void yMinMaxOnXAxisCurrentRange (double &min, double &max, QCPAbstractPlottable *plottable_p=nullptr)
 
void yMinMaxOnXAxisCurrentRange (double &min, double &max, int index)
 
virtual void replotWithAxesRanges (QCPRange xAxisRange, QCPRange yAxisRange, PlotAxis whichAxis)
 
virtual void replotWithAxisRangeX (double lower, double upper)
 
virtual void replotWithAxisRangeY (double lower, double upper)
 
virtual void hideAllPlotItems ()
 PLOTTING / REPLOTTING functions. More...
 
virtual void showTracers ()
 Show the traces (vertical and horizontal). More...
 
virtual void hideTracers ()
 Hide the traces (vertical and horizontal). More...
 
virtual void drawRectangleAndPrepareZoom ()
 
virtual void prepareXDeltaLineAndMeasure ()
 
virtual void drawXDeltaLineAndMeasure ()
 
virtual void drawXDeltaLineForIntegration ()
 
virtual void calculateDragDeltas ()
 
virtual void calculateDragDeltasAndUnSortedRegionCorners ()
 
virtual bool isProperSelectionRectangle ()
 
virtual void setFocus ()
 PLOT ITEMS : TRACER TEXT ITEMS... More...
 
virtual void redrawPlotBackground (QWidget *focusedPlotWidget)
 Redraw the background of the focusedPlotWidget plot widget. More...
 
virtual void updateContextRanges ()
 
virtual const BasePlotContextgetContext () const
 

Protected Attributes

MassSpecTracePlotContext m_context
 
double m_chargeMinimalFractionalPart = 0.990
 
int m_chargeStateEnvelopePeakSpan = 1
 
- Protected Attributes inherited from pappso::BasePlotWidget
QString m_name = "NOT_SET"
 Name of the plot widget. More...
 
QString m_desc = "NOT_SET"
 Description of the plot widget. More...
 
QString m_fileName
 The name of the data file from which the mass data were read. More...
 
QString m_axisLabelX
 
QString m_axisLabelY
 
BasePlotContext m_context
 
int m_leftMousePseudoButtonKey = Qt::Key_Less
 
int m_rightMousePseudoButtonKey = Qt::Key_Greater
 
QCPItemRect * mp_zoomRectItem = nullptr
 Rectangle defining the borders of zoomed-in/out data. More...
 
QCPItemLine * mp_selectLineItem = nullptr
 Line that is printed when the user selects a range. More...
 
QCPItemText * mp_xDeltaTextItem = nullptr
 Text describing the x-axis delta value during a drag operation. More...
 
bool m_shouldTracersBeVisible = true
 Tells if the tracers should be visible. More...
 
QCPItemLine * mp_hPosTracerItem
 Horizontal position tracer. More...
 
QCPItemLine * mp_vPosTracerItem
 Vertical position tracer. More...
 
QCPItemLine * mp_vStartTracerItem
 Vertical selection start tracer (typically in green). More...
 
QCPItemLine * mp_vEndTracerItem
 Vertical selection end tracer (typically in red). More...
 
std::size_t m_lastAxisRangeHistoryIndex = 0
 Index of the last axis range history item. More...
 
std::vector< QCPRange * > m_xAxisRangeHistory
 List of x axis ranges occurring during the panning zooming actions. More...
 
std::vector< QCPRange * > m_yAxisRangeHistory
 List of y axis ranges occurring during the panning zooming actions. More...
 
int m_mouseMoveHandlerSkipAmount = 10
 How many mouse move events must be skipped *‍/. More...
 
int m_mouseMoveHandlerSkipCount = 0
 Counter to handle the "fat data" mouse move event handling. More...
 
QColor m_unfocusedColor = QColor("lightgray")
 Color used for the background of unfocused plot. More...
 
QBrush m_unfocusedBrush = QBrush(m_unfocusedColor)
 Color used for the background of unfocused plot. More...
 
QColor m_focusedColor = QColor(Qt::transparent)
 Color used for the background of focused plot. More...
 
QBrush m_focusedBrush = QBrush(m_focusedColor)
 Color used for the background of focused plot. More...
 
QPen m_pen
 Pen used to draw the graph and textual elements in the plot widget. More...
 

Detailed Description

Definition at line 70 of file massspectraceplotwidget.h.

Constructor & Destructor Documentation

◆ MassSpecTracePlotWidget() [1/2]

pappso::MassSpecTracePlotWidget::MassSpecTracePlotWidget ( QWidget *  parent = 0)
explicit

Definition at line 77 of file massspectraceplotwidget.cpp.

78  : BaseTracePlotWidget(parent)
79 {
80  // Set the base context to be of kind DataKind::mz;
81 
83 
84  // And then initialize ours with the base class' one.
86 
87  // qDebug() << "Data kind:" <<
88  // static_cast<int>(m_context.baseContext.dataKind);
89 }

References pappso::MassSpecTracePlotContext::baseContext, pappso::BasePlotContext::dataKind, m_context, pappso::BasePlotWidget::m_context, and pappso::mz.

◆ MassSpecTracePlotWidget() [2/2]

pappso::MassSpecTracePlotWidget::MassSpecTracePlotWidget ( QWidget *  parent,
const QString &  x_axis_label,
const QString &  y_axis_label 
)
explicit

Definition at line 91 of file massspectraceplotwidget.cpp.

94  : BaseTracePlotWidget(parent, x_axis_label, y_axis_label)
95 {
96  // Set the base context to be of kind DataKind::mz;
97 
99 
100  // And then initialize ours with the base class' one.
102 
103  // qDebug() << "Data kind:" <<
104  // static_cast<int>(m_context.baseContext.dataKind);
105 }

References pappso::MassSpecTracePlotContext::baseContext, pappso::BasePlotContext::dataKind, m_context, pappso::BasePlotWidget::m_context, and pappso::mz.

◆ ~MassSpecTracePlotWidget()

pappso::MassSpecTracePlotWidget::~MassSpecTracePlotWidget ( )
virtual

Definition at line 108 of file massspectraceplotwidget.cpp.

109 {
110 }

Member Function Documentation

◆ computeResolvingPower()

bool pappso::MassSpecTracePlotWidget::computeResolvingPower ( )

Definition at line 561 of file massspectraceplotwidget.cpp.

562 {
563 
564  // m_xRangeLower and m_xRangeUpper and m_xDelta (in fabs() form) have been set
565  // during mouve movement handling. Note that the range values *are
566  // sorted*.
567 
569  {
570  m_context.lastResolvingPower = std::numeric_limits<double>::min();
571 
572  return false;
573  }
574 
575  // Resolving power is m/z / Delta(m/z), for singly-charged species.
576 
578  (std::min<double>(m_context.baseContext.xRegionRangeStart,
580  (m_context.baseContext.xDelta / 2)) /
582 
583  // The m_context was refreshed with the base class context in the calling
584  // chain.
586 
587  return true;
588 }

References pappso::MassSpecTracePlotContext::baseContext, pappso::MassSpecTracePlotContext::lastResolvingPower, m_context, resolvingPowerComputationSignal(), pappso::BasePlotContext::xDelta, pappso::BasePlotContext::xRegionRangeEnd, and pappso::BasePlotContext::xRegionRangeStart.

Referenced by mouseMoveHandlerDraggingCursor().

◆ deconvolute()

bool pappso::MassSpecTracePlotWidget::deconvolute ( )

Deconvolute the mass peaks into charge and molecular mass.

Definition at line 268 of file massspectraceplotwidget.cpp.

269 {
270 
271  // There are two situations: when the user is deconvoluting on the
272  // basis of the distance between two consecutive peaks of a same
273  // isotopic cluster or when the user deconvolutes on the basis of two
274  // different charged-stated peaks that belong to the same envelope.
275 
276  // We can tell the difference because in the first case the xDelta
277  // should be less than 1. In the other case, of course the difference
278  // is much greater than 1.
279 
280  // In order to do the deconvolutions, we need to know what is the tolerance
281  // on the fractional part of the deconvoluted charge value. This value is set
282  // in the parent window's double spin box.
283 
284  if(fabs(m_context.baseContext.xDelta) >= 0 &&
285  fabs(m_context.baseContext.xDelta) <= 1.1)
286  {
287  // qDebug() << __FILE__ << __LINE__ << __FUNCTION__ << "()"
288  //<< "m_xDelta:" << m_context.baseContext.xDelta
289  //<< "trying isotope-based deconvolution.";
290 
292  }
293 
294  // If not deconvoluting on the basis of the isotopic cluster, then:
295 
297 }

References pappso::MassSpecTracePlotContext::baseContext, deconvoluteChargedState(), deconvoluteIsotopicCluster(), m_chargeStateEnvelopePeakSpan, m_context, and pappso::BasePlotContext::xDelta.

Referenced by mouseMoveHandlerDraggingCursor().

◆ deconvoluteChargedState()

bool pappso::MassSpecTracePlotWidget::deconvoluteChargedState ( int  span = 1)

Deconvolute the mass peaks into charge and molecular mass.

This is one of two methods to deconvolute mass data into a charge value and a Mr value. The method implemented in this function is based on the charge state envelope offered by the mass spectrum (most often for polymers of a reasonable size).

Parameters
spanvalue representing the number of peaks of the charge state envelope that are spanned by the user selection. Defaults to 1, that is, the span encompasses two consecutive mass peaks of a given charge state envelope.

Set m_lastMz, m_lastZ and m_lastMass.

Returns
true if the deconvolution could be performed, false otherwise.

Definition at line 318 of file massspectraceplotwidget.cpp.

319 {
320  // We assume that we are dealing with two successive (if span is 1) mass
321  // peaks belonging to a given charge state family.
322 
323  // We call span the number of intervals in a given charge state envelope
324  // that separate the initial peak (lowerMz) from the last peak (upperMz).
325  // That parameter defaults to 1, that is the two peaks are immediately
326  // consecutive, that is, there is only one interval.
327 
328  // We use the m_contex.baseContext.xRegionRange structure that is unsorted.
329  // That is, lower is the start drag point.x and upper is the current drag
330  // point.x. If dragging occurs from left to right, start.x < cur.x.
331  // We use the unsorted values, because we need to know in which direction
332  // the user has drug the mouse, because we want to provide the Mr value
333  // for the peak currently under the mouse cursor, that is under
334  // currentDragPoint, that is the value in
335  // m_context.baseContext.xRegionRange.upper.
336 
337  double startMz = m_context.baseContext.xRegionRangeStart;
338  double curMz = m_context.baseContext.xRegionRangeEnd;
339 
340  // qDebug() << "startMz:" << startMz << "curMz:" << curMz;
341 
342  if(startMz == curMz)
343  {
344  m_context.lastZ = -1;
345  m_context.lastMz = std::numeric_limits<double>::min();
346  m_context.lastTicIntensity = std::numeric_limits<double>::min();
347  m_context.lastMr = std::numeric_limits<double>::min();
348 
349  return false;
350  }
351 
352  // We need to be aware that the status bar of the window that contains
353  // this plot widget shows the cursor position realtime, and that cursor
354  // position is the m_currentDragPoint.x value, that is, curMz. Thus, we need
355  // to make the calculations with the charge being the one of the polymer under
356  // the cursor position. This is tricky because it changes when the user
357  // switches drag senses: from left to right and right to left.
358  // The way z is calculated always makes it the charge of the highest mz
359  // value. So knowing this, depending on the drag direction we'll have to take
360  // curMz and apply to it either z charge (left to right drag) or (z+span)
361  // charge (right to left).
362 
363  // Make sure lower is actually lower, even if drag is from right to left.
364  // This is only to have a single charge calculation.
365  double lowerMz;
366  double upperMz;
367 
368  if(startMz < curMz)
369  {
370  lowerMz = startMz;
371  upperMz = curMz;
372  }
373  else
374  {
375  lowerMz = curMz;
376  upperMz = startMz;
377  }
378 
379  double chargeTemp = ((lowerMz * span) - span) / (upperMz - lowerMz);
380 
381  // Make a judicious roundup.
382 
383  double chargeIntPart;
384  double chargeFracPart = modf(chargeTemp, &chargeIntPart);
385 
386  // When calculating the charge of the ion, very rarely does it provide a
387  // perfect integer value. Most often (if deconvolution is for bona fide
388  // peaks belonging to the same charge state envelope) that value is with
389  // either a large fractional part or a very small fractional part. What we
390  // test here, it that fractional part. If it is greater than
391  // m_chargeMinimalFractionalPart, then we simply round up to the next integer
392  // value (that is, chargeIntPart = 27 and chargeFracPart 0.995, then we
393  // set charge to 28). If it is lesser or equal to (1 -
394  // m_chargeMinimalFractionalPart /* that is >= 0.01 */, then we let
395  // chargeIntPart unmodified (that is, chargeIntPart = 29 and
396  // chargeFracPart 0.01, then we set charge to 29). If chargeFracPart is in
397  // between (1 - m_chargeMinimalFractionalPart) and
398  // m_chargeMinimalFractionalPart, then we consider that the peaks do not
399  // belong to the same charge state envelope.
400 
401  // qDebug() << __FILE__ << __LINE__ << __FUNCTION__
402  //<< "Charge:" << chargeIntPart
403  //<< "Charge fractional part: " << chargeFracPart;
404 
405 
406  if(chargeFracPart >=
407  (1 - m_chargeMinimalFractionalPart /* that is >= 0.01 */) &&
408  chargeFracPart <= m_chargeMinimalFractionalPart /* that is <= 0.99 */)
409  {
410  m_context.lastZ = -1;
411  m_context.lastMz = std::numeric_limits<double>::min();
412  m_context.lastTicIntensity = std::numeric_limits<double>::min();
413  m_context.lastMr = std::numeric_limits<double>::min();
414 
415  // qDebug() << __FILE__ << __LINE__
416  //<< "Not a charge state family peak,"
417  //<< "returning from deconvoluteChargeState";
418 
419  return false;
420  }
421 
422  if(chargeFracPart > m_chargeMinimalFractionalPart)
423  m_context.lastZ = chargeIntPart + 1;
424  else
425  m_context.lastZ = chargeIntPart;
426 
427  // Now, to actually compute the molecular mass based on the charge and on
428  // the currently displayed m/z value, we need to have some thinking:
429 
430  if(startMz < curMz)
431  {
432  // The drag was from left to right, that is curMz is greater than
433  // startMz. Fine, the z value is effectively the charge of the ion at
434  // curMz. Easy, no charge value modification here.
435  }
436  else
437  {
438  // The drag was from right to left, that is curMz is less than startMz.
439  // So we want to show the charge of the curMz, that is, z + span.
440  m_context.lastZ = m_context.lastZ + span;
441  }
442 
443  m_context.lastMz = curMz;
444  m_context.lastMr =
446 
447  // qDebug() << __FILE__ << __LINE__
448  //<< "startMz:" << QString("%1").arg(startMz, 0, 'f', 6)
449  //<< "m_lastMz (curMz):"
450  //<< QString("%1").arg(m_context.lastMz, 0, 'f', 6)
451  //<< "m_lastMass:" << QString("%1").arg(m_context.lastMr, 0, 'f', 6)
452  //<< "m_lastZ:" << QString("%1").arg(m_context.lastZ);
453 
454  // qDebug() << __FILE__ << __LINE__ << __FUNCTION__ << "()"
455  //<< "returning true";
456 
457  // The m_context was refreshed with the base class context in the calling
458  // chain.
460 
461  return true;
462 }

References pappso::MassSpecTracePlotContext::baseContext, pappso::MassSpecTracePlotContext::lastMr, pappso::MassSpecTracePlotContext::lastMz, pappso::MassSpecTracePlotContext::lastTicIntensity, pappso::MassSpecTracePlotContext::lastZ, m_chargeMinimalFractionalPart, m_context, massDeconvolutionSignal(), pappso::MPROTON(), pappso::BasePlotContext::xRegionRangeEnd, and pappso::BasePlotContext::xRegionRangeStart.

Referenced by deconvolute().

◆ deconvoluteIsotopicCluster()

bool pappso::MassSpecTracePlotWidget::deconvoluteIsotopicCluster ( )

Deconvolute the mass peaks into charge and molecular mass.

This is one of two methods to deconvolute mass data into a charge value and a Mr value. The method implemented in this function is based on the distance that separates two immediately consecutive peaks of an isotopic cluster. This method can be used as long as the instrument produced data with a resolution sufficient to separate reasonably well the different peaks of an isotopic cluster.

Set m_lastMz, m_lastZ and m_lastMass.

Returns
true if the deconvolution could be performed, false otherwise.

Definition at line 480 of file massspectraceplotwidget.cpp.

481 {
482 
485  {
486  // qDebug() << __FILE__ << __LINE__
487  //<< "Same xRegionRange.upper and xRegionRange.lower:"
488  //<< "returning from deconvoluteIsotopicCluster";
489 
490  return false;
491  }
492 
493  double chargeTemp = 1 / fabs(m_context.baseContext.xDelta);
494 
495  // Make a judicious roundup.
496  double chargeIntPart;
497  double chargeFracPart = modf(chargeTemp, &chargeIntPart);
498 
499  // qDebug() << "m_xDelta:" << m_context.baseContext.xDelta
500  //<< "chargeTemp:" << QString("%1").arg(chargeTemp, 0, 'f', 6)
501  //<< "chargeIntPart:" << chargeIntPart
502  //<< "chargeFracPart:" << QString("%1").arg(chargeFracPart, 0, 'f', 6)
503  //<< "m_chargeMinimalFractionalPart:" << m_chargeMinimalFractionalPart;
504 
505  if(chargeFracPart >= (1 - m_chargeMinimalFractionalPart) &&
506  chargeFracPart <= m_chargeMinimalFractionalPart)
507  {
508  m_context.lastZ = -1;
509  m_context.lastMz = std::numeric_limits<double>::min();
510  m_context.lastTicIntensity = std::numeric_limits<double>::min();
511  m_context.lastMr = std::numeric_limits<double>::min();
512 
513  // qDebug() << "Not in a isotopic cluster peak:"
514  //<< "returning from deconvoluteIsotopicCluster";
515 
516  return false;
517  }
518 
519  if(chargeFracPart > m_chargeMinimalFractionalPart)
520  {
521  m_context.lastZ = chargeIntPart + 1;
522 
523  // qDebug() << "chargeFracPart > m_chargeMinimalFractionalPart -> m_lastZ
524  // = "
525  //<< m_context.lastZ;
526  }
527  else
528  {
529  m_context.lastZ = chargeIntPart;
530 
531  // qDebug()
532  //<< "chargeFracPart <= m_chargeMinimalFractionalPart -> m_lastZ = "
533  //<< m_context.lastZ;
534  }
535 
536  // Now that we have the charge in the form of an int, we can compute the
537  // Mr of the lightest isotopic cluster peak (the one that has the lowest x
538  // value). That value is stored in m_xRangeLower.
539 
540  // We need to sort the xRegionRange before being certain that lower is indeed
541  // the left value of the drag span.
542 
545 
546  m_context.lastMr =
548 
549  // qDebug() << __FILE__ << __LINE__ << __FUNCTION__ << "()"
550  //<< "returning true";
551 
552  // The m_context was refreshed with the base class context in the calling
553  // chain.
555 
556  return true;
557 }

References pappso::MassSpecTracePlotContext::baseContext, pappso::MassSpecTracePlotContext::lastMr, pappso::MassSpecTracePlotContext::lastMz, pappso::MassSpecTracePlotContext::lastTicIntensity, pappso::MassSpecTracePlotContext::lastZ, m_chargeMinimalFractionalPart, m_context, massDeconvolutionSignal(), pappso::MPROTON(), pappso::BasePlotContext::xDelta, pappso::BasePlotContext::xRegionRangeEnd, and pappso::BasePlotContext::xRegionRangeStart.

Referenced by deconvolute().

◆ getChargeMinimalFractionalPart()

double pappso::MassSpecTracePlotWidget::getChargeMinimalFractionalPart ( ) const

Definition at line 246 of file massspectraceplotwidget.cpp.

247 {
249 }

References m_chargeMinimalFractionalPart.

◆ getChargeStateEnvelopePeakSpan()

int pappso::MassSpecTracePlotWidget::getChargeStateEnvelopePeakSpan ( ) const

Definition at line 260 of file massspectraceplotwidget.cpp.

261 {
263 }

References m_chargeStateEnvelopePeakSpan.

◆ keyPressEvent()

void pappso::MassSpecTracePlotWidget::keyPressEvent ( QKeyEvent *  event)
overridevirtual

Set the m_pressedKeyCode to the key code in event.

Reimplemented from pappso::BasePlotWidget.

Definition at line 115 of file massspectraceplotwidget.cpp.

116 {
117  // qDebug() << "ENTER";
119 
120  // Before working on the various data belonging to the base context, we need
121  // to get it from the base class and refresh our local context with it.
123 
124  // qDebug() << "Going to emit keyPressEventSignal(m_context);";
125 
131 }

References pappso::MassSpecTracePlotContext::baseContext, pappso::BasePlotContext::currentDragPoint, pappso::BasePlotWidget::keyPressEvent(), keyPressEventSignal(), m_context, newKeyPressEventSignal(), refreshBaseContext(), and testKeyPressEventSignal().

◆ keyPressEventSignal

void pappso::MassSpecTracePlotWidget::keyPressEventSignal ( const MassSpecTracePlotContext context)
signal

Referenced by keyPressEvent().

◆ keyReleaseEvent()

void pappso::MassSpecTracePlotWidget::keyReleaseEvent ( QKeyEvent *  event)
overridevirtual

Handle specific key codes and trigger respective actions.

Reimplemented from pappso::BasePlotWidget.

Definition at line 136 of file massspectraceplotwidget.cpp.

137 {
139 
140  // Before working on the various data belonging to the base context, we need
141  // to get it from the base class and refresh our local context with it.
143 }

References pappso::BasePlotWidget::keyReleaseEvent(), and refreshBaseContext().

◆ massDeconvolutionSignal

void pappso::MassSpecTracePlotWidget::massDeconvolutionSignal ( const MassSpecTracePlotContext context)
signal

◆ mouseMoveHandler()

void pappso::MassSpecTracePlotWidget::mouseMoveHandler ( QMouseEvent *  event)
overridevirtual

Handle mouse movements, in particular record all the last visited points.

This function is reponsible for storing at each time the last visited point in the graph. Here, point is intended as any x/y coordinate in the plot widget viewport, not a graph point.

The stored values are then the basis for a large set of calculations throughout all the plot widget.

Parameters
pointerto QMouseEvent from which to retrieve the coordinates of the visited viewport points.

Reimplemented from pappso::BasePlotWidget.

Definition at line 160 of file massspectraceplotwidget.cpp.

161 {
163 
164  // Before working on the various data belonging to the base context, we need
165  // to get it from the base class and refresh our local context with it.
167 }

References pappso::BasePlotWidget::mouseMoveHandler(), and refreshBaseContext().

◆ mouseMoveHandlerDraggingCursor()

void pappso::MassSpecTracePlotWidget::mouseMoveHandlerDraggingCursor ( )
overridevirtual

Reimplemented from pappso::BasePlotWidget.

Definition at line 182 of file massspectraceplotwidget.cpp.

183 {
185 
186  // Before working on the various data belonging to the base context, we need
187  // to get it from the base class and refresh our local context with it.
189 
190  if(m_context.baseContext.mouseButtonsAtMousePress & Qt::LeftButton)
191  {
193  return;
194 
195  // qDebug() << "lastMovingMouseButtons:"
196  //<< m_context.baseContext.lastMovingMouseButtons;
197 
198  deconvolute();
200  }
201 }

References pappso::MassSpecTracePlotContext::baseContext, computeResolvingPower(), deconvolute(), pappso::BasePlotContext::isMeasuringDistance, m_context, pappso::BasePlotContext::mouseButtonsAtMousePress, pappso::BasePlotWidget::mouseMoveHandlerDraggingCursor(), and refreshBaseContext().

◆ mouseMoveHandlerNotDraggingCursor()

void pappso::MassSpecTracePlotWidget::mouseMoveHandlerNotDraggingCursor ( )
overridevirtual

Reimplemented from pappso::BasePlotWidget.

Definition at line 171 of file massspectraceplotwidget.cpp.

172 {
174 
175  // Before working on the various data belonging to the base context, we need
176  // to get it from the base class and refresh our local context with it.
178 }

References pappso::BasePlotWidget::mouseMoveHandlerNotDraggingCursor(), and refreshBaseContext().

◆ mousePressHandler()

void pappso::MassSpecTracePlotWidget::mousePressHandler ( QMouseEvent *  event)
overridevirtual

Record the clicks of the mouse.

Reimplemented from pappso::BasePlotWidget.

Definition at line 206 of file massspectraceplotwidget.cpp.

207 {
209 
210  // Before working on the various data belonging to the base context, we need
211  // to get it from the base class and refresh our local context with it.
213 }

References pappso::BasePlotWidget::mousePressHandler(), and refreshBaseContext().

◆ mouseReleaseEventSignal

void pappso::MassSpecTracePlotWidget::mouseReleaseEventSignal ( const MassSpecTracePlotContext context)
signal

◆ mouseReleaseHandler()

void pappso::MassSpecTracePlotWidget::mouseReleaseHandler ( QMouseEvent *  event)
overridevirtual

React to the release of the mouse buttons.

Reimplemented from pappso::BasePlotWidget.

Definition at line 218 of file massspectraceplotwidget.cpp.

219 {
221 
222  // Before working on the various data belonging to the base context, we need
223  // to get it from the base class and refresh our local context with it.
225 }

References pappso::BasePlotWidget::mouseReleaseHandler(), and refreshBaseContext().

◆ newKeyPressEventSignal

void pappso::MassSpecTracePlotWidget::newKeyPressEventSignal ( pappso::DataPoint  context)
signal

Referenced by keyPressEvent().

◆ refreshBaseContext()

◆ resolvingPowerComputationSignal

void pappso::MassSpecTracePlotWidget::resolvingPowerComputationSignal ( const MassSpecTracePlotContext context)
signal

Referenced by computeResolvingPower().

◆ setChargeMinimalFractionalPart()

void pappso::MassSpecTracePlotWidget::setChargeMinimalFractionalPart ( double  charge_fractional_part)

Definition at line 238 of file massspectraceplotwidget.cpp.

240 {
241  m_chargeMinimalFractionalPart = charge_fractional_part;
242 }

References m_chargeMinimalFractionalPart.

◆ setChargeStateEnvelopePeakSpan()

void pappso::MassSpecTracePlotWidget::setChargeStateEnvelopePeakSpan ( int  interval)

Definition at line 253 of file massspectraceplotwidget.cpp.

254 {
256 }

References m_chargeStateEnvelopePeakSpan.

◆ testKeyPressEventSignal

void pappso::MassSpecTracePlotWidget::testKeyPressEventSignal ( pappso::MassSpecTracePlotContext  context)
signal

Referenced by keyPressEvent().

Member Data Documentation

◆ m_chargeMinimalFractionalPart

double pappso::MassSpecTracePlotWidget::m_chargeMinimalFractionalPart = 0.990
protected

◆ m_chargeStateEnvelopePeakSpan

int pappso::MassSpecTracePlotWidget::m_chargeStateEnvelopePeakSpan = 1
protected

◆ m_context


The documentation for this class was generated from the following files:
pappso::MassSpecTracePlotContext::lastTicIntensity
double lastTicIntensity
Definition: massspectraceplotwidget.h:62
pappso::BasePlotContext::xRegionRangeStart
double xRegionRangeStart
Definition: baseplotwidget.h:104
pappso::BasePlotWidget::mouseMoveHandler
virtual void mouseMoveHandler(QMouseEvent *event)
Definition: baseplotwidget.cpp:1072
pappso::MassSpecTracePlotWidget::deconvoluteIsotopicCluster
bool deconvoluteIsotopicCluster()
Deconvolute the mass peaks into charge and molecular mass.
Definition: massspectraceplotwidget.cpp:480
pappso::MassSpecTracePlotContext::lastZ
int lastZ
Definition: massspectraceplotwidget.h:60
pappso::BasePlotContext::dataKind
DataKind dataKind
Definition: baseplotwidget.h:71
pappso::BasePlotWidget::mousePressHandler
virtual void mousePressHandler(QMouseEvent *event)
KEYBOARD-related EVENTS.
Definition: baseplotwidget.cpp:774
pappso::BasePlotContext::currentDragPoint
QPointF currentDragPoint
Definition: baseplotwidget.h:82
pappso::MassSpecTracePlotWidget::deconvoluteChargedState
bool deconvoluteChargedState(int span=1)
Deconvolute the mass peaks into charge and molecular mass.
Definition: massspectraceplotwidget.cpp:318
pappso::DataKind::mz
@ mz
m/z
pappso::DataPoint
Definition: datapoint.h:20
pappso::MassSpecTracePlotWidget::keyPressEventSignal
void keyPressEventSignal(const MassSpecTracePlotContext &context)
pappso::BasePlotContext::isMeasuringDistance
bool isMeasuringDistance
Definition: baseplotwidget.h:96
pappso::MPROTON
const pappso_double MPROTON(1.007276466879)
pappso::MassSpecTracePlotWidget::testKeyPressEventSignal
void testKeyPressEventSignal(pappso::MassSpecTracePlotContext context)
pappso::BasePlotContext::mouseButtonsAtMousePress
Qt::MouseButtons mouseButtonsAtMousePress
Definition: baseplotwidget.h:123
pappso::BasePlotWidget::mouseMoveHandlerDraggingCursor
virtual void mouseMoveHandlerDraggingCursor()
Definition: baseplotwidget.cpp:1155
pappso::MassSpecTracePlotContext::lastMr
double lastMr
Definition: massspectraceplotwidget.h:63
pappso::BasePlotWidget::mouseReleaseHandler
virtual void mouseReleaseHandler(QMouseEvent *event)
Definition: baseplotwidget.cpp:879
pappso::BasePlotWidget::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
KEYBOARD-related EVENTS.
Definition: baseplotwidget.cpp:492
pappso::MassSpecTracePlotWidget::resolvingPowerComputationSignal
void resolvingPowerComputationSignal(const MassSpecTracePlotContext &context)
pappso::BaseTracePlotWidget::BaseTracePlotWidget
BaseTracePlotWidget(QWidget *parent=0)
Definition: basetraceplotwidget.cpp:44
pappso::MassSpecTracePlotContext::baseContext
BasePlotContext baseContext
Definition: massspectraceplotwidget.h:58
pappso::BasePlotWidget::mouseMoveHandlerNotDraggingCursor
virtual void mouseMoveHandlerNotDraggingCursor()
Definition: baseplotwidget.cpp:1109
pappso::MassSpecTracePlotWidget::computeResolvingPower
bool computeResolvingPower()
Definition: massspectraceplotwidget.cpp:561
pappso::MassSpecTracePlotWidget::m_context
MassSpecTracePlotContext m_context
Definition: massspectraceplotwidget.h:130
pappso::MassSpecTracePlotContext::lastResolvingPower
double lastResolvingPower
Definition: massspectraceplotwidget.h:64
pappso::MassSpecTracePlotWidget::m_chargeStateEnvelopePeakSpan
int m_chargeStateEnvelopePeakSpan
Definition: massspectraceplotwidget.h:144
pappso::MassSpecTracePlotContext::lastMz
double lastMz
Definition: massspectraceplotwidget.h:61
pappso::BasePlotContext::xRegionRangeEnd
double xRegionRangeEnd
Definition: baseplotwidget.h:105
pappso::MassSpecTracePlotWidget::m_chargeMinimalFractionalPart
double m_chargeMinimalFractionalPart
Definition: massspectraceplotwidget.h:137
pappso::BasePlotWidget::keyReleaseEvent
virtual void keyReleaseEvent(QKeyEvent *event)
Handle specific key codes and trigger respective actions.
Definition: baseplotwidget.cpp:521
pappso::MassSpecTracePlotWidget::newKeyPressEventSignal
void newKeyPressEventSignal(pappso::DataPoint context)
pappso::MassSpecTracePlotWidget::deconvolute
bool deconvolute()
Deconvolute the mass peaks into charge and molecular mass.
Definition: massspectraceplotwidget.cpp:268
pappso::MassSpecTracePlotWidget::refreshBaseContext
const MassSpecTracePlotContext & refreshBaseContext() const
Definition: massspectraceplotwidget.cpp:229
pappso::MassSpecTracePlotWidget::massDeconvolutionSignal
void massDeconvolutionSignal(const MassSpecTracePlotContext &context)
pappso::BasePlotContext::xDelta
double xDelta
Definition: baseplotwidget.h:110
pappso::BasePlotWidget::m_context
BasePlotContext m_context
Definition: baseplotwidget.h:312