| Bio-Phylo documentation | Contained in the Bio-Phylo distribution. |
Bio::Phylo::Taxa::TaxaLinker - Superclass for objects that link to taxa objects
use Bio::Phylo::Factory;
my $fac = Bio::Phylo::Factory->new;
my $matrix = $fac->create_matrix;
my $taxa = $fac->create_taxa;
if ( $matrix->isa('Bio::Phylo::Taxa::TaxaLinker') ) {
$matrix->set_taxa( $taxa );
}
This module is a superclass for objects that link to Bio::Phylo::Taxa objects.
Associates invocant with Bio::Phylo::Taxa argument.
Type : Mutator
Title : set_taxa
Usage : $obj->set_taxa( $taxa );
Function: Links the invocant object
to a taxa object.
Returns : Modified $obj
Args : A Bio::Phylo::Taxa object.
Removes association between invocant and Bio::Phylo::Taxa object.
Type : Mutator Title : unset_taxa Usage : $obj->unset_taxa(); Function: Removes the link between invocant object and taxa Returns : Modified $obj Args : NONE
Retrieves association between invocant and Bio::Phylo::Taxa object.
Type : Accessor
Title : get_taxa
Usage : my $taxa = $obj->get_taxa;
Function: Retrieves the Bio::Phylo::Taxa
object linked to the invocant.
Returns : Bio::Phylo::Taxa
Args : NONE
Comments: This method returns the Bio::Phylo::Taxa
object to which the invocant is linked.
The returned object can therefore contain
*more* taxa than are actually in the matrix.
Performs sanity check on taxon relationships.
Type : Interface method Title : check_taxa Usage : $obj->check_taxa Function: Performs sanity check on taxon relationships Returns : $obj Args : NONE
Creates a taxa block from the objects contents if none exists yet.
Type : Decorated interface method Title : make_taxa Usage : my $taxa = $obj->make_taxa Function: Creates a taxa block from the objects contents if none exists yet. Returns : $taxa Args : NONE
The matrix object subclasses Bio::Phylo::Taxa::TaxaLinker.
The forest object subclasses Bio::Phylo::Taxa::TaxaLinker.
Also see the manual: Bio::Phylo::Manual and http://rutgervos.blogspot.com.
If you use Bio::Phylo in published research, please cite it:
Rutger A Vos, Jason Caravas, Klaas Hartmann, Mark A Jensen and Chase Miller, 2011. Bio::Phylo - phyloinformatic analysis using Perl. BMC Bioinformatics 12:63. http://dx.doi.org/10.1186/1471-2105-12-63
$Id: TaxaLinker.pm 1660 2011-04-02 18:29:40Z rvos $
| Bio-Phylo documentation | Contained in the Bio-Phylo distribution. |
# $Id: TaxaLinker.pm 1660 2011-04-02 18:29:40Z rvos $ package Bio::Phylo::Taxa::TaxaLinker; use Bio::Phylo; use Bio::Phylo::Mediators::TaxaMediator; use Bio::Phylo::Util::Exceptions 'throw'; use Bio::Phylo::Util::CONSTANT qw'_TAXA_ looks_like_object'; use strict; my $logger = Bio::Phylo->get_logger; my $mediator = 'Bio::Phylo::Mediators::TaxaMediator'; my $TYPE_CONSTANT = _TAXA_;
sub set_taxa { my ( $self, $taxa ) = @_; if ( $taxa and looks_like_object $taxa, $TYPE_CONSTANT ) { $logger->info("setting taxa '$taxa'"); $mediator->set_link( '-one' => $taxa, '-many' => $self, ); } else { $logger->info("re-setting taxa link"); $mediator->remove_link( '-many' => $self ); } $self->check_taxa; return $self; }
sub unset_taxa { my $self = shift; $logger->info("unsetting taxa"); $self->set_taxa(); return $self; }
sub get_taxa { my $self = shift; $logger->debug("getting taxa"); return $mediator->get_link( '-source' => $self ); }
sub check_taxa { throw 'NotImplemented' => 'Not implemented!'; }
sub make_taxa { my $self = shift; if ( my $taxa = $self->get_taxa ) { return $taxa; } else { throw 'NotImplemented' => 'Not implemented!'; } } sub _cleanup { my $self = shift; }
1;