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 mouseWheelEventSignal (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 mouseWheelHandler (QWheelEvent *event)
 
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 (Axis 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, Axis axis)
 
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 drawXDeltaFeatures ()
 
virtual void drawYDeltaFeatures ()
 
virtual void calculateDragDeltas ()
 
virtual bool isVerticalDisplacementAboveThreshold ()
 
virtual void drawSelectionRectangleAndPrepareZoom (bool as_line_segment=false, bool for_integration=false)
 
virtual void updateSelectionRectangle (bool as_line_segment=false, bool for_integration=false)
 
virtual void resetSelectionRectangle ()
 
virtual void hideSelectionRectangle (bool reset_values=false)
 
virtual bool isSelectionRectangleVisible ()
 
virtual PolygonType whatIsVisibleOfTheSelectionRectangle ()
 
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 updateContextXandYAxisRanges ()
 
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
 
QCPItemLine * mp_selectionRectangeLine1 = nullptr
 Rectangle defining the borders of zoomed-in/out data. More...
 
QCPItemLine * mp_selectionRectangeLine2 = nullptr
 
QCPItemLine * mp_selectionRectangeLine3 = nullptr
 
QCPItemLine * mp_selectionRectangeLine4 = nullptr
 
QCPItemText * mp_xDeltaTextItem = nullptr
 Text describing the x-axis delta value during a drag operation. More...
 
QCPItemText * mp_yDeltaTextItem = nullptr
 
bool m_shouldTracersBeVisible = true
 Tells if the tracers should be visible. More...
 
QCPItemLine * mp_hPosTracerItem = nullptr
 Horizontal position tracer. More...
 
QCPItemLine * mp_vPosTracerItem = nullptr
 Vertical position tracer. More...
 
QCPItemLine * mp_vStartTracerItem = nullptr
 Vertical selection start tracer (typically in green). More...
 
QCPItemLine * mp_vEndTracerItem = nullptr
 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...
 

Additional Inherited Members

- Protected Member Functions inherited from pappso::BasePlotWidget
virtual void createAllAncillaryItems ()
 
virtual void update1DSelectionRectangle (bool for_integration=false)
 
virtual void update2DSelectionRectangleSquare (bool for_integration=false)
 
virtual void update2DSelectionRectangleSkewed (bool for_integration=false)
 
virtual QString allLayerNamesToString () const
 
virtual QString layerableLayerName (QCPLayerable *layerable_p) const
 
virtual int layerableLayerIndex (QCPLayerable *layerable_p) const
 

Detailed Description

Definition at line 57 of file massspectraceplotwidget.h.

Constructor & Destructor Documentation

◆ MassSpecTracePlotWidget() [1/2]

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

Definition at line 56 of file massspectraceplotwidget.cpp.

57  : BaseTracePlotWidget(parent)
58 {
59  // Set the base context to be of kind DataKind::mz;
60 
62 
63  // And then initialize ours with the base class' one.
65 
66  // qDebug() << "Data kind:" <<
67  // static_cast<int>(m_context.m_baseContext.m_dataKind);
68 }
BasePlotContext m_context
BaseTracePlotWidget(QWidget *parent=0)

References pappso::MassSpecTracePlotContext::m_baseContext, pappso::BasePlotWidget::m_context, m_context, pappso::BasePlotContext::m_dataKind, 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 70 of file massspectraceplotwidget.cpp.

73  : BaseTracePlotWidget(parent, x_axis_label, y_axis_label)
74 {
75  // Set the base context to be of kind DataKind::mz;
76 
78 
79  // And then initialize ours with the base class' one.
81 
82  // qDebug() << "Data kind:" <<
83  // static_cast<int>(m_context.m_baseContext.m_dataKind);
84 }

References pappso::MassSpecTracePlotContext::m_baseContext, pappso::BasePlotWidget::m_context, m_context, pappso::BasePlotContext::m_dataKind, and pappso::mz.

◆ ~MassSpecTracePlotWidget()

pappso::MassSpecTracePlotWidget::~MassSpecTracePlotWidget ( )
virtual

Definition at line 87 of file massspectraceplotwidget.cpp.

88 {
89 }

Member Function Documentation

◆ computeResolvingPower()

bool pappso::MassSpecTracePlotWidget::computeResolvingPower ( )

Definition at line 540 of file massspectraceplotwidget.cpp.

541 {
542 
543  // m_xRangeLower and m_xRangeUpper and m_xDelta (in fabs() form) have been set
544  // during mouve movement handling. Note that the range values *are
545  // sorted*.
546 
548  {
549  m_context.m_lastResolvingPower = std::numeric_limits<double>::min();
550 
551  return false;
552  }
553 
554  // Resolving power is m/z / Delta(m/z), for singly-charged species.
555 
557  (std::min<double>(m_context.m_baseContext.m_xRegionRangeStart,
561 
562  // The m_context was refreshed with the base class context in the calling
563  // chain.
565 
566  return true;
567 }
void resolvingPowerComputationSignal(const MassSpecTracePlotContext &context)

References pappso::MassSpecTracePlotContext::m_baseContext, m_context, pappso::MassSpecTracePlotContext::m_lastResolvingPower, pappso::BasePlotContext::m_xDelta, pappso::BasePlotContext::m_xRegionRangeEnd, pappso::BasePlotContext::m_xRegionRangeStart, and resolvingPowerComputationSignal().

Referenced by mouseMoveHandlerDraggingCursor().

◆ deconvolute()

bool pappso::MassSpecTracePlotWidget::deconvolute ( )

Deconvolute the mass peaks into charge and molecular mass.

Definition at line 247 of file massspectraceplotwidget.cpp.

248 {
249 
250  // There are two situations: when the user is deconvoluting on the
251  // basis of the distance between two consecutive peaks of a same
252  // isotopic cluster or when the user deconvolutes on the basis of two
253  // different charged-stated peaks that belong to the same envelope.
254 
255  // We can tell the difference because in the first case the xDelta
256  // should be less than 1. In the other case, of course the difference
257  // is much greater than 1.
258 
259  // In order to do the deconvolutions, we need to know what is the tolerance
260  // on the fractional part of the deconvoluted charge value. This value is set
261  // in the parent window's double spin box.
262 
263  if(fabs(m_context.m_baseContext.m_xDelta) >= 0 &&
264  fabs(m_context.m_baseContext.m_xDelta) <= 1.1)
265  {
266  // qDebug() << __FILE__ << __LINE__ << __FUNCTION__ << "()"
267  //<< "m_xDelta:" << m_context.m_baseContext.m_xDelta
268  //<< "trying isotope-based deconvolution.";
269 
271  }
272 
273  // If not deconvoluting on the basis of the isotopic cluster, then:
274 
276 }
bool deconvoluteChargedState(int span=1)
Deconvolute the mass peaks into charge and molecular mass.
bool deconvoluteIsotopicCluster()
Deconvolute the mass peaks into charge and molecular mass.

References deconvoluteChargedState(), deconvoluteIsotopicCluster(), pappso::MassSpecTracePlotContext::m_baseContext, m_chargeStateEnvelopePeakSpan, m_context, and pappso::BasePlotContext::m_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 297 of file massspectraceplotwidget.cpp.

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

References pappso::MassSpecTracePlotContext::m_baseContext, m_chargeMinimalFractionalPart, m_context, pappso::MassSpecTracePlotContext::m_lastMr, pappso::MassSpecTracePlotContext::m_lastMz, pappso::MassSpecTracePlotContext::m_lastTicIntensity, pappso::MassSpecTracePlotContext::m_lastZ, pappso::BasePlotContext::m_xRegionRangeEnd, pappso::BasePlotContext::m_xRegionRangeStart, massDeconvolutionSignal(), and pappso::MPROTON().

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 459 of file massspectraceplotwidget.cpp.

460 {
461 
464  {
465  // qDebug() << __FILE__ << __LINE__
466  //<< "Same xRegionRange.upper and xRegionRange.lower:"
467  //<< "returning from deconvoluteIsotopicCluster";
468 
469  return false;
470  }
471 
472  double chargeTemp = 1 / fabs(m_context.m_baseContext.m_xDelta);
473 
474  // Make a judicious roundup.
475  double chargeIntPart;
476  double chargeFracPart = modf(chargeTemp, &chargeIntPart);
477 
478  // qDebug() << "m_xDelta:" << m_context.m_baseContext.m_xDelta
479  //<< "chargeTemp:" << QString("%1").arg(chargeTemp, 0, 'f', 6)
480  //<< "chargeIntPart:" << chargeIntPart
481  //<< "chargeFracPart:" << QString("%1").arg(chargeFracPart, 0, 'f', 6)
482  //<< "m_chargeMinimalFractionalPart:" << m_chargeMinimalFractionalPart;
483 
484  if(chargeFracPart >= (1 - m_chargeMinimalFractionalPart) &&
485  chargeFracPart <= m_chargeMinimalFractionalPart)
486  {
487  m_context.m_lastZ = -1;
488  m_context.m_lastMz = std::numeric_limits<double>::min();
489  m_context.m_lastTicIntensity = std::numeric_limits<double>::min();
490  m_context.m_lastMr = std::numeric_limits<double>::min();
491 
492  // qDebug() << "Not in a isotopic cluster peak:"
493  //<< "returning from deconvoluteIsotopicCluster";
494 
495  return false;
496  }
497 
498  if(chargeFracPart > m_chargeMinimalFractionalPart)
499  {
500  m_context.m_lastZ = chargeIntPart + 1;
501 
502  // qDebug() << "chargeFracPart > m_chargeMinimalFractionalPart -> m_lastZ
503  // = "
504  //<< m_context.m_lastZ;
505  }
506  else
507  {
508  m_context.m_lastZ = chargeIntPart;
509 
510  // qDebug()
511  //<< "chargeFracPart <= m_chargeMinimalFractionalPart -> m_lastZ = "
512  //<< m_context.m_lastZ;
513  }
514 
515  // Now that we have the charge in the form of an int, we can compute the
516  // Mr of the lightest isotopic cluster peak (the one that has the lowest x
517  // value). That value is stored in m_xRangeLower.
518 
519  // We need to sort the xRegionRange before being certain that lower is indeed
520  // the left value of the drag span.
521 
524 
527 
528  // qDebug() << __FILE__ << __LINE__ << __FUNCTION__ << "()"
529  //<< "returning true";
530 
531  // The m_context was refreshed with the base class context in the calling
532  // chain.
534 
535  return true;
536 }

References pappso::MassSpecTracePlotContext::m_baseContext, m_chargeMinimalFractionalPart, m_context, pappso::MassSpecTracePlotContext::m_lastMr, pappso::MassSpecTracePlotContext::m_lastMz, pappso::MassSpecTracePlotContext::m_lastTicIntensity, pappso::MassSpecTracePlotContext::m_lastZ, pappso::BasePlotContext::m_xDelta, pappso::BasePlotContext::m_xRegionRangeEnd, pappso::BasePlotContext::m_xRegionRangeStart, massDeconvolutionSignal(), and pappso::MPROTON().

Referenced by deconvolute().

◆ getChargeMinimalFractionalPart()

double pappso::MassSpecTracePlotWidget::getChargeMinimalFractionalPart ( ) const

Definition at line 225 of file massspectraceplotwidget.cpp.

226 {
228 }

References m_chargeMinimalFractionalPart.

◆ getChargeStateEnvelopePeakSpan()

int pappso::MassSpecTracePlotWidget::getChargeStateEnvelopePeakSpan ( ) const

Definition at line 239 of file massspectraceplotwidget.cpp.

240 {
242 }

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 94 of file massspectraceplotwidget.cpp.

95 {
96  // qDebug() << "ENTER";
98 
99  // Before working on the various data belonging to the base context, we need
100  // to get it from the base class and refresh our local context with it.
102 
103  // qDebug() << "Going to emit keyPressEventSignal(m_context);";
104 
110 }
virtual void keyPressEvent(QKeyEvent *event)
KEYBOARD-related EVENTS.
const MassSpecTracePlotContext & refreshBaseContext() const
void testKeyPressEventSignal(pappso::MassSpecTracePlotContext context)
void newKeyPressEventSignal(pappso::DataPoint context)
void keyPressEventSignal(const MassSpecTracePlotContext &context)

References pappso::BasePlotWidget::keyPressEvent(), keyPressEventSignal(), pappso::MassSpecTracePlotContext::m_baseContext, m_context, pappso::BasePlotContext::m_currentDragPoint, 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 115 of file massspectraceplotwidget.cpp.

116 {
118 
119  // Before working on the various data belonging to the base context, we need
120  // to get it from the base class and refresh our local context with it.
122 }
virtual void keyReleaseEvent(QKeyEvent *event)
Handle specific key codes and trigger respective actions.

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 139 of file massspectraceplotwidget.cpp.

140 {
142 
143  // Before working on the various data belonging to the base context, we need
144  // to get it from the base class and refresh our local context with it.
146 }
virtual void mouseMoveHandler(QMouseEvent *event)
KEYBOARD-related EVENTS.

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

◆ mouseMoveHandlerDraggingCursor()

void pappso::MassSpecTracePlotWidget::mouseMoveHandlerDraggingCursor ( )
overridevirtual

Reimplemented from pappso::BasePlotWidget.

Definition at line 161 of file massspectraceplotwidget.cpp.

162 {
164 
165  // Before working on the various data belonging to the base context, we need
166  // to get it from the base class and refresh our local context with it.
168 
170  {
172  return;
173 
174  // qDebug() << "lastMovingMouseButtons:"
175  //<< m_context.m_baseContext.m_lastMovingMouseButtons;
176 
177  deconvolute();
179  }
180 }
Qt::MouseButtons m_mouseButtonsAtMousePress
virtual void mouseMoveHandlerDraggingCursor()
bool deconvolute()
Deconvolute the mass peaks into charge and molecular mass.

References computeResolvingPower(), deconvolute(), pappso::MassSpecTracePlotContext::m_baseContext, m_context, pappso::BasePlotContext::m_isMeasuringDistance, pappso::BasePlotContext::m_mouseButtonsAtMousePress, pappso::BasePlotWidget::mouseMoveHandlerDraggingCursor(), and refreshBaseContext().

◆ mouseMoveHandlerNotDraggingCursor()

void pappso::MassSpecTracePlotWidget::mouseMoveHandlerNotDraggingCursor ( )
overridevirtual

Reimplemented from pappso::BasePlotWidget.

Definition at line 150 of file massspectraceplotwidget.cpp.

151 {
153 
154  // Before working on the various data belonging to the base context, we need
155  // to get it from the base class and refresh our local context with it.
157 }
virtual void mouseMoveHandlerNotDraggingCursor()

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 185 of file massspectraceplotwidget.cpp.

186 {
188 
189  // Before working on the various data belonging to the base context, we need
190  // to get it from the base class and refresh our local context with it.
192 }
virtual void mousePressHandler(QMouseEvent *event)
KEYBOARD-related EVENTS.

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 197 of file massspectraceplotwidget.cpp.

198 {
200 
201  // Before working on the various data belonging to the base context, we need
202  // to get it from the base class and refresh our local context with it.
204 }
virtual void mouseReleaseHandler(QMouseEvent *event)

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 217 of file massspectraceplotwidget.cpp.

219 {
220  m_chargeMinimalFractionalPart = charge_fractional_part;
221 }

References m_chargeMinimalFractionalPart.

◆ setChargeStateEnvelopePeakSpan()

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

Definition at line 232 of file massspectraceplotwidget.cpp.

233 {
235 }

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: