Package ete2 :: Package phylo :: Module phylotree :: Class PhyloNode
[hide private]
[frames] | no frames]

Class PhyloNode

source code

            object --+    
                     |    
coretype.tree.TreeNode --+
                         |
                        PhyloNode

Re-implementation of the standart TreeNode instance. It adds attributes and methods to work with phylogentic trees.

Instance Methods [hide private]
 
_get_species(self) source code
 
_set_species(self, value) source code
 
__init__(self, newick=None, alignment=None, alg_format='fasta', sp_naming_function=<function _parse_species at 0x261e848>, format=0)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
set_species_naming_function(self, fn) source code
 
link_to_alignment(self, alignment, alg_format='fasta') source code
 
get_species(self)
Returns the set of species covered by its partition.
source code
 
iter_species(self)
Returns an iterator over the species grouped by this node.
source code
 
is_monophyletic(self, species)
Returns True id species names under this node are all included in a given list or set of species names.
source code
 
get_age(self, species2age) source code
 
reconcile(self, species_tree)
Returns the reconcilied topology with the provided species tree, and a list of evolutionary events inferred from such reconciliation.
source code
 
get_my_evol_events(self, sos_thr=0.0)
Returns a list of duplication and speciation events in which the current node has been involved.
source code
 
get_descendant_evol_events(self, sos_thr=0.0)
Returns a list of **all** duplication and speciation events detected after this node.
source code
 
get_farthest_oldest_leaf(self, species2age)
Returns the farthest oldest leafnode to the current one.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

    Inherited from coretype.tree.TreeNode
 
__add__(self, value)
This allows to sum two trees.
source code
 
__and__(self, value)
This allows to execute tree&'A' to obtain the descendant node A
source code
 
__contains__(self, item)
Check if item belongs to this node.
source code
 
__iter__(self)
Iterator over leaf nodes
source code
 
__len__(self)
Node len returns number of children.
source code
 
__str__(self)
Print tree in newick format.
source code
 
_asciiArt(self, char1='-', show_internal=True, compact=False)
Returns the ASCII representation of the tree.
source code
 
_get_children(self) source code
 
_get_dist(self) source code
 
_get_support(self) source code
 
_get_up(self) source code
 
_iter_descendants_postorder(self)
Iterator over all desdecendant nodes.
source code
 
_iter_descendants_preorder(self)
Iterator over all desdecendant nodes.
source code
 
_set_children(self, value) source code
 
_set_dist(self, value) source code
 
_set_support(self, value) source code
 
_set_up(self, value) source code
 
add_child(self, child=None, name=None, dist=None, support=None)
Adds a new child to this node.
source code
 
add_feature(self, pr_name, pr_value)
Adds or updates a node's feature.
source code
 
add_features(self, **features)
Adds or updates a node's feature.
source code
 
add_sister(self, sister=None, name=None, dist=None)
Adds a sister to this node.
source code
 
collapse(self) source code
 
del_feature(self, pr_name)
Deletes permanently a node's feature.
source code
 
delete(self, prevent_nondicotomic=True)
Deletes node from the tree structure.
source code
 
describe(self)
Prints general information about this node and its connections.
source code
 
detach(self)
Detachs this node (and all its descendants) from its parent and returns the referent to itself.
source code
 
expand(self) source code
 
get_ascii(self, show_internal=True, compact=False)
Returns a string containing an ascii drawing of the tree.
source code
 
get_children(self)
Returns an independent list of node's children.
source code
 
get_common_ancestor(self, *target_nodes)
Returns the first common ancestor between this node and a given list of 'target_nodes'.
source code
 
get_descendants(self, strategy='preorder')
Returns the list of all nodes (leaves and internal) under this node.
source code
 
get_distance(self, target, target2=None, topology_only=False)
Returns the distance between two nodes.
source code
 
get_farthest_leaf(self, topology_only=False)
Returns node's farthest descendant node (which is always a leaf), and the distance to it.
source code
 
get_farthest_node(self, topology_only=False)
Returns the node's farthest descendant or ancestor node, and the distance to it.
source code
 
get_leaf_names(self)
Returns the list of terminal node names under the current node.
source code
 
get_leaves(self)
Returns the list of terminal nodes (leaves) under this node.
source code
 
get_leaves_by_name(self, name)
Returns a list of nodes marching a given name.
source code
 
get_midpoint_outgroup(self)
Returns the node that divides the current tree into two distance-balanced partitions.
source code
 
get_sisters(self)
Returns an indepent list of sister nodes.
source code
 
get_tree_root(self)
Returns the absolute root node of current tree structure.
source code
 
is_leaf(self) source code
 
is_root(self) source code
 
iter_descendants(self, strategy='preorder')
Returns an iterator over descendant nodes.
source code
 
iter_leaf_names(self)
Returns an iterator over the leaf names under this node.
source code
 
iter_leaves(self)
Returns an iterator over the leaves under this node.
source code
 
iter_search_nodes(self, **conditions) source code
 
populate(self, size, names_library=[], reuse_names=True)
Populates the partition under this node with a given number of leaves.
source code
 
prune(self, nodes)
Prunes the topology of this node in order to conserve only a selected list of leaf or internal nodes.
source code
 
remove_child(self, child)
Removes a child from this node (parent and child nodes still exit but are no longer connected).
source code
 
remove_sister(self, sister=None)
Removes a node's sister node.
source code
 
render(self, file_name, layout=None, w=None, h=None, img_properties=None, header=None)
Renders the tree structure into an image file.
source code
 
search_nodes(self, **conditions) source code
 
set_outgroup(self, outgroup)
Sets a descendant node as the outgroup of a tree.
source code
 
show(self, layout=None, image_properties=None)
Begins an interative session to visualize this node structure.
source code
 
swap_childs(self)
Swaps current childs order.
source code
 
traverse(self, strategy='preorder')
Returns an iterator that traverse the tree structure under this node.
source code
 
unroot(self)
Unroots this node.
source code
 
write(self, features=None, outfile=None, format=0)
Returns the newick representation of this node topology.
source code
Properties [hide private]
  species

Inherited from object: __class__

    Inherited from coretype.tree.TreeNode
  children
  dist
  support
  up
Method Details [hide private]

__init__(self, newick=None, alignment=None, alg_format='fasta', sp_naming_function=<function _parse_species at 0x261e848>, format=0)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

get_my_evol_events(self, sos_thr=0.0)

source code 

Returns a list of duplication and speciation events in which the current node has been involved. Scanned nodes are also labeled internally as dup=True|False. You can access this labels using the 'node.dup' sintaxis.

Method: the algorithm scans all nodes from the given leafName to the root. Nodes are assumed to be duplications when a species overlap is found between its child linages. Method is described more detail in:

"The Human Phylome." Huerta-Cepas J, Dopazo H, Dopazo J, Gabaldon T. Genome Biol. 2007;8(6):R109.

get_descendant_evol_events(self, sos_thr=0.0)

source code 

Returns a list of **all** duplication and speciation events detected after this node. Nodes are assumed to be duplications when a species overlap is found between its child linages. Method is described more detail in:

"The Human Phylome." Huerta-Cepas J, Dopazo H, Dopazo J, Gabaldon T. Genome Biol. 2007;8(6):R109.

get_farthest_oldest_leaf(self, species2age)

source code 

Returns the farthest oldest leafnode to the current one. It requieres an species2age dictionary with the age estimation for all species.


Property Details [hide private]

species

Get Method:
_get_species(self)
Set Method:
_set_species(self, value)