annotate rDiff/src/tests/get_nonparametric_masks.m @ 0:0f80a5141704

version 0.3 uploaded
author vipints
date Thu, 14 Feb 2013 23:38:36 -0500
parents
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 [MASKS]=get_nonparametric_masks(CFG,reads1,reads2)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 %What fracitons should be choosen for the cutoff
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4 cen_arr=0.1:0.1:1;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 % Define the mask which should be used in order to mask high
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7 % expresse genes
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 MASKS=zeros(length(cen_arr),size(reads1,2));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 COUNTER=1;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 for censor_frac= cen_arr
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 temp_reads1=reads1;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 temp_reads2=reads2;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 %cut to relvant position
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15 read_coverage=sum(reads1,1)+sum(reads2,1);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16 % get positions with a positive coverage
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 nonzero_position=read_coverage>0;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 %Determine the cutoff values
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 sorted_coverage=sort(read_coverage(nonzero_position));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20 nr_of_nonzero_positions=sum(nonzero_position);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 relevant_positions=read_coverage<=sorted_coverage(ceil(nr_of_nonzero_positions*censor_frac));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 MASKS(COUNTER,relevant_positions)=1;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23 COUNTER=COUNTER+1;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24 end