File Exchange

image thumbnail

Multiple Peaks Alignment for Mass Spectrometry

version 1.0.0.0 (27.4 KB) by Andrea Padoan
Function that align peaks from several files and gives a matrix as result.

3 Downloads

Updated 01 Jun 2011

View License

When a large number of samples is analyzed by mass spectrometry instrument, a common issue is the multiple spectra peaks alignment. In fact, the statistical analysis generally requires a data matrix, easily to import from a file to the software. Furthermore, in a multiple mass spectrometry analyses, this kind of matrix must contains sample IDs as rows and identified features as columns.
Mass spectrometry instrumentation and the concerning software gives as result a mass spectra for each sample and therefore a lots of files will be produced. The first analysis step is normally the peak finding. A lot of literature has been produced since the last 10 years about peak finding and also a lot of bioinformatic functions have been provided by Matlab in the bioinformatic tool. But, once that this step has been successful passed, the way to create a unique file that contains the matrix with sample IDs and peaks intensity would not be easy.
The aims of this Matlab function is to find all spectrum file in the current working directory and:
1) performs an alignment of peaks using a user defined sliding windows
2) produces a graphic of the alignment
3) creates an output file that contain the sample IDs and, for each peak, the peak intensities. This file is ready to import in SPSS or other statistical software
4) identifies putative double charged peaks
5) cuts from the output file (it's an user defined option) peaks that is less represented, considering all spectra together.

As input, the function PeaksAlign requires text files with at least 2 columns. The first column is, by default, the m/z (the ion mass) while the intensities column can be user defined. So you can export mass list from your mass spectrometry software and save it as a csv file, for example. In this case the separation character must be set as a semicolon. The separator must be passed to the function as a parameter.

As output, this function gives a csv file that contains the aligned peaks matrix, and a further file that contains the list of double charged peaks.

Passed Parameters:
- FileExtension = for example '*.txt' or '*.csv'. You need to type a star as willcard.
- delimiter = delimiter of input files. For examples '\t' for tab delimited files, ' ' for space delimited files or ';' for csv files.
- dMass = delta Mass to keep as sliding window. It depends on mass spectrometry instrumentation. For example for MALDI-TOF you can use 0.4 to 0.6 (at your risk). Be careful in the selection of this window and please visual checks the result.
- OutputFileName = chose a filename as output. Defaul is example.csv
- Intensity Column = specify the column to be kept as intensity in the input file. Must be > of 1.
- Percentage = trim peaks present in less than as indicated, considering all peaks

Try:
PeaksAlign('*.txt', ';', 0.6)

Cite As

Andrea Padoan (2021). Multiple Peaks Alignment for Mass Spectrometry (https://www.mathworks.com/matlabcentral/fileexchange/31635-multiple-peaks-alignment-for-mass-spectrometry), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

Ben

I got past my initial problem and am faced with a different one:

??? Error using ==> fprintf
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in ==> PeaksAlign at 361
fprintf(fid,'%s;',MatrixToWrite{RowIndex,ColIndex});

Thank you for your help!

Andrea

mohammad

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!