Opened 13 years ago

Closed 13 years ago

#609 closed (fixed)

Spectrum peaks displayed as wide

Reported by: Fredrik Levander Owned by: olle
Milestone: Proteios SE 2.9 Keywords:
Cc:

Description

Refs #592. When zooming into spectra or in spectra with few peaks, it seems like peaks can get very wide. They should always be one pixel wide, if possible.

Change History (14)

comment:1 Changed 13 years ago by Gregory Vincic

Owner: changed from Gregory Vincic to olle

comment:2 Changed 13 years ago by olle

Status: newassigned

Ticket accepted.

comment:3 Changed 13 years ago by olle

Traceability note:

  • Zooming of spectra was introduced in Ticket #592 (zoom in spectra).

comment:4 Changed 13 years ago by olle

Design discussion.

  • Current spectrum display uses ChartFactory method createXYBarChart(...) in third-party library JFreeChart. A data set with mass/intensity values corresponding to the mass spectrum peaks is used as input data, which JFreeChart uses to create a bar diagram including all data points in the set. The default bar width in pixels depends on the peak distribution, and cannot be changed in the used version of JFreeChart. For a spectrum with a single peak, the default peak width is near one mass unit, which will nearly fill the whole diagram.
  • Exchanging ChartFactory method createXYBarChart(...) for method createHistogram(...), allows the peak width to be controlled by the input data set, if each mass peak is represented by several data points, defining a narrow rectangle in the histogram. The rectangle width is defined in mass units. not pixels, but will be set to a small value in mass units, so that in most cases a one-pixel wide rectangle will result. This will solve the problem except for the case of a single mass peak, which will still nearly fill the whole diagram.
  • The single mass peak problem can be solved by adding an extra zero-height dummy peak to set the chart high end limit. Current annotation placement is based on the first mass peak being drawn directly following a fixed offset. In order not to interfere with this, no dummy peak is added to set the chart low end limit.

Class ChartFactory contains many methods that might be used instead of createXYBarChart(...), but createHistogram(...) was chosen as it introduced less side effects. Method createXYStepChart(...) does not display the mass values on the x-axis, while createXYAreaChart(...) uses a brighter diagram color.

comment:5 Changed 13 years ago by olle

(In [3412]) Refs #609. Refs #592. Inspection of mass spectra stored in spectrum files or in the database updated to display mass peaks as narrow vertical lines in most cases:

  1. Class/file action/peakList/PlotFileSpectrum.java in

client/servlet/ updated in protected method void runMe():

  1. Each mass peak is now represented by several data points defining

a narrow rectangle.

  1. If only one mass peak should be displayed, a zero-height dummy

peak is added to set the chart high end limit.

  1. The diagram chart is now created by ChartFactory method

createHistogram(...) in third-party library JFreeChart, instead of by method createXYBarChart(...) in the same class.

  1. Class/file action/peakList/PlotSpectrum.java in

client/servlet/ updated in protected method void runMe():

  1. Each mass peak is now represented by several data points defining

a narrow rectangle.

  1. If only one mass peak should be displayed, a zero-height dummy

peak is added to set the chart high end limit.

  1. The diagram chart is now created by ChartFactory method

createHistogram(...) in third-party library JFreeChart, instead of by method createXYBarChart(...) in the same class.

comment:6 Changed 13 years ago by olle

Note:

In continuous mass spectra, an ion is represented by several data points defining the shape of the mass peak. Displaying all mass data points in a mass spectrum as narrow vertical lines, might give the erroneous impression that each data point represents an ion clearly separated in the mass spectrometer.

comment:7 Changed 13 years ago by olle

severity: 164

Although a simple solution to the problem has been implemented, the severity is set to 4, as the current solution might not cover all cases, and gives an unrealistic view of continuous mass spectra.

comment:8 Changed 13 years ago by olle

Resolution: fixed
Status: assignedclosed

Ticket closed as a simple solution to the problem has been implemented. If the solution should be found to be unsatisfactory, the ticket may be re-opened, or a new ticket created.

comment:9 Changed 13 years ago by Fredrik Levander

Resolution: fixed
Status: closedreopened

The X axis range in a zoomed spectrum is different to the one requested. Asked for 428.6 to 429.3, but the displayed range is from 429.10 to 429.30. Seems to be dependent on where actual peaks are found.

comment:10 Changed 13 years ago by olle

Comment on the mass range issue added 2009-09-22 10:51:08 ("The X axis range in a zoomed spectrum is different to the one requested").

  • Currently the third-party JFreeChart utility used to create the mass spectrum image is responsible for the detailed placement of peaks in the plot. This has been the case since the first implementation of mass spectrum display in Proteios, but is only important for spectra with few peaks, and has therefore been brought into focus after zooming of spectra was introduced.
  • When a mass spectra is zoomed, all mass peaks in the selected mass interval are displayed, even if the shown mass range differs from the one entered. This only means that there are no peaks in the interval not shown.
  • As noted in the design discussion 2009-09-14 15:45:07, current annotation placement is based on the first mass peak being drawn directly following a fixed offset. In order not to interfere with this, when a dummy peak was added to the chart high end limit, to prevent JFreeChart from expanding a single peak to fill the entire diagram, no zero-height dummy peak was added to set the chart low end limit.

