vdj_pipe
pipeline for processing DNA sequence data
sequence_entry.hpp
Go to the documentation of this file.
1 
7 #ifndef SEQUENCE_ENTRY_HPP_
8 #define SEQUENCE_ENTRY_HPP_
9 #include <string>
10 #include "boost/assert.hpp"
11 #include "boost/functional/hash.hpp"
13 #include "vdj_pipe/object_ids.hpp"
14 
15 namespace vdj_pipe{
16 
19 class Seq_entry {
20 public:
21  explicit Seq_entry(
22  const boost::string_ref seq = "",
23  const Read_id id = Read_id()
24  )
25  : seq_(seq.begin(), seq.size()),
26  id_(id)
27  {}
28 
29  unsigned size() const {return seq_.size();}
30  std::string const& sequence() const {return seq_;}
31  bool empty() const {return seq_.empty();}
32  Read_id id() const {return id_;}
33 
34 private:
35  std::string seq_;
36  Read_id id_;
37 };
38 
41 inline bool operator==(Seq_entry const& se1, Seq_entry const& se2) {
42  return se1.sequence() == se2.sequence();
43 }
44 
47 inline bool operator==(const boost::string_ref se1, Seq_entry const& se2) {
48  return se1 == se2.sequence();
49 }
50 
53 inline bool operator==(Seq_entry const& se1, const boost::string_ref se2) {
54  return se1.sequence() == se2;
55 }
56 
59 inline std::size_t hash_value(Seq_entry const& se) {
60  return boost::hash_value(se.sequence());
61 }
62 
63 
64 }//namespace vdj_pipe
65 #endif /* SEQUENCE_ENTRY_HPP_ */
unsigned size() const
Definition: sequence_entry.hpp:29
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
std::string seq_
Definition: sequence_entry.hpp:35
std::size_t hash_value(basic_string_ref< charT, traits > const &str)
Definition: string_ref.hpp:15
std::string const & sequence() const
Definition: sequence_entry.hpp:30
Read_id id() const
Definition: sequence_entry.hpp:32
std::size_t hash_value(File const &f)
Definition: file.cpp:158
bool operator==(Seq_entry const &se1, Seq_entry const &se2)
Definition: sequence_entry.hpp:41
Seq_entry(const boost::string_ref seq="", const Read_id id=Read_id())
Definition: sequence_entry.hpp:21
bool empty() const
Definition: sequence_entry.hpp:31
Definition: sequence_entry.hpp:19
Read_id id_
Definition: sequence_entry.hpp:36