void operator()(std::string::const_iterator,
std::string::const_iterator) const
{
- //std::cout << "adding annot: " << begin << " " << end << " " << name << " " << type << std::endl;
+ //std::cout << "adding annot: " << begin << "|" << end << "|" << name << "|" << type << std::endl;
annot_list.push_back(annot(begin, end, name, type));
};
};
+spirit::space_p >>
spirit::uint_p[spirit::assign_a(end)] >>
+spirit::space_p >>
- (*(spirit::alpha_p|spirit::digit_p))[spirit::assign_a(name)] >>
- // optional type
- !(
- +spirit::space_p >>
- (*(spirit::alpha_p))[spirit::assign_a(type)]
- )
+ (
+ spirit::alpha_p >>
+ *spirit::graph_p
+ )[spirit::assign_a(name)] >>
+ // optional type
+ !(
+ +spirit::space_p >>
+ (
+ spirit::alpha_p >>
+ *spirit::graph_p
+ )[spirit::assign_a(type)]
+ )
// to understand how this group gets set
// read the comment above struct push_back_annot
)[push_back_annot(annots, start, end, type, name)]
"GCT\n"
"gCTn\n"
"75\t90\tname2\ttype2\n"
+ "100 120 name-asdf type!@#$%\n"
;
string s(100, 'A');
s += "GCTGCTAATT";
seq.parse_annot(annot_data, 0, 0);
std::list<annot> annots_list = seq.annotations();
std::vector<annot> annots(annots_list.begin(), annots_list.end());
- BOOST_REQUIRE_EQUAL( annots.size(), 7);
+ BOOST_REQUIRE_EQUAL( annots.size(), 8);
BOOST_CHECK_EQUAL( annots[0].start, 0 );
BOOST_CHECK_EQUAL( annots[0].end, 10 );
BOOST_CHECK_EQUAL( annots[0].type, "type");
BOOST_CHECK_EQUAL( annots[4].name, "backward");
BOOST_CHECK_EQUAL( annots[5].name, "name2");
BOOST_CHECK_EQUAL( annots[5].end, 90);
+ BOOST_CHECK_EQUAL( annots[6].start, 100);
+ BOOST_CHECK_EQUAL( annots[6].end, 120);
+ BOOST_CHECK_EQUAL( annots[6].name, "name-asdf");
+ BOOST_CHECK_EQUAL( annots[6].type, "type!@#$%");
// sequence defined annotations will always be after the
// absolute positions
- BOOST_CHECK_EQUAL( annots[6].name, "ident3 asdf");
- BOOST_CHECK_EQUAL( annots[6].start, 100);
+ BOOST_CHECK_EQUAL( annots[7].name, "ident3 asdf");
+ BOOST_CHECK_EQUAL( annots[7].start, 100);
//BOOST_CHECK_EQUAL( annots
}