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