File Coverage

Bio/DB/GFF/Featname.pm
Criterion Covered Total %
statement 16 19 84.2
branch n/a
condition n/a
subroutine 8 10 80.0
pod 6 6 100.0
total 30 35 85.7


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             Bio::DB::GFF::Featname -- The name of a feature
4              
5             =head1 SYNOPSIS
6              
7             use Bio::DB::GFF;
8              
9             my $db = Bio::DB::GFF->new( -adaptor => 'dbi:mysql',
10             -dsn => 'dbi:mysql:elegans42');
11              
12             my $feature = Bio::DB::GFF::Featname->new(Locus => 'unc-19');
13             my $segment = $db->segment($feature);
14              
15             =head1 DESCRIPTION
16              
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-Enew() and Bio::DB::GFF-Esegment() as a
21             replacement for the -name and -class arguments.
22              
23             =head1 METHODS
24              
25             =cut
26              
27             package Bio::DB::GFF::Featname;
28 3     3   15 use strict;
  3         6  
  3         69  
29 3     3   12 use base qw(Bio::Root::RootI);
  3         3  
  3         774  
30              
31             use overload
32 3         15 '""' => 'asString',
33 3     3   18 fallback => 1;
  3         3  
34              
35             =head2 new
36              
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
43              
44             =cut
45              
46             sub new {
47             # use a blessed array for speed
48 434     434 1 495 my $pack = shift;
49 434         1293 bless [@_],$pack; # class,name
50             }
51              
52 0     0   0 sub _cleanup_methods { return; }
53              
54             =head2 id
55              
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
62              
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.
66              
67             =cut
68              
69             sub id {
70 0     0 1 0 my $self = shift;
71 0         0 return join ':',@$self;
72             }
73              
74             =head2 name
75              
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
82              
83             =cut
84              
85 3925     3925 1 12419 sub name { shift->[1] }
86              
87             =head2 class
88              
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
95              
96             =cut
97              
98 669     669 1 965 sub class { shift->[0] }
99              
100             =head2 asString
101              
102             Title : asString
103             Usage : $string = $name->asString
104             Function: same as name()
105             Returns : a string
106             Args : none
107             Status : Public
108              
109             This method is used to overload the "" operator. It is equivalent to
110             calling name().
111              
112             =cut
113              
114 3925     3925 1 8740 sub asString { shift->name }
115              
116             =head2 clone
117              
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
124              
125             This method creates an exact copy of the object.
126              
127             =cut
128              
129             sub clone {
130 107     107 1 129 my $self = shift;
131 107         223 return bless [@$self],ref $self;
132             }
133              
134             =head1 BUGS
135              
136             This module is still under development.
137              
138             =head1 SEE ALSO
139              
140             L, L, L
141              
142             =head1 AUTHOR
143              
144             Lincoln Stein Elstein@cshl.orgE.
145              
146             Copyright (c) 2001 Cold Spring Harbor Laboratory.
147              
148             This library is free software; you can redistribute it and/or modify
149             it under the same terms as Perl itself.
150              
151             =cut
152              
153             1;