annotate rDiff/src/variance/estimate_variance_parametric.m @ 1:08d3a6143873

Deleted selected files
author vipints
date Tue, 08 Oct 2013 06:54:25 -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 [VARIANCE1, VARIANCE2]=estimate_variance_parametric(CFG,genes)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 fprintf('Estimating variance function for rDiff.parametric\n')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 VARIANCE1=[];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 VARIANCE2=[];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 %Get the gene expression
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 fprintf('Loading gene expression\n')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 if isempty(CFG.Counts_gene_expression)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 EXPR_TAB_FILENAME=[CFG.out_base 'Gene_expression.tab'];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 else
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 EXPR_TAB_FILENAME=CFG.Counts_gene_expression;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16 try
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 Gene_expression=importdata(EXPR_TAB_FILENAME,'\t',1);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 catch
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 error(['Could not open: ' EXPR_TAB_FILENAME])
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 %C=importdata('../out/release_test/Gene_expression.tab','\t',1);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24 %Get the counts
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
25 fprintf('Loading alternative region counts\n')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
26 if isempty(CFG.Counts_rDiff_parametric)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
27 IN_FILENAME=[CFG.out_base 'Alternative_region_counts.mat'];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
28 load(IN_FILENAME,'Counts_rDiff_parametric')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
29 else
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
30 IN_FILENAME=[CFG.out_base CFG.Counts_rDiff_parametric];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
31 load(IN_FILENAMEc,'Counts_rDiff_parametric')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
32 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
33
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
34 %Iterate over the functions to be generated
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
35 %compute means and variances
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
36
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
37 if CFG.compute_variance_function_1
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
38 fprintf('estimating variance function for sample 1\n')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
39 %Get the samples to use for the for estimation the variance function
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
40 if CFG.merge_sample1
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
41 SAMPLE_IX=find(CFG.SAMPLES);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
42 else
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
43 SAMPLE_IX=find(CFG.SAMPLES==1);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
44 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
45 VARIANCE1=estimate_variance_helper(CFG,SAMPLE_IX,Counts_rDiff_parametric,Gene_expression.data);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
46 if not(isempty(CFG.save_variance_function_1))
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
47 VARIANCE_FUNTION_OUTPATH=[CFG.out_base CFG.save_variance_function_1];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
48 save(VARIANCE_FUNTION_OUTPATH,'VARIANCE1');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
49 else
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
50 %Use previously estimated variance function
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
51 if not(isempty(CFG.variance_function_1))
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
52 try
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
53 VARIANCE_FUNTION_INPATH=[CFG.out_base CFG.variance_function_1];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
54 VARIANCE1=load(VARIANCE_FUNTION_INPATH);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
55 catch
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
56 error(['Could not load variance function for sample 1 from: ' VARIANCE_FUNTION_INPATH])
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
57 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
58 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
59 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
60 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
61
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
62 if CFG.compute_variance_function_2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
63 fprintf('estimating variance function for sample 2\n')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
64 %Get the samples to use for the for estimation the variance function
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
65 if CFG.merge_sample2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
66 SAMPLE_IX=find(CFG.SAMPLES);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
67 else
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
68 SAMPLE_IX=find(CFG.SAMPLES==2);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
69 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
70 VARIANCE2=estimate_variance_helper(CFG,SAMPLE_IX,Counts_rDiff_parametric,Gene_expression.data);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
71 if not(isempty(CFG.save_variance_function_2))
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
72 VARIANCE_FUNTION_OUTPATH=[CFG.out_base CFG.save_variance_function_2];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
73 save(VARIANCE_FUNTION_OUTPATH,'VARIANCE2');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
74 else
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
75 %Use previously estimated variance function
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
76 if not(isempty(CFG.variance_function_2))
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
77 try
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
78 VARIANCE_FUNTION_INPATH=[CFG.out_base CFG.variance_function_2];
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
79 VARIANCE2=load(VARIANCE_FUNTION_INPATH);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
80 catch
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
81 error(['Could not load variance function for sample 2 from: ' VARIANCE_FUNTION_INPATH])
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
82 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
83 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
84 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
85 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
86
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
87
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
88