Skip to content

Commit d0d4391

Browse files
Added a force option to the format command to override the consistency checks for paired-end read mate identification
1 parent 1f3e9e5 commit d0d4391

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
@@ -1064,6 +1064,7 @@ main_format(int argc, const char **argv) {
10641064
size_t suff_len = 0;
10651065
bool single_end = false;
10661066
bool VERBOSE = false;
1067+
bool force = false;
10671068
size_t n_threads = 1;
10681069

10691070
const string description = "convert SAM/BAM mapped bs-seq reads "
@@ -1088,6 +1089,8 @@ main_format(int argc, const char **argv) {
10881089
opt_parse.add_opt("check", 'c',
10891090
"check this many reads to validate read name suffix",
10901091
false, n_reads_to_check);
1092+
opt_parse.add_opt("force", 'F', "run format even with inconsistent "
1093+
"pair information", false, force);
10911094
opt_parse.add_opt("verbose", 'v', "print more information",
10921095
false, VERBOSE);
10931096
opt_parse.set_show_defaults();
@@ -1135,14 +1138,15 @@ main_format(int argc, const char **argv) {
11351138
if (suff_len == 0) {
11361139
size_t repeat_count = 0;
11371140
suff_len = guess_suff_len(infile, n_reads_to_check, repeat_count);
1138-
if (repeat_count > 1)
1141+
if (repeat_count > 1 && !force)
11391142
throw fr_expt("failed to identify read name suffix length\n"
11401143
"verify reads are not single-end\n"
11411144
"specify read name suffix length directly");
11421145
if (VERBOSE)
11431146
cerr << "[read name suffix length guess: " << suff_len << "]" << endl;
11441147
}
1145-
else if (!check_suff_len(infile, suff_len, n_reads_to_check))
1148+
else if (!check_suff_len(infile, suff_len, n_reads_to_check) &&
1149+
!force)
11461150
throw fr_expt("wrong read name suffix length [" +
11471151
std::to_string(suff_len) + "] in: " + infile);
11481152
if (!check_sorted(infile, suff_len, n_reads_to_check))

0 commit comments

Comments
 (0)