annotate html_siRNA.pl @ 0:87fe81de0931 draft default tip

Uploaded
author bigrna
date Sun, 04 Jan 2015 02:47:25 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
1 #!/usr/bin/perl -w
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
2 #Filename:
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
3 #Author: Tian Dongmei
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
4 #Email: tiandm@big.ac.cn
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
5 #Date: 2014-5-29
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
6 #Modified:
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
7 #Description:
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
8 my $version=1.00;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
9
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
10 use strict;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
11 use Getopt::Long;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
12 use File::Basename;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
13
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
14 my %opts;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
15 GetOptions(\%opts,"i=s","format=s","o=s","h");
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
16 if (!(defined $opts{o} and defined $opts{format} and defined $opts{i} ) || defined $opts{h}) { #necessary arguments
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
17 &usage;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
18 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
19 my ($config,$prepath,$rfampath,$genomepath,$clusterpath,$annotatepath,$plotpath,$degpath);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
20 my ($predir,$rfamdir,$genomedir,$clusterdir,$annotatedir,$plotdir,$degdir);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
21 open IN,"<$opts{i}";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
22 $config=<IN>; chomp $config;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
23 $prepath=<IN>; chomp $prepath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
24 $rfampath=<IN>;chomp $rfampath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
25 $genomepath=<IN>; chomp $genomepath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
26 $clusterpath=<IN>; chomp $clusterpath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
27 $annotatepath=<IN>; chomp $annotatepath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
28 $plotpath=<IN>; chomp $plotpath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
29 my $deg_tag=1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
30 if(eof){$deg_tag=0;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
31 else{
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
32 $degpath=<IN>; chomp $degpath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
33 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
34 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
35 my @tmp=split/\//,$prepath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
36 $predir=$tmp[-1];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
37 @tmp=split/\//,$rfampath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
38 $rfamdir=$tmp[-1];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
39 @tmp=split/\//,$genomepath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
40 $genomedir=$tmp[-1];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
41 @tmp=split/\//,$clusterpath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
42 $clusterdir=$tmp[-1];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
43 @tmp=split/\//,$annotatepath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
44 $annotatedir=$tmp[-1];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
45 @tmp=split/\//,$plotpath;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
46 $plotdir=$tmp[-1];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
47
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
48 my $dir=dirname($opts{'o'});
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
49
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
50 open OUT ,">$opts{'o'}";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
51 print OUT "<HTML>\n <HEAD>\n <TITLE> Analysis Report </TITLE>\n </HEAD>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
52 <BODY bgcolor=\"lightgray\">\n <h1 align=\"center\">\n <font face=\"ºÚÌå\">\n <b>Small RNA Analysis Report</b>\n </font>\n </h1>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
53 <h2>1. Sequence No. and quality</h2>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
54 <h3>1.1 Sequece No.</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
55 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
56
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
57 ### raw data no
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
58 open IN,"<$config";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
59 my @files;my @marks; my @rawNo;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
60 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
61 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
62 my @tmp=split/\t/,$aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
63 push @files,$tmp[0];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
64
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
65 my $no=`less $tmp[0] |wc -l `;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
66 chomp $no;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
67 if ($opts{'format'} eq "fq" || $opts{'format'} eq "fastq") {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
68 $no=$no/4;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
69 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
70 else{
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
71 $no=$no/2;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
72 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
73 push @rawNo,$no;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
74
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
75 push @marks,$tmp[1];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
76 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
77 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
78
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
79 ### preprocess
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
80 unless ($prepath=~/\/$/) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
81 $prepath .="/";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
82 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
83
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
84 my @trimNo;my @collapse;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
85 my $collapsefile=$prepath."collapse_reads.fa";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
86 open IN,"<$collapsefile";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
87 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
88 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
89 <IN>;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
90 $aline=~/:([\d|_]+)_x(\d+)$/;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
91 my @lng=split/_/,$1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
92 for (my $i=0;$i<@lng;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
93 if ($lng[$i]>0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
94 $trimNo[$i] +=$lng[$i];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
95 $collapse[$i] ++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
96 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
97 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
98 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
99 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
100
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
101 my @cleanR;my @cleanT;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
102 my $clean=$prepath."collapse_reads_18-40.fa";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
103 open IN,"<$clean";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
104 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
105 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
106 <IN>;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
107 $aline=~/:([\d|_]+)_x(\d+)$/;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
108 my @lng=split/_/,$1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
109 for (my $i=0;$i<@lng;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
110 if ($lng[$i]>0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
111 $cleanR[$i] +=$lng[$i];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
112 $cleanT[$i] ++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
113 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
114 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
115 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
116 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
117
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
118 my @filterR;my @filterT;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
119 my $filter=$prepath."collapse_reads_out.fa";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
120 open IN,"<$filter";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
121 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
122 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
123 <IN>;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
124 $aline=~/:([\d|_]+)_x(\d+)$/;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
125 my @lng=split/_/,$1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
126 for (my $i=0;$i<@lng;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
127 if ($lng[$i]>0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
128 $filterR[$i] +=$lng[$i];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
129 $filterT[$i] ++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
130 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
131 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
132 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
133 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
134
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
135
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
136 print OUT "<table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
137 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
138 <th>&nbsp;</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
139 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
140 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
141 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
142 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
143 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
144 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
145 <th align=\"left\">Raw Reads No. </th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
146 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
147 foreach (@rawNo) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
148 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
149 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
150 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
151 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
152 <th align=\"left\">Reads No. After Trimed 3\' adapter </th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
153 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
154 foreach (@trimNo) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
155 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
156 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
157 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
158 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
159 <th align=\"left\">Unique Tags No. </th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
160 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
161 foreach (@collapse) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
162 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
163 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
164 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
165 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
166 <th align=\"left\">Clean Reads No. </th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
167 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
168 foreach (@cleanR) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
169 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
170 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
171 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
172 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
173 <th align=\"left\">Clean Tags No. </th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
174 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
175 foreach (@cleanT) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
176 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
177 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
178 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
179 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
180 <th align=\"left\">Filter Reads No. \(reads count \>3\) </th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
181 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
182 foreach (@filterR) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
183 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
184 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
185 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
186 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
187 <th align=\"left\">Filter Tags No. \(reads count \>3\) </th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
188 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
189 foreach (@filterT) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
190 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
191 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
192 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
193 print OUT "<p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
194 Note:<br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
195 The raw data file path is: <b>$files[0]</b><br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
196 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
197 for (my $i=1;$i<@files;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
198 print OUT "&nbsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<b>$files[$i]</b><br />";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
199 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
200 print OUT "The collapsed file path is: <b>$collapsefile</b><br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
201 The clean data file path is: <b>$clean</b><br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
202 The filter (remain total reads>3) data file path is: <b>$filter</b><br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
203 </p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
204 <h2> 1. Sequence length count</h2>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
205 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
206 print OUT "\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
207
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
208 my $length=$prepath."length.html";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
209 open IN,"<$length";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
210 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
211 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
212 print OUT "$aline\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
213 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
214 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
215
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
216 print OUT "<p> Note:<br />The sequence length data: <a href=\"./$predir/reads_length_distribution_after_count_filter.txt\"> length file</a>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
217 </p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
218 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
219
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
220 #### rfam
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
221 unless ($rfampath=~/\/$/) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
222 $rfampath .="/";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
223 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
224 unless ($genomepath=~/\/$/) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
225 $genomepath .="/";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
226 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
227 print OUT "<h2>2. Rfam non-miRNA annotation</h2>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
228 <h3>2.1 Reads count</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
229 <table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
230 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
231 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
232
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
233 my @rfamR; my @rfamT;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
234 my $tag=1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
235 open IN,"<$dir/rfam_match/rfam_non-miRNA_annotation.txt";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
236 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
237 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
238 $tag=0 if($aline=~/tags\s+number/);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
239 next if($aline=~/^\#/);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
240 next if($aline=~/^\s*$/);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
241 my @tmp=split/\s+/,$aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
242 if($tag == 1){push @rfamR,[@tmp];}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
243 else{push @rfamT,[@tmp];}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
244 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
245 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
246
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
247
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
248 print OUT "<th>RNA Name</th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
249 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
250 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
251 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
252 for (my $i=0;$i<@rfamR;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
253 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
254 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
255 <th align=\"left\">$rfamR[$i][0]</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
256 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
257 for (my $j=1;$j<@{$rfamR[$i]} ;$j++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
258 print OUT "<td> $rfamR[$i][$j]</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
259 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
260 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
261
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
262 print OUT "</tr>\n</table>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
263 <h3>2.2 Tags count</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
264 <table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
265 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
266 <th>RNA Name</th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
267 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
268 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
269 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
270 for (my $i=0;$i<@rfamT;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
271 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
272 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
273 <th align=\"left\">$rfamT[$i][0]</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
274 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
275 for (my $j=1;$j<@{$rfamT[$i]} ;$j++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
276 print OUT "<td> $rfamT[$i][$j]</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
277 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
278 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
279 print OUT "</tr>\n</table>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
280 <p>Note:<br />The rfam mapping results is: <b>$rfampath</b>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
281 print OUT "<b>rfam_mapped.bwt</b></p>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
282
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
283 open IN,"<$dir/genome_match/genome_mapped.bwt";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
284 my @genome_r_u;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
285 my @genome_r_m;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
286 my @genome_t_u;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
287 my @genome_t_m;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
288 my $tags_map_number=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
289 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
290 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
291 my @temp=split/\t/,$aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
292 if ($temp[6]==0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
293 $aline=~/:([\d|_]+)_x(\d+)/;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
294 my @lng=split/_/,$1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
295 for (my $i=0;$i<@lng;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
296 if ($lng[$i]>0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
297 $genome_r_u[$i] +=$lng[$i];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
298 $genome_t_u[$i] ++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
299 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
300 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
301 $tags_map_number++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
302 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
303 if ($temp[6]>0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
304 $aline=~/:([\d|_]+)_x(\d+)/;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
305 my @lng=split/_/,$1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
306 for (my $i=0;$i<@lng;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
307 if ($lng[$i]>0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
308 $genome_r_m[$i] +=$lng[$i];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
309 $genome_t_m[$i] ++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
310 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
311 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
312 for (my $i=0;$i<$temp[6] ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
313 my $next=<IN>;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
314 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
315 $tags_map_number++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
316 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
317 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
318 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
319 #<h3>3.1 Reads count</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
320 #<table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
321 #<tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
322 print OUT "<h2>3. genome mapping result</h2>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
323 <table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
324 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
325 <th align=\"left\">Map</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
326 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
327 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
328 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
329 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
330 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
331 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
332 <th align=\"left\">Uniq Map Reads No.</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
333 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
334 for (my $i=0;$i<@genome_r_u ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
335 print OUT "<td> $genome_r_u[$i]</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
336 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
337
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
338 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
339 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
340 <th align=\"left\">Uniq Map Tags No.</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
341 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
342 for (my $i=0;$i<@genome_t_u ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
343 print OUT "<td> $genome_t_u[$i]</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
344 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
345
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
346 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
347 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
348 <th align=\"left\">Multiple Map Reads No.</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
349 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
350 for (my $i=0;$i<@genome_r_m ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
351 print OUT "<td> $genome_r_m[$i]</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
352 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
353
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
354 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
355 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
356 <th align=\"left\">Multiple Map Tags No.</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
357 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
358 for (my $i=0;$i<@genome_t_m ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
359 print OUT "<td> $genome_t_m[$i]</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
360 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
361
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
362 print OUT "</tr>\n</table>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
363 <p>Note:<br />The genome mapping results is: <b>$genomepath</b>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
364 print OUT "<b>genome_mapped.bwt</b></p>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
365
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
366 my $cluster="$clusterpath/sample_reads.cluster";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
367 my $cluster_number=`less $cluster |wc -l `;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
368 $cluster_number=$cluster_number-1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
369 my (%cluster_length,@exp,@rpkm);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
370 my @exp_range=qw(0 \(0--10] \(10--100] \(100--1000] \(1000--10000] \(10000--100000] \(100000--**\));
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
371 my @rpkm_range=qw(0 \(0--0.25] \(0.25--0.5] \(0.5--1] \(1.0-5.0] \(5--10] \(10--50] \(50--100] \(100--500] \(500--1000] \(1000--**]);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
372
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
373 open IN,"<$cluster";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
374 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
375 next if($aline=~/^\"/);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
376 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
377 my @temp=split/\t/,$aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
378 my @id=split/:|-/,$temp[0];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
379 $cluster_length{$id[2]-$id[1]+1}++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
380 for (my $i=0;$i<@marks ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
381 if ($temp[$i+3] == 0) {$exp[0][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
382 elsif ($temp[$i+3]>0 && $temp[$i+3]<= 10 ){$exp[1][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
383 elsif ($temp[$i+3]>10 && $temp[$i+3]<=100){$exp[2][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
384 elsif ($temp[$i+3]>100 && $temp[$i+3]<=1000){$exp[3][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
385 elsif ($temp[$i+3]>1000 && $temp[$i+3]<=10000){$exp[4][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
386 elsif ($temp[$i+3]>10000 && $temp[$i+3]<=100000){$exp[5][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
387 elsif ($temp[$i+3]>100000){$exp[6][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
388 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
389 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
390 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
391
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
392 my $cluster_rpkm="$clusterpath/sample_rpkm.cluster";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
393 open IN,"<$cluster_rpkm";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
394 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
395 next if($aline=~/^\#/);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
396 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
397 my @temp=split/\t/,$aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
398 for (my $i=0;$i<@marks ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
399 if ($temp[$i+3]==0) {$rpkm[0][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
400 elsif($temp[$i+3]>0 && $temp[$i+3]<=0.25){$rpkm[1][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
401 elsif($temp[$i+3]>0.25 && $temp[$i+3]<=0.5){$rpkm[2][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
402 elsif($temp[$i+3]>0.5 && $temp[$i+3]<=1){$rpkm[3][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
403 elsif($temp[$i+3]>1 && $temp[$i+3]<=5){$rpkm[4][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
404 elsif($temp[$i+3]>5 && $temp[$i+3]<=10){$rpkm[5][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
405 elsif($temp[$i+3]>10 && $temp[$i+3]<=50){$rpkm[6][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
406 elsif($temp[$i+3]>50 && $temp[$i+3]<=100){$rpkm[7][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
407 elsif($temp[$i+3]>100 && $temp[$i+3]<=500){$rpkm[8][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
408 elsif($temp[$i+3]>500 && $temp[$i+3]<=1000){$rpkm[9][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
409 else{$rpkm[10][$i]++;}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
410 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
411 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
412
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
413 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
414
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
415 my $cluster_length_file="$clusterpath/cluster_length.txt";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
416 open LEN,">$cluster_length_file";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
417 print LEN "\#length\tcluster_number\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
418 foreach my $key (sort keys %cluster_length) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
419 print LEN "$key\t$cluster_length{$key}\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
420 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
421 close LEN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
422 print OUT "<h2>4. cluster result</h2>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
423 <h3>4.1 Cluster count</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
424 <table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
425 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
426 <th align=\"left\"> </th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
427 <td>Merged samples</td></tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
428 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
429 <th align=\"left\">Tags number</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
430 <td>$tags_map_number</td></tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
431 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
432 <th align=\"left\">Cluster number</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
433 <td>$cluster_number</td></tr>\n</table>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
434 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
435
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
436 print OUT "<h3>4.2 Cluster length</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
437 <p> Note:<br />The clusters length data: <a href=\"./$clusterdir/cluster_length.txt\"> length file</a>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
438 </p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
439 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
440 print OUT "<h3>4.3 Quantify</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
441 <table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
442 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
443 <th align=\"left\">Reads Range</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
444 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
445 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
446 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
447 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
448 for (my $i=0;$i<@exp_range;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
449 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
450 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
451 <th align=\"left\">$exp_range[$i]</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
452 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
453 for (my $j=0;$j<@marks ;$j++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
454 if (!(defined($exp[$i][$j]))) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
455 print OUT "<td> 0</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
456 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
457 else{print OUT "<td> $exp[$i][$j]</td>\n";}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
458 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
459 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
460 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
461
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
462 print OUT "\n<table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
463 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
464 <th align=\"left\">RPKM Range</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
465 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
466 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
467 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
468 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
469 for (my $i=0;$i<@rpkm_range;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
470 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
471 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
472 <th align=\"left\">$rpkm_range[$i]</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
473 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
474 for (my $j=0;$j<@marks ;$j++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
475 if (!(defined($rpkm[$i][$j]))) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
476 print OUT "<td> 0</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
477 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
478 else{print OUT "<td> $rpkm[$i][$j]</td>\n";}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
479 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
480 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
481 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
482
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
483 my $annotate="$annotatepath/sample_c_p.anno";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
484 my (%posit,%repeat,%nat1,%nat2);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
485 my (@phase,@long,@repeat,@nat);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
486 for (my $j=0;$j<@marks ;$j++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
487 $phase[$j]=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
488 $long[$j]=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
489 $repeat[$j]=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
490 $nat[$j]=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
491 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
492
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
493 my $class_anno=1;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
494 open ANNO,"<$annotate";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
495 while (my $aline=<ANNO>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
496 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
497 my @temp=split/\t/,$aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
498 if($aline=~/^\#/){
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
499 if (@temp != 10+@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
500 $class_anno=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
501 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
502 next;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
503 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
504 for (my $i=3+@marks+$class_anno;$i<@temp;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
505 my @posit=split/\;/,$temp[$i];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
506 for (my $j=0;$j<@marks ;$j++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
507 if ($temp[3+$j]>0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
508 $posit{$posit[0]}[$j]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
509 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
510 else{
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
511 if (!(defined($posit{$posit[0]}[$j]))) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
512 $posit{$posit[0]}[$j]=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
513 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
514 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
515 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
516 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
517 if ($class_anno) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
518 for (my $j=0;$j<@marks ;$j++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
519 if ($temp[3+$j]>0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
520 if ($temp[6] eq "phase") {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
521 $phase[$j]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
522 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
523 if ($temp[7] eq "long") {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
524 $long[$j]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
525 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
526 if ($temp[8] ne "\/") {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
527 $repeat[$j]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
528 my @rr=split/\;/,$temp[8];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
529 foreach (@rr) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
530 $repeat{$_}[$j]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
531 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
532 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
533 if ($temp[9] ne "\/") {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
534 $nat[$j]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
535 my @nn1=split/\;/,$temp[9];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
536 my @nn2=split/\;/,$temp[10];
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
537 for (my $k=0;$k<@nn1 ;$k++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
538 $nat1{$nn1[$k]}[$j]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
539 $nat2{$nn2[$k]}[$j]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
540 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
541 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
542 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
543 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
544 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
545 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
546 close ANNO;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
547
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
548 print OUT "<h2>5. Cluster Annotate</h2>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
549 <h3>5.1 Cluster genome position annotate</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
550 <table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
551 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
552 <th align=\"left\">clusters number</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
553 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
554
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
555 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
556 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
557 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
558 foreach my $key (sort keys %posit) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
559 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
560 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
561 <th align=\"left\">$key</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
562 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
563 foreach (@{$posit{$key}}) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
564 print OUT "<td> $_</td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
565 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
566 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
567 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
568 print OUT "<p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
569 Note:<br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
570 One cluster mybe annotate to multiple genes<br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
571 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
572
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
573 if ($class_anno) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
574 print OUT "<h3>5.2 Cluster source mechanism annotate</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
575 <table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
576 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
577 <th align=\"left\">clusters number</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
578 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
579
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
580 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
581 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
582 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
583 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
584 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
585 <th align=\"left\">Phase</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
586 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
587 foreach (@phase) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
588 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
589 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
590
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
591 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
592 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
593 <th align=\"left\">Long</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
594 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
595 foreach (@long) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
596 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
597 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
598
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
599 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
600 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
601 <th align=\"left\">Repeat</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
602 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
603 foreach (@repeat) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
604 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
605 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
606
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
607 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
608 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
609 <th align=\"left\">Nat</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
610 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
611 foreach (@nat) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
612 print OUT "<td> $_ </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
613 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
614 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
615
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
616 print OUT "<p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
617 Repeat subclass annotate:
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
618 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
619
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
620 print OUT "<table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
621 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
622 <th align=\"left\">Repeat subclass</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
623 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
624 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
625 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
626 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
627
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
628 foreach my $key (sort keys %repeat) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
629 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
630 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
631 <th align=\"left\">$key</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
632 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
633 for (my $i=0;$i<@marks ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
634 if (defined($repeat{$key}[$i])) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
635 print OUT "<td> $repeat{$key}[$i] </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
636 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
637 else{print OUT "<td> 0 </td>\n";}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
638 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
639 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
640 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
641
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
642
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
643 print OUT "<p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
644 Nat subclass1 annotate:
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
645 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
646
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
647 print OUT "<table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
648 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
649 <th align=\"left\">Nat subclass1</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
650 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
651 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
652 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
653 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
654 foreach my $key (sort keys %nat1) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
655 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
656 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
657 <th align=\"left\">$key</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
658 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
659 for (my $i=0;$i<@marks ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
660 if (defined($nat1{$key}[$i])) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
661 print OUT "<td> $nat1{$key}[$i] </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
662 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
663 else{print OUT "<td> 0 </td>\n";}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
664 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
665 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
666 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
667
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
668 print OUT "<p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
669 Nat subclass2 annotate:
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
670 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
671
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
672 print OUT "<table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
673 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
674 <th align=\"left\">Nat subclass2</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
675 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
676 foreach (@marks) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
677 print OUT "<th> $_ </th>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
678 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
679 foreach my $key (sort keys %nat2) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
680 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
681 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
682 <th align=\"left\">$key</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
683 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
684 for (my $i=0;$i<@marks ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
685 if (defined($nat2{$key}[$i])) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
686 print OUT "<td> $nat2{$key}[$i] </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
687 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
688 else{print OUT "<td> 0 </td>\n";}
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
689 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
690 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
691 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
692 print OUT "<p>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
693 Note:<br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
694 One cluster mybe annotate to multiple repeats or nats<br />
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
695 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
696 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
697 else {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
698 print OUT "<h3>5.2 Cluster source mechanism annotate</h3>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
699 <br />Do not do source mechanism annotate <br />";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
700
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
701 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
702
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
703 print OUT "<h2>6. Graph of Clusters of all samples</h2> \n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
704
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
705 my $plot=$plotpath."cluster.html";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
706 open IN,"<$plot";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
707 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
708 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
709 print OUT "$aline\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
710 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
711 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
712
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
713
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
714 if ($deg_tag) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
715 my $deg_file=`ls $degpath`;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
716 chomp $deg_file;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
717 my @deg_file=split/\n/,$deg_file;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
718 my %deg;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
719 foreach (@deg_file) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
720 my $output="$degpath/$_/output_score.txt";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
721 open IN,"<$output";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
722 $deg{$_}[0]=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
723 $deg{$_}[1]=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
724 $deg{$_}[2]=0;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
725 while (my $aline=<IN>) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
726 next if ($aline=~/^\"/);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
727 chomp $aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
728 my @temp=split/\t/,$aline;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
729 if ($temp[9] eq "TRUE") {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
730 $deg{$_}[0]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
731 if ($temp[4] >0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
732 $deg{$_}[1]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
733 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
734 if ($temp[4] <0) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
735 $deg{$_}[2]++;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
736 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
737 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
738 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
739 close IN;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
740 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
741
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
742 print OUT "<h2>7. DEG</h2>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
743 <table border=\"1\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
744 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
745 <th align=\"left\">Genes number</th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
746 <th> DEG </th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
747 <th> UP </th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
748 <th> DOWN </th>\n
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
749 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
750
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
751 foreach my $key (sort keys %deg) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
752 print OUT "</tr>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
753 <tr align=\"center\">
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
754 <th align=\"left\">$key</th>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
755 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
756 for (my $i=0;$i<@{$deg{$key}} ;$i++) {
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
757 print OUT "<td> $deg{$key}[$i] </td>\n";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
758 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
759 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
760 print OUT "</tr>\n</table>";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
761 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
762 else{
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
763 print OUT "<h2>7. DEG</h2>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
764 <br />Do not do DE clusters <br />";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
765 }
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
766
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
767 print OUT "
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
768 </BODY>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
769 </HTML>
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
770 ";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
771 close OUT;
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
772
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
773
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
774
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
775
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
776 sub usage{
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
777 print <<"USAGE";
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
778 Version $version
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
779 Usage:
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
780 $0 -o
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
781 options:
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
782 -i
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
783 -format
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
784 -o output file
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
785 -h help
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
786 USAGE
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
787 exit(1);
87fe81de0931 Uploaded
bigrna
parents:
diff changeset
788 }