A library for working with phylogenetic and population genetic data.
v0.27.0
placement/simulator/functions.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_PLACEMENT_SIMULATOR_FUNCTIONS_H_
2 #define GENESIS_PLACEMENT_SIMULATOR_FUNCTIONS_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 
34 #include <cstddef>
35 #include <iosfwd>
36 #include <vector>
37 
38 namespace genesis {
39 namespace placement {
40 
41 // =================================================================================================
42 // Forward Declarations
43 // =================================================================================================
44 
45 class Sample;
46 
47 class SimulatorEdgeDistribution;
48 class SimulatorExtraPlacementDistribution;
49 class SimulatorLikeWeightRatioDistribution;
50 class SimulatorPendantLengthDistribution;
51 class SimulatorProximalLengthDistribution;
52 
53 // =================================================================================================
54 // Stream Output Operators
55 // =================================================================================================
56 
57 std::ostream& operator <<( std::ostream& out, SimulatorEdgeDistribution const& distrib );
58 std::ostream& operator <<( std::ostream& out, SimulatorExtraPlacementDistribution const& distrib );
59 std::ostream& operator <<( std::ostream& out, SimulatorLikeWeightRatioDistribution const& distrib );
60 
61 // =================================================================================================
62 // Edge Distribution
63 // =================================================================================================
64 
65 void set_uniform_weights( Sample const& sample, SimulatorEdgeDistribution& edge_distrib );
66 void set_uniform_weights( size_t edge_count, SimulatorEdgeDistribution& edge_distrib );
67 
68 void set_random_weights( Sample const& sample, SimulatorEdgeDistribution& edge_distrib );
69 void set_random_weights( size_t edge_count, SimulatorEdgeDistribution& edge_distrib );
70 
71 void set_random_edges( Sample const& sample, SimulatorEdgeDistribution& edge_distrib );
72 void set_random_edges( size_t edge_count, SimulatorEdgeDistribution& edge_distrib );
73 
75  Sample const& sample,
76  SimulatorEdgeDistribution& edge_distrib
77 );
78 
80  Sample const& sample,
81  std::vector<double> const& depth_weights,
82  SimulatorEdgeDistribution& edge_distrib
83 );
84 
86  Sample const& sample,
87  SimulatorEdgeDistribution& edge_distrib
88 );
89 
91  Sample const& sample,
92  size_t link_index,
93  SimulatorEdgeDistribution& edge_distrib
94 );
95 
96 void learn_per_edge_weights( Sample const& sample, SimulatorEdgeDistribution& edge_distrib );
97 
98 // =================================================================================================
99 // Extra Placement Number Distribution
100 // =================================================================================================
101 
103  Sample const& sample,
104  SimulatorExtraPlacementDistribution& p_distib
105 );
106 
108  Sample const& sample,
109  SimulatorExtraPlacementDistribution& p_distib
110 );
111 
112 // =================================================================================================
113 // Like Weight Ratio Distribution
114 // =================================================================================================
115 
117  Sample const& sample,
118  SimulatorLikeWeightRatioDistribution& lwr_distib,
119  size_t number_of_intervals = 10
120 );
121 
122 } // namespace placement
123 } // namespace genesis
124 
125 #endif // include guard
genesis::placement::set_random_edges
void set_random_edges(Sample const &sample, SimulatorEdgeDistribution &edge_distrib)
Set the weights of a SimulatorEdgeDistribution randomly to either 0.0 or 1.0, so that a random subset...
Definition: placement/simulator/functions.cpp:159
genesis::placement::learn_per_edge_weights
void learn_per_edge_weights(Sample const &sample, SimulatorEdgeDistribution &edge_distrib)
Sets the weights of an SimulatorEdgeDistributionso that they follow the same distribution of placemen...
Definition: placement/simulator/functions.cpp:355
genesis::placement::set_random_subtree_weights
size_t set_random_subtree_weights(Sample const &sample, SimulatorEdgeDistribution &edge_distrib)
Sets the weights of an SimulatorEdgeDistribution to 1.0 for a randomly chosen subtree,...
Definition: placement/simulator/functions.cpp:265
genesis::placement::set_uniform_weights
void set_uniform_weights(Sample const &sample, SimulatorEdgeDistribution &edge_distrib)
Sets the weights of an SimulatorEdgeDistribution to 1.0 for all edges, so that each edge has the same...
Definition: placement/simulator/functions.cpp:106
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42
genesis::placement::learn_like_weight_ratio_distribution
void learn_like_weight_ratio_distribution(Sample const &sample, SimulatorLikeWeightRatioDistribution &lwr_distib, size_t number_of_intervals)
Definition: placement/simulator/functions.cpp:423
genesis::placement::set_subtree_weights
void set_subtree_weights(Sample const &sample, size_t link_index, SimulatorEdgeDistribution &edge_distrib)
Set the weights of a subtree to 1.0 and all other weights to 0.0.
Definition: placement/simulator/functions.cpp:312
genesis::placement::learn_placement_path_length_weights
void learn_placement_path_length_weights(Sample const &sample, SimulatorExtraPlacementDistribution &p_distib)
Definition: placement/simulator/functions.cpp:379
genesis::placement::set_depths_distributed_weights
void set_depths_distributed_weights(Sample const &sample, SimulatorEdgeDistribution &edge_distrib)
Set the weights of an SimulatorEdgeDistribution so that they follow the depth distribution of the edg...
Definition: placement/simulator/functions.cpp:195
genesis::placement::set_random_weights
void set_random_weights(Sample const &sample, SimulatorEdgeDistribution &edge_distrib)
Set the weights of an SimulatorEdgeDistribution for the edges randomly to a value between 0....
Definition: placement/simulator/functions.cpp:130
genesis::placement::operator<<
std::ostream & operator<<(std::ostream &out, Sample const &smp)
Print a table of all Pqueries with their Placements and Names to the stream.
Definition: placement/function/operators.cpp:238
genesis::placement::learn_placement_number_weights
void learn_placement_number_weights(Sample const &sample, SimulatorExtraPlacementDistribution &p_distib)
Definition: placement/simulator/functions.cpp:364
genesis::tree::edge_count
size_t edge_count(Tree const &tree)
Return the number of Edges of a Tree. Same as Tree::edge_count().
Definition: tree/function/functions.cpp:212