annotate html.pl @ 3:a0c49a058bec draft

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