annotate html.pl @ 18:22d79320085c draft

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