7 #ifndef SEQUENCE_FLS_HPP_ 8 #define SEQUENCE_FLS_HPP_ 11 #include "boost/assert.hpp" 12 #include "boost/cstdint.hpp" 13 #include "boost/integer/static_log2.hpp" 24 template<
unsigned N = 4,
typename S = boost::u
int_least32_t>
class Seq_fls {
26 static const unsigned MAX_CHARS =
sizeof(S) * 8 / BITS_PER_CHAR;
54 bool operator!=(self_type
const& sf)
const {
return !(*
this == sf);}
57 BOOST_ASSERT(i < MAX_CHARS);
62 BOOST_ASSERT(i < MAX_CHARS);
63 BOOST_ASSERT(
n < alphabet_size);
69 std::string s(
n,
'X');
71 for(std::size_t i = 0; i !=
n; ++i) {
82 for(std::size_t i = 0; i !=
n; ++i) {
91 void assign(
const boost::string_ref seq) {
92 if( seq.size() >
size() ) BOOST_THROW_EXCEPTION(
98 for(
unsigned i = seq.size(); i != 0; --i) {
100 if( n >= alphabet_size ) {
104 BOOST_THROW_EXCEPTION(
117 friend std::ostream&
operator<<(std::ostream& os, self_type
const& seq) {
118 return seq.
print(os);
129 if( seq2.size() >
length() )
return false;
131 for(
unsigned i = seq2.size(); i != 0; --i) {
133 if( n >= alphabet_size )
return false;
143 template<
class Seq>
inline int 146 const boost::string_ref
s2,
148 const std::size_t = 0
151 for(std::size_t
n = 0;
n != s1.size() &&
n != s2.size(); ++
n) {
161 template<
unsigned N,
typename S>
inline int 166 const unsigned len =
N 169 for(
unsigned j = 0; j != len; ++j ) {
170 i +=
identity(seq1[j], seq2[j], sm);
store short sequence in an integer
Definition: sequence_fls.hpp:24
static const unsigned MASK
Definition: sequence_fls.hpp:27
Seq_fls(self_type const &ss)
Definition: sequence_fls.hpp:40
int identity(Seq const &s1, const boost::string_ref s2, scoring_matrix_t const &sm, const std::size_t=0)
Definition: sequence_fls.hpp:144
Qual_record::quality::value_type value
Definition: find_interval_run.cpp:17
static std::size_t length()
Definition: sequence_fls.hpp:31
bool operator!=(self_type const &sf) const
Definition: sequence_fls.hpp:54
friend bool assign(self_type &seq1, const boost::string_ref seq2)
Definition: sequence_fls.hpp:128
std::ostream & print(std::ostream &os, std::size_t n=self_type::length()) const
Definition: sequence_fls.hpp:77
Definition: find_shared.hpp:22
const std::string s2
Definition: short_seq_map_run.cpp:18
self_type & operator=(self_type const &ss)
Definition: sequence_fls.hpp:42
Seq_fls()
Definition: sequence_fls.hpp:34
Nucleotide
Definition: nucleotide_index.hpp:24
static const unsigned MAX_CHARS
Definition: sequence_fls.hpp:26
void assign(const boost::string_ref seq)
Definition: sequence_fls.hpp:91
static const unsigned alphabet_size
Definition: sequence_fls.hpp:30
self_type & operator=(const boost::string_ref seq)
Definition: sequence_fls.hpp:47
const std::string s1
Definition: short_seq_map_run.cpp:17
friend std::ostream & operator<<(std::ostream &os, self_type const &seq)
Definition: sequence_fls.hpp:117
boost::error_info< struct errinfo_int1_, int > int1_t
Definition: exception.hpp:28
Seq_fls(const boost::string_ref seq)
Definition: sequence_fls.hpp:36
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
static const int N
Definition: find_shared.cpp:275
const std::string seq1
Definition: match_step_run.cpp:43
friend std::size_t hash_value(self_type const &seq)
Definition: sequence_fls.hpp:115
boost::error_info< struct errinfo_int2_, int > int2_t
Definition: exception.hpp:29
boost::error_info< struct errinfo_str1_, std::string > str1_t
Definition: exception.hpp:25
Nucleotide operator[](const std::size_t i) const
Definition: sequence_fls.hpp:56
std::size_t size() const
Definition: sequence_fls.hpp:41
const std::size_t n
Definition: vector_set_test.cpp:26
Nucleotide nucleotide_index(const char c)
Definition: nucleotide_index.hpp:45
Definition: exception.hpp:23
char to_capital(const Nucleotide n)
Definition: nucleotide_index.hpp:216
boost::error_info< struct errinfo_message_, std::string > msg_t
Definition: exception.hpp:24
std::string sanitize(const char c)
Definition: sanitize_string.cpp:53
bool operator==(self_type const &sf) const
Definition: sequence_fls.hpp:53
const std::string seq2
Definition: match_step_run.cpp:89
S val_
Definition: sequence_fls.hpp:89
static const unsigned BITS_PER_CHAR
Definition: sequence_fls.hpp:25
std::string to_string(std::size_t n=self_type::length()) const
Definition: sequence_fls.hpp:68
Seq_fls self_type
Definition: sequence_fls.hpp:32