7 #ifndef SEQUENCE_TRANSFORM_HPP_ 8 #define SEQUENCE_TRANSFORM_HPP_ 10 #include "boost/range.hpp" 11 #include "boost/range/as_literal.hpp" 21 template<
class Range>
inline std::string
complement(Range
const& r) {
22 std::string rstr(boost::size(boost::as_literal(r)),
'X');
23 std::string::reverse_iterator i = rstr.rbegin();
24 typedef typename boost::range_iterator<const Range>::type iter;
25 iter j = boost::begin(boost::as_literal(r)), end = boost::end(boost::as_literal(r));
26 for(; j != end; ++i, ++j) {
35 const boost::string_ref seq,
40 (std::size_t)si.lower() > seq.size() ||
41 (std::size_t)si.upper() > seq.size()
42 ) BOOST_THROW_EXCEPTION(
50 complement(seq.substr(si.lower(), width(si))) :
51 seq.substr(si.lower(), width(si)).
to_string()
boost::error_info< struct errinfo_int1_, int > int1_t
Definition: exception.hpp:28
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
boost::error_info< struct errinfo_int2_, int > int2_t
Definition: exception.hpp:29
std::string to_string(detail::Queable_ofstream_types::val_vector const v)
Definition: find_shared.cpp:174
Nucleotide complement(const Nucleotide n)
Definition: nucleotide_index.hpp:153
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
Definition: exception.hpp:23
boost::error_info< struct errinfo_message_, std::string > msg_t
Definition: exception.hpp:24
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