Skip to content

Commit 9cc1f9b

Browse files
src/common.hpp and src/abismal.cpp: fixing missing include info
1 parent b7a3981 commit 9cc1f9b

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

src/abismal.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "dna_four_bit.hpp"
2323
#include "dna_four_bit_bisulfite.hpp"
2424
#include "popcnt.hpp"
25-
#include "sam_flags.hpp"
2625

2726
#include "OptionParser.hpp"
2827

src/common.hpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212
*/
1313

1414
#include <algorithm>
15+
#include <cstddef>
16+
#include <cstdint>
1517
#include <cstdlib>
1618
#include <iomanip>
19+
#include <iterator>
20+
#include <sstream>
21+
#include <string>
22+
#include <vector>
1723

1824
template <typename T>
1925
inline auto
@@ -70,3 +76,45 @@ struct progress_bar {
7076

7177
static const std::size_t max_bar_width = 72;
7278
};
79+
80+
// from 30 April 2020 SAM documentation
81+
// 1 0x1 template having multiple segments in sequencing
82+
// 2 0x2 each segment properly aligned according to the aligner
83+
// 4 0x4 segment unmapped
84+
// 8 0x8 next segment in the template unmapped
85+
// 16 0x10 SEQ being reverse complemented
86+
// 32 0x20 SEQ of the next segment in the template being reverse complemented
87+
// 64 0x40 the first segment in the template
88+
// 128 0x80 the last segment in the template
89+
// 256 0x100 secondary alignment
90+
// 512 0x200 not passing filters, such as platform/vendor quality controls
91+
// 1024 0x400 PCR or optical duplicate
92+
// 2048 0x800 supplementary alignment
93+
94+
namespace samflags {
95+
// ADS: names of flags adjusted to how we typically interpret
96+
static const std::uint16_t read_paired = 0x1;
97+
static const std::uint16_t read_pair_mapped = 0x2;
98+
static const std::uint16_t read_unmapped = 0x4;
99+
static const std::uint16_t mate_unmapped = 0x8;
100+
static const std::uint16_t read_rc = 0x10;
101+
static const std::uint16_t mate_rc = 0x20;
102+
static const std::uint16_t template_first = 0x40;
103+
static const std::uint16_t template_last = 0x80;
104+
static const std::uint16_t secondary_aln = 0x100;
105+
static const std::uint16_t below_quality = 0x200;
106+
static const std::uint16_t pcr_duplicate = 0x400;
107+
static const std::uint16_t supplementary_aln = 0x800;
108+
constexpr auto
109+
check(const std::uint16_t to_check, const std::uint16_t &f) -> bool {
110+
return to_check & f;
111+
}
112+
constexpr auto
113+
set(std::uint16_t &to_set, const std::uint16_t f) {
114+
to_set |= f;
115+
}
116+
constexpr auto
117+
unset(std::uint16_t &to_unset, const std::uint16_t f) {
118+
to_unset &= ~f;
119+
}
120+
} // namespace samflags

0 commit comments

Comments
 (0)