Skip to content

Converting an mzML file to a Matlab object

Guillaume Erny edited this page Mar 3, 2017 · 44 revisions

The built-in Matlab function [xmlread] (https://www.mathworks.com/help/matlab/ref/xmlread.html) allows to load XML documents (such as mzML files). However, this function is problematic with large files; the information is not readily accessible in the resulting object. Finnee2016 used three different objects to organise the information. Moreover, MS data are not stored in the object, but in additional binary files, this allows working efficiently with large files as spectra are only loaded when needed.

The Finnee object

The [Finnee class] (https://github.com/glerny/Finnee2016/wiki/Finnee(class)) is the entry object for Finnee2016 and contains all recorded information about a single [X-HRMS] (https://github.com/glerny/Finnee2016/wiki/Definition-of-terms) run. A new Finnee object should be created for each run by entering the following line in the command window

myFinnee = Finnee;

If entered without any option (as it is on top), you will be asked to:

  1. Select the mzML file
  2. Select a folder of destination
  3. Enter a generic name

The creation of the Finnee object can take few minutes (use Ctrl-c if you want to abort). All information are stored in a new folder whose name is the one given in 3, with a ´.fin´extension. This folder contains the Matlab file ‘myFinnee.mat’ and one or more large files with a random name. Those are the binary data files. The variable myFinnee should also be in your workspace with as value ‘1x1Finnee’. In Matlab, you can easily interact with the variables. For example, right-clicking on myFinnee allows you to rename it. If you double left-click on this variable, you should see the five properties associated with this variable.

Properties of Finnee

The Dataset object

Dataset objects contain the collection of traces (trace can be MS spectrum, chromatogram, electropherogram or any 2D data representation) that were recorded during a single experiment. At the creation of the Finnee object only the original dataset exists, however, additional datasets can be created for example after filtering, baseline correction or centroidisation. As with Finnee, double left-click on the dataset allows listing all associated properties with a given dataset.

Properties of Dataset

For more information about the different properties and methods associated with this object you can check the detailed description of [Dataset] (https://github.com/glerny/Finnee2016/wiki/Dataset(class))

The Trace object

The Trace object will contain all information about a two-dimensional data series. This can either be a profile (chromatogram, electropherogram…) or an MS spectra. The properties associated with the Trace object are

Properties of Trace

  • Title
  • Format (‘MS profile’, ‘MS centroid’, or ‘Ion profile’)
  • XLabel, Xunit and PrecInX are information about the X axis
  • YLabel, Yunit and PrecInY are information about the Y axis
  • Path2Dat is the address of the binary file where the data are stored
  • Index is the 3x1 array that allows finding the data in the binary file
  • Precision is the encoding precision

For more information about the different properties and methods associated with this object you can check the detailed description of [Trace] (https://github.com/glerny/Finnee2016/wiki/Trace(class))

Option to Finnee

Different options can be used when creating a Finnee object; those can be input either using [Options4Finnee] (https://github.com/glerny/Finnee2016/wiki/Trace(class)) or using the Finnee function. Available options are:

  • 'tLim', should be followed by a 2x1 array allow; set the time interval of interest
  • 'mzMlim', should be followed by a 2x1 array; set the m/z interval of interest
  • 'rounding', To be explained
  • 'spikes', followed by an integer n (n = 0, 1, 2 or 3). Remove spikes from each MS scans where a spike is an "MS peak" that contain n or less non-zeros points. By default peaks with 2 or fewer points will be removed from each scan. ('spikes', 0) is used to don't remove spikes.
  • 'fileIn', followed by the full path to the mzML file
  • 'folderOut', path to the output folder
  • 'fileID', name of the folder (without the .fin extension)
  • 'overwrite', delete 'folderout'/'fileID'.fin if it exists

example

myFinnee = finnee('tLim', [2 10], 'fileID', 'myExperiment', 'overwrite') myFinnee = finnee('spikes', 1, 'overwrite')

Loading and saving

Finnee objects are saved automatically at creation or when a new dataset is added. However, it is possible to add or delete traces, delete datasets or edit some properties. To save your modification, use

myFinnee.save

To load a Finnee object you can either use

load('(the full path)\myFinnee.mat')

or you can load the .fin folder using browse for folder, and double click on myFinnee.mat

loading Finnee


Up            : Where to start?
Next         : [Profile and spectrum] (https://github.com/glerny/Finnee2016/wiki/Profile-and-spectrum)
Previous  : mzML files


Related to:

Clone this wiki locally