7 #ifndef PARSER_QUAL_HPP_ 8 #define PARSER_QUAL_HPP_ 10 #include "boost/lexical_cast.hpp" 11 #include "boost/tokenizer.hpp" 27 if( fi.format() != format::Qual ) BOOST_THROW_EXCEPTION(
29 << Err::msg_t(
"wrong file format for quality score parser")
30 << Err::str1_t(sanitize(fi.path()))
31 << Err::int1_t(fi.format())
45 const boost::string_ref get_id() {
return Parser_line::get_id(
'>');}
46 void next_record() {Parser_line::seek_line(
'>');}
47 const boost::string_ref get_defstr() {
return Parser_line::get_defstr(
'>');}
51 get_qual(back_inserter(q));
55 template<
class InsertIter>
void get_qual(InsertIter ii) {
56 while( fis_.istream().peek() !=
'>' && getline(fis_.istream(), str_) ) {
58 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
59 boost::char_separator<char> sep(
" \t");
60 tokenizer tok(str_, sep);
61 for(tokenizer::const_iterator ti = tok.begin(); ! ti.at_end(); ++ti) {
63 const int i = boost::lexical_cast<
int>(*ti);
64 ii = boost::numeric_cast<quality::value_type>(i);
65 }
catch(std::bad_cast
const&) {
66 BOOST_THROW_EXCEPTION(
68 << Err::msg_t(
"invalid quality score")
69 << Err::str1_t(sanitize(*ti, 60))
70 << Err::line_t(line_num() - 1)
81 get_qual(back_inserter(qr.
qual_));
82 }
catch(std::exception
const&) {
83 BOOST_THROW_EXCEPTION(
85 << Err::msg_t(
"invalid quality score")
86 << Err::str1_t(sanitize(qr.
id_, 60))
87 << Err::str2_t(sanitize(qr.
comm_, 60))
88 << Err::nested_t(boost::current_exception())
quality qual_
Definition: sequence_record.hpp:57
Definition: sequence_record.hpp:35
Compression
File compression types.
Definition: file_properties.hpp:19
Definition: parser_line.hpp:26
Main namespace of vdj_pipe library.
Definition: sequence_file.hpp:14
Definition: parser_qual.hpp:19
Definition: sequence_record.hpp:53
Basic line-based parser; use to derive other parsers.
Definition: parser_line.hpp:23