Skip to content

Commit

Permalink
Merge pull request #187 from smithlabcode/roi-regions-regular-file
Browse files Browse the repository at this point in the history
roi regions must be regular file
  • Loading branch information
andrewdavidsmith authored Nov 27, 2023
2 parents fd59ec9 + 52a9811 commit 0de6ad4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/analysis/roimethstat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <unordered_map>
#include <utility>
#include <vector>
#include <filesystem>

#include "GenomicRegion.hpp"
#include "LevelsCounter.hpp"
Expand All @@ -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() ||
Expand Down Expand Up @@ -299,6 +302,7 @@ get_bed_columns(const string &regions_file) {
return n_columns;
}


int
main_roimethstat(int argc, const char **argv) {
try {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0de6ad4

Please sign in to comment.