maint: restructure to use Dist::Zilla
[bioperl-live.git] / lib / Bio / DB / GFF / Featname.pm
bloba0d64da8b670b5135062fb8d551fae44cee10106
1 =head1 NAME
3 Bio::DB::GFF::Featname -- The name of a feature
5 =head1 SYNOPSIS
7 use Bio::DB::GFF;
9 my $db = Bio::DB::GFF->new( -adaptor => 'dbi:mysql',
10 -dsn => 'dbi:mysql:elegans42');
12 my $feature = Bio::DB::GFF::Featname->new(Locus => 'unc-19');
13 my $segment = $db->segment($feature);
15 =head1 DESCRIPTION
17 Bio::DB::GFF::Featname is the name of a feature. It contains two
18 fields: name and class. It is typically used by the Bio::DB::GFF
19 module to denote a group, and is accepted by
20 Bio::DB::Relsegment-E<gt>new() and Bio::DB::GFF-E<gt>segment() as a
21 replacement for the -name and -class arguments.
23 =head1 METHODS
25 =cut
27 package Bio::DB::GFF::Featname;
28 use strict;
29 use base qw(Bio::Root::RootI);
31 use overload
32 '""' => 'asString',
33 fallback => 1;
35 =head2 new
37 Title : new
38 Usage : $name = Bio::DB::GFF::Featname->new($class,$name)
39 Function: create a new Bio::DB::GFF::Featname object
40 Returns : a new Bio::DB::GFF::Featname object
41 Args : class and ID
42 Status : Public
44 =cut
46 sub new {
47 # use a blessed array for speed
48 my $pack = shift;
49 bless [@_],$pack; # class,name
52 sub _cleanup_methods { return; }
54 =head2 id
56 Title : id
57 Usage : $id = $name->id
58 Function: return a unique ID for the combination of class and name
59 Returns : a string
60 Args : none
61 Status : Public
63 This method returns a unique combination of the name and class in the
64 form "class:name". Coincidentally, this is the same format used
65 by AceDB.
67 =cut
69 sub id {
70 my $self = shift;
71 return join ':',@$self;
74 =head2 name
76 Title : name
77 Usage : $name = $name->name
78 Function: return the name of the Featname
79 Returns : a string
80 Args : none
81 Status : Public
83 =cut
85 sub name { shift->[1] }
87 =head2 class
89 Title : class
90 Usage : $class = $name->class
91 Function: return the name of the Featname
92 Returns : a string
93 Args : none
94 Status : Public
96 =cut
98 sub class { shift->[0] }
100 =head2 asString
102 Title : asString
103 Usage : $string = $name->asString
104 Function: same as name()
105 Returns : a string
106 Args : none
107 Status : Public
109 This method is used to overload the "" operator. It is equivalent to
110 calling name().
112 =cut
114 sub asString { shift->name }
116 =head2 clone
118 Title : clone
119 Usage : $new_clone = $type->clone;
120 Function: clone this object
121 Returns : a new Bio::DB::GFF::Featname object
122 Args : none
123 Status : Public
125 This method creates an exact copy of the object.
127 =cut
129 sub clone {
130 my $self = shift;
131 return bless [@$self],ref $self;
134 =head1 BUGS
136 This module is still under development.
138 =head1 SEE ALSO
140 L<bioperl>, L<Bio::DB::GFF>, L<Bio::DB::RelSegment>
142 =head1 AUTHOR
144 Lincoln Stein E<lt>lstein@cshl.orgE<gt>.
146 Copyright (c) 2001 Cold Spring Harbor Laboratory.
148 This library is free software; you can redistribute it and/or modify
149 it under the same terms as Perl itself.
151 =cut