0
|
1 #-----------------------------------------------------------------
|
|
2 # $Id: GenericDatabase.pm,v 1.5 2002/10/22 07:38:38 lapp Exp $
|
|
3 #
|
|
4 # BioPerl module Bio::Search::GenericDatabase
|
|
5 #
|
|
6 # Cared for by Steve Chervitz <sac@bioperl.org>
|
|
7 #
|
|
8 # You may distribute this module under the same terms as perl itself
|
|
9 #-----------------------------------------------------------------
|
|
10
|
|
11 # POD documentation - main docs before the code
|
|
12
|
|
13 =head1 NAME
|
|
14
|
|
15 Bio::Search::GenericDatabase - Generic implementation of Bio::Search::DatabaseI
|
|
16
|
|
17 =head1 SYNOPSIS
|
|
18
|
|
19 use Bio::Search::GenericDatabase;
|
|
20
|
|
21 $db = Bio::Search::GenericDatabase->new( -name => 'my Blast db',
|
|
22 -date => '2001-03-13',
|
|
23 -length => 2352511,
|
|
24 -entries => 250000 );
|
|
25
|
|
26 $name = $db->name();
|
|
27 $date = $db->date();
|
|
28 $num_letters = $db->letters();
|
|
29 $num_entries = $db->entries();
|
|
30
|
|
31 =head1 DESCRIPTION
|
|
32
|
|
33 This module provides a basic implementation of B<Bio::Search::DatabaseI>.
|
|
34 See documentation in that module for more information.
|
|
35
|
|
36 =head1 FEEDBACK
|
|
37
|
|
38 =head2 Mailing Lists
|
|
39
|
|
40 User feedback is an integral part of the evolution of this and other
|
|
41 Bioperl modules. Send your comments and suggestions preferably to one
|
|
42 of the Bioperl mailing lists. Your participation is much appreciated.
|
|
43
|
|
44 bioperl-l@bioperl.org - General discussion
|
|
45 http://bio.perl.org/MailList.html - About the mailing lists
|
|
46
|
|
47 =head2 Reporting Bugs
|
|
48
|
|
49 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
50 the bugs and their resolution. Bug reports can be submitted via email
|
|
51 or the web:
|
|
52
|
|
53 bioperl-bugs@bio.perl.org
|
|
54 http://bugzilla.bioperl.org/
|
|
55
|
|
56 =head1 AUTHOR
|
|
57
|
|
58 Steve Chervitz E<lt>sac@bioperl.orgE<gt>
|
|
59
|
|
60 See L<the FEEDBACK section | FEEDBACK> for where to send bug reports and comments.
|
|
61
|
|
62 =head1 COPYRIGHT
|
|
63
|
|
64 Copyright (c) 2001 Steve Chervitz. All Rights Reserved.
|
|
65
|
|
66 =head1 DISCLAIMER
|
|
67
|
|
68 This software is provided "as is" without warranty of any kind.
|
|
69
|
|
70 =cut
|
|
71
|
|
72 =head1 APPENDIX
|
|
73
|
|
74
|
|
75 The rest of the documentation details each of the object methods.
|
|
76
|
|
77 =cut
|
|
78
|
|
79 # Let the code begin...
|
|
80
|
|
81 package Bio::Search::GenericDatabase;
|
|
82
|
|
83 use strict;
|
|
84 use Bio::Search::DatabaseI;
|
|
85 use Bio::Root::Root;
|
|
86 use vars qw( @ISA );
|
|
87
|
|
88 @ISA = qw( Bio::Root::Root Bio::Search::DatabaseI);
|
|
89
|
|
90 sub new {
|
|
91 my ($class, @args) = @_;
|
|
92 my $self = $class->SUPER::new(@args);
|
|
93 my ($name, $date, $length, $ents) =
|
|
94 $self->_rearrange( [qw(NAME DATE LENGTH ENTRIES)], @args);
|
|
95
|
|
96 $name && $self->name($name);
|
|
97 $date && $self->date($date);
|
|
98 $length && $self->letters($length);
|
|
99 $ents && $self->entries($ents);
|
|
100
|
|
101 return $self;
|
|
102 }
|
|
103
|
|
104 =head2 name
|
|
105
|
|
106 See L<Bio::Search::DatabaseI::name>() for documentation
|
|
107
|
|
108 This implementation is a combined set/get accessor.
|
|
109
|
|
110 =cut
|
|
111
|
|
112 #---------------
|
|
113 sub name {
|
|
114 #---------------
|
|
115 my $self = shift;
|
|
116 if(@_) {
|
|
117 my $name = shift;
|
|
118 $name =~ s/(^\s+|\s+$)//g;
|
|
119 $self->{'_db'} = $name;
|
|
120 }
|
|
121 $self->{'_db'};
|
|
122 }
|
|
123
|
|
124 =head2 date
|
|
125
|
|
126 See L<Bio::Search::DatabaseI::date>() for documentation
|
|
127
|
|
128 This implementation is a combined set/get accessor.
|
|
129
|
|
130 =cut
|
|
131
|
|
132 #-----------------------
|
|
133 sub date {
|
|
134 #-----------------------
|
|
135 my $self = shift;
|
|
136 if(@_) { $self->{'_dbDate'} = shift; }
|
|
137 $self->{'_dbDate'};
|
|
138 }
|
|
139
|
|
140
|
|
141 =head2 letters
|
|
142
|
|
143 See L<Bio::Search::DatabaseI::letters>() for documentation
|
|
144
|
|
145 This implementation is a combined set/get accessor.
|
|
146
|
|
147 =cut
|
|
148
|
|
149 #----------------------
|
|
150 sub letters {
|
|
151 #----------------------
|
|
152 my $self = shift;
|
|
153 if(@_) { $self->{'_dbLetters'} = shift; }
|
|
154 $self->{'_dbLetters'};
|
|
155 }
|
|
156
|
|
157
|
|
158 =head2 entries
|
|
159
|
|
160 See L<Bio::Search::DatabaseI::entries>() for documentation
|
|
161
|
|
162 This implementation is a combined set/get accessor.
|
|
163
|
|
164 =cut
|
|
165
|
|
166 #------------------
|
|
167 sub entries {
|
|
168 #------------------
|
|
169 my $self = shift;
|
|
170 if(@_) { $self->{'_dbEntries'} = shift; }
|
|
171 $self->{'_dbEntries'};
|
|
172 }
|
|
173
|
|
174 1;
|