Skip to content

Commit 3266dde

Browse files
Adding initialization for some variables that needed it and fixing a bug that reversed the order of checking for sorted positions in the input
1 parent eaea59b commit 3266dde

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/radmeth/methdiff.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ process_sites(const bool VERBOSE, igzfstream &in_a, igzfstream &in_b,
147147
MSite a, b;
148148
string prev_chrom_a, prev_chrom_b;
149149
size_t chrom_id_a = 0, chrom_id_b = 0;
150-
size_t prev_chrom_id_a, prev_chrom_id_b = 0;
151-
size_t prev_pos_a, prev_pos_b = 0;
150+
size_t prev_chrom_id_a = 0, prev_chrom_id_b = 0;
151+
size_t prev_pos_a = 0, prev_pos_b = 0;
152152

153153
while (in_a >> a) {
154154

@@ -159,7 +159,7 @@ process_sites(const bool VERBOSE, igzfstream &in_a, igzfstream &in_b,
159159
if (VERBOSE)
160160
cerr << "processing " << a.chrom << endl;
161161
}
162-
if (!site_precedes(prev_chrom_id_a, prev_pos_a, chrom_id_a, a.pos))
162+
if (site_precedes(chrom_id_a, a.pos, prev_chrom_id_a, prev_pos_a))
163163
throw runtime_error(bad_order(chrom_order, prev_chrom_a, prev_pos_a,
164164
a.chrom, a.pos));
165165

@@ -170,7 +170,7 @@ process_sites(const bool VERBOSE, igzfstream &in_a, igzfstream &in_b,
170170
chrom_id_b = get_chrom_id(chrom_order, chroms_seen_b, b);
171171
prev_chrom_b = b.chrom;
172172
}
173-
if (!site_precedes(prev_chrom_id_b, prev_pos_b, chrom_id_b, b.pos))
173+
if (site_precedes(chrom_id_b, b.pos, prev_chrom_id_b, prev_pos_b))
174174
throw runtime_error(bad_order(chrom_order, prev_chrom_b, prev_pos_b,
175175
b.chrom, b.pos));
176176
advance_b = site_precedes(chrom_id_b, b.pos, chrom_id_a, a.pos);

0 commit comments

Comments
 (0)