X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=qualityscores.cpp;h=0641d3b7bf4ed8abc588467b946d0678766c5fb0;hb=6da6af5c7f43f9f4f602d224af447805fb01c46c;hp=1ef074df88919d9e15ac1655ea217c37b74949f4;hpb=24083a26340293cb3a0e44bcf79edbc9b31f41db;p=mothur.git diff --git a/qualityscores.cpp b/qualityscores.cpp index 1ef074d..0641d3b 100644 --- a/qualityscores.cpp +++ b/qualityscores.cpp @@ -44,16 +44,67 @@ 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; } +// } +// cout << scores << endl; +// 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"); @@ -67,6 +118,7 @@ QualityScores::QualityScores(ifstream& qFile){ string QualityScores::getName(){ try { + cout << qScores.size() << '\t'; return seqName; } catch(exception& e) { @@ -102,6 +154,8 @@ void QualityScores::trimQScores(int start, int end){ try { vector hold; + cout << seqName << '\t' << qScores.size() << '\t' << start << '\t' << end << endl; + if(end == -1){ hold = vector(qScores.begin()+start, qScores.end()); qScores = hold; @@ -194,7 +248,6 @@ bool QualityScores::stripQualRollingAverage(Sequence& sequence, double qThreshol if(rollingSum / (double)(i+1) < qThreshold){ end = i; -// cout << i+1 << '\t' << seqName << '\t' << rollingSum / (double)(i+1) << endl; break; } } @@ -310,7 +363,7 @@ void QualityScores::updateQScoreErrorMap(map >& qualErrorMap, int seqLength = errorSeq.size(); int qIndex = start - 1; - cout << start << '\t' << stop << '\t' << seqLength << endl; + for(int i=0;i