Skip to content

Commit eba9caa

Browse files
smithlab_utils.hpp: Cleaning up some of the code
1 parent 9e5d83d commit eba9caa

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

smithlab_utils.hpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ template <class T> std::string toa(T t) {
300300
return s.str();
301301
}
302302

303-
304303
////////////////////////////////////////////////////////////////////////
305304
// Code for dealing with the DNA alphabet
306305

@@ -338,8 +337,6 @@ bits2string_masked(size_t mask, size_t bits) {
338337
return s;
339338
}
340339

341-
342-
343340
inline std::string
344341
bits2string_for_positions(size_t positions, size_t bits) {
345342
std::string s;
@@ -356,22 +353,14 @@ percent(const size_t a, const size_t b) {
356353
return static_cast<size_t>((100.0*a)/b);
357354
}
358355

359-
360-
361-
362-
363-
////////////////////Code from Alphabet//////////////////////
364-
365-
366-
367-
bool
368-
inline valid_base(char c) {
356+
inline bool
357+
valid_base(char c) {
369358
char i = std::toupper(c);
370359
return (i == 'A' || i == 'C' || i == 'G' || i == 'T');
371360
}
372361

373-
size_t
374-
inline mer2index(const char *s, size_t n) {
362+
inline size_t
363+
mer2index(const char *s, size_t n) {
375364
size_t multiplier = 1, index = 0;
376365
do {
377366
--n;
@@ -381,9 +370,9 @@ inline mer2index(const char *s, size_t n) {
381370
return index;
382371
}
383372

384-
size_t
385-
inline kmer_counts(const std::vector<std::string> &seqs,
386-
std::vector<size_t> &counts, size_t k) {
373+
inline size_t
374+
kmer_counts(const std::vector<std::string> &seqs,
375+
std::vector<size_t> &counts, size_t k) {
387376
counts.clear();
388377
size_t nwords =
389378
static_cast<size_t>(pow(static_cast<float>(smithlab::alphabet_size),
@@ -404,7 +393,6 @@ inline kmer_counts(const std::vector<std::string> &seqs,
404393
return total;
405394
}
406395

407-
408396
/*
409397
* How to use the ProgressBar:
410398
*

0 commit comments

Comments
 (0)