.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Bio::Tree::NodeI 3pm" .TH Bio::Tree::NodeI 3pm "2020-10-28" "perl v5.30.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Bio::Tree::NodeI \- Interface describing a Tree Node .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 5 \& # get a Tree::NodeI somehow \& # like from a TreeIO \& use Bio::TreeIO; \& # read in a clustalw NJ in phylip/newick format \& my $treeio = Bio::TreeIO\->new(\-format => \*(Aqnewick\*(Aq, \-file => \*(Aqfile.dnd\*(Aq); \& \& my $tree = $treeio\->next_tree; # we\*(Aqll assume it worked for demo purposes \& # you might want to test that it was defined \& \& my $rootnode = $tree\->get_root_node; \& \& # process just the next generation \& foreach my $node ( $rootnode\->each_Descendent() ) { \& print "branch len is ", $node\->branch_length, "\en"; \& } \& \& # process all the children \& my $example_leaf_node; \& foreach my $node ( $rootnode\->get_all_Descendents() ) { \& if( $node\->is_Leaf ) { \& print "node is a leaf ... "; \& # for example use below \& $example_leaf_node = $node unless defined $example_leaf_node; \& } \& print "branch len is ", $node\->branch_length, "\en"; \& } \& \& # The ancestor() method points to the parent of a node \& # A node can only have one parent \& \& my $parent = $example_leaf_node\->ancestor; \& \& # parent won\*(Aqt likely have an description because it is an internal node \& # but child will because it is a leaf \& \& print "Parent id: ", $parent\->id," child id: ", \& $example_leaf_node\->id, "\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" A NodeI is capable of the basic structure of building a tree and storing the branch length between nodes. The branch length is the length of the branch between the node and its ancestor, thus a root node in a Tree will not typically have a valid branch length. .PP Various implementations of NodeI may extend the basic functions and allow storing of other information (like attaching a species object or full sequences used to build a tree or alternative sequences). If you don't know how to extend a Bioperl object please ask, happy to help, we would also greatly appreciate contributions with improvements or extensions of the objects back to the Bioperl code base so that others don't have to reinvent your ideas. .SH "FEEDBACK" .IX Header "FEEDBACK" .SS "Mailing Lists" .IX Subsection "Mailing Lists" User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. .PP .Vb 2 \& bioperl\-l@bioperl.org \- General discussion \& http://bioperl.org/wiki/Mailing_lists \- About the mailing lists .Ve .SS "Support" .IX Subsection "Support" Please direct usage questions or support issues to the mailing list: .PP \&\fIbioperl\-l@bioperl.org\fR .PP rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. .SS "Reporting Bugs" .IX Subsection "Reporting Bugs" Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: .PP .Vb 1 \& https://github.com/bioperl/bioperl\-live/issues .Ve .SH "AUTHOR \- Jason Stajich" .IX Header "AUTHOR - Jason Stajich" Email jason@bioperl.org .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" Aaron Mackey amackey@virginia.edu .SH "APPENDIX" .IX Header "APPENDIX" The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ .SS "add_Descendent" .IX Subsection "add_Descendent" .Vb 5 \& Title : add_Descendent \& Usage : $node\->add_Descendent($node); \& Function: Adds a descendent to a node \& Returns : number of current descendents for this node \& Args : Bio::Node::NodeI .Ve .SS "each_Descendent" .IX Subsection "each_Descendent" .Vb 6 \& 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 .Ve .SS "Decorated Interface methods" .IX Subsection "Decorated Interface methods" .SS "get_all_Descendents" .IX Subsection "get_all_Descendents" .Vb 7 \& 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", "alpha", "revalpha", \& or a coderef to be used to sort the order of children nodes. .Ve .SS "is_Leaf" .IX Subsection "is_Leaf" .Vb 5 \& Title : is_Leaf \& Usage : if( $node\->is_Leaf ) \& Function: Get Leaf status \& Returns : boolean \& Args : none .Ve .SS "descendent_count" .IX Subsection "descendent_count" .Vb 6 \& 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 .Ve .SS "to_string" .IX Subsection "to_string" .Vb 5 \& Title : to_string \& Usage : my $str = $node\->to_string() \& Function: For debugging, provide a node as a string \& Returns : string \& Args : none .Ve .SS "height" .IX Subsection "height" .Vb 6 \& Title : height \& Usage : my $len = $node\->height \& Function: Returns the height of the tree starting at this \& node. Height is the maximum branchlength to get to the tip. \& Returns : The longest length (weighting branches with branch_length) to a leaf \& Args : none .Ve .SS "depth" .IX Subsection "depth" .Vb 6 \& Title : depth \& Usage : my $len = $node\->depth \& Function: Returns the depth of the tree starting at this \& node. Depth is the distance from this node to the root. \& Returns : The branch length to the root. \& Args : none .Ve .SS "Get/Set methods" .IX Subsection "Get/Set methods" .SS "branch_length" .IX Subsection "branch_length" .Vb 5 \& Title : branch_length \& Usage : $obj\->branch_length() \& Function: Get/Set the branch length \& Returns : value of branch_length \& Args : newvalue (optional) .Ve .SS "id" .IX Subsection "id" .Vb 5 \& Title : id \& Usage : $obj\->id($newval) \& Function: The human readable identifier for the node \& Returns : value of human readable id \& Args : newvalue (optional) .Ve .SS "internal_id" .IX Subsection "internal_id" .Vb 5 \& Title : internal_id \& Usage : my $internalid = $node\->internal_id \& Function: Returns the internal unique id for this Node \& Returns : unique id \& Args : none .Ve .SS "description" .IX Subsection "description" .Vb 5 \& Title : description \& Usage : $obj\->description($newval) \& Function: Get/Set the description string \& Returns : value of description \& Args : newvalue (optional) .Ve .SS "bootstrap" .IX Subsection "bootstrap" .Vb 5 \& Title : bootstrap \& Usage : $obj\->bootstrap($newval) \& Function: Get/Set the bootstrap value \& Returns : value of bootstrap \& Args : newvalue (optional) .Ve .SS "ancestor" .IX Subsection "ancestor" .Vb 5 \& 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 .Ve .SS "invalidate_height" .IX Subsection "invalidate_height" .Vb 5 \& Title : invalidate_height \& Usage : private helper method \& Function: Invalidate our cached value of the node height in the tree \& Returns : nothing \& Args : none .Ve .SS "Methods for associating Tag/Values with a Node" .IX Subsection "Methods for associating Tag/Values with a Node" These methods associate tag/value pairs with a Node .SS "set_tag_value" .IX Subsection "set_tag_value" .Vb 7 \& Title : set_tag_value \& Usage : $node\->set_tag_value($tag,$value) \& $node\->set_tag_value($tag,@values) \& Function: Sets a tag value(s) to a node. Replaces old values. \& Returns : number of values stored for this tag \& Args : $tag \- tag name \& $value \- value to store for the tag .Ve .SS "add_tag_value" .IX Subsection "add_tag_value" .Vb 6 \& 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 .Ve .SS "remove_tag" .IX Subsection "remove_tag" .Vb 5 \& 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 .Ve .SS "remove_all_tags" .IX Subsection "remove_all_tags" .Vb 5 \& Title : remove_all_tags \& Usage : $node\->remove_all_tags() \& Function: Removes all tags \& Returns : None \& Args : None .Ve .SS "get_all_tags" .IX Subsection "get_all_tags" .Vb 5 \& 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 .Ve .SS "get_tag_values" .IX Subsection "get_tag_values" .Vb 5 \& Title : get_tag_values \& Usage : my @values = $node\->get_tag_values($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 .Ve .SS "has_tag" .IX Subsection "has_tag" .Vb 5 \& Title : has_tag \& Usage : $node\->has_tag($tag) \& Function: Boolean test if tag exists in the Node \& Returns : Boolean \& Args : $tag \- tagname .Ve .SS "Helper Functions" .IX Subsection "Helper Functions" .SS "id_output" .IX Subsection "id_output" .Vb 7 \& Title : id_output \& Usage : my $id = $node\->id_output; \& Function: Return an id suitable for output in format like newick \& so that if it contains spaces or ():; characters it is properly \& quoted \& Returns : $id string if $node\->id has a value \& Args : none .Ve