vdj_pipe
pipeline for processing DNA sequence data
me_factory.hpp
Go to the documentation of this file.
1 
7 #ifndef ME_FACTORY_HPP_
8 #define ME_FACTORY_HPP_
9 #include <iosfwd>
10 #include <map>
11 #include <memory>
12 #include <string>
13 #include "boost/assert.hpp"
14 #include "boost/optional.hpp"
15 #include "boost/property_tree/ptree_fwd.hpp"
16 namespace bpt = boost::property_tree;
17 
19 #include "me_battery.hpp"
20 #include "vdj_pipe/config.hpp"
21 #include "vdj_pipe/exception.hpp"
22 
23 namespace vdj_pipe{
24 class Input_manager;
25 class Vm_access_single;
26 
27 namespace match{
28 
32 public:
33 
34  struct Err : public base_exception{};
35 
37  Vm_access_single const& vma,
38  Input_manager const& in
39  )
40  : vma_(vma),
41  in_(in)
42  {}
43 
44  void insert_element(bpt::ptree const& pt);
45  void insert_combination(bpt::ptree const& pt);
46 
47  std::auto_ptr<Match_element_battery> get() const {
48  return std::auto_ptr<Match_element_battery>(
50  );
51  }
52 
53 private:
58  std::vector<std::string> names_;
59  std::vector<std::string> dep_names_;
60  std::vector<bool> required_;
62 };
63 
66 struct Cut_proto {
67  static const int unset;
68 
69  struct Err : public base_exception{};
70 
72  : cut_(false),
73  re_start_(true),
74  pos_(unset)
75  {}
76 
77  void parse(bpt::ptree const& pt);
78 
80  return Relative_position(pos_, re_start_);
81  }
82 
83  bool cut_;
84  bool re_start_;
85  int pos_;
86 };
87 
91  std::vector<std::string> const& me_names,
92  std::vector<std::string> const& all_me_names,
93  std::vector<std::size_t>& mev
94 );
95 
98 void make_column_inds(
99  std::string const& line,
100  std::vector<std::string> const& col_names,
101  std::vector<int>& col_inds
102 );
103 
110  std::istream& is,
111  std::vector<int> const& col_inds,
113 );
114 
118  bpt::ptree const& pt,
119  Input_manager const& in,
120  std::vector<std::string> const& me_names,
121  std::vector<std::size_t>& mev,
123 );
124 
128  Value_map const& vm,
129  bpt::ptree const& pt,
130  Input_manager const& in,
131  std::vector<std::string> const& me_names
132 );
133 
137  static const int unset;
138 
139  struct Err : public base_exception{};
140 
142  bpt::ptree const& pt,
143  Input_manager const& in
144  );
145 
147  return Truncate(
148  cut_lo_.cut_,
149  cut_up_.cut_,
150  cut_lo_.position(),
151  cut_up_.position()
152  );
153  }
154 
155  Relative_interval interval() const;
156  void parse_position(bpt::ptree const& pt);
157 
158  void parse_csv_file(
159  bpt::ptree const& pt,
160  Input_manager const& in
161  );
162 
163  //true if start of interval is defined
165  //true if position is defined relative to start of reference interval
166  bool re_start_;
167  std::string name_;
168  std::string value_name_;
169  std::string score_name_;
170  std::string identity_name_;
171  std::string re_name_;
172  boost::optional<int> pos_;
173  boost::optional<int> len_;
174  boost::optional<int> min_score_;
175  boost::optional<unsigned> min_match_length_;
176 
180  bool required_;
184  boost::optional<detail::Seq_props> sp_;
187 };
188 
189 
190 }//namespace match
191 }//namespace vdj_pipe
192 #endif /* ME_FACTORY_HPP_ */
Sequence position defined relatively to an interval.
Definition: me_relative_position.hpp:16
Definition: file_properties.hpp:59
Definition: me_truncate.hpp:15
bool re_start_
Definition: me_factory.hpp:84
Match_combination make_combination(Value_map const &vm, bpt::ptree const &pt, Input_manager const &in, std::vector< std::string > const &me_names)
Definition: me_factory.cpp:365
std::string re_name_
Definition: me_factory.hpp:171
bool allow_gaps_
Definition: me_factory.hpp:179
Definition: me_factory.hpp:69
Cut_proto cut_lo_
Definition: me_factory.hpp:185
bool start_defined_
Definition: me_factory.hpp:164
bool require_best_
Definition: me_factory.hpp:182
std::vector< std::string > names_
Definition: me_factory.hpp:58
variant_vector vv_
Definition: me_factory.hpp:56
Definition: value_map_access_single.hpp:16
Definition: me_factory.hpp:139
void make_element_index(std::vector< std::string > const &me_names, std::vector< std::string > const &all_me_names, std::vector< std::size_t > &mev)
Definition: me_factory.cpp:190
Input_manager const & in_
Definition: me_factory.hpp:55
bool re_start_
Definition: me_factory.hpp:166
std::vector< std::string > dep_names_
Definition: me_factory.hpp:59
bool required_
Definition: me_factory.hpp:180
static const int unset
Definition: me_factory.hpp:137
std::string identity_name_
Definition: me_factory.hpp:170
void insert_combination(bpt::ptree const &pt)
Definition: me_factory.cpp:410
std::vector< bool > required_
Definition: me_factory.hpp:60
boost::optional< int > pos_
Definition: me_factory.hpp:172
static const int unset
Definition: me_factory.hpp:67
bool track_mismatches_
Definition: me_factory.hpp:178
Definition: me_factory.hpp:34
std::string score_name_
Definition: me_factory.hpp:169
boost::optional< int > len_
Definition: me_factory.hpp:173
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
Truncate truncation() const
Definition: me_factory.hpp:146
detail::name_seq_vector seqs_
Definition: me_factory.hpp:183
void parse_csv_combination(std::istream &is, std::vector< int > const &col_inds, detail::string_table &st)
Definition: me_factory.cpp:257
combination_vector cv_
Definition: me_factory.hpp:61
Vm_access_single const & vma_
Definition: me_factory.hpp:54
std::vector< string_vector > string_table
Definition: sequence_map_types.hpp:17
Definition: me_battery.hpp:53
int pos_
Definition: me_factory.hpp:85
#define VDJ_PIPE_DECL
Definition: config.hpp:23
Definition: me_combination.hpp:23
std::vector< me_variant > variant_vector
Definition: me_types.hpp:31
Definition: me_factory.hpp:66
boost::optional< unsigned > min_match_length_
Definition: me_factory.hpp:175
truncate_vector tv_
Definition: me_factory.hpp:57
bool ignore_dups_
Definition: me_factory.hpp:181
Definition: input_manager.hpp:22
std::vector< Truncate > truncate_vector
Definition: me_types.hpp:32
Cut_proto()
Definition: me_factory.hpp:71
void insert_element(bpt::ptree const &pt)
Definition: me_factory.cpp:99
Definition: me_factory.hpp:136
Relative_position position() const
Definition: me_factory.hpp:79
std::string name_
Definition: me_factory.hpp:167
Cut_proto cut_up_
Definition: me_factory.hpp:186
void make_column_inds(std::string const &line, std::vector< std::string > const &col_names, std::vector< int > &col_inds)
Definition: me_factory.cpp:211
Definition: exception.hpp:23
boost::optional< detail::Seq_props > sp_
Definition: me_factory.hpp:184
boost::optional< int > min_score_
Definition: me_factory.hpp:174
Match_element_factory(Vm_access_single const &vma, Input_manager const &in)
Definition: me_factory.hpp:36
Store values mapped against name strings and value IDs.
Definition: value_map.hpp:23
bool cut_
Definition: me_factory.hpp:83
std::string value_name_
Definition: me_factory.hpp:168
bpt::ptree ptree
Definition: processing_step_utils.hpp:19
std::vector< Match_combination > combination_vector
Definition: me_types.hpp:33
std::vector< match_seq > name_seq_vector
Definition: sequence_map_types.hpp:15
Definition: me_relative_interval.hpp:15
Definition: me_factory.hpp:31