X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=aligncommand.h;h=f806c8ded8b6c586e1592b004cd379eda2e79453;hb=HEAD;hp=cfded3819156764fc86e49e9cb1977af9bb2ef48;hpb=1a5c2356c1b955c6ec024b2baf9f46377ee7c72e;p=mothur.git diff --git a/aligncommand.h b/aligncommand.h index cfded38..f806c8d 100644 --- a/aligncommand.h +++ b/aligncommand.h @@ -144,8 +144,6 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ inFASTA.seekg(pDataArray->start-1); pDataArray->m->gobble(inFASTA); } - pDataArray->count = pDataArray->end; - AlignmentDB* templateDB = new AlignmentDB(pDataArray->templateFileName, pDataArray->search, pDataArray->kmerSize, pDataArray->gapOpen, pDataArray->gapExtend, pDataArray->match, pDataArray->misMatch, pDataArray->threadID); //moved this into driver to avoid deep copies in windows paralellized version @@ -161,7 +159,7 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ alignment = new NeedlemanOverlap(pDataArray->gapOpen, pDataArray->match, pDataArray->misMatch, longestBase); } - int count = 0; + pDataArray->count = 0; for(int i = 0; i < pDataArray->end; i++){ //end is the number of sequences to process if (pDataArray->m->control_pressed) { break; } @@ -179,7 +177,7 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ } Sequence temp = templateDB->findClosestSequence(candidateSeq); - Sequence* templateSeq = &temp; + Sequence* templateSeq = new Sequence(temp.getName(), temp.getAligned()); float searchScore = templateDB->getSearchScore(); @@ -206,7 +204,7 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ //rerun alignment Sequence temp2 = templateDB->findClosestSequence(copy); - Sequence* templateSeq2 = &temp2; + Sequence* templateSeq2 = new Sequence(temp2.getName(), temp2.getAligned()); searchScore = templateDB->getSearchScore(); @@ -215,7 +213,8 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ //check if any better if (copy->getNumBases() > candidateSeq->getNumBases()) { candidateSeq->setAligned(copy->getAligned()); //use reverse compliments alignment since its better - templateSeq = templateSeq2; + delete templateSeq; + templateSeq = templateSeq2; delete nast; nast = nast2; needToDeleteCopy = true; @@ -223,6 +222,7 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ }else{ wasBetter = "\treverse complement did NOT produce a better alignment so it was not used, please check sequence."; delete nast2; + delete templateSeq2; delete copy; } } @@ -240,18 +240,19 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ report.print(); delete nast; + delete templateSeq; if (needToDeleteCopy) { delete copy; } - count++; + pDataArray->count++; } delete candidateSeq; //report progress - if((count) % 100 == 0){ pDataArray->m->mothurOut(toString(count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 == 0){ pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count)+"\n"); } } //report progress - if((count) % 100 != 0){ pDataArray->m->mothurOut(toString(count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count)+"\n"); } delete alignment; delete templateDB;