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