diff deseq-hts_1.0/src/remove_reads_from_other_genes.m @ 0:94a108763d9e draft

deseq-hts version 1.0 wraps the DESeq 1.6.0
author vipints
date Wed, 09 May 2012 20:43:47 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deseq-hts_1.0/src/remove_reads_from_other_genes.m	Wed May 09 20:43:47 2012 -0400
@@ -0,0 +1,21 @@
+function [READS_OUT,FLAG]=remove_reads_from_other_genes(READS,GENE)
+%This funtion removes the reads in READS which could ome from other
+%annotated genes. FLAG is 1 if this was sucsesfull and 0 otherwise
+READS_IN=READS;
+if isfield(GENE,'non_unique_regions')
+  EXONS=GENE.non_unique_regions;
+  IDX=zeros(1,GENE.stop-GENE.start+1);
+  
+  for i=1:size(EXONS,1)
+    START=max(EXONS(i,1),GENE.start)-GENE.start+1;
+    STOP=min(EXONS(i,2),GENE.stop)-GENE.start+1;
+    IDX(START:STOP)=1;
+  end  
+  READS=READS(not(sum(READS(:,IDX>0),2)==sum(READS,2)),:); 
+  FLAG=1;
+  READS_OUT=READS;
+else
+  READS_OUT=READS_IN;
+  FLAG=0;  
+end
+