comparison variant_effect_predictor/Bio/DB/GFF/Featname.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
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-E<gt>new() and Bio::DB::GFF-E<gt>segment() 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 use strict;
29 use vars '@ISA';
30 use Bio::Root::RootI;
31 @ISA = qw(Bio::Root::RootI);
32
33 use overload
34 '""' => 'asString',
35 fallback => 1;
36
37 =head2 new
38
39 Title : new
40 Usage : $name = Bio::DB::GFF::Featname->new($class,$name)
41 Function: create a new Bio::DB::GFF::Featname object
42 Returns : a new Bio::DB::GFF::Featname object
43 Args : class and ID
44 Status : Public
45
46 =cut
47
48 sub new {
49 # use a blessed array for speed
50 my $pack = shift;
51 bless [@_],$pack; # class,name
52 }
53
54 sub _cleanup_methods { return; }
55
56 =head2 id
57
58 Title : id
59 Usage : $id = $name->id
60 Function: return a unique ID for the combination of class and name
61 Returns : a string
62 Args : none
63 Status : Public
64
65 This method returns a unique combination of the name and class in the
66 form "class:name". Coincidentally, this is the same format used
67 by AceDB.
68
69 =cut
70
71 sub id {
72 my $self = shift;
73 return join ':',@$self;
74 }
75
76 =head2 name
77
78 Title : name
79 Usage : $name = $name->name
80 Function: return the name of the Featname
81 Returns : a string
82 Args : none
83 Status : Public
84
85 =cut
86
87 sub name { shift->[1] }
88
89 =head2 class
90
91 Title : class
92 Usage : $class = $name->class
93 Function: return the name of the Featname
94 Returns : a string
95 Args : none
96 Status : Public
97
98 =cut
99
100 sub class { shift->[0] }
101
102 =head2 asString
103
104 Title : asString
105 Usage : $string = $name->asString
106 Function: same as name()
107 Returns : a string
108 Args : none
109 Status : Public
110
111 This method is used to overload the "" operator. It is equivalent to
112 calling name().
113
114 =cut
115
116 sub asString { shift->name }
117
118 =head2 clone
119
120 Title : clone
121 Usage : $new_clone = $type->clone;
122 Function: clone this object
123 Returns : a new Bio::DB::GFF::Featname object
124 Args : none
125 Status : Public
126
127 This method creates an exact copy of the object.
128
129 =cut
130
131 sub clone {
132 my $self = shift;
133 return bless [@$self],ref $self;
134 }
135
136 =head1 BUGS
137
138 This module is still under development.
139
140 =head1 SEE ALSO
141
142 L<bioperl>, L<Bio::DB::GFF>, L<Bio::DB::RelSegment>
143
144 =head1 AUTHOR
145
146 Lincoln Stein E<lt>lstein@cshl.orgE<gt>.
147
148 Copyright (c) 2001 Cold Spring Harbor Laboratory.
149
150 This library is free software; you can redistribute it and/or modify
151 it under the same terms as Perl itself.
152
153 =cut
154
155 1;