annotate html_siRNA.pl @ 51:3202911efdae draft

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