41 #include <Bpp/Text/TextTools.h> 42 #include <Bpp/Text/StringTokenizer.h> 43 #include <Bpp/Numeric/NumTools.h> 55 if (!input) {
throw IOException (
"PhredPoly::read: fail to open stream"); }
57 string temp, name, sequence =
"";
62 getline(input, temp,
'\n');
63 StringTokenizer st(temp,
" ");
64 name = st.getToken(0);
67 const Alphabet* alpha = seq.getAlphabet();
70 while (!input.eof()) {
71 getline(input, temp,
'\n');
72 StringTokenizer st(temp,
" ");
73 if (st.numberOfRemainingTokens() == 12) {
74 double a = TextTools::toDouble(st.getToken(3));
75 double b = TextTools::toDouble(st.getToken(7));
80 v.push_back(st.getToken(0));
81 if (b / a > this->ratio_) {
82 v.push_back(st.getToken(4));
88 throw Exception(
"PhredPoly::read: sequence without name!");
91 seq.setContent(sequence);
virtual int getGeneric(const std::vector< int > &states) const =0
Get the generic state that match a set of states.
This alphabet is used to deal NumericAlphabet.
PhredPoly(double ratio=0.8)
Build a new PhredPoly object.
bool nextSequence(std::istream &input, Sequence &seq) const
Read sequence from stream.