A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
placement/pquery/placement.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_PLACEMENT_PQUERY_PLACEMENT_H_
2 #define GENESIS_PLACEMENT_PQUERY_PLACEMENT_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 namespace genesis {
37 
38 // =================================================================================================
39 // Forward Declarations
40 // =================================================================================================
41 
42 namespace tree {
43 
44  class TreeEdge;
45 
46 }
47 
48 namespace placement {
49 
50  using PlacementTreeEdge = tree::TreeEdge;
51 
52  class PlacementEdgeData;
53  class PlacementNodeData;
54  class Pquery;
55 
56 }
57 
58 // =================================================================================================
59 // Pquery Placement
60 // =================================================================================================
61 
62 namespace placement {
63 
76 {
77 public:
78 
79  // -------------------------------------------------------------------
80  // Constructor and Rule of Five
81  // -------------------------------------------------------------------
82 
87  : likelihood(0.0)
88  , like_weight_ratio(0.0)
89  , proximal_length(0.0)
90  , pendant_length(0.0)
91  , parsimony(0)
92  , edge_(nullptr)
93  {}
94 
99  : likelihood(0.0)
100  , like_weight_ratio(0.0)
101  , proximal_length(0.0)
102  , pendant_length(0.0)
103  , parsimony(0)
104  , edge_(&edge)
105  {}
106 
107  ~PqueryPlacement() = default;
108 
109  PqueryPlacement( PqueryPlacement const& ) = default;
110  PqueryPlacement( PqueryPlacement&& ) = default;
111 
112  PqueryPlacement& operator= ( PqueryPlacement const& ) = default;
114 
115  // -------------------------------------------------------------------
116  // Public Property Data Members
117  // -------------------------------------------------------------------
118 
119  // Yes, the following members are public data members. It's neither nice nor consistent,
120  // but makes life so much easier for the moment. Maybe we'll fix that in the future...
121 
127  double likelihood;
128 
140 
158 
168 
175 
176  // -------------------------------------------------------------------
177  // Properties
178  // -------------------------------------------------------------------
179 
186  int edge_num() const
187  {
188  return edge_->data<PlacementEdgeData>().edge_num();
189  }
190 
194  const PlacementTreeEdge& edge() const
195  {
196  return *edge_;
197  }
198 
203  {
204  return *edge_;
205  }
206 
216  {
217  edge_ = &edge;
218  }
219 
220  // -------------------------------------------------------------------
221  // Data Members
222  // -------------------------------------------------------------------
223 
224 private:
225 
226  PlacementTreeEdge* edge_;
227 };
228 
229 } // namespace placement
230 } // namespace genesis
231 
232 #endif // include guard
double proximal_length
Distance of this placement to the next node towards the root.
Data class for PlacementTreeEdges. Stores the branch length of the edge, and the edge_num, as defined in the jplace standard.
One placement position of a Pquery on a Tree.
PlacementTreeEdge & edge()
Get the PlacementTreeEdge where this PqueryPlacement is placed.
PqueryPlacement()
Default constructor. Sets all values to 0.
PqueryPlacement & operator=(PqueryPlacement const &)=default
tree::TreeEdge PlacementTreeEdge
Alias for tree::TreeEdge used in a PlacementTree. See PlacementEdgeData for the data stored on the ed...
PqueryPlacement(PlacementTreeEdge &edge)
Constructor that takes the edge where this placement is being placed at.
const PlacementTreeEdge & edge() const
Get the PlacementTreeEdge where this PqueryPlacement is placed.
void reset_edge(PlacementTreeEdge &edge)
Set the PlacementTreeEdge at which this PqueryPlacement is placed.
int edge_num() const
Get the edge_num where this PqueryPlacement is placed.
double pendant_length
Length of the attached branch of this placement.
double like_weight_ratio
Likelihood weight ratio of this placement.
EdgeDataType & data()
Definition: edge.hpp:183
double likelihood
Total likelihood of the tree with this placement attached to it.