vdj_pipe
pipeline for processing DNA sequence data
read_info.hpp
Go to the documentation of this file.
1 
7 #ifndef READ_INFO_HPP_
8 #define READ_INFO_HPP_
9 #include <string>
10 #include "boost/assert.hpp"
11 #include "vdj_pipe/object_ids.hpp"
14 
15 namespace vdj_pipe{
18 class Read_info {
19 public:
20  explicit Read_info(const boost::string_ref name)
21  : name_(name.to_string()),
22  reverse_(false),
23  seq_file_(Path_id()),
24  trim_(sequence_interval::whole())
25  {}
26 
28  const boost::string_ref name,
29  const Path_id seq_file,
30  const unsigned len,
31  const bool reverse
32  )
33  : name_(name.to_string()),
34  reverse_(reverse),
35  seq_file_(seq_file),
36  trim_(0, (int)len)
37  {}
38 
39  const std::string& name() const {return name_;}
40  unsigned size() const {return width(trim_);}
41  bool empty() const {return boost::numeric::empty(trim_);}
42  Path_id seq_file() const {return seq_file_;}
43  bool is_reverse() const {return reverse_;}
44  sequence_interval const& trim() const {return trim_;}
45 
46  Read_info& reverse(const bool rev) {
47  reverse_ = rev;
48  return *this;
49  }
50 
51  Read_info& seq_file(const Path_id pid) {
52  BOOST_ASSERT((! seq_file_) || (seq_file_ == pid));
53  seq_file_ = pid;
54  return *this;
55  }
56 
57  Read_info& trim(const unsigned lo, const unsigned hi) {
58  return trim(sequence_interval(lo,hi));
59  }
60 
62  trim_ = intersect(trim_, si);
63  return *this;
64  }
65 
66  void combine(Read_info const& si) {
67  BOOST_ASSERT( name_ == si.name_ );
68  reverse_ |= si.is_reverse();
69  if( si.seq_file() ) seq_file(si.seq_file());
70  trim_ = intersect(trim_, si.trim());
71  }
72 
73 private:
74  std::string name_;
75  bool reverse_;
76  Path_id seq_file_;
78 };
79 
80 template<class Ostr> inline Ostr& operator<<(Ostr& ostr, const Read_info si) {
81  ostr << si.name() << '[' << si.size() << ']';
82  return ostr;
83 }
84 
85 }//namespace vdj_pipe
86 #endif /* READ_INFO_HPP_ */
sequence_interval trim_
Definition: read_info.hpp:77
Path_id seq_file() const
Definition: read_info.hpp:42
const std::string & name() const
Definition: read_info.hpp:39
void combine(Read_info const &si)
Definition: read_info.hpp:66
Read_info & trim(const unsigned lo, const unsigned hi)
Definition: read_info.hpp:57
bool empty() const
Definition: read_info.hpp:41
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
Read_info & trim(sequence_interval const &si)
Definition: read_info.hpp:61
Path_id seq_file_
Definition: read_info.hpp:76
unsigned size() const
Definition: read_info.hpp:40
std::string name_
Definition: read_info.hpp:74
Read_info(const boost::string_ref name)
Definition: read_info.hpp:20
sequence_interval const & trim() const
Definition: read_info.hpp:44
std::string to_string(detail::Queable_ofstream_types::val_vector const v)
Definition: find_shared.cpp:174
Definition: read_info.hpp:18
boost::numeric::interval< int, boost::numeric::interval_lib::policies< boost::numeric::interval_lib::rounded_math< int >, detail::Interval_checking_policy< int > > > sequence_interval
Definition: sequence_interval.hpp:40
bool is_reverse() const
Definition: read_info.hpp:43
std::basic_ostream< ChT, Tr > & operator<<(std::basic_ostream< ChT, Tr > &os, Blank const &)
Definition: value_variant.hpp:37
Read_info & reverse(const bool rev)
Definition: read_info.hpp:46
bool reverse_
Definition: read_info.hpp:75
Read_info(const boost::string_ref name, const Path_id seq_file, const unsigned len, const bool reverse)
Definition: read_info.hpp:27
Read_info & seq_file(const Path_id pid)
Definition: read_info.hpp:51