libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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 mousePressEventSignal (const MassSpecTracePlotContext &context)
 
void mouseReleaseEventSignal (const 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 mousePressEventSignal (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.
 
bool deconvoluteIsotopicCluster ()
 Deconvolute the mass peaks into charge and molecular mass.
 
bool deconvoluteChargedState (int span=1)
 Deconvolute the mass peaks into charge and molecular mass.
 
bool computeResolvingPower ()
 
virtual void keyPressEvent (QKeyEvent *event) override
 Set the m_pressedKeyCode to the key code in event.
 
virtual void keyReleaseEvent (QKeyEvent *event) override
 Handle specific key codes and trigger respective actions.
 
virtual void mouseMoveHandler (QMouseEvent *event) override
 Handle mouse movements, in particular record all the last visited points.
 
virtual void mousePressHandler (QMouseEvent *event) override
 Record the clicks of the mouse.
 
virtual void mouseReleaseHandler (QMouseEvent *event) override
 React to the release of the mouse buttons.
 
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.
 
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.
 
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.
 
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.
 
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.
 
virtual void restorePreviousAxesRangeHistory ()
 Go up one history element in the axis history.
 
virtual void restoreAxesRangeHistory (std::size_t index)
 Get the axis histories at index index and update the plot ranges.
 
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.
 
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.
 
virtual QCPRange getRangeY (bool &found_range, int index) const
 
QCPRange getRange (Enums::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, Enums::Axis axis)
 
virtual void replotWithAxisRangeX (double lower, double upper)
 
virtual void replotWithAxisRangeY (double lower, double upper)
 
virtual void hideAllPlotItems ()
 PLOTTING / REPLOTTING functions.
 
virtual void showTracers ()
 Show the traces (vertical and horizontal).
 
virtual void hideTracers ()
 Hide the traces (vertical and horizontal).
 
virtual void drawXScopeSpanFeatures ()
 
virtual void drawYScopeSpanFeatures ()
 
virtual void calculateDragDeltas ()
 
virtual bool isVerticalDisplacementAboveThreshold ()
 
virtual void drawSelectionRectangleAndPrepareZoom (bool as_line_segment=false, bool for_integration=false)
 
virtual void updateIntegrationScopeDrawing (bool as_line_segment=false, bool for_integration=false)
 
virtual void resetSelectionRectangle ()
 
virtual void hideSelectionRectangle (bool reset_values=false)
 
virtual bool isSelectionRectangleVisible ()
 
virtual SelectionDrawingLines whatIsVisibleOfTheSelectionRectangle ()
 
virtual void setFocus ()
 PLOT ITEMS : TRACER TEXT ITEMS...
 
virtual void redrawPlotBackground (QWidget *focusedPlotWidget)
 Redraw the background of the focusedPlotWidget plot widget.
 
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.
 
QString m_desc = "NOT_SET"
 Description of the plot widget.
 
QString m_fileName
 The name of the data file from which the mass data were read.
 
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.
 
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.
 
QCPItemText * mp_yDeltaTextItem = nullptr
 
bool m_shouldTracersBeVisible = true
 Tells if the tracers should be visible.
 
QCPItemLine * mp_hPosTracerItem = nullptr
 Horizontal position tracer.
 
QCPItemLine * mp_vPosTracerItem = nullptr
 Vertical position tracer.
 
QCPItemLine * mp_vStartTracerItem = nullptr
 Vertical selection start tracer (typically in green).
 
QCPItemLine * mp_vEndTracerItem = nullptr
 Vertical selection end tracer (typically in red).
 
std::size_t m_lastAxisRangeHistoryIndex = 0
 Index of the last axis range history item.
 
std::vector< QCPRange * > m_xAxisRangeHistory
 List of x axis ranges occurring during the panning zooming actions.
 
std::vector< QCPRange * > m_yAxisRangeHistory
 List of y axis ranges occurring during the panning zooming actions.
 
int m_mouseMoveHandlerSkipAmount = 10
 How many mouse move events must be skipped *‍/.
 
int m_mouseMoveHandlerSkipCount = 0
 Counter to handle the "fat data" mouse move event handling.
 
QColor m_unfocusedColor = QColor("lightgray")
 Color used for the background of unfocused plot.
 
QBrush m_unfocusedBrush = QBrush(m_unfocusedColor)
 Color used for the background of unfocused plot.
 
QColor m_focusedColor = QColor(Qt::transparent)
 Color used for the background of focused plot.
 
QBrush m_focusedBrush = QBrush(m_focusedColor)
 Color used for the background of focused plot.
 
QPen m_pen
 Pen used to draw the graph and textual elements in the plot widget.
 

Additional Inherited Members

- Protected Member Functions inherited from pappso::BasePlotWidget
virtual void createAllAncillaryItems ()
 
virtual void updateIntegrationScope (bool for_integration=false)
 
virtual void updateIntegrationScopeRect (bool for_integration=false)
 
virtual void updateIntegrationScopeHorizontalRhomb (bool for_integration=false)
 
virtual void updateIntegrationScopeVerticalRhomb (bool for_integration=false)
 
virtual void updateIntegrationScopeRhomb (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 55 of file massspectraceplotwidget.cpp.

56 : BaseTracePlotWidget(parent)
57{
59 m_context.m_dataKind = Enums::DataKind::mz;
60
61 // qDebug() << "Data kind:" << static_cast<int>(m_context.m_dataKind);
62}
Enums::DataKind m_dataKind
BasePlotContext m_context

References pappso::BaseTracePlotWidget::BaseTracePlotWidget(), pappso::BasePlotWidget::m_context, m_context, and pappso::Enums::mz.

◆ MassSpecTracePlotWidget() [2/2]

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

Definition at line 64 of file massspectraceplotwidget.cpp.

67 : BaseTracePlotWidget(parent, x_axis_label, y_axis_label)
68{
69 // Set the base context to be of kind Enums::DataKind::mz;
70
72 m_context.m_dataKind = Enums::DataKind::mz;
73
74 // qDebug() << "Data kind:" << static_cast<int>(m_context.m_dataKind);
75}

References pappso::BaseTracePlotWidget::BaseTracePlotWidget(), pappso::BasePlotWidget::m_context, m_context, and pappso::Enums::mz.

◆ ~MassSpecTracePlotWidget()

pappso::MassSpecTracePlotWidget::~MassSpecTracePlotWidget ( )
virtual

Definition at line 78 of file massspectraceplotwidget.cpp.

79{
80}

Member Function Documentation

◆ computeResolvingPower()

bool pappso::MassSpecTracePlotWidget::computeResolvingPower ( )

Definition at line 552 of file massspectraceplotwidget.cpp.

553{
554
555 // m_xRangeLower and m_xRangeUpper and m_xDelta (in fabs() form) have been set
556 // during mouve movement handling. Note that the range values *are
557 // sorted*.
558
559 if(!m_context.m_xDelta || m_context.m_xDelta > 1)
560 {
561 m_context.m_lastResolvingPower = std::numeric_limits<double>::min();
562
563 return false;
564 }
565
566 // Resolving power is m/z / Delta(m/z), for singly-charged species.
567
568 // qDebug() << "Calculating the resolving power with these data:"
569 //<< "m_context.m_xRegionRangeStart: " << m_context.m_xRegionRangeStart
570 //<< "m_context.m_xRegionRangeEnd: " << m_context.m_xRegionRangeEnd
571 //<< "m_context.m_xDelta / 2: " << m_context.m_xDelta / 2;
572
573 m_context.m_lastResolvingPower =
574 (std::min<double>(m_context.m_xRegionRangeStart,
575 m_context.m_xRegionRangeEnd) +
576 (m_context.m_xDelta / 2)) /
577 m_context.m_xDelta;
578
579 // The m_context was refreshed with the base class context in the calling
580 // chain.
582
583 return true;
584}
void resolvingPowerComputationSignal(const MassSpecTracePlotContext &context)

References m_context, and resolvingPowerComputationSignal().

Referenced by mouseMoveHandlerDraggingCursor().

◆ deconvolute()

bool pappso::MassSpecTracePlotWidget::deconvolute ( )

Deconvolute the mass peaks into charge and molecular mass.

Definition at line 265 of file massspectraceplotwidget.cpp.

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

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

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

References m_chargeMinimalFractionalPart, m_context, 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 472 of file massspectraceplotwidget.cpp.

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

References m_chargeMinimalFractionalPart, m_context, massDeconvolutionSignal(), and pappso::MPROTON().

Referenced by deconvolute().

◆ getChargeMinimalFractionalPart()

double pappso::MassSpecTracePlotWidget::getChargeMinimalFractionalPart ( ) const

Definition at line 243 of file massspectraceplotwidget.cpp.

244{
246}

References m_chargeMinimalFractionalPart.

◆ getChargeStateEnvelopePeakSpan()

int pappso::MassSpecTracePlotWidget::getChargeStateEnvelopePeakSpan ( ) const

Definition at line 257 of file massspectraceplotwidget.cpp.

258{
260}

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

86{
87 // qDebug() << "ENTER";
89
90 // Before working on the various data belonging to the base context, we need
91 // to get it from the base class and refresh our local context with it.
93
94 // qDebug() << "Going to emit keyPressEventSignal(m_context);";
95
97}
virtual void keyPressEvent(QKeyEvent *event)
KEYBOARD-related EVENTS.
const MassSpecTracePlotContext & refreshBaseContext() const
void keyPressEventSignal(const MassSpecTracePlotContext &context)

References pappso::BasePlotWidget::keyPressEvent(), keyPressEventSignal(), m_context, and refreshBaseContext().

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

103{
104 // Before working on the various data belonging to the base context, we need
105 // to get it from the base class and refresh our local context with it.
107
109}
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 126 of file massspectraceplotwidget.cpp.

127{
128 // Before working on the various data belonging to the base context, we need
129 // to get it from the base class and refresh our local context with it.
131
133}
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 148 of file massspectraceplotwidget.cpp.

149{
151
152 // Before working on the various data belonging to the base context, we need
153 // to get it from the base class and refresh our local context with it.
155
156 if(m_context.m_mouseButtonsAtMousePress & Qt::LeftButton)
157 {
158 if(!m_context.m_isMeasuringDistance)
159 return;
160
161 // qDebug() << "lastMovingMouseButtons:"
162 //<< m_context.m_baseContext.m_lastMovingMouseButtons;
163
164 deconvolute();
166 }
167}
virtual void mouseMoveHandlerDraggingCursor()
bool deconvolute()
Deconvolute the mass peaks into charge and molecular mass.

References computeResolvingPower(), deconvolute(), m_context, pappso::BasePlotWidget::mouseMoveHandlerDraggingCursor(), and refreshBaseContext().

◆ mouseMoveHandlerNotDraggingCursor()

void pappso::MassSpecTracePlotWidget::mouseMoveHandlerNotDraggingCursor ( )
overridevirtual

Reimplemented from pappso::BasePlotWidget.

Definition at line 137 of file massspectraceplotwidget.cpp.

138{
139 // Before working on the various data belonging to the base context, we need
140 // to get it from the base class and refresh our local context with it.
142
144}
virtual void mouseMoveHandlerNotDraggingCursor()

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

◆ mousePressEventSignal

void pappso::MassSpecTracePlotWidget::mousePressEventSignal ( const MassSpecTracePlotContext & context)
signal

Referenced by mousePressHandler().

◆ mousePressHandler()

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

Record the clicks of the mouse.

Reimplemented from pappso::BasePlotWidget.

Definition at line 172 of file massspectraceplotwidget.cpp.

173{
174 // qDebug() << "Entering";
175
176 // Before working on the various data belonging to the base context, we need
177 // to get it from the base class and refresh our local context with it.
179
181
183
184 // qDebug() << "Exiting after having emitted mousePressEventSignal with context:"
185 // << m_context.toString();
186}
virtual void mousePressHandler(QMouseEvent *event)
KEYBOARD-related EVENTS.
void mousePressEventSignal(const MassSpecTracePlotContext &context)

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

◆ mouseReleaseEventSignal

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

Referenced by mouseReleaseHandler().

◆ mouseReleaseHandler()

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

React to the release of the mouse buttons.

Reimplemented from pappso::BasePlotWidget.

Definition at line 191 of file massspectraceplotwidget.cpp.

192{
193 // qDebug() << "Entering";
194
195 // Before working on the various data belonging to the base context, we need
196 // to get it from the base class and refresh our local context with it.
198
200
202
203 // qDebug() << "Exiting after having emitted mouseReleaseEventSignal with context:"
204 // << m_context.toString();
205}
virtual void mouseReleaseHandler(QMouseEvent *event)
void mouseReleaseEventSignal(const MassSpecTracePlotContext &context)

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

◆ refreshBaseContext()

const MassSpecTracePlotContext & pappso::MassSpecTracePlotWidget::refreshBaseContext ( ) const

Definition at line 209 of file massspectraceplotwidget.cpp.

210{
211 // BasePlotWidget has a member m_context of type BasePlotContext.
212 // Here we also have a m_context *distinct* member that is of type
213 // MassSpecTracePlotContext.
214
215 // While MassSpecTracePlotContext is derived from BasePlotContext, the two
216 // m_context members are distinct and there are lots of housekeeping data that
217 // are managed by the parent BasePlotWidget class in its m_context member
218 // *independently* of what we have in the ::BasePlotContext part of our
219 // m_context member that is of type MassSpecTracePlotContext. We thus need to
220 // resynchronize the data from BasePlotWidget::m_context to our m_context.
221
222 // qDebug().noquote() << "The base plot context:" <<
223 // BasePlotWidget::m_context.toString();
224
226
227 // qDebug().noquote() << "After refreshing the base context, base context:"
228 // << m_context.toString();
229
230 return m_context;
231}

References pappso::BasePlotWidget::m_context, and m_context.

Referenced by keyPressEvent(), keyReleaseEvent(), mouseMoveHandler(), mouseMoveHandlerDraggingCursor(), mouseMoveHandlerNotDraggingCursor(), mousePressHandler(), and mouseReleaseHandler().

◆ resolvingPowerComputationSignal

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

Referenced by computeResolvingPower().

◆ setChargeMinimalFractionalPart()

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

Definition at line 235 of file massspectraceplotwidget.cpp.

237{
238 m_chargeMinimalFractionalPart = charge_fractional_part;
239}

References m_chargeMinimalFractionalPart.

◆ setChargeStateEnvelopePeakSpan()

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

Definition at line 250 of file massspectraceplotwidget.cpp.

251{
253}

References m_chargeStateEnvelopePeakSpan.

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: