annotate deseq-hts_2.0/src/mask_dubl.m @ 10:2fe512c7bfdf draft

DESeq2 version 1.0.19 added to the repo
author vipints <vipin@cbio.mskcc.org>
date Tue, 08 Oct 2013 08:15:34 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
1 function [new_genes]=mask_dubl(genes,THRESH);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
2
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
3 CHROMOSOMES={};
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
4 COUNTER=1;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
5 for i=1:size(genes,2)
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
6 CHROMOSOMES{COUNTER}=genes(i).chr;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
7 COUNTER=COUNTER+1;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
8 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
9 CHROMOSOMES=unique(CHROMOSOMES);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
10
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
11
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
12 INFO=zeros(size(genes,2),4);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
13 for i=1:size(genes,2)
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
14 CHR_VAL=0;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
15 for chr= 1:length(CHROMOSOMES)
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
16 if strcmp(genes(i).chr,CHROMOSOMES(chr))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
17 CHR_VAL=chr;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
18 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
19 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
20 INFO(i,:)=[i,genes(i).start,genes(i).stop, CHR_VAL];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
21 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
22
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
23 COUNTER=1;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
24 new_genes=genes;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
25 for chr= 1:length(CHROMOSOMES)
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
26 GENES_ON_CHR=INFO(INFO(:,4)==chr,:);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
27 [TEMP,POS]=sort(GENES_ON_CHR(:,2));
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
28 GENES_ON_CHR=GENES_ON_CHR(POS,:);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
29 STARTS=GENES_ON_CHR(:,2);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
30 STOPS=GENES_ON_CHR(:,3);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
31 for i=1:(size(GENES_ON_CHR,1))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
32 MIN_START=find(STOPS>=STARTS(i),1,'first');
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
33 MAX_STOP=find(STARTS<=STOPS(i),1,'last');
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
34 if MIN_START==i
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
35 MIN_START=[];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
36 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
37 if MAX_STOP==i
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
38 MAX_STOP=[];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
39 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
40 EXONS=[];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
41 if not (isempty(MIN_START))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
42 for CURR=MIN_START:(i-1)
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
43 if(not(isempty(genes(GENES_ON_CHR(CURR,1)).transcripts)))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
44 for tra=1:size(genes(GENES_ON_CHR(CURR,1)).transcripts,2)
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
45 if(not(isempty(genes(GENES_ON_CHR(CURR,1)).exons)))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
46 EXONS=[EXONS;genes(GENES_ON_CHR(CURR,1)).exons{tra}];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
47 else
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
48 EXONS=[EXONS;genes(GENES_ON_CHR(CURR,1)).start,genes(GENES_ON_CHR(CURR,1)).stop];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
49 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
50 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
51 else
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
52 EXONS=[EXONS;genes(GENES_ON_CHR(CURR,1)).start,genes(GENES_ON_CHR(CURR,1)).stop];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
53 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
54 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
55 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
56 if not (isempty(MAX_STOP))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
57 for CURR=(i+1):MAX_STOP
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
58 if(not(isempty(genes(GENES_ON_CHR(CURR,1)).transcripts)))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
59 for tra=1:size(genes(GENES_ON_CHR(CURR,1)).transcripts,2)
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
60 if(not(isempty(genes(GENES_ON_CHR(CURR,1)).exons)))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
61 EXONS=[EXONS;genes(GENES_ON_CHR(CURR,1)).exons{tra}];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
62 else
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
63 EXONS=[EXONS;genes(GENES_ON_CHR(CURR,1)).start,genes(GENES_ON_CHR(CURR,1)).stop];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
64 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
65 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
66 else
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
67 EXONS=[EXONS;genes(GENES_ON_CHR(CURR,1)).start,genes(GENES_ON_CHR(CURR,1)).stop];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
68 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
69
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
70 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
71 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
72 if not (isempty([MAX_STOP,MIN_START]))
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
73 EXONS=EXONS(EXONS(:,2)>=STARTS(i),:);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
74 EXONS=EXONS(EXONS(:,1)<=STOPS(i),:);
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
75 new_genes(GENES_ON_CHR(i,1)).non_unique_regions=EXONS;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
76 else
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
77 new_genes(GENES_ON_CHR(i,1)).non_unique_regions=[];
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
78 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
79 end
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
80 COUNTER=COUNTER+1;
2fe512c7bfdf DESeq2 version 1.0.19 added to the repo
vipints <vipin@cbio.mskcc.org>
parents:
diff changeset
81 end