File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,15 @@ class SeqRegions : public std::vector<SeqRegion> {
149149 const Alignment* aln,
150150 const bool inverse = false ) const
151151 -> std::unique_ptr<SeqRegions>;
152+
153+ /* *
154+ Check if this likelihood vector contains at least N mutations
155+ @param min_mut the number of mutations
156+ @return TRUE if this likelihood vector contains at least N mutations
157+ */
158+ template <const cmaple::StateType num_states>
159+ auto containAtLeastNMuts (const int min_mut) const
160+ -> bool;
152161
153162 /* *
154163 Merge two likelihood vectors, one from above and one from below
@@ -2342,4 +2351,28 @@ RealNumType SeqRegions::calculateSiteLhContributions(
23422351 return log_lh;
23432352}
23442353
2354+ template <const StateType num_states>
2355+ auto cmaple::SeqRegions::containAtLeastNMuts (const int min_mut) const
2356+ -> bool
2357+ {
2358+ int count_mutations = 0 ;
2359+
2360+ // loop over the vector of regions
2361+ for (auto i = 0 ; i < size (); ++i)
2362+ {
2363+ const auto * const seq_region = &(at (i));
2364+
2365+ if (seq_region->type < num_states)
2366+ {
2367+ ++count_mutations;
2368+
2369+ // check if it meets the requirement
2370+ if (count_mutations >= min_mut)
2371+ return true ;
2372+ }
2373+ }
2374+
2375+ return false ;
2376+ }
2377+
23452378} // namespace cmaple
You can’t perform that action at this time.
0 commit comments