Skip to content

Commit

Permalink
Merge pull request #205 from smithlabcode/pmd-coverage-and-binsize
Browse files Browse the repository at this point in the history
pmd guarantee coverage
  • Loading branch information
andrewdavidsmith committed Jan 8, 2024
2 parents a5c618d + d100541 commit 7d5d684
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/analysis/pmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>::min() ?
num_lim<size_t>::max() : bin_size;
return frac_passed < min_frac_passed ? num_lim<size_t>::max() : bin_size;
}


Expand Down
6 changes: 3 additions & 3 deletions src/common/counts_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ using std::to_string;
using bamxx::bgzf_file;

void
write_counts_header_from_chom_sizes(const vector<string> &chrom_names,
const vector<uint64_t> &chrom_sizes,
bgzf_file &out) {
write_counts_header_from_chrom_sizes(const vector<string> &chrom_names,
const vector<uint64_t> &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) {
Expand Down
6 changes: 3 additions & 3 deletions src/common/counts_header.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "bamxx.hpp"

void
write_counts_header_from_chom_sizes(const std::vector<std::string> &chrom_names,
const std::vector<uint64_t> &chrom_sizes,
bamxx::bgzf_file &out);
write_counts_header_from_chrom_sizes(const std::vector<std::string> &chrom_names,
const std::vector<uint64_t> &chrom_sizes,
bamxx::bgzf_file &out);

// returns -1 on failure, 0 on success
int
Expand Down
5 changes: 2 additions & 3 deletions src/utils/xcounts.cpp
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down Expand Up @@ -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};
Expand Down

0 comments on commit 7d5d684

Please sign in to comment.