From 935486c72589910b311d4cfdbff10dc2d3cda03f Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Sat, 2 Dec 2023 20:23:56 -0800 Subject: [PATCH 1/3] updating submodule bamxx --- src/bamxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bamxx b/src/bamxx index a9bf1878..09cfe360 160000 --- a/src/bamxx +++ b/src/bamxx @@ -1 +1 @@ -Subproject commit a9bf1878022235cdb331880957eff55889845315 +Subproject commit 09cfe360be875271014b2824fecd8b732e640630 From 06a032867e72e11f2f3479621ac7042ef36f5615 Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Sat, 2 Dec 2023 20:24:18 -0800 Subject: [PATCH 2/3] covered: using input file compression mode to determine output file compression mode --- src/utils/covered.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/covered.cpp b/src/utils/covered.cpp index 9f9f5927..0147bc88 100644 --- a/src/utils/covered.cpp +++ b/src/utils/covered.cpp @@ -118,12 +118,15 @@ main_covered(int argc, const char **argv) { bgzf_file in(filename, "r"); if (!in) throw runtime_error("could not open file: " + filename); - bgzf_file out(outfile, "w"); + + const auto outfile_mode = in.compression() ? "w" : "wu"; + + bgzf_file out(outfile, outfile_mode); if (!out) throw runtime_error("error opening output file: " + outfile); if (n_threads > 1) { // ADS: something breaks when we use the thread for the input - // tpool.set_io(in); + tpool.set_io(in); tpool.set_io(out); } From b5f987c123fad4c5ddfd4208e21c84f1640a56fd Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Sat, 2 Dec 2023 20:31:00 -0800 Subject: [PATCH 3/3] covered.cpp: formatting --- src/utils/covered.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/utils/covered.cpp b/src/utils/covered.cpp index 0147bc88..0ce1c916 100644 --- a/src/utils/covered.cpp +++ b/src/utils/covered.cpp @@ -15,26 +15,26 @@ * General Public License for more details. */ -#include -#include +#include + #include #include -#include +#include +#include // from smithlab_cpp #include "OptionParser.hpp" -#include "smithlab_utils.hpp" #include "smithlab_os.hpp" +#include "smithlab_utils.hpp" -using std::string; -using std::cout; using std::cerr; +using std::cout; using std::endl; using std::runtime_error; +using std::string; using bamxx::bgzf_file; - inline auto getline(bgzf_file &file, kstring_t &line) -> bgzf_file & { if (file.f == nullptr) return file; @@ -54,30 +54,25 @@ getline(bgzf_file &file, kstring_t &line) -> bgzf_file & { return file; } - -static inline -bool get_is_mutated(const kstring_t &line) { +static inline bool +get_is_mutated(const kstring_t &line) { const auto end_itr = line.s + line.l; return std::find(line.s, end_itr, 'x') != end_itr; } - -static inline -uint32_t get_n_reads(const kstring_t &line) { +static inline uint32_t +get_n_reads(const kstring_t &line) { const auto end_itr = std::make_reverse_iterator(line.s + line.l); const auto beg_itr = std::make_reverse_iterator(line.s); - auto n_reads_pos = std::find_if(end_itr, beg_itr, [](const char c) { - return c == ' ' || c == '\t'; - }); + auto n_reads_pos = std::find_if( + end_itr, beg_itr, [](const char c) { return c == ' ' || c == '\t'; }); ++n_reads_pos; return atoi(n_reads_pos.base()); } - int main_covered(int argc, const char **argv) { try { - size_t n_threads = 1; string outfile{"-"}; @@ -118,7 +113,6 @@ main_covered(int argc, const char **argv) { bgzf_file in(filename, "r"); if (!in) throw runtime_error("could not open file: " + filename); - const auto outfile_mode = in.compression() ? "w" : "wu"; bgzf_file out(outfile, outfile_mode);