Skip to content

Commit

Permalink
Merge pull request #221 from smithlabcode/levels-thread-bug-fix
Browse files Browse the repository at this point in the history
unxcounts: fixing bug related to threadpool scope
  • Loading branch information
andrewdavidsmith authored Jun 4, 2024
2 parents 43da2b1 + a2c9da1 commit 37c7cc4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/unxcounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ static void
verify_chrom_orders(const bool verbose, const uint32_t n_threads,
const string &filename,
const unordered_map<string, int32_t> &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);
Expand All @@ -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;
Expand Down

0 comments on commit 37c7cc4

Please sign in to comment.