Skip to content

Commit 51a7704

Browse files
Merge pull request #98 from smithlabcode/bamxx-submodule-update
Bamxx submodule update
2 parents 53ea443 + 8b1295d commit 51a7704

File tree

15 files changed

+30
-34
lines changed

15 files changed

+30
-34
lines changed

src/abismal

src/analysis/hmr-rep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using std::to_string;
4747
using std::begin;
4848
using std::end;
4949

50-
using bgzf_file = bamxx::bam_bgzf;
50+
using bamxx::bgzf_file;
5151

5252
static GenomicRegion
5353
as_gen_rgn(const MSite &s) {

src/analysis/hmr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ using std::runtime_error;
4848
using std::to_string;
4949
using std::unordered_set;
5050

51-
using bgzf_file = bamxx::bam_bgzf;
51+
using bamxx::bgzf_file;
5252

5353
static GenomicRegion
5454
as_gen_rgn(const MSite &s) {

src/analysis/hypermr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ as_gen_rgn(const MSite &s) {
6161
static void
6262
load_cpgs(const string &cpgs_file, vector<MSite> &cpgs,
6363
vector<pair<double, double>> &meth) {
64-
bamxx::bam_bgzf in(cpgs_file, "r");
64+
bamxx::bgzf_file in(cpgs_file, "r");
6565
if (!in) throw runtime_error("failed opening file: " + cpgs_file);
6666

6767
MSite the_site;
6868
string line;
69-
while (in.getline(line)) cpgs.push_back(MSite(line));
69+
while (getline(in, line)) cpgs.push_back(MSite(line));
7070

7171
meth.resize(cpgs.size());
7272
for (size_t i = 0; i < cpgs.size(); ++i)

src/analysis/levels.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ using std::string;
5252
using std::to_string;
5353
using std::vector;
5454

55-
using bgzf_file = bamxx::bam_bgzf;
55+
using bamxx::bgzf_file;
5656

5757
enum class counts_file_format { ordinary, asym_cpg, sym_cpg };
5858

src/analysis/methcounts.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ tag_with_mut(const uint32_t tag, const bool mut) {
239239

240240

241241
static void
242-
write_output(const bamxx::bam_header &hdr, bamxx::bam_bgzf &out,
242+
write_output(const bamxx::bam_header &hdr, bamxx::bgzf_file &out,
243243
const int32_t tid, const string &chrom,
244244
const vector<CountSet> &counts, bool CPG_ONLY) {
245245

@@ -267,8 +267,7 @@ write_output(const bamxx::bam_header &hdr, bamxx::bam_bgzf &out,
267267
<< tag_values[tag_with_mut(the_tag, mut)] << '\t'
268268
<< (n_reads > 0 ? unconverted/n_reads : 0.0) << '\t'
269269
<< n_reads << '\n';
270-
const size_t expected_size = buf.tellp();
271-
if (out.write(buf.c_str(), expected_size))
270+
if (!out.write(buf.c_str(), buf.tellp()))
272271
throw dnmt_error("error writing output");
273272
}
274273
}
@@ -397,7 +396,7 @@ process_reads(const bool VERBOSE,
397396

398397
// open the output file
399398
const string output_mode = compress_output ? "w" : "wu";
400-
bamxx::bam_bgzf out(outfile, output_mode);
399+
bamxx::bgzf_file out(outfile, output_mode);
401400
if (!out) throw dnmt_error("error opening output file: " + outfile);
402401

403402
/* set the threads for the input file decompression */

src/analysis/multimethstat.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ using std::ifstream;
4949
using std::isfinite;
5050
using std::is_sorted;
5151

52-
using bgzf_file = bamxx::bam_bgzf;
52+
using bamxx::bgzf_file;
5353

5454
static pair<bool, bool>
5555
meth_unmeth_calls(const size_t n_meth, const size_t n_unmeth) {
@@ -174,7 +174,7 @@ process_with_cpgs_loaded(const bool VERBOSE,
174174
if (!in) throw runtime_error("cannot open file: " + cpgs_file);
175175

176176
string header;
177-
in.getline(header);
177+
getline(in, header);
178178

179179
std::istringstream iss(header);
180180
string col_name;
@@ -197,7 +197,7 @@ process_with_cpgs_loaded(const bool VERBOSE,
197197
vector<vector<double> > values;
198198
MSite the_cpg;
199199
string line;
200-
while (in.getline(line)) {
200+
while (getline(in, line)) {
201201
values.push_back(vector<double>());
202202
get_site_and_values(line, the_cpg, values.back());
203203
cpgs.push_back(the_cpg);

src/analysis/pmd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ using std::ostream;
5252
using std::ofstream;
5353
using std::to_string;
5454

55-
using bgzf_file = bamxx::bam_bgzf;
55+
using bamxx::bgzf_file;
5656

5757
static void
5858
get_adjacent_distances(const vector<GenomicRegion> &pmds,
@@ -739,7 +739,7 @@ check_if_array_data(const string &infile) {
739739
if (!in) throw std::runtime_error("bad file: " + infile);
740740

741741
std::string line;
742-
in.getline(line);
742+
getline(in, line);
743743
std::istringstream iss(line);
744744
std::string chrom, pos, strand, seq, meth, cov;
745745
iss >> chrom >> pos >> strand >> seq >> meth;

src/analysis/roimethstat.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ using std::isfinite;
5151
using std::is_sorted;
5252
using std::regex_match;
5353

54-
using bgzf_file = bamxx::bam_bgzf;
54+
using bamxx::bgzf_file;
5555

5656
static pair<bool, bool>
5757
meth_unmeth_calls(const size_t n_meth, const size_t n_unmeth) {
@@ -480,7 +480,7 @@ Columns (beyond the first 6) in the BED format output:
480480
throw runtime_error("format must be 3 or 6+ column bed: " + regions_file);
481481
if (is_msite_file(regions_file)) {
482482
cerr << opt_parse.help_message() << endl;
483-
throw runtime_error("The file seems to be a methylation file: " +
483+
throw runtime_error("The file seems to be a methylation file: " +
484484
regions_file + "\nCheck the order of the input arguments");
485485
}
486486
if (!is_msite_file(cpgs_file)) {
@@ -533,6 +533,3 @@ Columns (beyond the first 6) in the BED format output:
533533
}
534534
return EXIT_SUCCESS;
535535
}
536-
537-
538-

src/bamxx

Submodule bamxx updated 1 file

0 commit comments

Comments
 (0)