From 503a06f1ce709b6377d670f07b282f2520aed9a9 Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Mon, 8 Jan 2024 14:46:16 -0800 Subject: [PATCH 1/2] xcounts.cpp and counts_header.hpp and cpp: fixing a typo in a function name --- src/common/counts_header.cpp | 6 +++--- src/common/counts_header.hpp | 6 +++--- src/utils/xcounts.cpp | 5 ++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/common/counts_header.cpp b/src/common/counts_header.cpp index e6a814b0..051eb89e 100644 --- a/src/common/counts_header.cpp +++ b/src/common/counts_header.cpp @@ -38,9 +38,9 @@ using std::to_string; using bamxx::bgzf_file; void -write_counts_header_from_chom_sizes(const vector &chrom_names, - const vector &chrom_sizes, - bgzf_file &out) { +write_counts_header_from_chrom_sizes(const vector &chrom_names, + const vector &chrom_sizes, + bgzf_file &out) { const auto version = "#DNMTOOLS " + string(VERSION) + "\n"; out.write(version.c_str()); for (auto i = 0u; i < size(chrom_sizes); ++i) { diff --git a/src/common/counts_header.hpp b/src/common/counts_header.hpp index 171eff28..bb3f851b 100644 --- a/src/common/counts_header.hpp +++ b/src/common/counts_header.hpp @@ -26,9 +26,9 @@ #include "bamxx.hpp" void -write_counts_header_from_chom_sizes(const std::vector &chrom_names, - const std::vector &chrom_sizes, - bamxx::bgzf_file &out); +write_counts_header_from_chrom_sizes(const std::vector &chrom_names, + const std::vector &chrom_sizes, + bamxx::bgzf_file &out); // returns -1 on failure, 0 on success int diff --git a/src/utils/xcounts.cpp b/src/utils/xcounts.cpp index ab271e6b..372f970e 100644 --- a/src/utils/xcounts.cpp +++ b/src/utils/xcounts.cpp @@ -1,5 +1,5 @@ /* xcounts: reformat counts so they only give the m and u counts in a - * wig format + * dynamic step wig format * * Copyright (C) 2023 Andrew D. Smith * @@ -145,14 +145,13 @@ main_xcounts(int argc, const char **argv) { if (!out) throw dnmt_error("error opening output file: " + outfile); if (n_threads > 1) { - // ADS: something breaks when we use the thread for the input if (in.is_bgzf()) tpool.set_io(in); tpool.set_io(out); } if (!genome_file.empty()) - write_counts_header_from_chom_sizes(chrom_names, chrom_sizes, out); + write_counts_header_from_chrom_sizes(chrom_names, chrom_sizes, out); // use the kstring_t type to more directly use the BGZF file kstring_t line{0, 0, nullptr}; From d100541fa7be08e31cfeb4045d093f32b2b4ee6d Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Mon, 8 Jan 2024 14:58:28 -0800 Subject: [PATCH 2/2] pmd.cpp: if the fraction of bins passing after finding a bin size by the dynamic method is still not high enough, the bin size is set to numeric limits max --- src/analysis/pmd.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/analysis/pmd.cpp b/src/analysis/pmd.cpp index 07c3e3b1..f8e3b047 100644 --- a/src/analysis/pmd.cpp +++ b/src/analysis/pmd.cpp @@ -1064,8 +1064,7 @@ binsize_selection(const size_t resolution, const size_t min_bin_sz, if (frac_passed < min_frac_passed) bin_size += resolution; } - return frac_passed <= num_lim::min() ? - num_lim::max() : bin_size; + return frac_passed < min_frac_passed ? num_lim::max() : bin_size; }