buzgilla -> redmine
[bioperl-db.git] / lib / Bio / BioEntry.pm
blob8aa53eb718e2579de0b704be82964fce596614e7
1 # $Id$
3 # BioPerl module for Bio::BioEntry
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Hilmar Lapp <hlapp at gmx.net>
9 # Copyright Hilmar Lapp
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 =head1 NAME
17 Bio::BioEntry - DESCRIPTION of Object
19 =head1 SYNOPSIS
21 Give standard usage here
23 =head1 DESCRIPTION
25 Describe the object here
27 =head1 FEEDBACK
29 =head2 Mailing Lists
31 User feedback is an integral part of the evolution of this and other
32 Bioperl modules. Send your comments and suggestions preferably to
33 the Bioperl mailing list. Your participation is much appreciated.
35 bioperl-l@bioperl.org - General discussion
36 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
38 =head2 Support
40 Please direct usage questions or support issues to the mailing list:
42 I<bioperl-l@bioperl.org>
44 rather than to the module maintainer directly. Many experienced and
45 reponsive experts will be able look at the problem and quickly
46 address it. Please include a thorough description of the problem
47 with code and data examples if at all possible.
49 =head2 Reporting Bugs
51 Report bugs to the Bioperl bug tracking system to help us keep track
52 of the bugs and their resolution. Bug reports can be submitted via
53 the web:
55 http://redmine.open-bio.org/projects/bioperl/
57 =head1 AUTHOR - Hilmar Lapp
59 Email hlapp at gmx.net
61 Describe contact details here
63 =head1 CONTRIBUTORS
65 Additional contributors names and emails here
67 =head1 APPENDIX
69 The rest of the documentation details each of the object methods.
70 Internal methods are usually preceded with a _
72 =cut
75 # Let the code begin...
78 package Bio::BioEntry;
79 use vars qw(@ISA);
80 use strict;
82 # Object preamble - inherits from Bio::Root::Root
84 use Bio::Root::Root;
85 use Bio::IdentifiableI;
86 use Bio::DescribableI;
88 @ISA = qw(Bio::Root::Root Bio::IdentifiableI Bio::DescribableI);
90 =head2 new
92 Title : new
93 Usage : my $obj = Bio::BioEntry->new();
94 Function: Builds a new Bio::BioEntry object
95 Returns : an instance of Bio::BioEntry
96 Args :
99 =cut
101 sub new {
102 my($class,@args) = @_;
104 my $self = $class->SUPER::new(@args);
105 my ($objid, $ns, $auth, $v, $display_id, $desc) =
106 $self->_rearrange([qw(OBJECT_ID
107 NAMESPACE
108 AUTHORITY
109 VERSION
110 DISPLAY_ID
111 DESCRIPTION)
113 @args);
115 $self->object_id($objid) if $objid;
116 $self->namespace($ns) if $ns;
117 $self->authority($auth) if $auth;
118 $self->version($v) if $v;
119 $self->display_name($display_id) if $display_id;
120 $self->description($desc) if $desc;
122 return $self;
125 =head1 Methods for Bio::IdentifiableI compliance
127 =head2 object_id
129 Title : object_id
130 Usage : $string = $obj->object_id()
131 Function: a string which represents the stable primary identifier
132 in this namespace of this object. For DNA sequences this
133 is its accession_number, similarly for protein sequences
135 This is aliased to accession_number().
136 Returns : A scalar
139 =cut
141 sub object_id {
142 my ($self, $value) = @_;
144 if( defined $value) {
145 $self->{'object_id'} = $value;
147 return $self->{'object_id'};
150 =head2 version
152 Title : version
153 Usage : $version = $obj->version()
154 Function: a number which differentiates between versions of
155 the same object. Higher numbers are considered to be
156 later and more relevant, but a single object described
157 the same identifier should represent the same concept
159 Returns : A number
161 =cut
163 sub version{
164 my ($self,$value) = @_;
165 if( defined $value) {
166 $self->{'_version'} = $value;
168 return $self->{'_version'};
172 =head2 authority
174 Title : authority
175 Usage : $authority = $obj->authority()
176 Function: a string which represents the organisation which
177 granted the namespace, written as the DNS name for
178 organisation (eg, wormbase.org)
180 Returns : A scalar
182 =cut
184 sub authority {
185 my ($obj,$value) = @_;
186 if( defined $value) {
187 $obj->{'authority'} = $value;
189 return $obj->{'authority'};
192 =head2 namespace
194 Title : namespace
195 Usage : $string = $obj->namespace()
196 Function: A string representing the name space this identifier
197 is valid in, often the database name or the name
198 describing the collection
200 Returns : A scalar
203 =cut
205 sub namespace{
206 my ($self,$value) = @_;
207 if( defined $value) {
208 $self->{'namespace'} = $value;
210 return $self->{'namespace'} || "";
213 =head1 Methods for Bio::DescribableI compliance
215 =head2 display_name
217 Title : display_name
218 Usage : $string = $obj->display_name()
219 Function: A string which is what should be displayed to the user
220 the string should have no spaces (ideally, though a cautious
221 user of this interface would not assumme this) and should be
222 less than thirty characters (though again, double checking
223 this is a good idea)
225 This is aliased to display_id().
226 Returns : A scalar
228 =cut
230 sub display_name {
231 my ($self,$value) = @_;
232 if( defined $value) {
233 $self->{'_display_name'} = $value;
235 return $self->{'_display_name'};
238 =head2 description
240 Title : description
241 Usage : $string = $obj->description()
242 Function: A text string suitable for displaying to the user a
243 description. This string is likely to have spaces, but
244 should not have any newlines or formatting - just plain
245 text. The string should not be greater than 255 characters
246 and clients can feel justified at truncating strings at 255
247 characters for the purposes of display
249 This is aliased to desc().
250 Returns : A scalar
252 =cut
254 sub description {
255 my ($self,$value) = @_;
257 if( defined $value) {
258 $self->{'_description'} = $value;
260 return $self->{'_description'};