annotate rDiff/src/tools/read_utils/remove_reads_from_other_genes.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 [READS_OUT,FLAG]=remove_reads_from_other_genes(READS,GENE,OFFSET)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2 if nargin==2
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 OFFSET=0;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 %This funtion removes the reads in READS which could ome from other
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 %annotated genes. FLAG is 1 if this was sucsesfull and 0 otherwise
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7 READS_IN=READS;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 if isfield(GENE,'non_unique_regions')
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 EXONS=GENE.non_unique_regions;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 IDX=zeros(1,size(READS,2));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 for i=1:size(EXONS,1)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 START=max(EXONS(i,1),GENE.start-OFFSET)-GENE.start+1+OFFSET;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 STOP=min(EXONS(i,2),GENE.stop+OFFSET)-GENE.start+1+OFFSET;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15 IDX(START:STOP)=1;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 READS=READS(not(sum(READS(:,IDX>0),2)==sum(READS,2)),:);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 FLAG=1;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 READS_OUT=READS;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20 else
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 READS_OUT=READS_IN;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 FLAG=0;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23 end
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24