Bio::DB::GFF Typename
SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::DB::GFF::Typename -- The name of a feature type
Package variables
Privates (from "my" definitions)
%OBJECT_CACHE;
Synopsis
  use Bio::DB::GFF;

  my $type = Bio::DB::GFF::Typename->new(similarity => 'BLAT_EST_GENOME');
  my $segment = $segment->features($type);
Description
Bio::DB::GFF::Typename objects encapsulate the combination of feature
method and source used by the GFF flat file format. They can be used
in the Bio::DB::GFF modules wherever a feature type is called for.
Since there are relatively few types and many features, this module
maintains a memory cache of unique types so that two features of the
same type will share the same Bio::DB::GFF::Typename object.
Methods
newDescriptionCode
methodDescriptionCode
sourceDescriptionCode
asStringDescriptionCode
cloneDescriptionCode
matchDescriptionCode
Methods description
newcode    nextTop
 Title   : new
 Usage   : $type = Bio::DB::GFF::Typename->new($method,$source)
 Function: create a new Bio::DB::GFF::Typename object
 Returns : a new Bio::DB::GFF::Typename object
 Args    : method and source
 Status  : Public
methodcodeprevnextTop
 Title   : method
 Usage   : $method = $type->method([$newmethod])
 Function: get or set the method
 Returns : a method name
 Args    : new method name (optional)
 Status  : Public
sourcecodeprevnextTop
 Title   : source
 Usage   : $source = $type->source([$newsource])
 Function: get or set the source
 Returns : a source name
 Args    : new source name (optional)
 Status  : Public
asStringcodeprevnextTop
 Title   : asString
 Usage   : $string = $type->asString
 Function: get the method and source as a string
 Returns : a string in "method:source" format
 Args    : none
 Status  : Public
This method is used by operator overloading to overload the '""'
operator.
clonecodeprevnextTop
 Title   : clone
 Usage   : $new_clone = $type->clone;
 Function: clone this object
 Returns : a new Bio::DB::GFF::Typename object
 Args    : none
 Status  : Public
This method creates an exact copy of the object.
matchcodeprevnextTop
 Title   : match
 Usage   : $boolean = $type->match($type_or_string)
 Function: fuzzy match on types
 Returns : a flag indicating that the argument matches the object
 Args    : a Bio::DB::GFF::typename object, or a string in method:source format
 Status  : Public
This match allows Sequence:Link and Sequence: to match, but not
Sequence:Link and Sequence:Genomic_canonical.
Methods code
newdescriptionprevnextTop
sub new {
  my $package = shift;
  my ($method,$source) = @_;
  $method ||= '';
  $source ||= '';
  if ($source eq '' && $method =~ /^(\w+):(\w+)$/) {
    $method = $1;
    $source = $2;
  }
  return $OBJECT_CACHE{"$method:$source"} ||= bless [$method,$source],$package;
}
methoddescriptionprevnextTop
sub method {
  my $self = shift;
  my $d = $self->[0];
  $self->[0] = shift if @_;
  $d;
}
sourcedescriptionprevnextTop
sub source {
  my $self = shift;
  my $d = $self->[1];
  $self->[1] = shift if @_;
  $d;
}
asStringdescriptionprevnextTop
sub asString {
  $_[0]->[1] ? join ':',@{$_[0]} : $_[0]->[0];
}
clonedescriptionprevnextTop
sub clone {
  my $self = shift;
  return bless [@$self],ref $self;
}
matchdescriptionprevnextTop
sub match {
  my $self   = shift;
  my $target = shift;
  my ($method,$source);
  if (UNIVERSAL::isa($target,'Bio::DB::GFF::Typename')) {
    ($method,$source) = ($target->method,$target->source);
  } else {
    ($method,$source) = split /:/,$target;
  }

  return if $method ne '' && $self->method ne '' && $method ne $self->method;
  return if $source ne '' && $self->source ne '' && $source ne $self->source;
  1;
}
General documentation
BUGSTop
This module is still under development.
SEE ALSOTop
bioperl, Bio::DB::GFF, Bio::DB::RelSegment
AUTHORTop
Lincoln Stein <lstein@cshl.org>.
Copyright (c) 2001 Cold Spring Harbor Laboratory.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.