X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=qualityscores.cpp;h=26492245e2b9805144125052d57045a834bc3f95;hp=4998b3d1c4dabd18b97fb8f33e36860127e757e5;hb=a8e2df1b96a57f5f29576b08361b86a96a8eff4f;hpb=4b54ce99af7db8019ea907cd7c2edf789369ada9 diff --git a/qualityscores.cpp b/qualityscores.cpp index 4998b3d..2649224 100644 --- a/qualityscores.cpp +++ b/qualityscores.cpp @@ -34,13 +34,17 @@ QualityScores::QualityScores(ifstream& qFile){ int score; seqName = getSequenceName(qFile); + if (m->debug) { m->mothurOut("[DEBUG]: name = '" + seqName + "'\n."); } + if (!m->control_pressed) { string qScoreString = m->getline(qFile); - //cout << qScoreString << endl; + + if (m->debug) { m->mothurOut("[DEBUG]: scores = '" + qScoreString + "'\n."); } + while(qFile.peek() != '>' && qFile.peek() != EOF){ if (m->control_pressed) { break; } string temp = m->getline(qFile); - //cout << temp << endl; + if (m->debug) { m->mothurOut("[DEBUG]: scores = '" + temp + "'\n."); } qScoreString += ' ' + temp; } //cout << "done reading " << endl; @@ -51,6 +55,8 @@ QualityScores::QualityScores(ifstream& qFile){ string temp; qScoreStringStream >> temp; m->gobble(qScoreStringStream); + if (m->debug) { m->mothurOut("[DEBUG]: score " + toString(qScores.size()) + " = '" + temp + "'\n."); } + //check temp to make sure its a number if (!m->isContainingOnlyDigits(temp)) { m->mothurOut("[ERROR]: In sequence " + seqName + "'s quality scores, expected a number and got " + temp + ", setting score to 0."); m->mothurOutEndLine(); temp = "0"; } convert(temp, score); @@ -83,9 +89,7 @@ string QualityScores::getSequenceName(ifstream& qFile) { name = name.substr(1); - for (int i = 0; i < name.length(); i++) { - if (name[i] == ':') { name[i] = '_'; m->changedSeqNames = true; } - } + m->checkName(name); }else{ m->mothurOut("Error in reading your qfile, at position " + toString(qFile.tellg()) + ". Blank name."); m->mothurOutEndLine(); m->control_pressed = true; } @@ -100,10 +104,7 @@ string QualityScores::getSequenceName(ifstream& qFile) { void QualityScores::setName(string name) { try { - for (int i = 0; i < name.length(); i++) { - if (name[i] == ':') { name[i] = '_'; m->changedSeqNames = true; } - } - + m->checkName(name); seqName = name; } catch(exception& e) {