Skip to content

Commit b563648

Browse files
Reverting uint64_t to size_t in amrfinder code because of compiler errors; will sort this out later
1 parent ed14ccd commit b563648

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/amrfinder/amrfinder.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ struct amr_summary {
5959
amr_summary(const vector<GenomicRegion> &amrs) {
6060
amr_count = size(amrs);
6161
amr_total_size = accumulate(cbegin(amrs), cend(amrs), 0ul,
62-
[](const uint64_t t, const GenomicRegion &p) {
62+
[](const size_t t, const GenomicRegion &p) {
6363
return t + p.get_width();
6464
});
6565
amr_mean_size = static_cast<double>(amr_total_size) /
66-
std::max(amr_count, static_cast<uint64_t>(1));
66+
std::max(amr_count, static_cast<size_t>(1));
6767
}
6868

6969
// amr_count is the number of identified AMRs, which are the merged
7070
// AMRs that are found to be significant when tested as a single
7171
// interval
72-
uint64_t amr_count{};
72+
size_t amr_count{};
7373
// total_amr_size is the sum of the sizes of the identified AMRs
74-
uint64_t amr_total_size{};
74+
size_t amr_total_size{};
7575
// mean_amr_size is the mean size of the identified AMRs
7676
double amr_mean_size{};
7777

@@ -115,7 +115,7 @@ using epi_r = small_epiread;
115115

116116
/* merges amrs within some pre-defined distance */
117117
static void
118-
merge_amrs(const uint64_t gap_limit, vector<GenomicRegion> &amrs) {
118+
merge_amrs(const size_t gap_limit, vector<GenomicRegion> &amrs) {
119119
auto j = begin(amrs);
120120
for (const auto &a : amrs)
121121
// check distance between two amrs is greater than gap limit
@@ -251,7 +251,7 @@ clip_read(const size_t start_pos, const size_t end_pos, epi_r r) {
251251
static vector<epi_r>
252252
get_current_epireads(const vector<epi_r> &epireads, const size_t max_len,
253253
const size_t cpg_window, const size_t start_pos,
254-
uint64_t &read_id) {
254+
size_t &read_id) {
255255

256256
// assert(is_sorted(cbegin(epireads), cend(epireads),
257257
// [](const epi_r &a, const epi_r &b) {
@@ -274,9 +274,9 @@ get_current_epireads(const vector<epi_r> &epireads, const size_t max_len,
274274
return current_epireads;
275275
}
276276

277-
static inline uint64_t
277+
static inline size_t
278278
total_states(const vector<epi_r> &epireads) {
279-
uint64_t tot = 0;
279+
size_t tot = 0;
280280
for (auto &e : epireads) tot += e.length();
281281
return tot;
282282
}
@@ -290,10 +290,10 @@ add_amr(const string &chrom_name, const size_t start_cpg,
290290
amrs.emplace_back(chrom_name, start_cpg, end_cpg, rds, score, '+');
291291
}
292292

293-
static inline uint64_t
293+
static inline size_t
294294
get_n_cpgs(const std::vector<epi_r> &reads) {
295-
uint64_t n_cpgs = 0;
296-
for (auto &r : reads) n_cpgs = max(n_cpgs, static_cast<uint64_t>(r.end()));
295+
size_t n_cpgs = 0;
296+
for (auto &r : reads) n_cpgs = max(n_cpgs, static_cast<size_t>(r.end()));
297297
return n_cpgs;
298298
}
299299

@@ -330,8 +330,8 @@ process_chrom(const bool verbose, const uint32_t n_threads,
330330

331331
const auto n_blocks = n_threads*blocks_per_thread;
332332

333-
const uint64_t lim = n_cpgs - window_size + 1;
334-
const auto blocks = get_block_bounds(static_cast<uint64_t>(0),
333+
const size_t lim = n_cpgs - window_size + 1;
334+
const auto blocks = get_block_bounds(static_cast<size_t>(0),
335335
lim, lim/n_blocks);
336336

337337
std::atomic_ulong windows_tested = 0;
@@ -341,8 +341,8 @@ process_chrom(const bool verbose, const uint32_t n_threads,
341341
#pragma omp parallel for
342342
for (const auto &b : blocks) {
343343
vector<GenomicRegion> curr_amrs;
344-
uint64_t start_idx = 0;
345-
uint64_t windows_tested_block = 0;
344+
size_t start_idx = 0;
345+
size_t windows_tested_block = 0;
346346
for (auto i = b.first; i < b.second && start_idx < size(epireads); ++i) {
347347
// ADS: below, we could do binary search, but this does not seem
348348
// to be a bottleneck
@@ -397,7 +397,7 @@ main_amrfinder(int argc, const char **argv) {
397397

398398
uint32_t max_itr = 10;
399399
uint32_t window_size = 10;
400-
uint64_t gap_limit = 1000;
400+
size_t gap_limit = 1000;
401401

402402
double high_prob = 0.75, low_prob = 0.25;
403403
uint32_t min_obs_per_cpg = 4;
@@ -482,7 +482,7 @@ main_amrfinder(int argc, const char **argv) {
482482
// windows_tested is the number of sliding windows in the
483483
// methylome that were tested for a signal of significant
484484
// allele-specific methylation
485-
uint64_t windows_tested = 0;
485+
size_t windows_tested = 0;
486486
epiread er;
487487
vector<epi_r> epireads;
488488
string prev_chrom, curr_chrom, tmp_states;

src/amrfinder/amrtester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ main_amrtester(int argc, const char **argv) {
273273
cerr << "number of regions: " << n_regions << endl;
274274

275275
string chrom_name;
276-
vector<uint64_t> cpg_positions;
276+
vector<size_t> cpg_positions;
277277

278278
std::ofstream of;
279279
if (!outfile.empty()) of.open(outfile);

0 commit comments

Comments
 (0)