Sync'ed RichSeqI with the implementation. RichSeq provides backward
[bioperl-live.git] / Bio / Search / GenericDatabase.pm
blobc4b5049f7c290ebb25202db27927768b2e532b56
1 #-----------------------------------------------------------------
2 # $Id$
4 # BioPerl module Bio::Search::GenericDatabase
6 # Cared for by Steve Chervitz <sac@bioperl.org>
8 # You may distribute this module under the same terms as perl itself
9 #-----------------------------------------------------------------
11 # POD documentation - main docs before the code
13 =head1 NAME
15 Bio::Search::GenericDatabase - Generic implementation of Bio::Search::DatabaseI
17 =head1 SYNOPSIS
19 use Bio::Search::GenericDatabase;
21 $db = Bio::Search::GenericDatabase->new( -name => 'my Blast db',
22 -date => '2001-03-13',
23 -length => 2352511,
24 -entries => 250000 );
26 $name = $db->name();
27 $date = $db->date();
28 $num_letters = $db->letters();
29 $num_entries = $db->entries();
31 =head1 DESCRIPTION
33 This module provides a basic implementation of B<Bio::Search::DatabaseI>.
34 See documentation in that module for more information.
36 =head1 FEEDBACK
38 =head2 Mailing Lists
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.
44 bioperl-l@bioperl.org - General discussion
45 http://bio.perl.org/MailList.html - About the mailing lists
47 =head2 Reporting Bugs
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:
53 bioperl-bugs@bio.perl.org
54 http://bugzilla.bioperl.org/
56 =head1 AUTHOR
58 Steve Chervitz E<lt>sac@bioperl.orgE<gt>
60 See L<the FEEDBACK section | FEEDBACK> for where to send bug reports and comments.
62 =head1 COPYRIGHT
64 Copyright (c) 2001 Steve Chervitz. All Rights Reserved.
66 =head1 DISCLAIMER
68 This software is provided "as is" without warranty of any kind.
70 =cut
72 =head1 APPENDIX
75 The rest of the documentation details each of the object methods.
77 =cut
79 # Let the code begin...
81 package Bio::Search::GenericDatabase;
83 use strict;
84 use Bio::Search::DatabaseI;
85 use Bio::Root::Root;
86 use vars qw( @ISA );
88 @ISA = qw( Bio::Root::Root Bio::Search::DatabaseI);
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);
96 $name && $self->name($name);
97 $date && $self->date($date);
98 $length && $self->letters($length);
99 $ents && $self->entries($ents);
101 return $self;
104 =head2 name
106 See L<Bio::Search::DatabaseI::name>() for documentation
108 This implementation is a combined set/get accessor.
110 =cut
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;
121 $self->{'_db'};
124 =head2 date
126 See L<Bio::Search::DatabaseI::date>() for documentation
128 This implementation is a combined set/get accessor.
130 =cut
132 #-----------------------
133 sub date {
134 #-----------------------
135 my $self = shift;
136 if(@_) { $self->{'_dbDate'} = shift; }
137 $self->{'_dbDate'};
141 =head2 letters
143 See L<Bio::Search::DatabaseI::letters>() for documentation
145 This implementation is a combined set/get accessor.
147 =cut
149 #----------------------
150 sub letters {
151 #----------------------
152 my $self = shift;
153 if(@_) { $self->{'_dbLetters'} = shift; }
154 $self->{'_dbLetters'};
158 =head2 entries
160 See L<Bio::Search::DatabaseI::entries>() for documentation
162 This implementation is a combined set/get accessor.
164 =cut
166 #------------------
167 sub entries {
168 #------------------
169 my $self = shift;
170 if(@_) { $self->{'_dbEntries'} = shift; }
171 $self->{'_dbEntries'};