diff --git a/src/analysis/bsrate.cpp b/src/analysis/bsrate.cpp index 5214e976..b4f85b9f 100644 --- a/src/analysis/bsrate.cpp +++ b/src/analysis/bsrate.cpp @@ -147,21 +147,23 @@ struct bsrate_summary { void set_values() { bisulfite_conversion_rate_positive = static_cast(converted_count_positive) / - max(total_count_positive, 1ul); + max(total_count_positive, static_cast(1)); bisulfite_conversion_rate_negative = static_cast(converted_count_negative) / - max(total_count_negative, 1ul); + max(total_count_negative, static_cast(1)); converted_count = converted_count_positive + converted_count_negative; total_count = total_count_positive + total_count_negative; bisulfite_conversion_rate = - static_cast(converted_count) / max(total_count, 1ul); + static_cast(converted_count) / + max(total_count, static_cast(1)); valid_count = total_count + error_count; - error_rate = static_cast(error_count) / max(valid_count, 1ul); + error_rate = static_cast(error_count) / + max(valid_count, static_cast(1)); } string tostring_as_row() const { diff --git a/src/analysis/hmr.cpp b/src/analysis/hmr.cpp index dea98c84..ea128645 100644 --- a/src/analysis/hmr.cpp +++ b/src/analysis/hmr.cpp @@ -56,8 +56,9 @@ struct hmr_summary { hmr_total_size = accumulate(cbegin(hmrs), cend(hmrs), 0, [](const uint64_t t, const GenomicRegion &p) { return t + p.get_width(); }); - hmr_mean_size = - static_cast(hmr_total_size)/std::max(1ul, hmr_count); + hmr_mean_size = + static_cast(hmr_total_size)/ + std::max(hmr_count, static_cast(1)); } // hmr_count is the number of identified HMRs. uint64_t hmr_count{}; @@ -452,7 +453,7 @@ main_hmr(int argc, const char **argv) { opt_parse.add_opt("params-out", 'p', "write HMM parameters to this " "file (default: none)", false, params_out_file); opt_parse.add_opt("seed", 's', "specify random seed", false, rng_seed); - opt_parse.add_opt("summary", 'S', "write summary output here", false, + opt_parse.add_opt("summary", 'S', "write summary output here", false, summary_file); opt_parse.set_show_defaults(); vector leftover_args; diff --git a/src/analysis/pmd.cpp b/src/analysis/pmd.cpp index bfcc60c3..0657db06 100644 --- a/src/analysis/pmd.cpp +++ b/src/analysis/pmd.cpp @@ -64,7 +64,7 @@ struct pmd_summary { [](const uint64_t t, const GenomicRegion &p) { return t + p.get_width(); }); pmd_mean_size = - static_cast(pmd_total_size)/std::max(1ul, pmd_count); + static_cast(pmd_total_size)/std::max(pmd_count, static_cast(1)); } // pmd_count is the number of identified PMDs. uint64_t pmd_count{}; diff --git a/src/common/LevelsCounter.cpp b/src/common/LevelsCounter.cpp index 0515d8d2..077051de 100644 --- a/src/common/LevelsCounter.cpp +++ b/src/common/LevelsCounter.cpp @@ -31,7 +31,7 @@ LevelsCounter::update(const MSite &s) { } if (s.n_reads > 0) { ++sites_covered; - max_depth = std::max(max_depth, s.n_reads); + max_depth = std::max(max_depth, static_cast(s.n_reads)); total_c += s.n_meth(); total_t += s.n_reads - s.n_meth(); total_meth += s.meth; diff --git a/src/common/LevelsCounter.hpp b/src/common/LevelsCounter.hpp index 39de02e1..4e0820c7 100644 --- a/src/common/LevelsCounter.hpp +++ b/src/common/LevelsCounter.hpp @@ -81,21 +81,24 @@ struct LevelsCounter { // is the ratio of total_c divided by coverage. This value is always // between 0 and 1. double mean_meth_weighted() const { - return static_cast(total_c)/std::max(coverage(), 1ul); + return static_cast(total_c)/ + std::max(coverage(), static_cast(1)); } // fractional_meth is the fraction of "called" sites that are called // methylated. It is the ratio of called_meth divided by // total_called. This value is always between 0 and 1. double fractional_meth() const { - return static_cast(called_meth)/std::max(total_called(), 1ul); + return static_cast(called_meth)/ + std::max(total_called(), static_cast(1)); } // mean_meth is the unweighted mean methylation level. This is the // ratio of total_meth divided by sites_covered. This value is // always between 0 and 1. double mean_meth() const { - return static_cast(total_meth)/std::max(sites_covered, 1ul); + return static_cast(total_meth)/ + std::max(sites_covered, static_cast(1)); } LevelsCounter(const std::string &c) : context{c} {}