annotate html.pl @ 29:206f92933924 draft

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