Skip to content

Commit 80fc9a1

Browse files
committed
Refactor: Combine two nested ifs into one
1 parent 75ed643 commit 80fc9a1

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/aln.cpp

+12-16
Original file line numberDiff line numberDiff line change
@@ -1052,15 +1052,13 @@ void align_or_map_paired(
10521052
statistics.n_hits += n_hits;
10531053
details[is_r1].nams = nams.size();
10541054

1055-
if (map_param.rescue_level > 1) {
1055+
if (map_param.rescue_level > 1 && (nams.empty() || nonrepetitive_fraction < 0.7)) {
10561056
Timer rescue_timer;
1057-
if (nams.empty() || nonrepetitive_fraction < 0.7) {
1058-
int n_rescue_hits;
1059-
std::tie(n_rescue_hits, nams) = find_nams_rescue(query_randstrobes, index, map_param.rescue_cutoff, map_param.use_mcs);
1060-
details[is_r1].nam_rescue = true;
1061-
details[is_r1].rescue_nams = nams.size();
1062-
statistics.n_rescue_hits += n_rescue_hits;
1063-
}
1057+
int n_rescue_hits;
1058+
std::tie(n_rescue_hits, nams) = find_nams_rescue(query_randstrobes, index, map_param.rescue_cutoff, map_param.use_mcs);
1059+
details[is_r1].nam_rescue = true;
1060+
details[is_r1].rescue_nams = nams.size();
1061+
statistics.n_rescue_hits += n_rescue_hits;
10641062
statistics.tot_time_rescue += rescue_timer.duration();
10651063
}
10661064
Timer nam_sort_timer;
@@ -1196,15 +1194,13 @@ void align_or_map_single(
11961194
statistics.n_hits += n_hits;
11971195
details.nams = nams.size();
11981196

1199-
if (map_param.rescue_level > 1) {
1197+
if (map_param.rescue_level > 1 && (nams.empty() || nonrepetitive_fraction < 0.7)) {
12001198
Timer rescue_timer;
1201-
if (nams.empty() || nonrepetitive_fraction < 0.7) {
1202-
int n_rescue_hits;
1203-
std::tie(n_rescue_hits, nams) = find_nams_rescue(query_randstrobes, index, map_param.rescue_cutoff, map_param.use_mcs);
1204-
statistics.n_rescue_hits += n_rescue_hits;
1205-
details.rescue_nams = nams.size();
1206-
details.nam_rescue = true;
1207-
}
1199+
int n_rescue_hits;
1200+
std::tie(n_rescue_hits, nams) = find_nams_rescue(query_randstrobes, index, map_param.rescue_cutoff, map_param.use_mcs);
1201+
statistics.n_rescue_hits += n_rescue_hits;
1202+
details.rescue_nams = nams.size();
1203+
details.nam_rescue = true;
12081204
statistics.tot_time_rescue += rescue_timer.duration();
12091205
}
12101206

0 commit comments

Comments
 (0)