Created
December 9, 2018 11:13
-
-
Save genomewalker/a3f03846cf7e5ad63be63a9c8c153301 to your computer and use it in GitHub Desktop.
Adapted patch from https://github.com/sim82/papara_nt/issues/3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- pvec.h 2018-12-09 12:08:14.727171805 +0100 | |
+++ pvec_mod.h 2018-12-09 12:09:36.186071505 +0100 | |
@@ -539,22 +539,26 @@ | |
static inline double gap_posterior( double v1, double v2 ) { | |
- assert( pgap_model.is_valid_ptr() ); | |
- //return v1 / (v1 + v2); | |
+ assert( pgap_model.is_valid_ptr() ); | |
+ //return v1 / (v1 + v2); | |
- v1 *= 1 - pgap_model->gap_freq(); | |
- // throw std::runtime_error( "i think there is an error in this function. why v1 in the next line?"); | |
- v2 *= pgap_model->gap_freq(); | |
- | |
- float v = float(v1 / (v1 + v2)); | |
- | |
- if( v != v ) { | |
- std::cerr << "meeeeep: " << v1 << " " << v2 << "\n"; | |
- | |
- throw std::runtime_error("bailing out."); | |
- } | |
- | |
- return v; | |
+ v1 *= 1 - pgap_model->gap_freq(); | |
+ // throw std::runtime_error( "i think there is an error in this function. why v1 in the next line?"); | |
+ v2 *= pgap_model->gap_freq(); | |
+ | |
+ float v; | |
+ | |
+ if (v1 != 0) { | |
+ v = float(v1 / (v1 + v2)); | |
+ if( v != v ) { | |
+ std::cerr << "meeeeep: " << v1 << " " << v2 << "\n"; | |
+ | |
+ throw std::runtime_error("bailing out."); | |
+ } | |
+ } else { | |
+ v = v1; | |
+ } | |
+ return v; | |
} | |
static inline double gap_ancestral_probability( double v1, double v2 ) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment