1
# $Id: IdentifiableI.pm,v 1.6 2002/10/23 18:07:49 lapp Exp $
4
# This module is licensed under the same terms as Perl itself. You use,
5
# modify, and redistribute it under the terms of the Perl Artistic License.
10
Bio::IdentifiableI - interface for objects with identifiers
15
# to test this is an identifiable object
17
$obj->isa("Bio::IdentifiableI") ||
18
$obj->throw("$obj does not implement the Bio::IdentifiableI interface");
22
$object_id = $obj->object_id();
23
$namespace = $obj->namespace();
24
$authority = $obj->authority();
25
$version = $obj->version();
29
$lsid = $obj->lsid_string(); # gives authority:namespace:object_id
30
$ns_string = $obj->namespace_string(); # gives namespace:object_id.version
35
This interface describes methods expected on identifiable objects, ie
36
ones which have identifiers expected to make sense across a number of
37
instances and/or domains. This interface is modeled after pretty much
38
ubiquitous ideas for names in bioinformatics being
40
databasename:object_id.version
50
We also work well with LSID proposals which adds in the concept of an
51
authority, being the DNS name of the organisation assigning the namespace.
52
Helper functions are provided to make useful strings being
55
lsid_string - string complying to the LSID standard
56
namespace_string - string complying to the usual convention of
57
namespace:object_id.version
63
User feedback is an integral part of the evolution of this and other
64
Bioperl modules. Send your comments and suggestions preferably to one
65
of the Bioperl mailing lists. Your participation is much appreciated.
67
bioperl-l@bioperl.org - General discussion
68
http://bio.perl.org/MailList.html - About the mailing lists
72
Report bugs to the Bioperl bug tracking system to help us keep track
73
the bugs and their resolution. Bug reports can be submitted via email
76
bioperl-bugs@bio.perl.org
77
http://bugzilla.bioperl.org/
79
=head1 AUTHOR - Ewan Birney
81
Email birney@sanger.ac.uk
85
package Bio::IdentifiableI;
91
@ISA = qw(Bio::Root::RootI);
93
=head1 Implementation Specific Functions
95
These functions are the ones that a specific implementation must
101
Usage : $string = $obj->object_id()
102
Function: a string which represents the stable primary identifier
103
in this namespace of this object. For DNA sequences this
104
is its accession_number, similarly for protein sequences
113
$self->throw_not_implemented();
119
Usage : $version = $obj->version()
120
Function: a number which differentiates between versions of
121
the same object. Higher numbers are considered to be
122
later and more relevant, but a single object described
123
the same identifier should represent the same concept
132
$self->throw_not_implemented();
139
Usage : $authority = $obj->authority()
140
Function: a string which represents the organisation which
141
granted the namespace, written as the DNS name for
142
organisation (eg, wormbase.org)
151
$self->throw_not_implemented();
158
Usage : $string = $obj->namespace()
159
Function: A string representing the name space this identifier
160
is valid in, often the database name or the name
161
describing the collection
170
$self->throw_not_implemented();
175
=head1 Implementation optional functions
177
These functions are helper functions that are provided by
178
the interface but can be overridden if so wished
183
Usage : $string = $obj->lsid_string()
184
Function: a string which gives the LSID standard
185
notation for the identifier of interest
195
return $self->authority.":".$self->namespace.":".$self->object_id;
200
=head2 namespace_string
202
Title : namespace_string
203
Usage : $string = $obj->namespace_string()
204
Function: a string which gives the common notation of
205
namespace:object_id.version
211
sub namespace_string {
214
return $self->namespace.":".$self->object_id .
215
(defined($self->version()) ? ".".$self->version : '');