msheatmap

Create pseudocolor image of set of mass spectra

Syntax

msheatmap(MZ, Intensities)
msheatmap(MZ, Times, Intensities)

msheatmap(..., 'Midpoint', MidpointValue, ...)
msheatmap(..., 'Range', RangeValue, ...)
msheatmap(..., 'Markers', MarkersValue, ...)
msheatmap(..., 'SpecIdx', SpecIdxValue, ...)
msheatmap(..., 'Group', GroupValue, ...)
msheatmap(..., 'Resolution', ResolutionValue, ...)

Arguments

MZColumn vector of common mass/charge (m/z) values for a set of spectra. The number of elements in the vector equals the number of rows in the matrix Intensities.

    Note:   You can use the msppresample function to create the MZ vector.

TimesColumn vector of retention times associated with a liquid chromatography/mass spectrometry (LC/MS) or gas chromatography/mass spectrometry (GC/MS) data set. The number of elements in the vector equals the number of columns in the matrix Intensities. The retention times are used to label the y-axis of the heat map.

    Tip   You can use the mzxml2peaks function to create the Times vector.

IntensitiesMatrix of intensity values for a set of mass spectra that share the same m/z range. Each row corresponds to an m/z value, and each column corresponds to a spectrum or retention time. The number of rows equals the number of elements in vector MZ. The number of columns equals the number of elements in vector Times.

    Note:   You can use the msppresample function to create the Intensities matrix.

MidpointValueValue specifying a quantile of the ion intensity values to fall below the midpoint of the colormap, meaning they do not represent peaks. msheatmap uses a custom colormap where cool colors represent nonpeak regions, white represents the midpoint, and warm colors represent peaks. Choices are any value ≥ 0 and ≤ 1. Default is:
  • 0.99 — For LC/MS or GC/MS data or when input T is provided. This means that 1% of the pixels are warm colors and represent peaks.

  • 0.95 — For non-LC/MS or non-GC/MS data or when input T is not provided. This means that 5% of the pixels are warm colors and represent peaks.

    Tip   You can also change the midpoint interactively after creating the heat map by right-clicking the color bar, selecting Interactive Colormap Shift, and then click-dragging the cursor vertically on the color bar. This technique is useful when comparing multiple heat maps.

RangeValue1-by-2 vector specifying the m/z range for the x-axis of the heat map. RangeValue must be within [min(MZ) max(MZ)]. Default is the full range [min(MZ) max(MZ)].
MarkersValueVector of m/z values to mark on the top horizontal axis of the heat map. Default is [].
SpecIdxValue

Either of the following:

  • Vector of values with the same number of elements as columns (spectra) in the matrix Intensities.

  • Cell array of strings with the same number of elements as columns (spectra) in the matrix Intensities.

Each value or string specifies a label for the corresponding spectrum. These values or strings are used to label the y-axis of the heat map.

    Note:   If input Times is provided, it is assumed that Intensities contains LC/MS or GC/MS data, and SpecIdxValue is ignored.

GroupValueEither of the following:
  • Vector of values with the same number of elements as rows in the matrix Intensities

  • Cell array of strings with the same number of elements as rows (spectra) in the matrix Intensities

Each value or string specifies a group to which the corresponding spectrum belongs. The spectra are sorted and combined into groups along the y-axis in the heat map.

    Note:   If input Times is provided, it is assumed that Intensities contains LC/MS or GC/MS data, and GroupValue is ignored.

ResolutionValueValue specifying the horizontal resolution of the heat map image. Increase this value to enhance details. Decrease this value to reduce memory usage. Default is:
  • 0.5 — When MZ contains > 2,500 elements.

  • 0.05 — When MZ contains <= 2,500 elements.

Description

msheatmap(MZ, Intensities) displays a pseudocolor heat map image of the intensities for the spectra in matrix Intensities.

msheatmap(MZ, Times, Intensities) displays a pseudocolor heat map image of the intensities for the spectra in matrix Intensities, using the retention times in vector Times to label the y-axis.

msheatmap(..., 'PropertyName', PropertyValue, ...) calls msheatmap with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Each PropertyName must be enclosed in single quotation marks and is case insensitive. These property name/property value pairs are as follows:


msheatmap(..., 'Midpoint', MidpointValue, ...)
specifies a quantile of the ion intensity values to fall below the midpoint of the colormap, meaning they do not represent peaks. msheatmap uses a custom colormap where cool colors represent nonpeak regions, white represents the midpoint, and warm colors represent peaks. Choices are any value between 0 and 1. Default is:

  • 0.99 — For LC/MS or GC/MS data or when input T is provided. This means that 1% of the pixels are warm colors and represent peaks.

  • 0.95 — For non-LC/MS or non-GC/MS data or when input T is not provided. This means that 5% of the pixels are warm colors and represent peaks.

    Tip   You can also change the midpoint interactively after creating the heat map by right-clicking the color bar, selecting Interactive Colormap Shift, then click-dragging the cursor vertically on the color bar. This technique is useful when comparing multiple heat maps.

msheatmap(..., 'Range', RangeValue, ...) specifies the m/z range for the x-axis of the heat map. RangeValue is a 1-by-2 vector that must be within [min(MZ) max(MZ)]. Default is the full range [min(MZ) max(MZ)].

msheatmap(..., 'Markers', MarkersValue, ...) places markers along the top horizontal axis of the heat map for the m/z values specified in the vector MarkersValue. Default is [].

msheatmap(..., 'SpecIdx', SpecIdxValue, ...) labels the spectra along the y-axis in the heat map. The labels are specified by SpecIdxValue, a vector of values or cell array of strings. The number of values or strings is the same as the number of columns (spectra) in the matrix Intensities. Each value or string specifies a label for the corresponding spectrum.

msheatmap(..., 'Group', GroupValue, ...) sorts and combines spectra into groups along the y-axis in the heat map. The groups are specified by GroupValue, a vector of values or cell array of strings. The number of values or strings is the same as the number of rows in the matrix Intensities. Each value or string specifies a group to which the corresponding spectrum belongs. Default is [1:numSpectra].

msheatmap(..., 'Resolution', ResolutionValue, ...) specifies the horizontal resolution of the heat map image. Increase this value to enhance details. Decrease this value to reduce memory usage. Default is:

  • 0.5 — When MZ contains > 2,500 elements.

  • 0.05 — When MZ contains <= 2,500 elements.

Examples

SELDI-TOF Data

  1. Load SELDI-TOF sample data.

    load sample_lo_res
  2. Create a vector of four m/z values to mark along the top horizontal axis of the heat map.

    M = [3991.4 4598 7964 9160];
  3. Display the heat map with m/z markers and a limited m/z range.

    msheatmap(MZ_lo_res,Y_lo_res,'markers',M,'range',[3000 10000])

  4. Display the heat map again grouping each spectrum into one of two groups.

    TwoGroups = [1 1 2 2 1 1 2 2];
    msheatmap(MZ_lo_res,Y_lo_res,'markers',M,'group',TwoGroups)

Liquid Chromatography/Mass Spectrometry (LC/MS) Data

  1. Load LC/MS sample data.

    load lcmsdata
  2. Resample the peak lists to create a vector of m/z values and a matrix of intensity values.

    [MZ, Intensities] = msppresample(ms_peaks, 5000);
  3. Display the heat map showing mass spectra at different retention times.

    msheatmap(MZ, ret_time, log(Intensities))

Was this topic helpful?