~ubuntu-branches/ubuntu/saucy/libbpp-phyl/saucy

« back to all changes in this revision

Viewing changes to src/Bpp/Phyl/Likelihood/RNonHomogeneousMixedTreeLikelihood.h

  • Committer: Package Import Robot
  • Author(s): Julien Dutheil
  • Date: 2013-02-09 16:00:00 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130209160000-5v65ba68z8032nzj
Tags: 2.0.3-1
* Reorganized model hierarchy
* New pairwise models
* Several bugs fixed

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#define _RNONHOMOGENEOUSMIXEDTREELIKELIHOOD_H_
42
42
 
43
43
#include "RNonHomogeneousTreeLikelihood.h"
44
 
#include "../Model/SubstitutionModelSet.h"
 
44
#include "../Model/MixedSubstitutionModelSet.h"
45
45
 
46
46
#include <Bpp/Numeric/VectorTools.h>
47
47
#include <Bpp/Numeric/Prob/DiscreteDistribution.h>
76
76
   * TreeLikelihoods for the expanded model on this branch.
77
77
   *
78
78
   */
 
79
 
79
80
  map<int, vector<RNonHomogeneousMixedTreeLikelihood*> > mvTreeLikelihoods_;
80
81
 
81
 
 
82
 
  /**
83
 
   * @brief the map of the branch numbers to the vector of the probabilities of the
84
 
   * TreeLikelihoods for the expanded model on this branch.
85
 
   *
86
 
   */
87
 
  
88
 
  map<int, vector<double> > mvProbas_;
89
 
 
90
 
  /**
91
 
   * @brief the vector of the number of the submodels that are taken
92
 
   * into account in each mixed model. If the model is not mixed, the
93
 
   * associated value is 0. If the model is not expanded at that
94
 
   * point, the associated value is -1.
95
 
   *
96
 
   */
97
 
  
98
 
  vector<int> vNumModels_;
99
 
 
100
 
  /**
101
 
   * @brief the number of the number of the node under which tree the
102
 
   * Treelikelihood is computed.
 
82
  /**
 
83
   * @brief A specific HyperNode in which the computation is
 
84
   * processed. If the probability of this HyperNode is -1, it means
 
85
   * that it should not be used, and the HyperNodes are all in the
 
86
   * MixedSubstitutionModelSet object.
 
87
   *
 
88
   * This object owns the HyperNode pointers of the owned
 
89
   * RNonHomogeneousMixedTreeLikelihood.
 
90
   */
 
91
  
 
92
  MixedSubstitutionModelSet::HyperNode hyperNode_;
 
93
 
 
94
  /**
 
95
   * @brief the number of the node under which tree the Treelikelihood
 
96
   * is computed.
103
97
   *
104
98
   */
105
99
  
122
116
   *
123
117
   * @param tree The tree to use.
124
118
   * @param modelSet The set of substitution models to use.
125
 
   * @param vsubmod the vector of the numbers of the sub models used in
126
 
   *  the mixed models.
 
119
   * @param hyperNode an hypernode of the numbers of the submodels
 
120
   *  used in the mixed models.
127
121
   * @param upperNode the number of the node under which the treelikelihood
128
122
   *  is computed.
129
123
   * @param rDist The rate across sites distribution to use.
134
128
   */
135
129
 
136
130
  RNonHomogeneousMixedTreeLikelihood(const Tree& tree,
137
 
                                     SubstitutionModelSet* modelSet,
138
 
                                     std::vector<int> &vsubmod,
 
131
                                     MixedSubstitutionModelSet* modelSet,
 
132
                                     const MixedSubstitutionModelSet::HyperNode& hyperNode,
139
133
                                     int upperNode,
140
134
                                     DiscreteDistribution* rDist,
141
135
                                     bool verbose,
152
146
   * @param tree The tree to use.
153
147
   * @param data Sequences to use.
154
148
   * @param modelSet The set of substitution models to use.
155
 
   * @param vsubmod the vector of the numbers of the sub models used in
156
 
   *  the mixed models.
 
149
   * @param hyperNode an hypernode of the numbers of the submodels
 
150
   *  used in the mixed models.
157
151
   * @param upperNode the number of the node under which the treelikelihood
158
152
   *  is computed.
159
153
   * @param rDist The rate across sites distribution to use.
165
159
 
166
160
  RNonHomogeneousMixedTreeLikelihood(const Tree& tree,
167
161
                                     const SiteContainer& data,
168
 
                                     SubstitutionModelSet* modelSet,
169
 
                                     std::vector<int> &vsubmod,
 
162
                                     MixedSubstitutionModelSet* modelSet,
 
163
                                     const MixedSubstitutionModelSet::HyperNode& hyperNode,
170
164
                                     int upperNode,
171
165
                                     DiscreteDistribution* rDist,
172
166
                                     bool verbose,
178
172
   *
179
173
   */
180
174
  
181
 
  void init(const Tree& tree,
182
 
            const SiteContainer* pdata,
183
 
            SubstitutionModelSet* modelSet,
184
 
            std::vector<int> &vsubmod,
185
 
            DiscreteDistribution* rDist,
186
 
            bool verbose,
187
 
            bool usePatterns);
 
175
  void init(bool usePatterns);
188
176
 
189
177
  
190
178
public:
206
194
   */
207
195
  RNonHomogeneousMixedTreeLikelihood(
208
196
    const Tree& tree,
209
 
    SubstitutionModelSet* modelSet,
 
197
    MixedSubstitutionModelSet* modelSet,
210
198
    DiscreteDistribution* rDist,
211
199
    bool verbose = true,
212
200
    bool usePatterns = true)
229
217
   */
230
218
  RNonHomogeneousMixedTreeLikelihood(const Tree& tree,
231
219
                                     const SiteContainer& data,
232
 
                                     SubstitutionModelSet* modelSet,
 
220
                                     MixedSubstitutionModelSet* modelSet,
233
221
                                     DiscreteDistribution* rDist,
234
222
                                     bool verbose = true,
235
223
                                     bool usePatterns = true)
257
245
  // Specific methods:
258
246
  void initialize() throw (Exception);
259
247
 
260
 
  virtual void computeTreeDLikelihood(const string& variable);
 
248
  void computeTreeDLikelihood(const string& variable);
261
249
 
262
 
  virtual void computeTreeD2Likelihood(const string& variable);
 
250
  void computeTreeD2Likelihood(const string& variable);
263
251
 
264
252
  /**
265
 
   * @brief return the probability of this objetct in the hierarchy
 
253
   * @brief returns the probability of this object in the hierarchy
266
254
   *
267
255
   */
268
256
  
269
257
  double getProbability() const;
 
258
 
 
259
  /**
 
260
   * @brief sets the probability of this object in the hierarchy
 
261
   *
 
262
   */
 
263
  
 
264
  void setProbability(double x);
 
265
 
 
266
  /**
 
267
   * @brief returns the HyperNode describing the owned submodels.
 
268
   *
 
269
   */
 
270
 
 
271
  const MixedSubstitutionModelSet::HyperNode& getHyperNode() { return hyperNode_;}
270
272
protected:
 
273
 
 
274
 
271
275
  /**
272
276
   * @brief Compute the likelihood for a subtree defined by the Tree::Node <i>node</i>.
273
277
   *