Skip to content

Commit

Permalink
src/simreads.cpp: apparently found the bug and it involved returning …
Browse files Browse the repository at this point in the history
…the int from the rng, despite the values generated by the rng being larger and the values it got assigned to being larger, they were squeezed through int
  • Loading branch information
andrewdavidsmith committed Oct 27, 2024
1 parent 1cbbac1 commit 80a2d95
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/simreads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ struct FragSampler {
sim_frag_position(genome, frag_len, the_info.seq, the_info.start_pos,
require_valid);

uint64_t offset = 0, chrom_idx = 0;
uint32_t offset = 0;
uint32_t chrom_idx = 0;
cl.get_chrom_idx_and_offset(the_info.start_pos, chrom_idx, offset);
the_info.chrom = cl.names[chrom_idx];
the_info.start_pos = offset;
Expand All @@ -306,15 +307,12 @@ struct FragSampler {
the_info.cigar = to_string(frag_len) + "M"; // default, no muts
}
char sim_strand() const {
if (strand_code == 'f')
return '+';
else if (strand_code == 'r')
return '-';
else if (strand_code == 'b')
return (simreads_random::rand() & 1) ? '+' : '-';
else
throw runtime_error("bad strand code: " + to_string(strand_code));
return '\0';
switch (strand_code) {
case 'f': return '+';
case 'r': return '-';
case 'b': return (simreads_random::rand() & 1) ? '+' : '-';
default: std::abort();
}
}
const string &genome;
ChromLookup cl;
Expand Down

0 comments on commit 80a2d95

Please sign in to comment.