line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Bio::Prospect::utilities -- miscellaneous utilities for Prospect |
4
|
|
|
|
|
|
|
S<$Id: utilities.pm,v 1.10 2003/11/18 19:45:45 rkh Exp $> |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 SYNOPSIS |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Bio::Prospect::utilities ; |
9
|
|
|
|
|
|
|
my ($scores,@fields) = score_summary( fn ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
B<Bio::Prospect::utilities> is a |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 ROUTINES & METHODS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Bio::Prospect::utilities; |
21
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
22
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
23
|
1
|
|
|
1
|
|
5
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
77
|
|
24
|
|
|
|
|
|
|
our @EXPORT = (); |
25
|
|
|
|
|
|
|
our @EXPORT_OK = qw( score_summary alignment_summary ); |
26
|
1
|
|
|
1
|
|
965
|
use Bio::Prospect::File; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
77
|
|
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
|
6
|
use vars qw( $VERSION ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
714
|
|
29
|
|
|
|
|
|
|
$VERSION = sprintf( "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/ ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub alignment_summary |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
0
|
0
|
|
my $xfn = shift; # Prospect xml output |
36
|
0
|
|
|
|
|
|
my $pf = new Bio::Prospect::File; |
37
|
0
|
|
|
|
|
|
my @aifields = qw(nident nalign nmatched alignFreq templateFrom |
38
|
|
|
|
|
|
|
templateTo targetFrom); |
39
|
0
|
|
|
|
|
|
my %sum; |
40
|
0
|
0
|
|
|
|
|
$pf->open( "<$xfn" ) |
41
|
|
|
|
|
|
|
or throw Exception ( "couldn't open $xfn" ); |
42
|
0
|
|
|
|
|
|
while( my $t = $pf->next_thread() ) |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
|
|
|
my $tn = $t->tname(); |
45
|
0
|
|
|
|
|
|
push( @{$sum{$tn}}, @{$t->{alignmentInfo}}{@aifields} ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
push( @{$sum{$tn}}, $t->{scoreInfo}->{radiusOfGyration} ); |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
return( \%sum, (@aifields,'rgyr') ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub score_summary |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
0
|
1
|
|
my $xfn = shift; # Prospect xml output |
57
|
0
|
|
|
|
|
|
my $ps = new IO::Pipe; |
58
|
0
|
|
|
|
|
|
my @fields; |
59
|
|
|
|
|
|
|
my %scores; |
60
|
0
|
|
|
|
|
|
$ps->reader('sortProspect',$xfn); |
61
|
0
|
|
|
|
|
|
while( my $line = <$ps> ) |
62
|
|
|
|
|
|
|
{ |
63
|
0
|
|
|
|
|
|
my @F = split(' ',$line); |
64
|
0
|
|
|
|
|
|
my $t = shift(@F); |
65
|
0
|
0
|
|
|
|
|
if ($line =~ m/^:/) |
66
|
0
|
|
|
|
|
|
{ @fields = @F } |
67
|
|
|
|
|
|
|
else |
68
|
0
|
0
|
|
|
|
|
{ @{$scores{$t}} = map { $_ eq '--' or $_ eq '-999.00' ? undef : $_ } @F } |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
0
|
|
|
|
|
|
$ps->close(); |
71
|
0
|
|
|
|
|
|
return (\%scores, @fields); |
72
|
|
|
|
|
|
|
=pod |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item B<score_summary( filename )> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Returns ($score_hashref, @fields) for the given filename. It is presumed |
79
|
|
|
|
|
|
|
that filename is the xml output of ONE prospect invocation (i.e., ONE |
80
|
|
|
|
|
|
|
query sequence). |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=back |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub summary |
89
|
|
|
|
|
|
|
{ |
90
|
0
|
|
|
0
|
1
|
|
my $xfn = shift; # Prospect xml output |
91
|
0
|
0
|
|
|
|
|
print(STDERR `date`, "# score_summary on $xfn...\n") if $ENV{DEBUG}; |
92
|
0
|
|
|
|
|
|
my ($Sh,@Sf) = score_summary($xfn); |
93
|
0
|
0
|
|
|
|
|
print(STDERR `date`, "# alignment_summary...\n") if $ENV{DEBUG}; |
94
|
0
|
|
|
|
|
|
my ($Ah,@Af) = alignment_summary($xfn); |
95
|
0
|
0
|
|
|
|
|
print(STDERR `date`, "# done\n") if $ENV{DEBUG}; |
96
|
0
|
|
|
|
|
|
push( @{$Sh->{$_}}, @{$Ah->{$_}} ) for keys %$Sh; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
push( @Sf, @Af ); |
98
|
0
|
|
|
|
|
|
return ($Sh, @Sf); |
99
|
|
|
|
|
|
|
=pod |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item B<summary( filename )> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Returns ($hashref, @fields) for the given filename. It is presumed |
106
|
|
|
|
|
|
|
that filename is the xml output of ONE prospect invocation (i.e., ONE |
107
|
|
|
|
|
|
|
query sequence). |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=back |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
my @signame; |
117
|
|
|
|
|
|
|
sub signame |
118
|
|
|
|
|
|
|
{ |
119
|
0
|
|
|
0
|
0
|
|
my $n = shift; |
120
|
0
|
0
|
|
|
|
|
if (not @signame) |
121
|
|
|
|
|
|
|
{ |
122
|
1
|
|
|
1
|
|
8
|
use Config; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
138
|
|
123
|
0
|
0
|
|
|
|
|
if (defined $Config{sig_name}) |
124
|
0
|
|
|
|
|
|
{ @signame = split(' ',$Config{sig_name}); } |
125
|
|
|
|
|
|
|
} |
126
|
0
|
0
|
|
|
|
|
defined $signame[$n] ? 'SIG'.$signame[$n] : 'unknown'; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=pod |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 BUGS |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 SEE ALSO |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |