A toolkit for working with phylogenetic data.
v0.24.0
placement/function/operators.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_PLACEMENT_FUNCTION_OPERATORS_H_
2 #define GENESIS_PLACEMENT_FUNCTION_OPERATORS_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2018 Lucas Czech and HITS gGmbH
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 
35 
36 #include <iosfwd>
37 #include <string>
38 
39 namespace genesis {
40 
41 // =================================================================================================
42 // Forward Declarations
43 // =================================================================================================
44 
45 namespace tree {
46 
47  class Tree;
48  class TreeSet;
49 
50  class CommonNodeData;
51  class CommonEdgeData;
52 
53  using CommonTree = Tree;
54  using MassTree = Tree;
55 }
56 
57 namespace placement {
58  class PlacementEdgeData;
59  class PlacementNodeData;
60 
61  class Sample;
62  class SampleSet;
63 }
64 
65 namespace placement {
66 
67 // =================================================================================================
68 // Comparision and Equality
69 // =================================================================================================
70 
84 bool compatible_trees( PlacementTree const& lhs, PlacementTree const& rhs );
85 
93 bool compatible_trees( Sample const& lhs, Sample const& rhs );
94 
95 // =================================================================================================
96 // Conversion
97 // =================================================================================================
98 
107 
118  Sample const& smp, double const sign, double const scaler, tree::MassTree& target
119 );
120 
127 std::pair< tree::MassTree, double > convert_sample_to_mass_tree( Sample const& sample, bool normalize );
128 
132 std::pair< tree::TreeSet, std::vector<double> >
133 convert_sample_set_to_mass_trees( SampleSet const& sample_set, bool normalize );
134 
135 // =================================================================================================
136 // Output
137 // =================================================================================================
138 
142 std::ostream& operator << ( std::ostream& out, Sample const& smp );
143 
148 std::string print_tree( Sample const& smp );
149 
150 } // namespace placement
151 } // namespace genesis
152 
153 #endif // include guard
Tree CommonTree
Alias for a Tree with data types CommonNodeData and CommonEdgeData.
double add_sample_to_mass_tree(Sample const &smp, double const sign, double const scaler, tree::MassTree &target)
Helper function to copy masses from a Sample to a MassTree.
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
tree::Tree PlacementTree
Alias for a tree::Tree used for a tree with information needed for storing Pqueries. This kind of tree is used by Sample.
std::pair< tree::MassTree, double > convert_sample_to_mass_tree(Sample const &sample, bool normalize)
Convert a Sample to a tree::MassTree.
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:97
PlacementTree convert_common_tree_to_placement_tree(tree::CommonTree const &source_tree)
Convert a CommonTree into a PlacementTree.
void normalize(Histogram &h, double total)
Definition: operations.cpp:61
bool compatible_trees(PlacementTree const &lhs, PlacementTree const &rhs)
Return whether two PlacementTrees are compatible.
std::ostream & operator<<(std::ostream &out, Tree const &tree)
std::string print_tree(Sample const &smp)
Return a simple view of the Tree of a Sample with information about the Pqueries on it...
std::pair< tree::TreeSet, std::vector< double > > convert_sample_set_to_mass_trees(SampleSet const &sample_set, bool normalize)
Convert all Samples in a SampleSet to tree::MassTrees.