From: westcott Date: Fri, 18 Jun 2010 11:37:36 +0000 (+0000) Subject: fixed problem with chimera.slayer realigner X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=291eaab661778e1fd02c5c22bc388daa97bb1d54 fixed problem with chimera.slayer realigner --- diff --git a/chimerarealigner.cpp b/chimerarealigner.cpp index 9a25162..a07e433 100644 --- a/chimerarealigner.cpp +++ b/chimerarealigner.cpp @@ -34,9 +34,9 @@ void ChimeraReAligner::reAlign(Sequence* query, vector parents) { //take query and break apart into pieces using breakpoints given by results of parents for (int i = 0; i < parents.size(); i++) { - int length = parents[i].nastRegionEnd - parents[i].nastRegionStart+1; string q = qAligned.substr(parents[i].nastRegionStart, length); + Sequence* queryFrag = new Sequence(query->getName(), q); queryParts.push_back(queryFrag); @@ -55,10 +55,13 @@ void ChimeraReAligner::reAlign(Sequence* query, vector parents) { //align each peice to correct parent from results for (int i = 0; i < queryParts.size(); i++) { - alignment = new NeedlemanOverlap(-2.0, match, misMatch, longest+1); //default gapopen, match, mismatch, longestbase + if ((queryParts[i]->getUnaligned() == "") || (parentParts[i]->getUnaligned() == "")) {;} + else { + alignment = new NeedlemanOverlap(-2.0, match, misMatch, longest+1); //default gapopen, match, mismatch, longestbase - Nast nast(alignment, queryParts[i], parentParts[i]); - delete alignment; + Nast nast(alignment, queryParts[i], parentParts[i]); + delete alignment; + } } //recombine pieces to form new query sequence @@ -78,7 +81,7 @@ void ChimeraReAligner::reAlign(Sequence* query, vector parents) { //make sure you don't cutoff end of query if (parents[parents.size()-1].nastRegionEnd < (qAligned.length()-1)) { newQuery += qAligned.substr(parents[parents.size()-1].nastRegionEnd+1); } - + //set query to new aligned string query->setAligned(newQuery); diff --git a/makefile b/makefile index ef5cfe7..3e83112 100644 --- a/makefile +++ b/makefile @@ -463,7 +463,7 @@ mothur : \ ./logsd.o\ ./geom.o\ ./setlogfilecommand.o\ - -o mothur + -o ../Release/mothur clean : rm \ diff --git a/nast.cpp b/nast.cpp index 50d3b24..9e26b11 100644 --- a/nast.cpp +++ b/nast.cpp @@ -38,13 +38,12 @@ Nast::Nast(Alignment* method, Sequence* cand, Sequence* temp) : alignment(method void Nast::pairwiseAlignSeqs(){ // Here we call one of the pairwise alignment methods to align our unaligned candidate // and template sequences - try { - + try { alignment->align(candidateSeq->getUnaligned(), templateSeq->getUnaligned()); string candAln = alignment->getSeqAAln(); string tempAln = alignment->getSeqBAln(); - + if(candAln == ""){ candidateSeq->setPairwise(""); @@ -91,6 +90,11 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl // here we do steps C-F of Fig. 2 from DeSantis et al. try { + //cout << candAln << endl; + //cout << tempAln << endl; + //cout << newTemplateAlign << endl; + //cout << endl; + int longAlignmentLength = newTemplateAlign.length(); for(int i=0; i