From a2c9da1eb82fcfc7ac7d2f359c6abc3602c49fd0 Mon Sep 17 00:00:00 2001 From: Andrew D Smith Date: Tue, 4 Jun 2024 10:40:35 -0700 Subject: [PATCH] src/utils/unxcounts.cpp: when verifying chrom orders in fasta files, fixing the order of declaration of thread pool for bgzf files and reordering a loop exit conditions --- src/utils/unxcounts.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/unxcounts.cpp b/src/utils/unxcounts.cpp index 156eb885..3b82cd58 100644 --- a/src/utils/unxcounts.cpp +++ b/src/utils/unxcounts.cpp @@ -82,10 +82,11 @@ static void verify_chrom_orders(const bool verbose, const uint32_t n_threads, const string &filename, const unordered_map &chroms_order) { + bamxx::bam_tpool tp(n_threads); + bgzf_file in(filename, "r"); if (!in) throw runtime_error("bad file: " + filename); - bamxx::bam_tpool tp(n_threads); // set the threads for the input file decompression if (n_threads > 1 && in.is_bgzf()) tp.set_io(in); @@ -98,8 +99,8 @@ verify_chrom_orders(const bool verbose, const uint32_t n_threads, if (ret) throw runtime_error("failed to acquire buffer"); while (getline(in, line)) { - if (is_counts_header_line(line.s)) continue; if (std::isdigit(line.s[0])) continue; + if (is_counts_header_line(line.s)) continue; string chrom{line.s}; if (verbose) cerr << "verifying: " << chrom << endl;