diff --git a/src/analysis/roimethstat.cpp b/src/analysis/roimethstat.cpp index 08357ed9..ee2e8569 100644 --- a/src/analysis/roimethstat.cpp +++ b/src/analysis/roimethstat.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "GenomicRegion.hpp" #include "LevelsCounter.hpp" @@ -49,6 +50,8 @@ using std::vector; using bamxx::bgzf_file; +namespace fs = std::filesystem; + bool cmp_within_chrom(const GenomicRegion &r1, const GenomicRegion &r2) { return (r1.get_start() < r2.get_start() || @@ -299,6 +302,7 @@ get_bed_columns(const string ®ions_file) { return n_columns; } + int main_roimethstat(int argc, const char **argv) { try { @@ -391,6 +395,10 @@ Columns (beyond the first 6) in the BED format output: if (VERBOSE) cerr << "loading regions" << endl; + if (!fs::is_regular_file(regions_file)) + // otherwise we could not read the file twice + throw runtime_error("regions file must be regular file"); + // MAGIC: below allow for ==3 or >=6 columns in the bed format const auto n_columns = get_bed_columns(regions_file); if (n_columns != 3 && n_columns < 6)