Skip to content

Commit c4b8a2e

Browse files
src/utils/xcounts.cpp: the -r flag for require sites to be covered was on by default. That was not intended, but can't change now. A new flag was added to keep all sites.
1 parent b058e49 commit c4b8a2e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/utils/xcounts.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ enum class xcounts_err {
5959
// clang-format on
6060
};
6161

62+
// clang-format off
6263
struct xcounts_err_cat : std::error_category {
6364
auto name() const noexcept -> const char * override {
6465
return "xcounts error";
@@ -78,6 +79,7 @@ struct xcounts_err_cat : std::error_category {
7879
std::abort(); // unreacheable
7980
}
8081
};
82+
// clang-format off
8183

8284
template <>
8385
struct std::is_error_code_enum<xcounts_err> : public std::true_type {};
@@ -107,6 +109,7 @@ main_xcounts(int argc, const char **argv) {
107109
try {
108110
bool verbose = false;
109111
bool gzip_output = false;
112+
bool keep_all_sites = false;
110113
bool require_coverage = false;
111114
size_t n_threads = 1;
112115
string genome_file;
@@ -123,8 +126,10 @@ main_xcounts(int argc, const char **argv) {
123126
false, outfile);
124127
opt_parse.add_opt("chroms", 'c', "make header from this reference", false,
125128
genome_file);
126-
opt_parse.add_opt("reads", 'r', "ouput only sites with reads", false,
129+
opt_parse.add_opt("reads", 'r', "output only sites with reads (on by default)", false,
127130
require_coverage);
131+
opt_parse.add_opt("keep", 'k', "keep sites that are not covered", false,
132+
keep_all_sites);
128133
opt_parse.add_opt("header", 'h', "use this file to generate header", false,
129134
header_file);
130135
opt_parse.add_opt("threads", 't', "threads for compression (use few)",
@@ -250,7 +255,7 @@ main_xcounts(int argc, const char **argv) {
250255
if (bgzf_write(out.f, site.chrom.data(), sz) != sz)
251256
ec = xcounts_err::failed_to_write_file;
252257
}
253-
if (site.n_reads > 0) {
258+
if (keep_all_sites || site.n_reads > 0) {
254259
const int64_t sz = fill_output_buffer(offset, site, buf);
255260
if (bgzf_write(out.f, buf.data(), sz) != sz)
256261
ec = xcounts_err::failed_to_write_file;

0 commit comments

Comments
 (0)