Design discussion for solving the mass range issue:

  • In order for the mass value annotation to work, addition of zero-height dummy peaks to the mass spectrum low and high end limits must be made directly to the spectrum mass data, not just to the chart created from original spectrum data.
  • An extra zero-height dummy peak should only be added for the end of the spectrum for which a mass limit has been specified in the zoom box. No dummy peak is added to the spectra if no mass limit values have been entered.
  • In order to prevent JFreeChart from expanding a single peak to fill the entire diagram, when zooming is not used, the previous solution of adding a zero-height dummy peak to set the chart low end limit is retained for this case.
  • However, it is undesirable to have the dummy peaks added to the spectrum mass data being annotated in the displayed spectra. Since mass value annotation is based on intensity value, the zero-height dummy peaks will in many cases not be annotated, but may be so for sparse spectra, where no normal mass peaks lie in the vicinity of the dummy peak. To solve this problem, the peak annotation utility should be updated to never annotate a zero-height peak. This will not interfere with annotation of real mass peaks, since a peak with zero intensity indicates that no ion was detected at the mass value, and will therefore never occur in a real mass spectra.

comment:11 Changed 13 years ago by olle

Traceability note:

  • Mass value annotation in displayed mass spectra was introduced in Ticket #425 (Show mass values for some peaks in mass spectra).

comment:12 Changed 13 years ago by olle

Correction of the design update added 2009-10-01 14:47:06 (changed text in bold):

  • In order for the mass value annotation to work, addition of zero-height dummy peaks to the mass spectrum low and high end limits must be made directly to the spectrum mass data, not just to the chart created from original spectrum data.
  • An extra zero-height dummy peak should only be added for the end of the spectrum for which a mass limit has been specified in the zoom box. No dummy peak is added to the spectra if no mass limit values have been entered.
  • In order to prevent JFreeChart from expanding a single peak to fill the entire diagram, when zooming is not used, the previous solution of adding a zero-height dummy peak to set the chart high end limit is retained for this case.
  • However, it is undesirable to have the dummy peaks added to the spectrum mass data being annotated in the displayed spectra. Since mass value annotation is based on intensity value, the zero-height dummy peaks will in many cases not be annotated, but may be so for sparse spectra, where no normal mass peaks lie in the vicinity of the dummy peak. To solve this problem, the peak annotation utility should be updated to never annotate a zero-height peak. This will not interfere with annotation of real mass peaks, since a peak with zero intensity indicates that no ion was detected at the mass value, and will therefore never occur in a real mass spectra.

comment:13 Changed 13 years ago by olle

(In [3425]) Refs #609. Refs #592. Refs #425. Inspection of mass spectra stored in spectrum files or in the database updated to display a mass range that includes entered mass limits, when zooming is used:

  1. Class/file action/peakList/PlotFileSpectrum.java in

client/servlet/ updated:

  1. Protected method void runMe() updated to only add an extra

zero-height dummy peak to set the spectrum chart high end limit for a single peak, when zooming is not used.

  1. Private method SpectrumInterface zoomSpectrum(SpectrumInterface spectrum,

Float massCutoffLow, Float massCutoffHigh) updated. Mass low end limit equal to zero is now supported. An extra zero-height dummy peak is added at the end of the spectrum for which a mass limit has been specified in the zoom box. No dummy peak is added to the spectra if no mass limit values have been entered.

  1. Class/file action/peakList/PlotSpectrum.java in

client/servlet/ updated:

  1. Protected method void runMe() updated to only add an extra

zero-height dummy peak to set the spectrum chart high end limit for a single peak, when zooming is not used.

  1. Private method SpectrumInterface zoomSpectrum(SpectrumInterface spectrum,

Float massCutoffLow, Float massCutoffHigh) updated. Mass low end limit equal to zero is now supported. An extra zero-height dummy peak is added at the end of the spectrum for which a mass limit has been specified in the zoom box. No dummy peak is added to the spectra if no mass limit values have been entered.

  1. Class/file action/peakList/PeakAnnotationUtil.java in

client/servlet/ updated:

  1. Public method List<Integer> findTopPeaks(double[] x, double[] y,

int searchWindowSize, double dominanceFactor) updated to never annotate a zero-height peak.

comment:14 Changed 13 years ago by olle

Resolution: fixed
Status: reopenedclosed

Ticket closed again as the displayed mass range now includes entered mass limits, when zooming is used.

Note: See TracTickets for help on using tickets.