* sync with trunk
[bioperl-live.git] / Bio / Search / GenericDatabase.pm
blobfc03807d265dc0b4bf1511bad21628490c9073a3
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 L<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://bioperl.org/wiki/Mailing_lists - 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 the
51 web:
53 http://bugzilla.open-bio.org/
55 =head1 AUTHOR
57 Steve Chervitz E<lt>sac@bioperl.orgE<gt>
59 See L<the FEEDBACK section | FEEDBACK> for where to send bug reports and comments.
61 =head1 COPYRIGHT
63 Copyright (c) 2001 Steve Chervitz. All Rights Reserved.
65 =head1 DISCLAIMER
67 This software is provided "as is" without warranty of any kind.
69 =cut
71 =head1 APPENDIX
74 The rest of the documentation details each of the object methods.
76 =cut
78 # Let the code begin...
80 package Bio::Search::GenericDatabase;
82 use strict;
84 use base qw(Bio::Root::Root Bio::Search::DatabaseI);
86 sub new {
87 my ($class, @args) = @_;
88 my $self = $class->SUPER::new(@args);
89 my ($name, $date, $length, $ents) =
90 $self->_rearrange( [qw(NAME DATE LENGTH ENTRIES)], @args);
92 $name && $self->name($name);
93 $date && $self->date($date);
94 $length && $self->letters($length);
95 $ents && $self->entries($ents);
97 return $self;
100 =head2 name
102 See L<Bio::Search::DatabaseI::name>() for documentation
104 This implementation is a combined set/get accessor.
106 =cut
108 #---------------
109 sub name {
110 #---------------
111 my $self = shift;
112 if(@_) {
113 my $name = shift;
114 $name =~ s/(^\s+|\s+$)//g;
115 $self->{'_db'} = $name;
117 $self->{'_db'};
120 =head2 date
122 See L<Bio::Search::DatabaseI::date>() for documentation
124 This implementation is a combined set/get accessor.
126 =cut
128 #-----------------------
129 sub date {
130 #-----------------------
131 my $self = shift;
132 if(@_) { $self->{'_dbDate'} = shift; }
133 $self->{'_dbDate'};
137 =head2 letters
139 See L<Bio::Search::DatabaseI::letters>() for documentation
141 This implementation is a combined set/get accessor.
143 =cut
145 #----------------------
146 sub letters {
147 #----------------------
148 my $self = shift;
149 if(@_) { $self->{'_dbLetters'} = shift; }
150 $self->{'_dbLetters'};
154 =head2 entries
156 See L<Bio::Search::DatabaseI::entries>() for documentation
158 This implementation is a combined set/get accessor.
160 =cut
162 #------------------
163 sub entries {
164 #------------------
165 my $self = shift;
166 if(@_) { $self->{'_dbEntries'} = shift; }
167 $self->{'_dbEntries'};