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