Mercurial > repos > big-tiandm > sirna_plant
comparison html.pl @ 19:e0884a4b996b draft
Uploaded
author | big-tiandm |
---|---|
date | Wed, 05 Nov 2014 01:17:26 -0500 |
parents | 0e4b6b0c6e9d |
children |
comparison
equal
deleted
inserted
replaced
18:22d79320085c | 19:e0884a4b996b |
---|---|
11 use Getopt::Long; | 11 use Getopt::Long; |
12 use File::Basename; | 12 use File::Basename; |
13 | 13 |
14 my %opts; | 14 my %opts; |
15 GetOptions(\%opts,"i=s","format=s","o=s","h"); | 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 | 16 if (!(defined $opts{o} and defined $opts{format} and defined $opts{i} ) || defined $opts{h}) { #necessary arguments |
17 &usage; | 17 &usage; |
18 } | 18 } |
19 my ($config,$prepath,$rfampath,$genomepath,$clusterpath,$annotatepath,$degpath); | 19 my ($config,$prepath,$rfampath,$genomepath,$clusterpath,$annotatepath,$plotpath,$degpath); |
20 my ($predir,$rfamdir,$genomedir,$clusterdir,$annotatedir,$degdir); | 20 my ($predir,$rfamdir,$genomedir,$clusterdir,$annotatedir,$plotdir,$degdir); |
21 open IN,"<$opts{i}"; | 21 open IN,"<$opts{i}"; |
22 $config=<IN>; chomp $config; | 22 $config=<IN>; chomp $config; |
23 $prepath=<IN>; chomp $prepath; | 23 $prepath=<IN>; chomp $prepath; |
24 $rfampath=<IN>;chomp $rfampath; | 24 $rfampath=<IN>;chomp $rfampath; |
25 $genomepath=<IN>; chomp $genomepath; | 25 $genomepath=<IN>; chomp $genomepath; |
26 $clusterpath=<IN>; chomp $clusterpath; | 26 $clusterpath=<IN>; chomp $clusterpath; |
27 $annotatepath=<IN>; chomp $annotatepath; | 27 $annotatepath=<IN>; chomp $annotatepath; |
28 $plotpath=<IN>; chomp $plotpath; | |
28 my $deg_tag=1; | 29 my $deg_tag=1; |
29 if(eof){$deg_tag=0;} | 30 if(eof){$deg_tag=0;} |
30 else{ | 31 else{ |
31 $degpath=<IN>; chomp $degpath; | 32 $degpath=<IN>; chomp $degpath; |
32 } | 33 } |
39 $genomedir=$tmp[-1]; | 40 $genomedir=$tmp[-1]; |
40 @tmp=split/\//,$clusterpath; | 41 @tmp=split/\//,$clusterpath; |
41 $clusterdir=$tmp[-1]; | 42 $clusterdir=$tmp[-1]; |
42 @tmp=split/\//,$annotatepath; | 43 @tmp=split/\//,$annotatepath; |
43 $annotatedir=$tmp[-1]; | 44 $annotatedir=$tmp[-1]; |
44 #@tmp=split/\//,$degpath; | 45 @tmp=split/\//,$plotpath; |
45 #$degdir=$tmp[-1]; | 46 $plotdir=$tmp[-1]; |
46 | 47 |
47 my $dir=dirname($opts{'o'}); | 48 my $dir=dirname($opts{'o'}); |
48 | 49 |
49 open OUT ,">$opts{'o'}"; | 50 open OUT ,">$opts{'o'}"; |
50 print OUT "<HTML>\n <HEAD>\n <TITLE> Analysis Report </TITLE>\n </HEAD> | 51 print OUT "<HTML>\n <HEAD>\n <TITLE> Analysis Report </TITLE>\n </HEAD> |
199 print OUT "The collapsed file path is: <b>$collapsefile</b><br /> | 200 print OUT "The collapsed file path is: <b>$collapsefile</b><br /> |
200 The clean data file path is: <b>$clean</b><br /> | 201 The clean data file path is: <b>$clean</b><br /> |
201 The filter (remain total reads>3) data file path is: <b>$filter</b><br /> | 202 The filter (remain total reads>3) data file path is: <b>$filter</b><br /> |
202 </p> | 203 </p> |
203 <h2> 1. Sequence length count</h2> | 204 <h2> 1. Sequence length count</h2> |
204 <h3> 1.1 Reads length</h3> | 205 "; |
205 "; | 206 print OUT "\n"; |
206 | 207 |
207 print OUT "<img src=\"./$predir/Reads_length_after_count_filter.png\" alt=\"Reads_length_after_count_filter.png\" width=\"400\" height=\"300\"/> | 208 my $length=$prepath."length.html"; |
208 <h3> 1.2 Tags length count</h3> | 209 open IN,"<$length"; |
209 <img src=\"./$predir/Tags_length_after_count_filter.png\" alt=\"Tags_length_after_count_filter.png\" width=\"400\" height=\"300\"/> | 210 while (my $aline=<IN>) { |
210 <p> Note:<br />The sequence length data: <a href=\"./$predir/reads_length_distribution_after_count_filter.txt\"> length file</a> | 211 chomp $aline; |
212 print OUT "$aline\n"; | |
213 } | |
214 close IN; | |
215 | |
216 print OUT "<p> Note:<br />The sequence length data: <a href=\"./$predir/reads_length_distribution_after_count_filter.txt\"> length file</a> | |
211 </p> | 217 </p> |
212 "; | 218 "; |
213 | 219 |
214 #### rfam | 220 #### rfam |
215 unless ($rfampath=~/\/$/) { | 221 unless ($rfampath=~/\/$/) { |
359 | 365 |
360 my $cluster="$clusterpath/sample_reads.cluster"; | 366 my $cluster="$clusterpath/sample_reads.cluster"; |
361 my $cluster_number=`less $cluster |wc -l `; | 367 my $cluster_number=`less $cluster |wc -l `; |
362 $cluster_number=$cluster_number-1; | 368 $cluster_number=$cluster_number-1; |
363 my (%cluster_length,@exp,@rpkm); | 369 my (%cluster_length,@exp,@rpkm); |
364 my @exp_range=qw(0 1--9 10--99 100--999 1000--9999 10000--99999 100000--**); | 370 my @exp_range=qw(0 \(0--10] \(10--100] \(100--1000] \(1000--10000] \(10000--100000] \(100000--**\)); |
365 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--**); | 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--**]); |
366 | 372 |
367 open IN,"<$cluster"; | 373 open IN,"<$cluster"; |
368 while (my $aline=<IN>) { | 374 while (my $aline=<IN>) { |
369 next if($aline=~/^\"/); | 375 next if($aline=~/^\"/); |
370 chomp $aline; | 376 chomp $aline; |
371 my @temp=split/\t/,$aline; | 377 my @temp=split/\t/,$aline; |
372 my @id=split/:|-/,$temp[0]; | 378 my @id=split/:|-/,$temp[0]; |
373 $cluster_length{$id[2]-$id[1]+1}++; | 379 $cluster_length{$id[2]-$id[1]+1}++; |
374 for (my $i=0;$i<@marks ;$i++) { | 380 for (my $i=0;$i<@marks ;$i++) { |
375 if ($temp[$i+3] == 0) {$exp[$i][0]++;} | 381 if ($temp[$i+3] == 0) {$exp[0][$i]++;} |
376 elsif ($temp[$i+3]>0 && $temp[$i+3]<= 10 ){$exp[$i][1]++;} | 382 elsif ($temp[$i+3]>0 && $temp[$i+3]<= 10 ){$exp[1][$i]++;} |
377 elsif ($temp[$i+3]>10 && $temp[$i+3]<=100){$exp[$i][2]++;} | 383 elsif ($temp[$i+3]>10 && $temp[$i+3]<=100){$exp[2][$i]++;} |
378 elsif ($temp[$i+3]>100 && $temp[$i+3]<=1000){$exp[$i][3]++;} | 384 elsif ($temp[$i+3]>100 && $temp[$i+3]<=1000){$exp[3][$i]++;} |
379 elsif ($temp[$i+3]>1000 && $temp[$i+3]<=10000){$exp[$i][4]++;} | 385 elsif ($temp[$i+3]>1000 && $temp[$i+3]<=10000){$exp[4][$i]++;} |
380 elsif ($temp[$i+3]>10000 && $temp[$i+3]<=100000){$exp[$i][5]++;} | 386 elsif ($temp[$i+3]>10000 && $temp[$i+3]<=100000){$exp[5][$i]++;} |
381 elsif ($temp[$i+3]>100000){$exp[$i][6]++;} | 387 elsif ($temp[$i+3]>100000){$exp[6][$i]++;} |
382 } | 388 } |
383 } | 389 } |
384 close IN; | 390 close IN; |
385 | 391 |
386 my $cluster_rpkm="$clusterpath/sample_rpkm.cluster"; | 392 my $cluster_rpkm="$clusterpath/sample_rpkm.cluster"; |
388 while (my $aline=<IN>) { | 394 while (my $aline=<IN>) { |
389 next if($aline=~/^\#/); | 395 next if($aline=~/^\#/); |
390 chomp $aline; | 396 chomp $aline; |
391 my @temp=split/\t/,$aline; | 397 my @temp=split/\t/,$aline; |
392 for (my $i=0;$i<@marks ;$i++) { | 398 for (my $i=0;$i<@marks ;$i++) { |
393 if ($temp[$i+3]==0) {$rpkm[$i][0]++;} | 399 if ($temp[$i+3]==0) {$rpkm[0][$i]++;} |
394 elsif($temp[$i+3]>0 && $temp[$i+3]<=0.25){$rpkm[$i][1]++;} | 400 elsif($temp[$i+3]>0 && $temp[$i+3]<=0.25){$rpkm[1][$i]++;} |
395 elsif($temp[$i+3]>0.25 && $temp[$i+3]<=0.5){$rpkm[$i][2]++;} | 401 elsif($temp[$i+3]>0.25 && $temp[$i+3]<=0.5){$rpkm[2][$i]++;} |
396 elsif($temp[$i+3]>0.5 && $temp[$i+3]<=1){$rpkm[$i][3]++;} | 402 elsif($temp[$i+3]>0.5 && $temp[$i+3]<=1){$rpkm[3][$i]++;} |
397 elsif($temp[$i+3]>1 && $temp[$i+3]<=5){$rpkm[$i][4]++;} | 403 elsif($temp[$i+3]>1 && $temp[$i+3]<=5){$rpkm[4][$i]++;} |
398 elsif($temp[$i+3]>5 && $temp[$i+3]<=10){$rpkm[$i][5]++;} | 404 elsif($temp[$i+3]>5 && $temp[$i+3]<=10){$rpkm[5][$i]++;} |
399 elsif($temp[$i+3]>10 && $temp[$i+3]<=50){$rpkm[$i][6]++;} | 405 elsif($temp[$i+3]>10 && $temp[$i+3]<=50){$rpkm[6][$i]++;} |
400 elsif($temp[$i+3]>50 && $temp[$i+3]<=100){$rpkm[$i][7]++;} | 406 elsif($temp[$i+3]>50 && $temp[$i+3]<=100){$rpkm[7][$i]++;} |
401 elsif($temp[$i+3]>100 && $temp[$i+3]<=500){$rpkm[$i][8]++;} | 407 elsif($temp[$i+3]>100 && $temp[$i+3]<=500){$rpkm[8][$i]++;} |
402 elsif($temp[$i+3]>500 && $temp[$i+3]<=1000){$rpkm[$i][9]++;} | 408 elsif($temp[$i+3]>500 && $temp[$i+3]<=1000){$rpkm[9][$i]++;} |
403 else{$rpkm[$i][10]++;} | 409 else{$rpkm[10][$i]++;} |
404 } | 410 } |
405 } | 411 } |
406 | 412 |
407 close IN; | 413 close IN; |
408 | 414 |
482 $long[$j]=0; | 488 $long[$j]=0; |
483 $repeat[$j]=0; | 489 $repeat[$j]=0; |
484 $nat[$j]=0; | 490 $nat[$j]=0; |
485 } | 491 } |
486 | 492 |
487 my $class_anno=6; | 493 my $class_anno=1; |
488 open ANNO,"<$annotate"; | 494 open ANNO,"<$annotate"; |
489 while (my $aline=<ANNO>) { | 495 while (my $aline=<ANNO>) { |
490 chomp $aline; | 496 chomp $aline; |
491 my @temp=split/\t/,$aline; | 497 my @temp=split/\t/,$aline; |
492 if($aline=~/^\#/){ | 498 if($aline=~/^\#/){ |
692 print OUT "<h3>5.2 Cluster source mechanism annotate</h3> | 698 print OUT "<h3>5.2 Cluster source mechanism annotate</h3> |
693 <br />Do not do source mechanism annotate <br />"; | 699 <br />Do not do source mechanism annotate <br />"; |
694 | 700 |
695 } | 701 } |
696 | 702 |
703 print OUT "<h2>6. Graph of Clusters of all samples</h2> \n"; | |
704 | |
705 my $plot=$plotpath."cluster.html"; | |
706 open IN,"<$plot"; | |
707 while (my $aline=<IN>) { | |
708 chomp $aline; | |
709 print OUT "$aline\n"; | |
710 } | |
711 close IN; | |
712 | |
713 | |
697 if ($deg_tag) { | 714 if ($deg_tag) { |
698 my $deg_file=`ls $degpath`; | 715 my $deg_file=`ls $degpath`; |
699 chomp $deg_file; | 716 chomp $deg_file; |
700 my @deg_file=split/\n/,$deg_file; | 717 my @deg_file=split/\n/,$deg_file; |
701 my %deg; | 718 my %deg; |
720 } | 737 } |
721 } | 738 } |
722 close IN; | 739 close IN; |
723 } | 740 } |
724 | 741 |
725 print OUT "<h2>6. DEG</h2> | 742 print OUT "<h2>7. DEG</h2> |
726 <table border=\"1\"> | 743 <table border=\"1\"> |
727 <tr align=\"center\"> | 744 <tr align=\"center\"> |
728 <th align=\"left\">Genes number</th>\n | 745 <th align=\"left\">Genes number</th>\n |
729 <th> DEG </th>\n | 746 <th> DEG </th>\n |
730 <th> UP </th>\n | 747 <th> UP </th>\n |
741 } | 758 } |
742 } | 759 } |
743 print OUT "</tr>\n</table>"; | 760 print OUT "</tr>\n</table>"; |
744 } | 761 } |
745 else{ | 762 else{ |
746 print OUT "<h2>6. DEG</h2> | 763 print OUT "<h2>7. DEG</h2> |
747 <br />Do not do DE clusters <br />"; | 764 <br />Do not do DE clusters <br />"; |
748 } | 765 } |
749 | 766 |
750 print OUT " | 767 print OUT " |
751 </BODY> | 768 </BODY> |