Skip to content

Commit

Permalink
amrfinder.cpp, hmr.cpp and pmd.cpp: summary output now uses 64-bit fo…
Browse files Browse the repository at this point in the history
…r total sizes and is unsigned. This should help with MongoDB integer values accumulating without wrapping and going negative only to be too large as unsigned
  • Loading branch information
andrewdavidsmith committed Nov 30, 2023
1 parent 108831b commit ee91acf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/amrfinder/amrfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ using bamxx::bgzf_file;
struct amr_summary {
amr_summary(const vector<GenomicRegion> &amrs) {
amr_count = size(amrs);
amr_total_size = accumulate(cbegin(amrs), cend(amrs), 0u,
amr_total_size = accumulate(cbegin(amrs), cend(amrs), 0ul,
[](const uint64_t t, const GenomicRegion &p) {
return t + p.get_width();
});
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/hmr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ using bamxx::bgzf_file;
struct hmr_summary {
hmr_summary(const vector<GenomicRegion> &hmrs) {
hmr_count = hmrs.size();
hmr_total_size = accumulate(cbegin(hmrs), cend(hmrs), 0,
hmr_total_size = accumulate(cbegin(hmrs), cend(hmrs), 0ul,
[](const uint64_t t, const GenomicRegion &p) {
return t + p.get_width(); });
hmr_mean_size =
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/pmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ template<typename T> using num_lim = std::numeric_limits<T>;
struct pmd_summary {
pmd_summary(const vector<GenomicRegion> &pmds) {
pmd_count = pmds.size();
pmd_total_size = accumulate(cbegin(pmds), cend(pmds), 0,
pmd_total_size = accumulate(cbegin(pmds), cend(pmds), 0ul,
[](const uint64_t t, const GenomicRegion &p) {
return t + p.get_width(); });
pmd_mean_size =
Expand Down

0 comments on commit ee91acf

Please sign in to comment.