line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# BioPerl module for Bio::DB::SeqVersion |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Please direct questions and support issues to |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Cared for by Brian Osborne |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Copyright Brian Osborne 2006 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# You may distribute this module under the same terms as Perl itself |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# POD documentation - main docs before the code |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Bio::DB::SeqVersion - front end to querying databases for identifier |
17
|
|
|
|
|
|
|
versions |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Bio::DB::SeqVersion; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $query = Bio::DB::SeqVersion->new(-type => 'gi'); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my @all_gis = $query->get_all(2); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $live_gi = $query->get_recent(2); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
The default type is 'gi'. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 FEEDBACK |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 Mailing Lists |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this and other |
38
|
|
|
|
|
|
|
Bioperl modules. Send your comments and suggestions preferably to |
39
|
|
|
|
|
|
|
the Bioperl mailing list. Your participation is much appreciated. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
bioperl-l@bioperl.org - General discussion |
42
|
|
|
|
|
|
|
http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 Support |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Please direct usage questions or support issues to the mailing list: |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
I |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
rather than to the module maintainer directly. Many experienced and |
51
|
|
|
|
|
|
|
reponsive experts will be able look at the problem and quickly |
52
|
|
|
|
|
|
|
address it. Please include a thorough description of the problem |
53
|
|
|
|
|
|
|
with code and data examples if at all possible. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 Reporting Bugs |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Report bugs to the Bioperl bug tracking system to help us keep track |
58
|
|
|
|
|
|
|
of the bugs and their resolution. Bug reports can be submitted via |
59
|
|
|
|
|
|
|
the web: |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
https://github.com/bioperl/bioperl-live/issues |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR - Brian Osborne |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Email bosborne at alum.mit.edu |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Torsten Seemann - torsten.seemann AT infotech.monash.edu.au |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 APPENDIX |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
The rest of the documentation details each of the object methods. |
74
|
|
|
|
|
|
|
Internal methods are usually preceded with a _ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Let the code begin... |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
package Bio::DB::SeqVersion; |
81
|
1
|
|
|
1
|
|
465
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
1
|
|
3
|
use base qw(Bio::WebAgent Bio::Root::Root); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
225
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Private class variable |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $DEFAULTIDTYPE = 'gi'; # sub default_id_type() |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 new() |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Usage : my $obj = Bio::DB::SeqVersion->new(); |
92
|
|
|
|
|
|
|
Function: Create a Bio::DB::SeqVersion object |
93
|
|
|
|
|
|
|
Returns : An instance of Bio::DB::SeqVersion |
94
|
|
|
|
|
|
|
Args : -type Identifier namespace, default is 'gi' |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub new { |
99
|
2
|
|
|
2
|
1
|
131
|
my($class,@args) = @_; |
100
|
|
|
|
|
|
|
|
101
|
2
|
100
|
|
|
|
10
|
if( $class =~ /Bio::DB::SeqVersion::\S+/ ) { |
102
|
1
|
|
|
|
|
6
|
my ($self) = $class->SUPER::new(@args); |
103
|
1
|
|
|
|
|
13
|
$self->_initialize(@args); |
104
|
1
|
|
|
|
|
2
|
return $self; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
else { |
107
|
1
|
|
|
|
|
3
|
my %param = @args; |
108
|
1
|
|
|
|
|
3
|
@param{ map { lc $_ } keys %param } = values %param; # lowercase keys |
|
1
|
|
|
|
|
4
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# we delete '-type' so it doesn't get passed to the sub-class constructor |
111
|
|
|
|
|
|
|
# note: delete() returns the value of the item deleted (undef if non-existent) |
112
|
1
|
|
33
|
|
|
4
|
my $type = lc( delete($param{'-type'}) || $DEFAULTIDTYPE ); |
113
|
|
|
|
|
|
|
|
114
|
1
|
50
|
|
|
|
3
|
return unless( $class->_load_seqversion_module($type) ); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# we pass %param here, not @args, as we have filtered out -type |
117
|
1
|
|
|
|
|
4
|
return "Bio::DB::SeqVersion::$type"->new(%param); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 get_recent() |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Usage : |
124
|
|
|
|
|
|
|
Function: |
125
|
|
|
|
|
|
|
Example : |
126
|
|
|
|
|
|
|
Returns : |
127
|
|
|
|
|
|
|
Args : |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub get_recent { |
132
|
0
|
|
|
0
|
1
|
0
|
my ($self,@args) = @_; |
133
|
0
|
|
|
|
|
0
|
$self->throw_not_implemented(); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 get_all() |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Usage : |
139
|
|
|
|
|
|
|
Function: |
140
|
|
|
|
|
|
|
Example : |
141
|
|
|
|
|
|
|
Returns : |
142
|
|
|
|
|
|
|
Args : |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub get_all { |
147
|
0
|
|
|
0
|
1
|
0
|
my ($self,@args) = @_; |
148
|
0
|
|
|
|
|
0
|
$self->throw_not_implemented(); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 _load_seqversion_module |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Title : _load_seqversion_module |
154
|
|
|
|
|
|
|
Usage : Used internally |
155
|
|
|
|
|
|
|
Function: Loads up a module at run time on demand |
156
|
|
|
|
|
|
|
Example : |
157
|
|
|
|
|
|
|
Returns : |
158
|
|
|
|
|
|
|
Args : Name of identifier type |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub _load_seqversion_module { |
163
|
1
|
|
|
1
|
|
3
|
my ($self,$db) = @_; |
164
|
1
|
|
|
|
|
3
|
my $module = "Bio::DB::SeqVersion::" . $db; |
165
|
1
|
|
|
|
|
1
|
my $ok; |
166
|
|
|
|
|
|
|
|
167
|
1
|
|
|
|
|
2
|
eval { $ok = $self->_load_module($module) }; |
|
1
|
|
|
|
|
10
|
|
168
|
1
|
50
|
|
|
|
3
|
if ( $@ ) { |
169
|
0
|
|
|
|
|
0
|
print STDERR $@; |
170
|
0
|
|
|
|
|
0
|
print STDERR <
|
171
|
|
|
|
|
|
|
$self: $module cannot be found |
172
|
|
|
|
|
|
|
Exception $@ |
173
|
|
|
|
|
|
|
For more information about the Bio::DB::SeqVersion system please see |
174
|
|
|
|
|
|
|
the Bio::DB::SeqVersion docs. |
175
|
|
|
|
|
|
|
END |
176
|
|
|
|
|
|
|
; |
177
|
|
|
|
|
|
|
} |
178
|
1
|
|
|
|
|
3
|
return $ok; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 default_id_type |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Title : default_id_type |
184
|
|
|
|
|
|
|
Usage : my $type = $self->default_id_type |
185
|
|
|
|
|
|
|
Function: Returns default identifier type for this module |
186
|
|
|
|
|
|
|
Returns : string |
187
|
|
|
|
|
|
|
Args : none |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub default_id_type { |
192
|
0
|
|
|
0
|
1
|
|
return $DEFAULTIDTYPE; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
1; |