vdj_pipe
pipeline for processing DNA sequence data
filter_base.hpp
Go to the documentation of this file.
1 
7 #ifndef FILTER_BASE_HPP_
8 #define FILTER_BASE_HPP_
10 #include "vdj_pipe/object_ids.hpp"
12 
13 namespace vdj_pipe{ namespace detail{
14 
17 class Filter_base : public Step_base_single {
18 public:
19 
20  void summary(std::ostream& os) const;
21 
22 protected:
23 
24  VDJ_PIPE_KEYWORD_STRUCT(
25  kwds,
26 
27  //name of boolean variable indicating whether read passed filter
28  (passed_name)
29  );
30 
32  vma_type const& vma,
33  boost::property_tree::ptree const& pt,
35  );
36 
37  void pass(const bool b) {
38  if( ! b ) {
39  ++nf_;
40  vma_.set_empty();
41  }
42  if( pass_id_ ) vma_[pass_id_] = b;
43  }
44 
45  std::size_t nf_;
46  Val_id pass_id_;
47 };
48 
52 public:
53  void summary(std::ostream& os) const;
54 
55 protected:
57  vma_type const& vma,
58  boost::property_tree::ptree const& pt,
60  )
61  : Filter_base(vma, pt, pe), nt_(0)
62  {}
63 
64  void trim(sequence_interval const& si) {
65  pass( ! empty(si) );
66  if( si.lower() > 0 || si.upper() < (int)vma_.sequence().size() ) {
67  ++nt_;
68  vma_.trim(si);
69  }
70  }
71 
72  std::size_t nt_;
73 };
74 
75 }//namespace detail
76 }//namespace vdj_pipe
77 #endif /* FILTER_BASE_HPP_ */
Definition: filter_base.hpp:17
Definition: value_map_access_single.hpp:16
Definition: filter_base.hpp:51
Main namespace of vdj_pipe library.
Definition: sequence_file.hpp:14
Definition: pipe_environment.hpp:26
Definition: step_base_single.hpp:16