Skip to content

Commit

Permalink
Updated variable types for stability
Browse files Browse the repository at this point in the history
  • Loading branch information
niemasd committed Mar 6, 2024
1 parent f08402b commit 2e46678
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion argparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct args_t {
//int16_t num_threads = DEFAULT_NUM_THREADS; // number of threads
uint8_t min_qual = DEFAULT_MIN_QUAL; // minimum base quality to count base in counts
COUNT_T min_depth = DEFAULT_MIN_DEPTH; // minimum depth to call base in consensus
double min_freq = DEFAULT_MIN_FREQ; // minimum frequency to call base in consensus
long double min_freq = DEFAULT_MIN_FREQ; // minimum frequency to call base in consensus
char ambig = DEFAULT_AMBIG; // ambiguous symbol
char* primer_bed_fn = nullptr; // primer bed filename
int16_t primer_offset = DEFAULT_PRIMER_OFFSET; // number of bases after primer to also trim
Expand Down
10 changes: 5 additions & 5 deletions count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

void write_pos_counts_tsv(std::vector<std::array<COUNT_T, 5>> const & pos_counts, std::ostream & out_file, char delim) {
out_file << "Pos" << delim << 'A' << delim << 'C' << delim << 'G' << delim << 'T' << delim << '-' << delim << "Total" << std::endl;
long unsigned int const pos_counts_size = pos_counts.size(); COUNT_T row_sum;
for(long unsigned int pos = 0; pos < pos_counts_size; ++pos) {
uint64_t const pos_counts_size = pos_counts.size(); COUNT_T row_sum;
for(uint64_t pos = 0; pos < pos_counts_size; ++pos) {
out_file << pos; row_sum = 0;
for(auto & val : pos_counts[pos]) {
out_file << delim << val; row_sum += val;
Expand Down Expand Up @@ -225,10 +225,10 @@ counts_t compute_counts(const char* const in_reads_fn, std::string const & ref,

std::string compute_consensus(std::vector<std::array<COUNT_T, 5>> const & pos_counts, std::unordered_map<uint32_t, std::unordered_map<std::string, COUNT_T>> & ins_counts, args_t const & user_args) {
std::string out; out.reserve(FASTA_STRING_RESERVE);
long unsigned int const pos_counts_size = pos_counts.size();
uint64_t const pos_counts_size = pos_counts.size();
std::unordered_map<uint32_t, std::unordered_map<std::string, COUNT_T>>::iterator ins_counts_it;
char best_pos_base; std::string best_ins_seq = ""; long unsigned int best_count; long unsigned int tot_depth;
for(long unsigned int pos = 0; pos <= pos_counts_size; ++pos) {
char best_pos_base; std::string best_ins_seq = ""; uint64_t best_count; uint64_t tot_depth;
for(uint64_t pos = 0; pos <= pos_counts_size; ++pos) {
// handle insertions before pos
ins_counts_it = ins_counts.find(pos);
if(ins_counts_it != ins_counts.end()) {
Expand Down
4 changes: 2 additions & 2 deletions primer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ std::vector<std::pair<uint32_t, uint32_t>> find_overlapping_primers(uint32_t con
}
min_max_primer_inds.resize(ref_len, std::make_pair((uint32_t)-1,(uint32_t)-1));
std::vector<std::pair<uint32_t, uint32_t>> primers = read_bed(primer_bed_fn);
unsigned long const NUM_PRIMERS = primers.size();
uint64_t const NUM_PRIMERS = primers.size();
std::list<const std::pair<uint32_t, uint32_t>*> curr_primers;
unsigned long primers_ind = 0;
uint64_t primers_ind = 0;
for(uint32_t pos = 0; pos < ref_len; ++pos) {
while(!curr_primers.empty() && pos >= curr_primers.front()->second + primer_offset) {
curr_primers.pop_front();
Expand Down

0 comments on commit 2e46678

Please sign in to comment.