A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-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 
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 
49  class DefaultNodeData;
50  class DefaultEdgeData;
51 
52  using DefaultTree = Tree;
53  using MassTree = Tree;
54 }
55 
56 namespace placement {
57  class PlacementEdgeData;
58  class PlacementNodeData;
59 
60  class Sample;
61  class SampleSet;
62 }
63 
64 namespace placement {
65 
66 // =================================================================================================
67 // Comparision and Equality
68 // =================================================================================================
69 
83 bool compatible_trees( PlacementTree const& lhs, PlacementTree const& rhs );
84 
92 bool compatible_trees( Sample const& lhs, Sample const& rhs );
93 
94 // =================================================================================================
95 // Conversion
96 // =================================================================================================
97 
106 
117  Sample const& smp, double const sign, double const scaler, tree::MassTree& target
118 );
119 
126 std::pair< tree::MassTree, double > convert_sample_to_mass_tree( Sample const& sample );
127 
131 std::pair< std::vector<tree::MassTree>, std::vector<double> >
132 convert_sample_set_to_mass_trees( SampleSet const& sample_set );
133 
134 // =================================================================================================
135 // Output
136 // =================================================================================================
137 
141 std::ostream& operator << ( std::ostream& out, Sample const& smp );
142 
147 std::string print_tree( Sample const& smp );
148 
149 } // namespace placement
150 } // namespace genesis
151 
152 #endif // include guard
Tree DefaultTree
Alias for a Tree with data types DefaultNodeData and DefaultEdgeData.
bool compatible_trees(PlacementTree const &lhs, PlacementTree const &rhs)
Return whether two PlacementTrees are compatible.
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.
PlacementTree convert_default_tree_to_placement_tree(tree::DefaultTree const &source_tree)
Convert a DefaultTree into a PlacementTree.
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< std::vector< tree::MassTree >, std::vector< double >> convert_sample_set_to_mass_trees(SampleSet const &sample_set)
Convert all Samples in a SampleSet to tree::MassTrees.
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.
Tree MassTree
Alias for a Tree that stores masses on its TreeEdges.
Class for representing phylogenetic trees.
Definition: tree/tree.hpp:95
std::pair< tree::MassTree, double > convert_sample_to_mass_tree(Sample const &sample)
Convert a Sample to a tree::MassTree.
std::ostream & operator<<(std::ostream &out, Sample const &smp)
Print a table of all Pqueries with their Placements and Names to the stream.