3 Bio::DB::GFF::Typename -- The name of a feature type
9 my $type = Bio::DB::GFF::Typename->new(similarity => 'BLAT_EST_GENOME');
10 my $segment = $segment->features($type);
14 Bio::DB::GFF::Typename objects encapsulate the combination of feature
15 method and source used by the GFF flat file format. They can be used
16 in the Bio::DB::GFF modules wherever a feature type is called for.
18 Since there are relatively few types and many features, this module
19 maintains a memory cache of unique types so that two features of the
20 same type will share the same Bio::DB::GFF::Typename object.
26 package Bio
::DB
::GFF
::Typename
;
34 use base
qw(Bio::Root::Root Bio::Das::FeatureTypeI);
36 # cut down on the number of equivalent objects we have to create
42 Usage : $type = Bio::DB::GFF::Typename->new($method,$source)
43 Function: create a new Bio::DB::GFF::Typename object
44 Returns : a new Bio::DB::GFF::Typename object
45 Args : method and source
52 my ($method,$source) = @_;
55 if ($source eq '' && $method =~ /^([\w\-\.]+):([\w\-\.]*)$/) {
59 return $OBJECT_CACHE{"$method:$source"} ||= bless [$method,$source],$package;
65 Usage : $method = $type->method([$newmethod])
66 Function: get or set the method
67 Returns : a method name
68 Args : new method name (optional)
76 $self->[0] = shift if @_;
84 Usage : $source = $type->source([$newsource])
85 Function: get or set the source
86 Returns : a source name
87 Args : new source name (optional)
95 $self->[1] = shift if @_;
102 Usage : $string = $type->asString
103 Function: get the method and source as a string
104 Returns : a string in "method:source" format
108 This method is used by operator overloading to overload the '""'
114 $_[0]->[1] ?
join ':',@
{$_[0]} : $_[0]->[0];
120 Usage : $new_clone = $type->clone;
121 Function: clone this object
122 Returns : a new Bio::DB::GFF::Typename object
126 This method creates an exact copy of the object.
132 return bless [@
$self],ref $self;
138 Usage : $boolean = $type->match($type_or_string)
139 Function: fuzzy match on types
140 Returns : a flag indicating that the argument matches the object
141 Args : a Bio::DB::GFF::typename object, or a string in method:source format
144 This match allows Sequence:Link and Sequence: to match, but not
145 Sequence:Link and Sequence:Genomic_canonical.
152 my ($method,$source);
154 if (UNIVERSAL
::isa
($target,'Bio::DB::GFF::Typename')) {
155 ($method,$source) = ($target->method,$target->source);
157 ($method,$source) = split /:/,$target;
160 $source ||= ''; # quash uninit variable warnings
162 return if $method ne '' && $self->method ne '' && $method ne $self->method;
163 return if $source ne '' && $self->source ne '' && $source ne $self->source;
171 This module is still under development.
175 L<bioperl>, L<Bio::DB::GFF>, L<Bio::DB::RelSegment>
179 Lincoln Stein E<lt>lstein@cshl.orgE<gt>.
181 Copyright (c) 2001 Cold Spring Harbor Laboratory.
183 This library is free software; you can redistribute it and/or modify
184 it under the same terms as Perl itself.