Skip to content

Commit

Permalink
src/utils/unxcounts.cpp: fixed a bug in which all non-covered cytosin…
Browse files Browse the repository at this point in the history
…es were being reported even when the data was assumed to be CpG-only.
  • Loading branch information
andrewdavidsmith committed Jun 23, 2024
1 parent 7b9ab65 commit 6a6c4f9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/unxcounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ write_missing_cpg(const uint32_t &name_size, const string &chrom,
const auto buf_end = buf.data() + size(buf);
// chrom name is already in the buffer so move past it
auto cursor = buf.data() + name_size + 1;
for (auto pos = start_pos; pos < end_pos; ++pos) {
const char base = chrom[pos];
if (is_cytosine(base)) {
for (auto pos = start_pos; pos < end_pos - 1; ++pos) {
// When this function is called, the "end_pos" is either the chrom
// size or the position of a base known to be a C. So we never
// have to allow pos+1 to equal end_pos.
if (is_cytosine(chrom[pos]) && is_guanine(chrom[pos+1])) {
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wstringop-overflow=0"
auto [ptr, ec] = to_chars(cursor, buf_end, pos);
Expand Down

0 comments on commit 6a6c4f9

Please sign in to comment.