The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bio::Phylo::Adaptor::Bioperl::Node - Adaptor class for bioperl compatibility

SYNOPSIS

use Bio::Phylo::Forest::Node;
use Bio::Phylo::Adaptor;

my $node = Bio::Phylo::Forest::Node->new;

$Bio::Phylo::COMPAT = 'Bioperl';

my $bpnode = Bio::Phylo::Adaptor->new($node);

print "compatible!" if $bpnode->isa('Bio::Tree::NodeI');

DESCRIPTION

This class wraps Bio::Phylo::Forest::Node objects to give them an interface compatible with bioperl.

METHODS

add_Descendent()

Adds a descendent to a node.

Title   : add_Descendent
Usage   : $node->add_Descendant($node);
Function: Adds a descendent to a node
Returns : number of current descendents for this node
Args    : Bio::Node::NodeI
each_Descendent()

All the descendents for this Node.

 Title   : each_Descendent
 Usage   : my @nodes = $node->each_Descendent;
 Function: all the descendents for this Node (but not their descendents 
					      i.e. not a recursive fetchall)
 Returns : Array of Bio::Tree::NodeI objects
 Args    : none
get_all_Descendents()

Recursively fetch all the nodes and their descendents.

Title   : get_all_Descendents($sortby)
Usage   : my @nodes = $node->get_all_Descendents;
Function: Recursively fetch all the nodes and their descendents
          *NOTE* This is different from each_Descendent
Returns : Array or Bio::Tree::NodeI objects
Args    : $sortby [optional] "height", "creation" or coderef to be used
          to sort the order of children nodes.
get_Descendents()

Alias to get_all_Descendents for backward compatibility.

is_Leaf()

Get Leaf status.

Title   : is_Leaf
Usage   : if( $node->is_Leaf ) 
Function: Get Leaf status
Returns : boolean
Args    : none
descendent_count()

Counts the number of descendents a node has.

Title   : descendent_count
Usage   : my $count = $node->descendent_count;
Function: Counts the number of descendents a node has 
          (and all of their subnodes)
Returns : integer
Args    : none
to_string()

For debugging, provide a node as a string.

Title   : to_string
Usage   : my $str = $node->to_string()
Function: For debugging, provide a node as a string
Returns : string
Args    : none
height()

Returns the height of the tree starting at this.

Title   : height
Usage   : my $len = $node->height
Function: Returns the height of the tree starting at this
          node.  Height is the maximum branchlength.
Returns : The longest length (weighting branches with branch_length) to a leaf
Args    : none
branch_length()

Get/Set the branch length.

Title   : branch_length
Usage   : $obj->branch_length()
Function: Get/Set the branch length
Returns : value of branch_length
Args    : newvalue (optional)
id()

The human readable identifier for the node.

Title   : id
Usage   : $obj->id($newval)
Function: The human readable identifier for the node 
Returns : value of human readable id
Args    : newvalue (optional)
internal_id()

Returns the internal unique id for this Node.

Title   : internal_id
Usage   : my $internalid = $node->internal_id
Function: Returns the internal unique id for this Node
Returns : unique id
Args    : none
description()

Get/Set the description string.

Title   : description
Usage   : $obj->description($newval)
Function: Get/Set the description string
Returns : value of description
Args    : newvalue (optional)
bootstrap()

Get/Set the bootstrap value.

Title   : bootstrap
Usage   : $obj->bootstrap($newval)
Function: Get/Set the bootstrap value
Returns : value of bootstrap
Args    : newvalue (optional)
ancestor()

Get/Set the ancestor node pointer for a Node.

Title   : ancestor
Usage   : my $node = $node->ancestor;
Function: Get/Set the ancestor node pointer for a Node
Returns : Null if this is top level node
Args    : none
invalidate_height()

Invalidate our cached value of the node height in the tree.

Title   : invalidate_height
Usage   : private helper method
Function: Invalidate our cached value of the node height in the tree
Returns : nothing
Args    : none
add_tag_value()

Adds a tag value to a node.

Title   : add_tag_value
Usage   : $node->add_tag_value($tag,$value)
Function: Adds a tag value to a node 
Returns : number of values stored for this tag
Args    : $tag   - tag name
          $value - value to store for the tag
remove_tag()

Remove the tag and all values for this tag.

Title   : remove_tag
Usage   : $node->remove_tag($tag)
Function: Remove the tag and all values for this tag
Returns : boolean representing success (0 if tag does not exist)
Args    : $tag - tagname to remove
remove_all_tags()

Removes all tags.

Title   : remove_all_tags
Usage   : $node->remove_all_tags()
Function: Removes all tags 
Returns : None
Args    : None
get_all_tags()

Gets all the tag names for this Node.

Title   : get_all_tags
Usage   : my @tags = $node->get_all_tags()
Function: Gets all the tag names for this Node
Returns : Array of tagnames
Args    : None
get_tag_values()

Gets the values for given tag.

Title   : get_tag_values
Usage   : my @values = $node->get_tag_value($tag)
Function: Gets the values for given tag ($tag)
Returns : Array of values or empty list if tag does not exist
Args    : $tag - tag name
has_tag()

Boolean test if tag exists in the Node.

Title   : has_tag
Usage   : $node->has_tag($tag)
Function: Boolean test if tag exists in the Node
Returns : Boolean
Args    : $tag - tagname

SEE ALSO

Bio::Phylo::Adaptor

The base class for the adaptor architecture, instantiates the appropriate wrapper depending on $Bio::Phylo::COMPAT

Bio::Tree::NodeI

Bio::Phylo::Adaptor::Bioperl::Node is an adaptor that makes Bio::Phylo nodes compatible with the Bio::Tree::NodeI interface.

Bio::Phylo::Manual

Also see the manual: Bio::Phylo::Manual.

REVISION

$Id: Node.pm 4265 2007-07-20 14:14:44Z rvosa $