line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BioX::FedDB::Client; |
2
|
1
|
|
|
1
|
|
5877
|
use base qw(BioX::FedDB::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
93
|
|
3
|
|
|
|
|
|
|
use Class::Std; |
4
|
|
|
|
|
|
|
use Class::Std::Utils; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use warnings; |
7
|
|
|
|
|
|
|
use strict; |
8
|
|
|
|
|
|
|
use Carp; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use version; our $VERSION = qv('0.0.1'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
{ |
13
|
|
|
|
|
|
|
sub query_count { |
14
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
15
|
|
|
|
|
|
|
my $sql = "select count(*) from hits where query_id = '$id'"; |
16
|
|
|
|
|
|
|
my ( $count ) = $self->dbh->sqlexec( $sql, '@' ); |
17
|
|
|
|
|
|
|
return $count || 0; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub subject_count { |
21
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
22
|
|
|
|
|
|
|
my $sql = "select count(*) from hits where subject_id = '$id'"; |
23
|
|
|
|
|
|
|
my ( $count ) = $self->dbh->sqlexec( $sql, '@' ); |
24
|
|
|
|
|
|
|
return $count || 0; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub query { |
28
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
29
|
|
|
|
|
|
|
my $sql = "select * from hits where query_id = '$id'"; |
30
|
|
|
|
|
|
|
my $rowsref = $self->dbh->sqlexec( $sql, '\@@' ); |
31
|
|
|
|
|
|
|
return $self->_build_records( $rowsref ) || 0; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub subject { |
35
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
36
|
|
|
|
|
|
|
my $sql = "select * from hits where subject_id = '$id'"; |
37
|
|
|
|
|
|
|
my $rowsref = $self->dbh->sqlexec( $sql, '\@@' ); |
38
|
|
|
|
|
|
|
return $self->_build_records( $rowsref ) || 0; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _build_records { |
42
|
|
|
|
|
|
|
my ( $self, $rowsref ) = @_; |
43
|
|
|
|
|
|
|
my @records = (); |
44
|
|
|
|
|
|
|
foreach my $rowref ( @$rowsref ) { |
45
|
|
|
|
|
|
|
#my ( $hit_id, $q_id, $q_start, $q_end, $q_string, $s_id, $s_start, $s_end, $s_string, $expect ) = @$rowref; |
46
|
|
|
|
|
|
|
my $record = "'" . join( "','", @$rowref) . "'"; |
47
|
|
|
|
|
|
|
push @records, $record; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return join( "\n", @records ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
56
|
|
|
|
|
|
|
__END__ |