vdj_pipe
pipeline for processing DNA sequence data
processing_step_utils.hpp
Go to the documentation of this file.
1 
7 #ifndef PROCESSING_STEP_UTILS_HPP_
8 #define PROCESSING_STEP_UTILS_HPP_
9 #include <string>
10 #include <sstream>
11 #include "boost/property_tree/json_parser.hpp"
12 #include "boost/shared_ptr.hpp"
15 
16 namespace vdj_pipe{ namespace test{
17 
18 namespace bpt = boost::property_tree;
19 typedef bpt::ptree ptree;
20 
24  static const std::string pe_opts_str =
25  " { "
26  " \"base_path_input\": \"sample_data\", "
27  " \"base_path_output\": \"out/temp\", "
28  "\"input\": {} "
29  " } ";
30  std::istringstream is1(pe_opts_str);
31 
32  ptree pt1;
33  bpt::read_json(is1, pt1);
34  return Pipe_environment(pt1, vm);
35 }
36 
39 template<class Step> Step make_step(
40  Vm_access_single const& vma,
41  std::string const& json
42 ) {
43  Pipe_environment pe = make_pe(vma);
44  std::istringstream is2(json);
45  ptree pt2;
46  bpt::read_json(is2, pt2);
47 
48  return Step(vma, pt2, pe);
49 }
50 
53 template<class Step> class Step_harness {
54  typedef boost::shared_ptr<Step> step_ptr;
55 
56 public:
57  explicit Step_harness(std::string const& json)
58  : vma_(Value_names::single()),
59  step_(make_step<Step>(vma_, json))
60  {}
61 
62  void run(std::string const& seq) {
63  vma_.sequence(seq);
64  Vm_access_single::qual_type qual(seq.size(), 10);
65  vma_.quality(qual);
66  vma_.interval(sequence_interval(0U, seq.size()));
67  vma_.set_reverse(false);
68  step_.run();
69  }
70 
71  Vm_access_single const& vma() const {return vma_;}
72 
73 private:
75  Step step_;
76 };
77 
78 
79 }//namespace test
80 }//namespace vdj_pipe
81 #endif /* PROCESSING_STEP_UTILS_HPP_ */
Step make_step(Vm_access_single const &vma, std::string const &json)
Definition: processing_step_utils.hpp:39
Vm_access_single vma_
Definition: processing_step_utils.hpp:74
Definition: sequence_record.hpp:35
qual_type const & quality() const
Definition: value_map_access_single.hpp:43
Definition: value_map_access_single.hpp:16
boost::shared_ptr< Step > step_ptr
Definition: processing_step_utils.hpp:54
Pipe_environment make_pe(Value_map const &vm)
Definition: processing_step_utils.hpp:23
sequence_interval interval() const
Definition: value_map_access_single.hpp:47
void run(std::string const &seq)
Definition: processing_step_utils.hpp:62
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
Qual_record::quality qual
Definition: match_element_run.cpp:26
Definition: pipe_environment.hpp:26
Definition: processing_step_utils.hpp:53
Vm_access_single const & vma() const
Definition: processing_step_utils.hpp:71
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
Step step_
Definition: processing_step_utils.hpp:75
Store values mapped against name strings and value IDs.
Definition: value_map.hpp:23
seq_type const & sequence() const
Definition: value_map_access_single.hpp:41
Definition: value_names.hpp:20
void set_reverse(const bool rev)
Definition: value_map_access_single.hpp:71
bpt::ptree ptree
Definition: processing_step_utils.hpp:19
Step_harness(std::string const &json)
Definition: processing_step_utils.hpp:57