MDA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | List of all members
MDAT::Tree Class Reference

This class provides several methods to read, compute and manipulate trees. More...

#include <Tree.hpp>

Public Member Functions

Treeoperator= (const Tree &)=delete
 
Treeoperator= (Tree &&other)
 
void clear ()
 Deletes all nodes from the tree.
 
size_t n_species () const
 Returns the number of species in this tree. More...
 
const TreeNoderoot () const
 Returns pointer to the root of the tree. More...
 
TreeNoderoot ()
 
bool empty () const
 Returns true if no species are in the node. More...
 
Constructors & Destructors
 Tree ()
 
 Tree (const MDAT::Tree &)=delete
 
virtual ~Tree ()
 
Tree computation methods
void nj (const Matrix< float > &dist_mat, const std::vector< std::string > &names)
 Tree construction using the neighbour joining method. More...
 
void upgma (const Matrix< float > &dist_mat, const std::vector< std::string > &names, std::vector< int > &n_members)
 Tree construction using the UPGMA method. More...
 

Detailed Description

This class provides several methods to read, compute and manipulate trees.

Constructor & Destructor Documentation

MDAT::Tree::Tree ( )

Simple Constructor for a tree.

Member Function Documentation

bool MDAT::Tree::empty ( ) const
inline

Returns true if no species are in the node.

Returns
True if empty else false.
size_t MDAT::Tree::n_species ( ) const
inline

Returns the number of species in this tree.

Returns
The number of species
void MDAT::Tree::nj ( const Matrix< float > &  dist_mat,
const std::vector< std::string > &  names 
)

Tree construction using the neighbour joining method.

This method returns a rooted binary tree. As the method usually returns a unrooted tree one of the edge lengths of the tree has been set to 0. This method has been first described in: Saitou N, Nei M. "The neighbor-joining method: a new method for reconstructing phylogenetic trees." Molecular Biology and Evolution, volume 4, issue 4, pp. 406-425, July 1987.

Parameters
dist_matA matrix giving the distances between the species.
namesThe names of the species.
const TreeNode* MDAT::Tree::root ( ) const
inline

Returns pointer to the root of the tree.

Returns
Pointer to the root.
void MDAT::Tree::upgma ( const Matrix< float > &  dist_mat,
const std::vector< std::string > &  names,
std::vector< int > &  n_members 
)

Tree construction using the UPGMA method.

The UPGMA (Unweighted Pair Group Method with Arithmetic Mean) method has been first described in: Sokal R and Michener C (1958). "A statistical method for evaluating systematic relationships". University of Kansas Science Bulletin 38: 1409–1438.

Parameters
dist_matA matrix giving the distances between the species.
namesThe names of the species.