Main Content

mzxml2peaks

Convert mzXML structure to peak list

Syntax

[Peaklist, Times] = mzxml2peaks(mzXMLStruct)
[Peaklist, Times] = mzxml2peaks(mzXMLStruct, 'Levels', LevelsValue)

Input Arguments

mzXMLStruct

MATLAB® structure containing information from an mzXML file, such as one created by the mzxmlread function. It includes the fields shown in the table below.

LevelsValue

Positive integer or vector of integers that specifies the level(s) of spectra in mzXMLStruct to convert, assuming the spectra are from tandem MS data sets. Default is 1, which converts only the first-level spectra, that is, spectra containing precursor ions. Setting LevelsValue to 2 converts only the second-level spectra, which are the fragment spectra (created from a precursor ion).

Output Arguments

PeaklistEither of the following:
  • Two-column matrix, where the first column contains mass/charge (m/z) values and the second column contains ion intensity values.

  • Cell array of peak lists, where each element is a two-column matrix of m/z values and ion intensity values, and each element corresponds to a spectrum or retention time.

TimesVector 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 Times equals the number of elements in Peaklist.

Description

[Peaklist, Times] = mzxml2peaks(mzXMLStruct) extracts peak information from mzXMLStruct, a MATLAB structure containing information from an mzXML file, such as one created by the mzxmlread function, and creates Peaklist, a cell array of matrices containing mass/charge (m/z) values and ion intensity values, and Times, a vector of retention times associated with a liquid chromatography/mass spectrometry (LC/MS) or gas chromatography/mass spectrometry (GC/MS) data set. mzXMLStruct includes the following fields:

FieldDescription
scanStructure array containing the data pertaining to each individual scan, such as mass spectrometry level, total ion current, polarity, precursor mass (when it applies), and the spectrum data.
indexStructure containing indices to the positions of scan elements in the XML document.
mzXML

Structure containing:

  • Information in the root element of the mzXML schema, such as instrument details, experiment details, and preprocessing method

  • URLs pointing to schemas for the individual scans

  • Indexing approach

  • Digital signature calculated for the current instance of the document

[Peaklist, Times] = mzxml2peaks(mzXMLStruct, 'Levels', LevelsValue) specifies the level(s) of the spectra in mzXMLStruct to convert, assuming the spectra are from tandem MS data sets. Default is 1, which converts only the first-level spectra, that is, spectra containing precursor ions. Setting LevelsValue to 2 converts only the second-level spectra, which are the fragment spectra (created from a precursor ion).

Examples

Note

In the following example, the file results.mzxml is not provided. Sample mzXML files can be found at:

  1. Use the mzxmlread function to read an mzXML file into the MATLAB software as structure. Then extract the peak information of only the first-level ions from the structure.

    mzxml_struct = mzxmlread('results.mzxml');
    [peaks,time] = mzxml2peaks(mzxml_struct);
    
  2. Create a dot plot of the LC/MS data.

    msdotplot(peaks,time)
    

Version History

Introduced in R2007a