vdj_pipe
pipeline for processing DNA sequence data
pipe_environment.hpp
Go to the documentation of this file.
1 
7 #ifndef PIPE_ENVIRONMENT_HPP_
8 #define PIPE_ENVIRONMENT_HPP_
9 #include <iosfwd>
10 #include "boost/property_tree/ptree_fwd.hpp"
11 #include "boost/shared_ptr.hpp"
12 #include "boost/chrono/process_cpu_clocks.hpp"
13 #include "vdj_pipe/config.hpp"
15 #include "vdj_pipe/exception.hpp"
18 #include "vdj_pipe/value_map.hpp"
19 
20 namespace vdj_pipe{
21 class Seq_file_map;
22 class Step_variant_store;
23 
27  typedef boost::shared_ptr<Input_manager> in_manager_ptr;
28  typedef boost::shared_ptr<Output_manager> out_manager_ptr;
29  BOOST_STATIC_CONSTANT(std::size_t, unset = static_cast<std::size_t>(-1));
30  static void input_csv(
32  std::vector<std::string>& vs
33  );
34 
35 public:
36  struct Err : public base_exception {};
37 
40  Value_map const& vm
41  );
42  Step_variant_store const& steps() const {return *steps_;}
43  Step_variant_store& steps() {return *steps_;}
44  Input_manager const& input() const {return *im_;}
45  Input_manager& input() {return *im_;}
46  Output_manager const& output() const {return *om_;}
47  Output_manager& output() {return *om_;}
48  char delimiter() const {return om_->delimiter();}
49  std::size_t max_reads() const {return max_reads_;}
50  std::size_t max_file_reads() const {return max_file_reads_;}
51 
52  bool process_more() {
53  if(
54  max_reads() <= (std::size_t)vm_.read_count() ||
55  max_file_reads() <= (std::size_t)vm_.file_read_count()
56  ) {
57  reads_skipped_ = true;
58  return false;
59  }
60  return true;
61  }
62 
63  std::size_t read_count() const;
64  void finish();
65  void process_read();
66  void summary();
67 
68  void write_config(
70  std::string const& path
71  ) const;
72 
73  void start_file(std::string const& fn);
74  void finish_file();
75 
76 private:
77  boost::shared_ptr<Step_variant_store> steps_;
78  in_manager_ptr im_;
79  out_manager_ptr om_;
80  std::size_t max_reads_;
81  std::size_t max_file_reads_;
82  std::string summary_output_path_;
83  boost::chrono::process_real_cpu_clock::time_point t1_, t2_, t3_;
87 
88 private:
89  std::ostream& print_summary(std::ostream& os) const;
90 
91 };
92 
93 }//namespace vdj_pipe
94 #endif /* PIPE_ENVIRONMENT_HPP_ */
Step_variant_store const & steps() const
Definition: pipe_environment.hpp:42
out_manager_ptr om_
Definition: pipe_environment.hpp:79
Definition: pipe_environment.hpp:36
Output_manager & output()
Definition: pipe_environment.hpp:47
Value_map vm_
Definition: pipe_environment.hpp:86
boost::shared_ptr< Step_variant_store > steps_
Definition: pipe_environment.hpp:77
bool reads_skipped_
Definition: pipe_environment.hpp:85
std::size_t max_reads_
Definition: pipe_environment.hpp:80
boost::shared_ptr< Input_manager > in_manager_ptr
Definition: pipe_environment.hpp:27
Input_manager const & input() const
Definition: pipe_environment.hpp:44
boost::shared_ptr< Output_manager > out_manager_ptr
Definition: pipe_environment.hpp:28
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
bool process_more()
Definition: pipe_environment.hpp:52
Input_manager & input()
Definition: pipe_environment.hpp:45
char delimiter() const
Definition: pipe_environment.hpp:48
bool is_running_
Definition: pipe_environment.hpp:84
in_manager_ptr im_
Definition: pipe_environment.hpp:78
Definition: pipe_environment.hpp:26
#define VDJ_PIPE_DECL
Definition: config.hpp:23
std::size_t max_file_reads() const
Definition: pipe_environment.hpp:50
boost::chrono::process_real_cpu_clock::time_point t3_
Definition: pipe_environment.hpp:83
Output_manager const & output() const
Definition: pipe_environment.hpp:46
Definition: input_manager.hpp:22
Definition: step_variant_store.hpp:40
Definition: exception.hpp:23
Step_variant_store & steps()
Definition: pipe_environment.hpp:43
Definition: output_manager.hpp:20
Store values mapped against name strings and value IDs.
Definition: value_map.hpp:23
std::string summary_output_path_
Definition: pipe_environment.hpp:82
std::size_t max_file_reads_
Definition: pipe_environment.hpp:81
bpt::ptree ptree
Definition: processing_step_utils.hpp:19
std::size_t max_reads() const
Definition: pipe_environment.hpp:49