annotate rDiff/src/variance/plot_variance_fit.m @ 2:233c30f91d66

updated python based GFF parsing module which will handle GTF/GFF/GFF3 file types
author vipints <vipin@cbio.mskcc.org>
date Tue, 08 Oct 2013 07:15:44 -0400
parents 0f80a5141704
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
1 function []=plot_variance_fit(VARIANCE,MEANS,VARS,MAX_X,MAX_Y)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 if nargin<=3
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4 MAX_X=1000;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 MAX_Y=1000;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 %values for which to plot the variance function
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 pp=0.1:1:MAX_X;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 %Define the legend entries
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 LEG={};
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 FIG_HANDLES=[];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 figure;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15 if and(not(isempty(MEANS)),not(isempty(VARS)))
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16 LEG{end+1}='Observation';
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 FIG_HANDLES(end+1)=plot(MEANS,VARS,'.');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 hold on
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20 %plot the predicted variances
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 FIG_HANDLES(end+1)=plot(pp',predict_variance(pp',VARIANCE),'r');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 LEG{end+1}='Variance fit';
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24 plot(pp,pp,'g')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
25
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
26 %Plot sliding window
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
27 RR=zeros(1,MAX_X);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
28 for i=1:MAX_X
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
29 TIDX=and(MEANS>i,MEANS<i*1.1+1);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
30 RR(i)= mean(VARS(TIDX));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
31 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
32 FIG_HANDLES(end+1)=plot(1:MAX_X,RR,'k');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
33 LEG{end+1}='Sliding window';
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
34
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
35 %Plot poisson
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
36 FIG_HANDLES(end+1)=plot(pp,pp,'g');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
37 LEG{end+1}='Poisson variance';
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
38
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
39 legend(FIG_HANDLES,LEG)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
40 xlabel('mean')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
41 ylabel('variance')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
42
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
43 % Change window
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
44 xlim([0,MAX_X])
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
45 ylim([0,MAX_Y])
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
46
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
47 return