Skip to content

Commit e820d15

Browse files
Fixing a bug that resulted in an incorrect read name suffix length being reported as reads not properly sorted
1 parent a6f98e1 commit e820d15

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/utils/format-reads.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,10 @@ get_max_repeat_count(const vector<string> &names, const size_t suff_len) {
327327
// assume "suff_len" is shorter than the shortest entry in "names"
328328
size_t repeat_count = 0;
329329
size_t tmp_repeat_count = 0;
330-
for (size_t i = 1; i < names.size() && repeat_count < 1; ++i) {
330+
// allow the repeat_count to go to 2, which might not be the "max"
331+
// but still would indicate that this suffix length is too long and
332+
// would result in more that two reads identified mutually as mates.
333+
for (size_t i = 1; i < names.size() && repeat_count < 2; ++i) {
331334
if (names[i-1].size() == names[i].size() &&
332335
equal(begin(names[i-1]), end(names[i-1]) - suff_len, begin(names[i])))
333336
++tmp_repeat_count;
@@ -548,7 +551,8 @@ main_format_reads(int argc, const char **argv) {
548551
}
549552
else if (!check_suffix_length(mapped_reads_file, suff_len,
550553
n_reads_to_check))
551-
throw runtime_error("incorrect read name suffix length in: " +
554+
throw runtime_error("incorrect read name suffix length [" +
555+
to_string(suff_len) + "] in: " +
552556
mapped_reads_file);
553557

554558
if (!check_mates_consecutive(mapped_reads_file, suff_len,

0 commit comments

Comments
 (0)