diff html.pl @ 19:e0884a4b996b draft

Uploaded
author big-tiandm
date Wed, 05 Nov 2014 01:17:26 -0500
parents 0e4b6b0c6e9d
children
line wrap: on
line diff
--- a/html.pl	Thu Oct 30 21:31:55 2014 -0400
+++ b/html.pl	Wed Nov 05 01:17:26 2014 -0500
@@ -13,11 +13,11 @@
 
 my %opts;
 GetOptions(\%opts,"i=s","format=s","o=s","h");
-if (!(defined $opts{o} and defined $opts{format} and defined $opts{i} ) || defined $opts{h}) { #necessary arguments
+if (!(defined $opts{o}  and defined $opts{format} and defined $opts{i} ) || defined $opts{h}) { #necessary arguments
 &usage;
 }
-my ($config,$prepath,$rfampath,$genomepath,$clusterpath,$annotatepath,$degpath);
-my ($predir,$rfamdir,$genomedir,$clusterdir,$annotatedir,$degdir);
+my ($config,$prepath,$rfampath,$genomepath,$clusterpath,$annotatepath,$plotpath,$degpath);
+my ($predir,$rfamdir,$genomedir,$clusterdir,$annotatedir,$plotdir,$degdir);
 open IN,"<$opts{i}";
 $config=<IN>; chomp $config;
 $prepath=<IN>; chomp $prepath;
@@ -25,6 +25,7 @@
 $genomepath=<IN>; chomp $genomepath;
 $clusterpath=<IN>; chomp $clusterpath;
 $annotatepath=<IN>; chomp $annotatepath;
+$plotpath=<IN>; chomp $plotpath;
 my $deg_tag=1;
 if(eof){$deg_tag=0;}
 else{
@@ -41,8 +42,8 @@
 $clusterdir=$tmp[-1];
 @tmp=split/\//,$annotatepath;
 $annotatedir=$tmp[-1];
-#@tmp=split/\//,$degpath;
-#$degdir=$tmp[-1];
+@tmp=split/\//,$plotpath;
+$plotdir=$tmp[-1];
 
 my $dir=dirname($opts{'o'});
 
@@ -201,13 +202,18 @@
 The filter (remain total reads>3) data file path is: <b>$filter</b><br />
 </p>
 <h2> 1. Sequence length count</h2>
-<h3> 1.1 Reads length</h3>
 ";
+print OUT "\n";
 
-print OUT "<img src=\"./$predir/Reads_length_after_count_filter.png\" alt=\"Reads_length_after_count_filter.png\" width=\"400\" height=\"300\"/>
-<h3> 1.2 Tags length count</h3>
-<img src=\"./$predir/Tags_length_after_count_filter.png\" alt=\"Tags_length_after_count_filter.png\" width=\"400\" height=\"300\"/>
-<p> Note:<br />The sequence length data: <a href=\"./$predir/reads_length_distribution_after_count_filter.txt\"> length file</a>
+my $length=$prepath."length.html";
+open IN,"<$length";
+while (my $aline=<IN>) {
+	chomp $aline;
+	print OUT "$aline\n";
+}
+close IN;
+
+print OUT "<p> Note:<br />The sequence length data: <a href=\"./$predir/reads_length_distribution_after_count_filter.txt\"> length file</a>
 </p>
 ";
 
@@ -361,8 +367,8 @@
 my $cluster_number=`less $cluster |wc -l `;
 $cluster_number=$cluster_number-1;
 my (%cluster_length,@exp,@rpkm);
-my @exp_range=qw(0 1--9 10--99 100--999 1000--9999 10000--99999 100000--**);
-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--**);
+my @exp_range=qw(0 \(0--10] \(10--100] \(100--1000] \(1000--10000] \(10000--100000] \(100000--**\));
+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--**]);
 
 open IN,"<$cluster";
 while (my $aline=<IN>) {
@@ -372,13 +378,13 @@
 	my @id=split/:|-/,$temp[0];
 	$cluster_length{$id[2]-$id[1]+1}++;
 	for (my $i=0;$i<@marks ;$i++) {
-		if ($temp[$i+3] == 0) {$exp[$i][0]++;}
-		elsif ($temp[$i+3]>0 && $temp[$i+3]<= 10  ){$exp[$i][1]++;}
-		elsif ($temp[$i+3]>10 && $temp[$i+3]<=100){$exp[$i][2]++;}
-		elsif ($temp[$i+3]>100 && $temp[$i+3]<=1000){$exp[$i][3]++;}
-		elsif ($temp[$i+3]>1000 && $temp[$i+3]<=10000){$exp[$i][4]++;}
-		elsif ($temp[$i+3]>10000 && $temp[$i+3]<=100000){$exp[$i][5]++;}
-		elsif ($temp[$i+3]>100000){$exp[$i][6]++;}
+		if ($temp[$i+3] == 0) {$exp[0][$i]++;}
+		elsif ($temp[$i+3]>0 && $temp[$i+3]<= 10  ){$exp[1][$i]++;}
+		elsif ($temp[$i+3]>10 && $temp[$i+3]<=100){$exp[2][$i]++;}
+		elsif ($temp[$i+3]>100 && $temp[$i+3]<=1000){$exp[3][$i]++;}
+		elsif ($temp[$i+3]>1000 && $temp[$i+3]<=10000){$exp[4][$i]++;}
+		elsif ($temp[$i+3]>10000 && $temp[$i+3]<=100000){$exp[5][$i]++;}
+		elsif ($temp[$i+3]>100000){$exp[6][$i]++;}
 	}
 }
 close IN;
