Products & Services Solutions Academia Support User Community Company

Learn more about Bioinformatics Toolbox   

mzxmlread - Read data from mzXML file

Syntax

mzXMLStruct = mzxmlread(File)

mzXMLStruct = mzxmlread(File, ...'Levels', LevelsValue, ...)
mzXMLStruct = mzxmlread(File, ...'TimeRange', TimeRangeValue, ...)
mzXMLStruct = mzxmlread(File, ...'ScanIndices', ScanIndicesValue, ...)
mzXMLStruct = mzxmlread(File, ...'Verbose', VerboseValue, ...)

Arguments

File

String containing a file name, or a path and file name, of an mzXML file that conforms to the mzXML 2.1 specification or earlier specifications.

If you specify only a file name, that file must be on the MATLAB search path or in the current folder.

LevelsValue

Positive integer or vector of integers specifying the level(s) of spectra in File to read. Default is to read all levels of spectra.

    Tip   For summary information about the levels of spectra in an mzXML file, use the mzxmlinfo function.

    Note   If you specify a LevelsValue, you cannot specify TimeRangeValue or ScanIndicesValue.

TimeRangeValue

Two-element numeric array [Start End] that specifies the range of time in File to read. Start is a scalar between the startTime and endTime attributes of the msRun element in File. End is a scalar between Start and the endTime attribute of the msRun element in File. Default is to read spectra from all times.

    Tip   For summary information about the time ranges in an mzXML file, use the mzxmlinfo function.

    Note   If you specify a TimeRangeValue, you cannot specify LevelsValue or ScanIndicesValue.

ScanIndicesValue

Positive integer, vector of integers, or a two-element numeric array [Start_Ind End_Ind] that specifies a scan, multiple scans, or a range of scans in File to read. Start_Ind and End_Ind are each positive integers indicating a scan number in the num attribute of the msRun element in File. Start_Ind must be less than End_Ind. Default is to read all scans.

    Tip   For summary information about the scan indices in an mzXML file, use the mzxmlinfo function.

    Note   If you specify a ScanIndicesValue, you cannot specify LevelsValue or TimeRangeValue.

VerboseValue

Controls the display of the progress of the reading of File. Choices are true (default) or false.

Return Values

mzXMLStruct

MATLAB structure containing information from an mzXML file. It includes the fields shown in the table below.

Description

mzXMLStruct = mzxmlread(File) reads an mzXML file, File, and then creates a MATLAB structure, mzXMLStruct.

File is a string containing a file name, or a path and file name, of an mzXML file. The file must conform to the mzXML 2.1 specification or earlier specifications. You can view the mzXML 2.1 specification at:

http://sashimi.sourceforge.net/schema_revision/mzXML_2.1/Doc/mzXML_2.1_tutorial.pdf

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

mzXMLStruct = mzxmlread(File, ...'PropertyName', PropertyValue, ...) calls mzxmlread 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:


mzXMLStruct = mzxmlread(File, ...'Levels', LevelsValue, ...)
specifies the level(s) of spectra in File to read. LevelsValue is a positive integer or vector of integers. Default is to read all levels of spectra.

mzXMLStruct = mzxmlread(File, ...'TimeRange', TimeRangeValue, ...) specifies the range of time in File to read. TimeRangeValue is two-element numeric array [Start End]. Start is a scalar between the startTime and endTime attributes of the msRun element in File. End is a scalar between Start and the endTime attribute of the msRun element in File. Default is to read spectra from all times.

mzXMLStruct = mzxmlread(File, ...'ScanIndices', ScanIndicesValue, ...) specifies a scan, multiple scans, or range of scans in File to read. ScanIndicesValue is a positive integer, vector of integers, or a two-element numeric array [Start_Ind End_Ind]. Start_Ind and End_Ind are each positive integers indicating a scan number in the num attribute of the msRun element in File. Start_Ind must be less than End_Ind. Default is to read all scan.

mzXMLStruct = mzxmlread(File, ...'Verbose', VerboseValue, ...) controls the display of the progress of the reading of File. Choices are true (default) or false.

Examples

  1. Read an mzXML file into the MATLAB software as a structure.

    out = mzxmlread('results.mzxml')
    
    out = 
    
        mzXML: [1x1 struct]
        index: [1x1 struct]
         scan: [2000x1 struct]
  2. View the first scan in the mzXML file by creating separate variables containing the mass and charge values respectively, and then plotting these values.

    m = out.scan(1).peaks.mz(1:2:end); 
    z = out.scan(1).peaks.mz(2:2:end); 
    stem(m,z,'marker','none')

See Also

Bioinformatics Toolbox functions: jcampread, mzcdfread, mzxml2peaks, mzxmlinfo, tgspcread

MATLAB function: xmlread

  


Free Computational Biology Interactive Kit

See how to analyze, visualize, and model biological data and systems using MathWorks products.

Get free kit

Trials Available

Try the latest computational biology products.

Get trial software
 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS