2 # See the NOTICE file distributed with this work for additional information
3 # regarding copyright ownership.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 ## Script used in conjunction with exon_conservation_check.pl. Requires
19 ## Tie::IxHash for key ordering.
22 ## conservation_statistics.pl my_conservation.log
28 tie my %exon_states,
'Tie::IxHash', (
29 '!!' =>
'Protein Coding MisMatch',
30 '%%' =>
'Non-Coding MisMatch',
31 '??' =>
'Missed mapping',
34 tie my %transcript_states,
'Tie::IxHash', (
35 '@@' =>
'Protein Coding Protein MisMatch',
36 ';;' =>
'Protein Coding cDNA MisMatch',
37 '**' =>
'Non-Coding MisMatch',
38 'XX' =>
'Missed mapping',
43 die
"Cannot find $file" if ! -f $file;
44 my %states =
map { $_, 0 } (keys %exon_states, keys %transcript_states);
46 open my $fh,
'<', $file or die
"Cannot open file '$file': $!";
47 while(my $line = <$fh>) {
49 if($line =~ /(^[!%?&@;*X^]{2})/xms) {
53 if($line =~ /^Total ((?:exons|transcripts)) : (\d+)$/) {
59 my $format =
"%s : %d (%.2f%%)\n";
61 print
"Exon summary\n";
62 foreach my $key (keys %exon_states) {
63 my $count = $states{$key};
64 my $percentage = ($count / $totals{exons})*100;
65 printf $format, $exon_states{$key}, $count, $percentage;
68 print
"\nTranscript summary\n";
69 foreach my $key (keys %transcript_states) {
70 my $count = $states{$key};
71 my $percentage = ($count / $totals{transcripts})*100;
72 printf $format, $transcript_states{$key}, $count, $percentage;