@@ -390,17 +396,17 @@
 	chomp $aline;
 	my @temp=split/\t/,$aline;
 	for (my $i=0;$i<@marks ;$i++) {
-		if ($temp[$i+3]==0) {$rpkm[$i][0]++;}
-		elsif($temp[$i+3]>0 && $temp[$i+3]<=0.25){$rpkm[$i][1]++;}
-		elsif($temp[$i+3]>0.25 && $temp[$i+3]<=0.5){$rpkm[$i][2]++;}
-		elsif($temp[$i+3]>0.5 && $temp[$i+3]<=1){$rpkm[$i][3]++;}
-		elsif($temp[$i+3]>1 && $temp[$i+3]<=5){$rpkm[$i][4]++;}
-		elsif($temp[$i+3]>5 && $temp[$i+3]<=10){$rpkm[$i][5]++;}
-		elsif($temp[$i+3]>10 && $temp[$i+3]<=50){$rpkm[$i][6]++;}
-		elsif($temp[$i+3]>50 && $temp[$i+3]<=100){$rpkm[$i][7]++;}
-		elsif($temp[$i+3]>100 && $temp[$i+3]<=500){$rpkm[$i][8]++;}
-		elsif($temp[$i+3]>500 && $temp[$i+3]<=1000){$rpkm[$i][9]++;}
-		else{$rpkm[$i][10]++;}
+		if ($temp[$i+3]==0) {$rpkm[0][$i]++;}
+		elsif($temp[$i+3]>0 && $temp[$i+3]<=0.25){$rpkm[1][$i]++;}
+		elsif($temp[$i+3]>0.25 && $temp[$i+3]<=0.5){$rpkm[2][$i]++;}
+		elsif($temp[$i+3]>0.5 && $temp[$i+3]<=1){$rpkm[3][$i]++;}
+		elsif($temp[$i+3]>1 && $temp[$i+3]<=5){$rpkm[4][$i]++;}
+		elsif($temp[$i+3]>5 && $temp[$i+3]<=10){$rpkm[5][$i]++;}
+		elsif($temp[$i+3]>10 && $temp[$i+3]<=50){$rpkm[6][$i]++;}
+		elsif($temp[$i+3]>50 && $temp[$i+3]<=100){$rpkm[7][$i]++;}
+		elsif($temp[$i+3]>100 && $temp[$i+3]<=500){$rpkm[8][$i]++;}
+		elsif($temp[$i+3]>500 && $temp[$i+3]<=1000){$rpkm[9][$i]++;}
+		else{$rpkm[10][$i]++;}
 	}
 }
 
@@ -484,7 +490,7 @@
 	$nat[$j]=0;
 }
 
-my $class_anno=6;
+my $class_anno=1;
 open ANNO,"<$annotate";
 while (my $aline=<ANNO>) {
 	chomp $aline;
@@ -694,6 +700,17 @@
 
 }
 
+print OUT "<h2>6. Graph of Clusters of all samples</h2> \n";
+
+my $plot=$plotpath."cluster.html";
+open IN,"<$plot";
+while (my $aline=<IN>) {
+	chomp $aline;
+	print OUT "$aline\n";
+}
+close IN;
+
+
 if ($deg_tag) {
 	my $deg_file=`ls $degpath`;
 	chomp $deg_file;
@@ -722,7 +739,7 @@
 		close IN;
 	}
 
-	print OUT "<h2>6. DEG</h2>
+	print OUT "<h2>7. DEG</h2>
 	<table border=\"1\">
 	<tr align=\"center\">
 	<th align=\"left\">Genes number</th>\n
@@ -743,7 +760,7 @@
 	print OUT "</tr>\n</table>";
 }
 else{
-	print OUT "<h2>6. DEG</h2>
+	print OUT "<h2>7. DEG</h2>
 	<br />Do not do DE clusters <br />";
 }