| Bioinformatics Toolbox | ![]() |
Resample a mass spectrometry signal
[MZout,Yout] = msresample(MZ, Y, N,
'PropertyName', PropertyValue...)
msresample(..., 'Uniform', UniformValue)
msresample(..., 'Range', RangeValue)
msresample(..., 'Missing', MissingValue)
msresample(..., 'Window', WindowValue)
msresample(..., 'Cutoff', CutoffValue)
msresample(..., 'Show', ShowValue)
MZ | Mass/charge vector with the range of ions in the spectra. |
Y | Ion intensity vector with the same length as the mass/charge vector (MZ). Y can also be a matrix with several spectra that share the same mass/charge (MZ) range. |
| N | Total number of samples. |
[MZout,Yout] = msresample(MZ, Y, N, 'PropertyName', PropertyValue ...) resamples a raw mass spectrum (Y). The output spectrum will have N samples with a spacing that increases linearly within the range [min(MZ) max(MZ)]. MZ can be a linear or a quadratic function of its index. When input arguments are set such that down-sampling takes place, msresample applies a lowpass filter before resampling to minimize aliasing.
For the antialias filter, msresample uses a linear-phase FIR filter with a least-squares error minimization. The cu-off frequency is set by the largest down-sampling ratio when comparing the same regions in the MZ and MZout vectors.
Note msresample is particularly useful when you have spectra with different mass/charge vectors and you want to match the scales. |
msresample(..., 'Uniform', UniformValue), when UniformValue is true, forces the vector MZ to be uniformly spaced. The default value is false.
msresample(..., 'Range', RangeValue) specifies a 1-by-2 vector with the mass/charge range for the output spectrum (Yout). RangeValue must be within [min(MZ) max(MZ)]. The default value is the full range [min(MZ) max(MZ)].
msresample(..., 'Missing', MissingValue), when MissingValue is true, analyzes the mass/charge vector (MZ) for dropped samples. The default value is false. If the down-sample factor is large, checking for dropped samples might not be worth the extra computing time. Dropped samples can only be recovered if the original MZ values follow a linear or a quadratic function of the MZ vector index.
msresample(..., 'Window', WindowValue) specifies the window used when calculating parameters for the lowpass filter. Enter 'Flattop', 'Blackman', 'Hamming', or 'Hanning'. The default value is 'Flattop'.
msresample(..., 'Cutoff', CutoffValue) specifies the cutoff frequency. Enter a scalar value between 0 and 1 ( Nyquist frequency or half the sampling frequency). By default, msresample estimates the cutoff value by inspecting the mass/charge vectors (MZ, MZout). However, the cutoff frequency might be underestimated if MZ has anomalies.
msresample(...,'ShowPlot', ShowPlotValue) plots the original and the resampled spectrum. When msresample is called without output arguments, the spectra are plotted unless ShowPlotValue is false. When ShowPlotValue is true, only the first spectrum in Y is plotted. ShowPlotValue can also contain an index to one of the spectra in Y.
load sample_hi_res; mz = MZ_hi_res; y = Y_hi_res; [mz1,y1] = msresample(mz, y, 10000, 'range',[2000 max(mz)]); plot(mz1,y1,'.')
The Bioinformatic Toolbox functions msalign, msbackadj, msheatmap, mslowess, msnorm, , mssgolay, msviewer
| msheatmap | mssgolay | ![]() |
© 1994-2005 The MathWorks, Inc.