Skip to content

Commit 5bc830d

Browse files
Adding an indication that certain classes will be deprecated within htslib_wrapper so we can prevent name clashes
1 parent 74d5d77 commit 5bc830d

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

htslib_wrapper.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Part of SMITHLAB_CPP software
2+
* This code will be replaced soon
23
*
34
* Copyright (C) 2013-2019 University of Southern California and
45
* Andrew D. Smith
@@ -34,7 +35,7 @@ using std::runtime_error;
3435

3536
char check_htslib_wrapper() {return 1;}
3637

37-
SAMReader::SAMReader(const string &fn, const string &mpr) :
38+
SAMReader_deprecated::SAMReader_deprecated(const string &fn, const string &mpr) :
3839
filename(fn), mapper(mpr), good(true) {
3940

4041
if (!(hts = hts_open(filename.c_str(), "r")))
@@ -56,7 +57,7 @@ SAMReader::SAMReader(const string &fn, const string &mpr) :
5657
throw runtime_error("mapper not supported: " + mapper);
5758
}
5859

59-
SAMReader::~SAMReader() {
60+
SAMReader_deprecated::~SAMReader_deprecated() {
6061
if (hdr) {
6162
bam_hdr_destroy(hdr);
6263
hdr = 0;
@@ -74,7 +75,7 @@ SAMReader::~SAMReader() {
7475

7576

7677
bool
77-
SAMReader::get_SAMRecord(const string &str, SAMRecord &samr) {
78+
SAMReader_deprecated::get_SAMRecord(const string &str, SAMRecord &samr) {
7879
if (mapper == "bsmap")
7980
return get_SAMRecord_bsmap(str, samr);
8081
else if (mapper == "bismark")
@@ -88,8 +89,8 @@ SAMReader::get_SAMRecord(const string &str, SAMRecord &samr) {
8889
return false;
8990
}
9091

91-
SAMReader&
92-
operator>>(SAMReader &reader, SAMRecord &aln) {
92+
SAMReader_deprecated&
93+
operator>>(SAMReader_deprecated &reader, SAMRecord &aln) {
9394
int rd_ret = 0;
9495
if ((rd_ret = sam_read1(reader.hts, reader.hdr, reader.b)) >= 0) {
9596
int fmt_ret = 0;
@@ -145,7 +146,7 @@ bsmap_get_strand(const string &strand_str, string &strand, string &bs_forward) {
145146
}
146147

147148
bool
148-
SAMReader::get_SAMRecord_bsmap(const string &str, SAMRecord &samr) {
149+
SAMReader_deprecated::get_SAMRecord_bsmap(const string &str, SAMRecord &samr) {
149150

150151
cerr << "WARNING: "<< "[BSMAP Converter] test "
151152
<< "version: may contain bugs" << endl;
@@ -217,7 +218,7 @@ get_mismatch_bismark(const string &edit_distance_str,
217218
}
218219

219220
bool
220-
SAMReader::get_SAMRecord_bismark(const string &str, SAMRecord &samr) {
221+
SAMReader_deprecated::get_SAMRecord_bismark(const string &str, SAMRecord &samr) {
221222
string name, chrom, CIGAR, mate_name, seq, qual, strand_str,
222223
edit_distance_str, mismatch_str, meth_call_str,
223224
read_conv_str, genome_conv_str;
@@ -283,7 +284,7 @@ class BSSEEKERFLAG : public FLAG {
283284
};
284285

285286
bool
286-
SAMReader::get_SAMRecord_bsseeker(const string &str, SAMRecord &samr) {
287+
SAMReader_deprecated::get_SAMRecord_bsseeker(const string &str, SAMRecord &samr) {
287288

288289
string name, chrom, CIGAR, mate_name, seq, qual, orientation_str,
289290
conversion_str, mismatch_str, mismatch_type_str, seq_genome_str;
@@ -336,7 +337,7 @@ class GENERALFLAG : public FLAG {
336337
};
337338

338339
bool
339-
SAMReader::get_SAMRecord_general(const string &str, SAMRecord &samr) {
340+
SAMReader_deprecated::get_SAMRecord_general(const string &str, SAMRecord &samr) {
340341
string name, chrom, CIGAR, mate_name, seq, qual;
341342
size_t flag, start, mapq_score, mate_start;
342343
int seg_len;

htslib_wrapper.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Part of SMITHLAB_CPP software
3+
* This code will be replaced soon
34
*
45
* Copyright (C) 2019 Meng Zhou and Andrew Smith
56
*
@@ -61,15 +62,15 @@ struct SAMRecord {
6162
std::string get_chrom() const {return mr.r.get_chrom();}
6263
};
6364

64-
class SAMReader {
65+
class SAMReader_deprecated {
6566
public:
66-
SAMReader(const std::string &filename, const std::string &mapper);
67-
~SAMReader();
67+
SAMReader_deprecated(const std::string &filename, const std::string &mapper);
68+
~SAMReader_deprecated();
6869

6970
operator bool() const {return good;}
7071

71-
friend SAMReader &
72-
operator>>(SAMReader& sam_stream, SAMRecord &samr);
72+
friend SAMReader_deprecated &
73+
operator>>(SAMReader_deprecated& sam_stream, SAMRecord &samr);
7374

7475
private:
7576
// internal methods
@@ -94,7 +95,7 @@ class SAMReader {
9495
bam1_t *b;
9596
};
9697

97-
SAMReader &
98-
operator>>(SAMReader& sam_stream, SAMRecord &samr);
98+
SAMReader_deprecated &
99+
operator>>(SAMReader_deprecated& sam_stream, SAMRecord &samr);
99100

100101
#endif

0 commit comments

Comments
 (0)