A library for working with phylogenetic and population genetic data.
SquashClustering Class Reference

#include <genesis/tree/mass_tree/squash_clustering.hpp>

Detailed Description

Perform Squash Clustering.

The class performs squash clustering and stores the results.

Definition at line 54 of file squash_clustering.hpp.

Public Member Functions

 SquashClustering ()=default
 SquashClustering (SquashClustering &&)=default
 SquashClustering (SquashClustering const &)=default
 ~SquashClustering ()=default
void clear ()
 Clear the clusters() and mergers() data. More...
std::vector< Cluster > const & clusters () const
std::vector< Merger > const & mergers () const
SquashClusteringoperator= (SquashClustering &&)=default
SquashClusteringoperator= (SquashClustering const &)=default
double p () const
SquashClusteringp (double value)
void run (std::vector< MassTree > &&trees)
 Perfom Squash Clustering. More...
std::string tree_string (std::vector< std::string > const &labels) const
 Build a Newick-format tree for visualizing the result of a squash_clustering(). More...

Public Attributes

std::function< void(void)> report_initialization
std::function< void(size_t i, size_t total)> report_step
std::function< void(MassTree const &cluster_tree, size_t index)> write_cluster_tree


struct  Cluster
struct  Merger

Constructor & Destructor Documentation

◆ SquashClustering() [1/3]

SquashClustering ( )

◆ ~SquashClustering()

~SquashClustering ( )

◆ SquashClustering() [2/3]

SquashClustering ( SquashClustering const &  )

◆ SquashClustering() [3/3]

Member Function Documentation

◆ clear()

void clear ( )

Clear the clusters() and mergers() data.

Definition at line 276 of file squash_clustering.cpp.

◆ clusters()

std::vector<Cluster> const& clusters ( ) const

Definition at line 169 of file squash_clustering.hpp.

◆ mergers()

std::vector<Merger> const& mergers ( ) const

Definition at line 174 of file squash_clustering.hpp.

◆ operator=() [1/2]

SquashClustering& operator= ( SquashClustering &&  )

◆ operator=() [2/2]

SquashClustering& operator= ( SquashClustering const &  )

◆ p() [1/2]

double p ( ) const

Definition at line 164 of file squash_clustering.hpp.

◆ p() [2/2]

SquashClustering& p ( double  value)

Definition at line 158 of file squash_clustering.hpp.

◆ run()

void run ( std::vector< MassTree > &&  trees)

Perfom Squash Clustering.

See the guppy documentation and the corresponding paper for details on this algorithm.

The funciton takes MassTrees as input, which are consumed. The optional parameter p is used as exponent to calculate the earth_movers_distance(). See there for details.

Definition at line 212 of file squash_clustering.cpp.

◆ tree_string()

std::string tree_string ( std::vector< std::string > const &  labels) const

Build a Newick-format tree for visualizing the result of a squash_clustering().

The resulting Tree is a tree of samples, i.e., each leaf node represents one MassTree that was used as input for the Squash Clustering. The labels vector needs to contain the labels for those tips, in the order of elements that was used for running squash_clustering().

Definition at line 252 of file squash_clustering.cpp.

Member Data Documentation

◆ report_initialization

std::function<void( void )> report_initialization

Definition at line 188 of file squash_clustering.hpp.

◆ report_step

std::function<void( size_t i, size_t total )> report_step

Definition at line 189 of file squash_clustering.hpp.

◆ write_cluster_tree

std::function<void( MassTree const& cluster_tree, size_t index )> write_cluster_tree

Definition at line 191 of file squash_clustering.hpp.

The documentation for this class was generated from the following files: