Skip to content

Commit 2dcc261

Browse files
src/AbismalIndex.cpp: just adding NOLINT blocks. too much to change for now
1 parent 20a0653 commit 2dcc261

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

src/AbismalIndex.cpp

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include <thread>
3535
#include <utility>
3636

37+
// NOLINTBEGIN
38+
3739
using abismal_clock = std::chrono::steady_clock;
3840
using std::chrono::time_point;
3941

@@ -110,7 +112,7 @@ mask_non_target(
110112
std::vector<std::uint8_t> &genome) {
111113
const auto target_end = std::cend(targets);
112114
auto target_itr = std::cbegin(targets);
113-
for (std::size_t i = 0; i < genome.size(); ++i) {
115+
for (std::size_t i = 0; i < std::size(genome); ++i) {
114116
if (target_itr == target_end || i < target_itr->first)
115117
genome[i] = 'N';
116118
else
@@ -159,7 +161,7 @@ static inline void
159161
replace_included_n(
160162
const std::vector<std::pair<std::size_t, std::size_t>> &exclude, G &genome) {
161163
std::size_t j = 0;
162-
for (std::size_t i = 0; i < genome.size(); ++i) {
164+
for (std::size_t i = 0; i < std::size(genome); ++i) {
163165
if (genome[i] == 'N' && i < exclude[j].first)
164166
genome[i] = random_base();
165167
if (exclude[j].second <= i)
@@ -208,15 +210,15 @@ AbismalIndex::create_index(const std::string &targets_file,
208210
std::vector<std::uint8_t> orig_genome;
209211
load_genome(genome_file, orig_genome, cl);
210212
if (VERBOSE)
211-
std::clog << delta_seconds(s_time) << std::endl;
213+
std::clog << delta_seconds(s_time) << '\n';
212214

213215
s_time = abismal_clock::now();
214216
if (VERBOSE)
215217
std::clog << "[loading target regions]";
216218
std::vector<g_interval> orig_targets = load_target_regions(targets_file);
217219
orig_targets = sort_by_chrom(cl.names, orig_targets);
218220
if (VERBOSE)
219-
std::clog << delta_seconds(s_time) << std::endl;
221+
std::clog << delta_seconds(s_time) << '\n';
220222

221223
s_time = abismal_clock::now();
222224
if (VERBOSE)
@@ -240,7 +242,7 @@ AbismalIndex::create_index(const std::string &targets_file,
240242

241243
replace_included_n(exclude, orig_genome);
242244
if (VERBOSE)
243-
std::clog << delta_seconds(s_time) << std::endl;
245+
std::clog << delta_seconds(s_time) << '\n';
244246

245247
s_time = abismal_clock::now();
246248

@@ -251,7 +253,7 @@ AbismalIndex::create_index(const std::string &targets_file,
251253
std::begin(genome));
252254
std::vector<std::uint8_t>().swap(orig_genome);
253255
if (VERBOSE)
254-
std::clog << delta_seconds(s_time) << std::endl;
256+
std::clog << delta_seconds(s_time) << '\n';
255257

256258
exclude_itr = get_exclude_itrs(genome, exclude);
257259

@@ -277,7 +279,7 @@ AbismalIndex::create_index(const std::string &genome_file) {
277279
load_genome(genome_file, orig_genome, cl);
278280
if (VERBOSE)
279281
std::clog << "[" << cl.names.size() << " targets]" << delta_seconds(s_time)
280-
<< std::endl;
282+
<< '\n';
281283

282284
s_time = abismal_clock::now();
283285
if (VERBOSE)
@@ -293,7 +295,7 @@ AbismalIndex::create_index(const std::string &genome_file) {
293295

294296
replace_included_n(exclude, orig_genome);
295297
if (VERBOSE)
296-
std::clog << delta_seconds(s_time) << std::endl;
298+
std::clog << delta_seconds(s_time) << '\n';
297299

298300
s_time = abismal_clock::now();
299301

@@ -304,7 +306,7 @@ AbismalIndex::create_index(const std::string &genome_file) {
304306
std::begin(genome));
305307
std::vector<std::uint8_t>().swap(orig_genome);
306308
if (VERBOSE)
307-
std::clog << delta_seconds(s_time) << std::endl;
309+
std::clog << delta_seconds(s_time) << '\n';
308310

309311
exclude_itr = get_exclude_itrs(genome, exclude);
310312

@@ -424,7 +426,7 @@ AbismalIndex::initialize_bucket_sizes() {
424426
bucket_ct.join();
425427
bucket_ga.join();
426428
if (VERBOSE)
427-
std::clog << delta_seconds(s_time) << std::endl;
429+
std::clog << delta_seconds(s_time) << '\n';
428430
}
429431

430432
static inline auto
@@ -531,7 +533,7 @@ AbismalIndex::select_two_letter_positions() {
531533
for (auto &thread : threads)
532534
thread.join();
533535
if (VERBOSE)
534-
std::clog << delta_seconds(s_time) << std::endl;
536+
std::clog << delta_seconds(s_time) << '\n';
535537
}
536538

537539
void
@@ -557,9 +559,9 @@ AbismalIndex::hash_genome() {
557559
index_t.resize(index_size_three, 0);
558560
index_a.resize(index_size_three, 0);
559561
if (VERBOSE)
560-
std::clog << delta_seconds(s_time) << std::endl
562+
std::clog << delta_seconds(s_time) << '\n'
561563
<< "[index sizes: two-letter=" << index_size << " "
562-
<< "three-letter=" << index_size_three << "]" << std::endl;
564+
<< "three-letter=" << index_size_three << "]\n";
563565
s_time = abismal_clock::now();
564566

565567
if (VERBOSE)
@@ -628,7 +630,7 @@ AbismalIndex::hash_genome() {
628630
ltr_counter_a.join();
629631

630632
if (VERBOSE)
631-
std::clog << delta_seconds(s_time) << std::endl;
633+
std::clog << delta_seconds(s_time) << '\n';
632634
}
633635

634636
struct dp_sol {
@@ -843,7 +845,7 @@ AbismalIndex::compress_dp() {
843845

844846
max_candidates = 100u; // GS: this is a heuristic
845847
if (VERBOSE)
846-
std::clog << delta_seconds(s_time) << std::endl;
848+
std::clog << delta_seconds(s_time) << '\n';
847849
}
848850

849851
struct BucketLess {
@@ -917,7 +919,7 @@ AbismalIndex::sort_buckets() {
917919
for (auto &thread : threads)
918920
thread.join();
919921
if (VERBOSE)
920-
std::clog << delta_seconds(s_time) << std::endl;
922+
std::clog << delta_seconds(s_time) << '\n';
921923
}
922924
{
923925
const auto s_time = abismal_clock::now();
@@ -940,7 +942,7 @@ AbismalIndex::sort_buckets() {
940942
for (auto &thread : threads)
941943
thread.join();
942944
if (VERBOSE)
943-
std::clog << delta_seconds(s_time) << std::endl;
945+
std::clog << delta_seconds(s_time) << '\n';
944946
}
945947
{
946948
const auto s_time = abismal_clock::now();
@@ -963,7 +965,7 @@ AbismalIndex::sort_buckets() {
963965
for (auto &thread : threads)
964966
thread.join();
965967
if (VERBOSE)
966-
std::clog << delta_seconds(s_time) << std::endl;
968+
std::clog << delta_seconds(s_time) << '\n';
967969
}
968970
}
969971

@@ -1073,7 +1075,7 @@ void
10731075
AbismalIndex::read(const std::string &index_file) {
10741076
static const std::string error_msg("failed loading index file");
10751077

1076-
FILE *in = fopen(index_file.c_str(), "rb");
1078+
FILE *in = fopen(index_file.data(), "rb");
10771079
if (!in)
10781080
throw std::runtime_error("cannot open input file " + index_file);
10791081

@@ -1341,3 +1343,5 @@ load_genome(const std::string &genome_file, std::vector<std::uint8_t> &genome,
13411343
ChromLookup &cl) {
13421344
load_genome_impl(genome_file, genome, cl);
13431345
}
1346+
1347+
// NOLINTEND

0 commit comments

Comments
 (0)