bpp-phyl  2.2.0
AbstractTreeLikelihoodData.h
Go to the documentation of this file.
1 //
2 // File: AbstractTreeLikelihoodData.h
3 // Created by: Julien Dutheil
4 // Created on: Sat Dec 30 12:48 2006
5 // From file AbstractTreeLikelihood.h
6 //
7 
8 /*
9 Copyright or © or Copr. CNRS, (November 16, 2004)
10 
11 This software is a computer program whose purpose is to provide classes
12 for phylogenetic data analysis.
13 
14 This software is governed by the CeCILL license under French law and
15 abiding by the rules of distribution of free software. You can use,
16 modify and/ or redistribute the software under the terms of the CeCILL
17 license as circulated by CEA, CNRS and INRIA at the following URL
18 "http://www.cecill.info".
19 
20 As a counterpart to the access to the source code and rights to copy,
21 modify and redistribute granted by the license, users are provided only
22 with a limited warranty and the software's author, the holder of the
23 economic rights, and the successive licensors have only limited
24 liability.
25 
26 In this respect, the user's attention is drawn to the risks associated
27 with loading, using, modifying and/or developing or reproducing the
28 software by the user in light of its specific status of free software,
29 that may mean that it is complicated to manipulate, and that also
30 therefore means that it is reserved for developers and experienced
31 professionals having in-depth computer knowledge. Users are therefore
32 encouraged to load and test the software's suitability as regards their
33 requirements in conditions enabling the security of their systems and/or
34 data to be ensured and, more generally, to use and operate it in the
35 same conditions as regards security.
36 
37 The fact that you are presently reading this means that you have had
38 knowledge of the CeCILL license and that you accept its terms.
39 */
40 
41 #ifndef _ABSTRACTTREELIKELIHOODDATA_H_
42 #define _ABSTRACTTREELIKELIHOODDATA_H_
43 
44 #include "TreeLikelihoodData.h"
45 
46 //From the STL:
47 #include <vector>
48 #include <map>
49 
50 namespace bpp
51 {
52 
72  public TreeLikelihoodData
73 {
74  protected:
86  std::vector<size_t> rootPatternLinks_;
87 
91  std::vector<unsigned int> rootWeights_;
92 
94 
95  const Alphabet* alphabet_;
96 
97  public:
100 
104  tree_(atd.tree_),
105  alphabet_(atd.alphabet_)
106  {}
107 
109  {
112  tree_ = atd.tree_;
113  alphabet_ = atd.alphabet_;
114  return *this;
115  }
116 
117 
119 
120  public:
121  std::vector<size_t>& getRootArrayPositions() { return rootPatternLinks_; }
122  const std::vector<size_t>& getRootArrayPositions() const { return rootPatternLinks_; }
123  size_t getRootArrayPosition(const size_t site) const
124  {
125  return rootPatternLinks_[site];
126  }
127  unsigned int getWeight(size_t pos) const
128  {
129  return rootWeights_[pos];
130  }
131  const std::vector<unsigned int>& getWeights() const
132  {
133  return rootWeights_;
134  }
135 
136  const Alphabet* getAlphabet() const { return alphabet_; }
137 
138  const TreeTemplate<Node>* getTree() const { return tree_; }
139 
140 };
141 
142 } //end of namespace bpp.
143 
144 #endif //_ABSTRACTTREELIKELIHOODDATA_H_
145 
AbstractTreeLikelihoodData & operator=(const AbstractTreeLikelihoodData &atd)
unsigned int getWeight(size_t pos) const
Partial implementation of the TreeLikelihoodData interface.
TreeLikelihood data structure.
The phylogenetic tree class.
const std::vector< unsigned int > & getWeights() const
const TreeTemplate< Node > * tree_
std::vector< size_t > rootPatternLinks_
Links between sites and patterns.
std::vector< size_t > & getRootArrayPositions()
const std::vector< size_t > & getRootArrayPositions() const
const TreeTemplate< Node > * getTree() const
AbstractTreeLikelihoodData(const AbstractTreeLikelihoodData &atd)
std::vector< unsigned int > rootWeights_
The frequency of each site.
AbstractTreeLikelihoodData(const TreeTemplate< Node > *tree)
size_t getRootArrayPosition(const size_t site) const