www.gusucode.com > bioinfo 案例源码程序 matlab代码 > bioinfo/QuantileNormalizationExample.m

    %% Quantile Normalization 
% This example shows how to perform quantile normalization for mass spec
% data.

% Copyright 2015 The MathWorks, Inc.


%%
% Load a MAT-file, included with the Bioinformatics Toolbox(TM) software,
% that contains sample mass spec data, including MZ_lo_res, a vector of m/z
% values, and Y_lo_res, a matrix of intensity values.
load sample_lo_res

%%
% Create a subset (four signals) of the data.
MZ = MZ_lo_res;
Y = Y_lo_res(:,[1 2 5 6]);

%%
% Normalize using the data in the m/z regions where the intensities are
% within the fourth quartile in at least 90% of the spectrograms. Note that
% you can use the normalization parameters in the second output to
% normalize another set of data in the same m/z regions. Plot the four
% spectra.
[Y3,S] = msnorm(MZ,Y,'Quantile',[0.75 1],'Consensus',0.9);
area(MZ,S.Xh.*1000,'LineStyle','None','FaceColor',[.8 .8 .8])
hold on
plot(MZ, Y3)
hold off
axis([-1000 20000 -20 105])
xlabel('Mass-charge Ratio')
ylabel('Relative Ion Intensities')
title('Fourth-quartile Normalized Spectra')

%%
% Use the normalization parameters in the second output of the previous
% step to normalize a different subset of data (four signals) using the
% data in the same m/z regions as the previous data set.  Plot the four
% spectra.
Y4 = msnorm(MZ,Y_lo_res(:,[3 4 7 8]),S);
 
area(MZ,S.Xh.*1000,'LineStyle','None','FaceColor',[.8 .8 .8])
hold on
plot(MZ, Y4)
hold off
axis([-1000 20000 -20 105])
xlabel('Mass-charge Ratio')
ylabel('Relative Ion Intensities')
title('Fourth-quartile Normalized Spectra')