Skip to content

Commit 7366058

Browse files
Adding the some bisulfite related code needed for abismal but it might not stay here
1 parent d347393 commit 7366058

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

bisulfite_utils.hpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,36 @@
2323
#include <string>
2424
#include <random>
2525

26+
#include "sam_record.hpp"
27+
28+
namespace bsflags {
29+
// ADS: this is our addition to the SAM flags, using the "free" bits
30+
/* 4096 0x1000 read is A-rich
31+
*/
32+
static const uint16_t read_is_t_rich = 0x1000;
33+
}
34+
35+
inline bool
36+
is_t_rich(const sam_rec &sr) {
37+
return samflags::check(sr.flags, bsflags::read_is_t_rich);
38+
}
39+
40+
inline bool
41+
is_a_rich(const sam_rec &sr) {
42+
return !samflags::check(sr.flags, bsflags::read_is_t_rich);
43+
}
44+
45+
inline void
46+
set_t_rich(sam_rec &sr) {
47+
samflags::set(sr.flags, bsflags::read_is_t_rich);
48+
}
49+
50+
inline void
51+
set_a_rich(sam_rec &sr) {
52+
samflags::unset(sr.flags, bsflags::read_is_t_rich);
53+
}
54+
55+
2656
void
2757
bisulfite_treatment(std::mt19937 &generator, std::string &seq,
2858
double bs_rate = 1.0, double meth_rate = 0.0);

0 commit comments

Comments
 (0)