X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=qualityscores.cpp;h=3f8722f34f83416aa143f21a5a81e99c7329a7d8;hb=47af4126c6ece121172cd486c1ca7eeb1ccae2de;hp=8b8e4ec22c68ea406ddcafeee6e4a1abb280566a;hpb=6973be461c47c057531f447de22003a30cabc193;p=mothur.git diff --git a/qualityscores.cpp b/qualityscores.cpp index 8b8e4ec..3f8722f 100644 --- a/qualityscores.cpp +++ b/qualityscores.cpp @@ -44,16 +44,66 @@ QualityScores::QualityScores(ifstream& qFile){ else{ seqName = seqName.substr(1); } - string qScoreString = m->getline(qFile); + while(qFile.peek() != '>' && qFile.peek() != EOF){ + qScoreString += ' ' + m->getline(qFile); + } istringstream qScoreStringStream(qScoreString); + int count = 0; while(!qScoreStringStream.eof()){ + if (m->control_pressed) { break; } qScoreStringStream >> score; qScores.push_back(score); + count++; } qScores.pop_back(); + +// string scores = ""; +// +// while(!qFile.eof()){ +// +// qFile >> seqName; +// +// //get name +// if (seqName.length() != 0) { +// seqName = seqName.substr(1); +// while (!qFile.eof()) { +// char c = qFile.get(); +// //gobble junk on line +// if (c == 10 || c == 13){ break; } +// } +// m->gobble(qFile); +// } +// +// //get scores +// while(qFile){ +// char letter=qFile.get(); +// if((letter == '>')){ qFile.putback(letter); break; } +// else if (isprint(letter)) { scores += letter; } +// } +// m->gobble(qFile); +// +// break; +// } +// +// //convert scores string to qScores +// istringstream qScoreStringStream(scores); +// +// int score; +// while(!qScoreStringStream.eof()){ +// +// if (m->control_pressed) { break; } +// +// qScoreStringStream >> score; +// qScores.push_back(score); +// } +// +// qScores.pop_back(); + seqLength = qScores.size(); + + } catch(exception& e) { m->errorOut(e, "QualityScores", "QualityScores"); @@ -101,7 +151,7 @@ void QualityScores::printQScores(ofstream& qFile){ void QualityScores::trimQScores(int start, int end){ try { vector hold; - + if(end == -1){ hold = vector(qScores.begin()+start, qScores.end()); qScores = hold;