A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
epca.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_PLACEMENT_FUNCTION_EPCA_H_
2 #define GENESIS_PLACEMENT_FUNCTION_EPCA_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2017 Lucas Czech
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
37 
38 namespace genesis {
39 
40 // =================================================================================================
41 // Forward Declarations
42 // =================================================================================================
43 
44 namespace tree {
45 
46  class Tree;
47 
48  class DefaultNodeData;
49  class DefaultEdgeData;
50 
51  using DefaultTree = Tree;
52 }
53 
54 namespace placement {
55  class PlacementEdgeData;
56  class PlacementNodeData;
57 
58  class Sample;
59  class SampleSet;
60 }
61 
62 namespace placement {
63 
64 // =================================================================================================
65 // Edge PCA
66 // =================================================================================================
67 
90 std::vector<double> epca_imbalance_vector( Sample const& sample, bool normalize = true );
91 
115 utils::Matrix<double> epca_imbalance_matrix( SampleSet const& samples, bool include_leaves = false );
116 
134  utils::Matrix<double>& imbalance_matrix,
135  double kappa = 1.0
136 );
137 
152 std::vector<size_t> epca_filter_constant_columns(
153  utils::Matrix<double>& imbalance_matrix,
154  double epsilon = 1e-5
155 );
156 
157 utils::PcaData epca(
158  SampleSet const& samples,
159  double kappa = 1.0,
160  double epsilon = 1e-5,
161  size_t components = 0
162 );
163 
164 } // namespace placement
165 } // namespace genesis
166 
167 #endif // include guard
utils::Matrix< double > epca_imbalance_matrix(SampleSet const &samples, bool include_leaves)
Calculate the imbalance matrix of placment mass for all Samples in a SampleSet.
Definition: epca.cpp:168
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:95
void normalize(Histogram &h, double total)
Definition: operations.cpp:61
std::vector< double > epca_imbalance_vector(Sample const &sample, bool normalize)
Calculate the imbalance of placement mass for each Edge of the given Sample.
Definition: epca.cpp:66
void epca_splitify_transform(utils::Matrix< double > &imbalance_matrix, double kappa)
Perform a component-wise transformation of the imbalance matrix used for epca().
Definition: epca.cpp:251
std::vector< size_t > epca_filter_constant_columns(utils::Matrix< double > &imbalance_matrix, double epsilon)
Filter out columns that have nearly constant values, measured using an epsilon.
Definition: epca.cpp:282
utils::PcaData epca(SampleSet const &samples, double kappa, double epsilon, size_t components)
Definition: epca.cpp:316