X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=nast.cpp;fp=nast.cpp;h=294940cd6aabd49f67aca028311d21529f0912ee;hb=1244c4907c07baea86b0f0676d098a29d2e95a39;hp=804e3c174d4408c2ae55963ba391098002978c18;hpb=ec92647e652017e0cd4ba0488a815094f88373b3;p=mothur.git diff --git a/nast.cpp b/nast.cpp index 804e3c1..294940c 100644 --- a/nast.cpp +++ b/nast.cpp @@ -94,7 +94,7 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl try { int longAlignmentLength = newTemplateAlign.length(); - + for(int i=0; i maxInsertLength){ maxInsertLength = insertLength; } - + if((leftRoom + rightRoom) >= insertLength){ // Parts D & E from Fig. 2 of DeSantis et al. @@ -168,6 +168,7 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl } else{ // not enough room to the right, have to steal some + // space to the left lets move left and then right... string leftTemplateString = newTemplateAlign.substr(0,i); string rightTemplateString = newTemplateAlign.substr(i+insertLength); @@ -183,7 +184,7 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl } } else{ - // there could be a case where there isn't enough room in + // there could be a case where there isn't enough room in string leftTemplateString = newTemplateAlign.substr(0,i); // either direction to move stuff string rightTemplateString = newTemplateAlign.substr(i+leftRoom+rightRoom); newTemplateAlign = leftTemplateString + rightTemplateString; @@ -193,9 +194,9 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl string insertString = candAln.substr(leftIndex+1,rightIndex-leftIndex-1); string rightCandidateString = candAln.substr(rightIndex+rightRoom); candAln = leftCandidateString + insertString + rightCandidateString; - + } - + i -= insertLength; } } @@ -337,12 +338,11 @@ void Nast::regapSequences(){ //This is essentially part B in Fig 2. of DeSantis candAln[i] = toupper(candAln[i]); // everything is upper case } - + if(candAln.length() != tempAln.length()){ // if the regapped candidate sequence is longer than the official removeExtraGaps(candAln, tempAln, newTemplateAlign);// template alignment then we need to do steps C-F in Fig. } // 2 of Desantis et al. - - + candidateSeq->setAligned(candAln); } catch(exception& e) {