Skip to content

Commit a5f261d

Browse files
committed
bug fixed when integrating mutations at local references
1 parent ded3a1a commit a5f261d

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

alignment/seqregions.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ class SeqRegions : public std::vector<SeqRegion> {
269269
*/
270270
template <const cmaple::StateType num_states>
271271
cmaple::RealNumType computeAbsoluteLhAtRoot(
272-
std::unique_ptr<SeqRegions>& node_mutations,
273272
Alignment* aln,
274273
const ModelBase* model,
275274
const std::vector<std::vector<PositionType>>& cumulative_base);
@@ -862,7 +861,7 @@ auto SeqRegions::integrateMutations(
862861
{
863862
// if a mutation occurs at this position,
864863
// modify the previous state
865-
if (region_type < num_states)
864+
if (mutation->type < num_states)
866865
{
867866
region_prev_state = mut_new_state;
868867
}
@@ -2178,25 +2177,18 @@ RealNumType SeqRegions::mergeTwoLowers(
21782177

21792178
template <const StateType num_states>
21802179
auto SeqRegions::computeAbsoluteLhAtRoot(
2181-
std::unique_ptr<SeqRegions>& node_mutations,
21822180
Alignment* aln,
21832181
const ModelBase* model,
21842182
const std::vector<std::vector<PositionType>>& cumulative_base)
21852183
-> RealNumType {
21862184
assert(model);
21872185
assert(size() > 0);
21882186

2189-
// 1. create a new regions that de-integrate the mutations, if any
2190-
std::unique_ptr<SeqRegions> mut_integrated_regions =
2191-
(node_mutations && node_mutations->size())
2192-
? integrateMutations<num_states>(node_mutations, aln, true)
2193-
: nullptr;
2194-
21952187
// dummy variables
21962188
RealNumType log_lh = 0;
21972189
RealNumType log_factor = 1;
21982190
PositionType start_pos = 0;
2199-
const SeqRegions& regions = (node_mutations && node_mutations->size()) ? *mut_integrated_regions : *this;
2191+
const SeqRegions& regions = *this;
22002192

22012193
// browse regions one by one to compute the likelihood of each region
22022194
for (const SeqRegion& region : regions) {

0 commit comments

Comments
 (0)