9 #include "boost/assert.hpp" 10 #include "boost/shared_ptr.hpp" 25 typedef boost::shared_ptr<map_type>
map_ptr;
39 :
map_(new map_type())
41 const std::string rc =
"read_count";
45 const std::string frc =
"file_read_count";
49 const std::string sfn =
"seq_file_name";
53 const std::string ri =
"read_id";
62 iterator
end()
const {
return map_->end();}
63 std::size_t
size()
const {
return map_->size();}
71 std::string
const&
name(
const Val_id vid)
const {
72 return map_->name(vid);
76 return map_->insert_name(name);
80 return map_->insert_new_name(name);
84 return map_->find_id(name);
88 return map_->value_id(name);
124 return value<std::string>(Val_id(
seq_fn_i));
136 return value<std::string>(Val_id(
read_id_i));
143 template<
typename T> T
const&
value(std::string
const&
name)
const {
145 if( !
id ) BOOST_THROW_EXCEPTION(
155 if( !
id ) BOOST_THROW_EXCEPTION(
160 return value_ptr<T>(id);
163 template<
typename T> T
const&
value(
const Val_id
id)
const {
165 return boost::get<T>((*map_)[id]);
166 }
catch(std::exception
const&) {
167 BOOST_THROW_EXCEPTION(
177 template<
typename T> T
const*
value_ptr(
const Val_id
id)
const {
178 return boost::get<T>(&(*map_)[id]);
183 if( std::string
const* id_ptr = boost::get<std::string>(&(*
map_)[
id]) )
185 static const std::string id_str =
"not_available";
193 const Val_id trim_id,
195 const bool reverse_compl
197 std::string
const& seq = value<std::string>(seq_id);
201 value<sequence_interval>(trim_id) :
208 const Val_id qual_id,
209 const Val_id trim_id,
211 const bool reverse_compl
215 std::size_t n2 = q.size();
221 if( n1 > q.size() || n2 > q.size() ) BOOST_THROW_EXCEPTION(
223 <<
Err::msg_t(
"sequence interval and quality score mismatch")
229 if( reverse_compl ) {
230 for(std::size_t i = 0, j = n2-1; i != q1.size(); ++i, --j) q1[i] = q[j];
232 for( std::size_t i = 0, j = n1; i != q1.size(); ++i, ++j) q1[i] = q[j];
void read_id(std::string const &id)
Definition: value_map.hpp:139
long read_count() const
Definition: value_map.hpp:99
Definition: value_map.hpp:30
void read_count_reset()
Definition: value_map.hpp:103
std::string const & read_id_nothrow() const
Definition: value_map.hpp:131
T const * value_ptr(std::string const &name) const
Definition: value_map.hpp:153
map_type::iterator iterator
Definition: value_map.hpp:34
Definition: value_map.hpp:28
value_variant const & operator[](const Val_id vid) const
Definition: value_map.hpp:91
boost::shared_ptr< map_type > map_ptr
Definition: value_map.hpp:25
Definition: sequence_record.hpp:35
long file_read_count() const
Definition: value_map.hpp:111
std::string const & variable_type_str(const int which)
Definition: value_variant.hpp:54
std::string const & str_nothrow(const Val_id id) const
Definition: value_map.hpp:182
Val_id value_id(std::string const &name) const
Definition: value_map.hpp:87
void clear_values()
Definition: value_map.hpp:65
Definition: value_map.hpp:29
iterator begin() const
Definition: value_map.hpp:61
Store values mapped against name strings and value IDs.
Definition: named_value_map.hpp:22
std::string const & seq_file_name() const
Definition: value_map.hpp:123
boost::error_info< struct errinfo_int1_, int > int1_t
Definition: exception.hpp:28
void seq_file_name(std::string const &fn)
Definition: value_map.hpp:127
std::string const & name(const Val_id vid) const
Definition: value_map.hpp:71
Definition: value_map.hpp:36
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
boost::errinfo_nested_exception nested_t
Definition: exception.hpp:32
Val_id insert_new_name(std::string const &name)
Definition: value_map.hpp:79
Qual_record::quality quality(const Val_id qual_id, const Val_id trim_id, const bool trimmed, const bool reverse_compl) const
Definition: value_map.hpp:207
boost::error_info< struct errinfo_str2_, std::string > str2_t
Definition: exception.hpp:26
T const * value_ptr(const Val_id id) const
Definition: value_map.hpp:177
boost::error_info< struct errinfo_int2_, int > int2_t
Definition: exception.hpp:29
Val_id insert_name(std::string const &name)
Definition: value_map.hpp:75
value_variant & operator[](const Val_id vid)
Definition: value_map.hpp:95
boost::error_info< struct errinfo_str1_, std::string > str1_t
Definition: exception.hpp:25
void read_count_incr()
Definition: value_map.hpp:107
void file_read_count_reset()
Definition: value_map.hpp:115
iterator const_iterator
Definition: value_map.hpp:35
Definition: value_map.hpp:27
boost::variant< Blank, bool, long, double, std::string, sequence_interval, Qual_record::quality > value_variant
Definition: value_variant.hpp:50
std::string const & read_id() const
Definition: value_map.hpp:135
Value_map()
Definition: value_map.hpp:38
std::size_t size() const
Definition: value_map.hpp:63
map_ptr map_
Definition: value_map.hpp:238
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
T const & value(const Val_id id) const
Definition: value_map.hpp:163
Definition: exception.hpp:23
Definition: id_iterator.hpp:16
boost::error_info< struct errinfo_message_, std::string > msg_t
Definition: exception.hpp:24
detail::Named_value_map< Val_id, value_variant > map_type
Definition: value_map.hpp:24
std::string sanitize(const char c)
Definition: sanitize_string.cpp:53
std::string transform(const boost::string_ref seq, sequence_interval const &si, const bool reverse)
Reverse-complement (optionally) a portion of a sequence.
Definition: sequence_transform.hpp:34
void file_read_count_incr()
Definition: value_map.hpp:119
Val_id const * find_id(std::string const &name) const
Definition: value_map.hpp:83
Store values mapped against name strings and value IDs.
Definition: value_map.hpp:23
T const & value(std::string const &name) const
Definition: value_map.hpp:143
iterator end() const
Definition: value_map.hpp:62
std::string sequence(const Val_id seq_id, const Val_id trim_id, const bool trimmed, const bool reverse_compl) const
Definition: value_map.hpp:191