From c48d91112209b841444923670dca5454da0e2a4d Mon Sep 17 00:00:00 2001 From: SarahsWork Date: Fri, 19 Apr 2013 14:19:00 -0400 Subject: [PATCH] added mothurOutJustToScreen function and changed all counter outputs to use it. --- aligncommand.cpp | 4 ++-- aligncommand.h | 4 ++-- chimeraccodecommand.cpp | 4 ++-- chimeracheckcommand.cpp | 9 ++++----- chimeraperseuscommand.cpp | 4 ++-- chimeraperseuscommand.h | 4 ++-- chimerapintailcommand.cpp | 8 ++++---- chimeraslayercommand.cpp | 8 ++++---- chimeraslayercommand.h | 8 ++++---- classifyseqscommand.cpp | 4 ++-- classifyseqscommand.h | 4 ++-- clusterfragmentscommand.cpp | 4 ++-- distancecommand.cpp | 29 ++++++++++++----------------- distancecommand.h | 9 ++++----- filterseqscommand.cpp | 16 ++++++++-------- filterseqscommand.h | 8 ++++---- matrixoutputcommand.cpp | 2 +- mothurout.cpp | 21 +++++++++++++++++++++ mothurout.h | 1 + myseqdist.cpp | 4 ++-- pairwiseseqscommand.cpp | 8 ++++---- pairwiseseqscommand.h | 8 ++++---- pcrseqscommand.h | 4 ++-- prcseqscommand.cpp | 4 ++-- preclustercommand.cpp | 4 ++-- preclustercommand.h | 4 ++-- screenseqscommand.cpp | 6 +++--- screenseqscommand.h | 4 ++-- seqerrorcommand.cpp | 4 ++-- seqsummarycommand.cpp | 7 +------ shhhercommand.cpp | 14 ++++++-------- unifracunweightedcommand.cpp | 2 +- unifracweightedcommand.cpp | 2 +- 33 files changed, 117 insertions(+), 109 deletions(-) diff --git a/aligncommand.cpp b/aligncommand.cpp index fc98c10..f9c0436 100644 --- a/aligncommand.cpp +++ b/aligncommand.cpp @@ -644,11 +644,11 @@ int AlignCommand::driver(linePair* filePos, string alignFName, string reportFNam #endif //report progress - if((count) % 100 == 0){ m->mothurOut(toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen(toString(count) + "\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut(toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen(toString(count) + "\n"); } delete alignment; alignmentFile.close(); diff --git a/aligncommand.h b/aligncommand.h index e5e9601..4e1b8d3 100644 --- a/aligncommand.h +++ b/aligncommand.h @@ -245,11 +245,11 @@ static DWORD WINAPI MyAlignThreadFunction(LPVOID lpParam){ delete candidateSeq; //report progress - if((pDataArray->count) % 100 == 0){ pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 == 0){ pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count)+"\n"); } } //report progress - if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count)+"\n"); } delete alignment; delete templateDB; diff --git a/chimeraccodecommand.cpp b/chimeraccodecommand.cpp index 7adf828..627f3a9 100644 --- a/chimeraccodecommand.cpp +++ b/chimeraccodecommand.cpp @@ -548,10 +548,10 @@ int ChimeraCcodeCommand::driver(linePair* filePos, string outputFName, string fi #endif //report progress - if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count) + "\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count) + "\n"); } out.close(); out2.close(); diff --git a/chimeracheckcommand.cpp b/chimeracheckcommand.cpp index 6caa606..31a36f7 100644 --- a/chimeracheckcommand.cpp +++ b/chimeracheckcommand.cpp @@ -547,11 +547,10 @@ int ChimeraCheckCommand::driver(linePair* filePos, string outputFName, string fi #endif //report progress - if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } - count++; + if((count) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count) + "\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count) + "\n"); } out.close(); inFASTA.close(); @@ -599,10 +598,10 @@ int ChimeraCheckCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File delete candidateSeq; //report progress - if((i+1) % 100 == 0){ cout << "Processing sequence: " << (i+1) << endl; m->mothurOutJustToLog("Processing sequence: " + toString(i+1) + "\n"); } + if((i+1) % 100 == 0){ cout << "Processing sequence: " << (i+1) << endl; } } //report progress - if(num % 100 != 0){ cout << "Processing sequence: " << num << endl; m->mothurOutJustToLog("Processing sequence: " + toString(num) + "\n"); } + if(num % 100 != 0){ cout << "Processing sequence: " << num << endl; } return 0; } diff --git a/chimeraperseuscommand.cpp b/chimeraperseuscommand.cpp index f7dc597..fd94fca 100644 --- a/chimeraperseuscommand.cpp +++ b/chimeraperseuscommand.cpp @@ -1046,10 +1046,10 @@ int ChimeraPerseusCommand::driver(string chimeraFileName, vector& seque } //report progress - if((i+1) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(i+1) + "\n"); } + if((i+1) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(i+1) + "\n"); } } - if((numSeqs) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(numSeqs) + "\n"); } + if((numSeqs) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(numSeqs) + "\n"); } chimeraFile.close(); accnosFile.close(); diff --git a/chimeraperseuscommand.h b/chimeraperseuscommand.h index 4fa4cff..99a66f8 100644 --- a/chimeraperseuscommand.h +++ b/chimeraperseuscommand.h @@ -343,10 +343,10 @@ static DWORD WINAPI MyPerseusThreadFunction(LPVOID lpParam){ chimeraFile << j << '\t' << sequences[j].seqName << "\t0\t0\tNull\t0\t0\t0\tNull\tNull\t0.0\t0.0\t0.0\t0\t0\t0\t0.0\t0.0\tgood" << endl; } //report progress - if((j+1) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(j+1) + "\n"); } + if((j+1) % 100 == 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(j+1) + "\n"); } } - if((numSeqs) % 100 != 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(numSeqs) + "\n"); } + if((numSeqs) % 100 != 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(numSeqs) + "\n"); } chimeraFile.close(); accnosFile.close(); diff --git a/chimerapintailcommand.cpp b/chimerapintailcommand.cpp index d2b7399..9d492af 100644 --- a/chimerapintailcommand.cpp +++ b/chimerapintailcommand.cpp @@ -636,10 +636,10 @@ int ChimeraPintailCommand::driver(linePair* filePos, string outputFName, string #endif //report progress - if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count) + "\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count) + "\n"); } out.close(); out2.close(); @@ -695,10 +695,10 @@ int ChimeraPintailCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_Fi delete candidateSeq; //report progress - if((i+1) % 100 == 0){ cout << "Processing sequence: " << (i+1) << endl; m->mothurOutJustToLog("Processing sequence: " + toString(i+1) + "\n"); } + if((i+1) % 100 == 0){ cout << "Processing sequence: " << (i+1) << endl; } } //report progress - if(num % 100 != 0){ cout << "Processing sequence: " << num << endl; m->mothurOutJustToLog("Processing sequence: " + toString(num) + "\n"); } + if(num % 100 != 0){ cout << "Processing sequence: " << num << endl; } return 0; diff --git a/chimeraslayercommand.cpp b/chimeraslayercommand.cpp index d16843c..e7003c4 100644 --- a/chimeraslayercommand.cpp +++ b/chimeraslayercommand.cpp @@ -1823,10 +1823,10 @@ int ChimeraSlayerCommand::driver(linePair filePos, string outputFName, string fi delete candidateSeq; //report progress - if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count) + "\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count)+ "\n"); } int numNoParents = chimera->getNumNoParents(); if (numNoParents == count) { m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors."); m->mothurOutEndLine(); } @@ -1973,10 +1973,10 @@ int ChimeraSlayerCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_Fil delete candidateSeq; //report progress - if((i+1) % 100 == 0){ cout << "Processing sequence: " << (i+1) << endl; m->mothurOutJustToLog("Processing sequence: " + toString(i+1) + "\n"); } + if((i+1) % 100 == 0){ cout << "Processing sequence: " << (i+1) << endl; } } //report progress - if(num % 100 != 0){ cout << "Processing sequence: " << num << endl; m->mothurOutJustToLog("Processing sequence: " + toString(num) + "\n"); } + if(num % 100 != 0){ cout << "Processing sequence: " << num << endl; } int numNoParents = chimera->getNumNoParents(); if (numNoParents == num) { cout << "[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors." << endl; } diff --git a/chimeraslayercommand.h b/chimeraslayercommand.h index 68e03b8..e8afc61 100644 --- a/chimeraslayercommand.h +++ b/chimeraslayercommand.h @@ -327,10 +327,10 @@ static DWORD WINAPI MySlayerThreadFunction(LPVOID lpParam){ delete candidateSeq; //report progress - if((pDataArray->count) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 == 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(pDataArray->count) +"\n"); } } //report progress - if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(pDataArray->count)+"\n"); } pDataArray->numNoParents = chimera->getNumNoParents(); if (pDataArray->numNoParents == pDataArray->count) { pDataArray->m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors.\n"); } @@ -506,10 +506,10 @@ static DWORD WINAPI MySlayerGroupThreadFunction(LPVOID lpParam){ if (inFASTA.eof()) { break; } //report progress - if((numSeqs) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(numSeqs)); pDataArray->m->mothurOutEndLine(); } + if((numSeqs) % 100 == 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(numSeqs)+"\n"); pDataArray->m->mothurOutEndLine(); } } //report progress - if((numSeqs) % 100 != 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(numSeqs)); pDataArray->m->mothurOutEndLine(); } + if((numSeqs) % 100 != 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(numSeqs)+"\n"); } pDataArray->numNoParents = chimera->getNumNoParents(); if (pDataArray->numNoParents == numSeqs) { pDataArray->m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors.\n"); } diff --git a/classifyseqscommand.cpp b/classifyseqscommand.cpp index 8b6a77b..edbd4c4 100644 --- a/classifyseqscommand.cpp +++ b/classifyseqscommand.cpp @@ -1151,11 +1151,11 @@ int ClassifySeqsCommand::driver(linePair* filePos, string taxFName, string tempT #endif //report progress - if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count) +"\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count)+"\n"); } inFASTA.close(); outTax.close(); diff --git a/classifyseqscommand.h b/classifyseqscommand.h index f8a820d..59d9ee2 100644 --- a/classifyseqscommand.h +++ b/classifyseqscommand.h @@ -211,11 +211,11 @@ static DWORD WINAPI MyClassThreadFunction(LPVOID lpParam){ } delete candidateSeq; //report progress - if((pDataArray->count) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 == 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(pDataArray->count)+"\n"); } } //report progress - if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(pDataArray->count)+"\n"); } delete myclassify; inFASTA.close(); diff --git a/clusterfragmentscommand.cpp b/clusterfragmentscommand.cpp index ef199cc..1b8cc71 100644 --- a/clusterfragmentscommand.cpp +++ b/clusterfragmentscommand.cpp @@ -262,10 +262,10 @@ int ClusterFragmentsCommand::execute(){ alignSeqs[i].active = 0; }//end if active i - if(i % 100 == 0) { m->mothurOut(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)); m->mothurOutEndLine(); } + if(i % 100 == 0) { m->mothurOutJustToScreen(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)+"\n"); } } - if(numSeqs % 100 != 0) { m->mothurOut(toString(numSeqs) + "\t" + toString(numSeqs - count) + "\t" + toString(count)); m->mothurOutEndLine(); } + if(numSeqs % 100 != 0) { m->mothurOutJustToScreen(toString(numSeqs) + "\t" + toString(numSeqs - count) + "\t" + toString(count)+"\n"); } string fileroot = outputDir + m->getRootName(m->getSimpleName(fastafile)); diff --git a/distancecommand.cpp b/distancecommand.cpp index 19094e9..9243df3 100644 --- a/distancecommand.cpp +++ b/distancecommand.cpp @@ -675,11 +675,11 @@ int DistanceCommand::driver(int startLine, int endLine, string dFileName, float if (output == "lt") { outFile << endl; } if(i % 100 == 0){ - m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } } - m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)+"\n"); outFile.close(); delete distCalculator; @@ -745,11 +745,11 @@ int DistanceCommand::driver(int startLine, int endLine, string dFileName, string outFile << endl; if(i % 100 == 0){ - m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } } - m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)+"\n"); outFile.close(); delete distCalculator; @@ -812,8 +812,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, MPI_File& outMPI, flo } if(i % 100 == 0){ - m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); - cout << i << '\t' << (time(NULL) - startTime) << endl; + m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } @@ -829,8 +828,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, MPI_File& outMPI, flo } - m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); - cout << (endLine-1) << '\t' << (time(NULL) - startTime) << endl; + m->mothurOutJustToScreen(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)+"\n"); delete distCalculator; return 1; } @@ -907,9 +905,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, unsigned if(i % 100 == 0){ - m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); - cout << i << '\t' << (time(NULL) - startTime) << endl; - } + m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } //send results to parent @@ -923,8 +919,8 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, unsigned delete buf; } - m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); - cout << (endLine-1) << '\t' << (time(NULL) - startTime) << endl; + m->mothurOutJustToScreen(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)+"\n"); + MPI_File_close(&outMPI); delete distCalculator; @@ -1002,8 +998,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, unsigned if(i % 100 == 0){ - m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); - cout << i << '\t' << (time(NULL) - startTime) << endl; + m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } @@ -1018,8 +1013,8 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, unsigned delete buf; } - m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); - cout << (endLine-1) << '\t' << (time(NULL) - startTime) << endl; + m->mothurOutJustToScreen(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)+"\n"); + MPI_File_close(&outMPI); delete distCalculator; return 1; diff --git a/distancecommand.h b/distancecommand.h index af55406..2f53232 100644 --- a/distancecommand.h +++ b/distancecommand.h @@ -119,11 +119,10 @@ static DWORD WINAPI MyDistThreadFunction(LPVOID lpParam){ if (pDataArray->output == "lt") { outFile << endl; } if(i % 100 == 0){ - pDataArray->m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine(); - } + pDataArray->m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } pDataArray->count++; } - pDataArray->m->mothurOut(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine(); + pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)+"\n"); }else{ if(pDataArray->startLine == 0){ outFile << pDataArray->alignDB.getNumSeqs() << endl; } @@ -148,11 +147,11 @@ static DWORD WINAPI MyDistThreadFunction(LPVOID lpParam){ outFile << endl; if(i % 100 == 0){ - pDataArray->m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine(); + pDataArray->m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } pDataArray->count++; } - pDataArray->m->mothurOut(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine(); + pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)+"\n"); } outFile.close(); diff --git a/filterseqscommand.cpp b/filterseqscommand.cpp index b17d9ed..8b68988 100644 --- a/filterseqscommand.cpp +++ b/filterseqscommand.cpp @@ -558,7 +558,7 @@ int FilterSeqsCommand::driverMPIRun(int start, int num, MPI_File& inMPI, MPI_Fil } - if((i+1) % 100 == 0){ cout << (i+1) << endl; m->mothurOutJustToLog(toString(i+1) + "\n"); } + if((i+1) % 100 == 0){ cout << (i+1) << endl; } } if(outputString != ""){ //output to file @@ -572,7 +572,7 @@ int FilterSeqsCommand::driverMPIRun(int start, int num, MPI_File& inMPI, MPI_Fil delete buf; } - if((num) % 100 != 0){ cout << (num) << endl; m->mothurOutJustToLog(toString(num) + "\n"); } + if((num) % 100 != 0){ cout << (num) << endl; } return 0; } @@ -623,10 +623,10 @@ int FilterSeqsCommand::driverRunFilter(string F, string outputFilename, string i #endif //report progress - if((count) % 100 == 0){ m->mothurOut(toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen(toString(count)+"\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut(toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen(toString(count)+"\n"); } out.close(); @@ -1006,10 +1006,10 @@ int FilterSeqsCommand::driverCreateFilter(Filters& F, string filename, linePair* #endif //report progress - if((count) % 100 == 0){ m->mothurOut(toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen(toString(count)+"\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut(toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen(toString(count)+"\n"); } in.close(); return count; @@ -1052,11 +1052,11 @@ int FilterSeqsCommand::MPICreateFilter(int start, int num, Filters& F, MPI_File& cout.flush(); //report progress - if((i+1) % 100 == 0){ cout << (i+1) << endl; m->mothurOutJustToLog(toString(i+1) + "\n"); } + if((i+1) % 100 == 0){ cout << (i+1) << endl; } } //report progress - if((num) % 100 != 0){ cout << num << endl; m->mothurOutJustToLog(toString(num) + "\n"); } + if((num) % 100 != 0){ cout << num << endl; } return 0; } diff --git a/filterseqscommand.h b/filterseqscommand.h index 90c13f8..ed7cfd1 100644 --- a/filterseqscommand.h +++ b/filterseqscommand.h @@ -168,10 +168,10 @@ static DWORD WINAPI MyCreateFilterThreadFunction(LPVOID lpParam){ } pDataArray->count++; //report progress - if((i) % 100 == 0){ pDataArray->m->mothurOut(toString(i)); pDataArray->m->mothurOutEndLine(); } + if((i) % 100 == 0){ pDataArray->m->mothurOutJustToScreen(toString(i)+"\n"); } } - if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count)+"\n"); } in.close(); @@ -223,10 +223,10 @@ static DWORD WINAPI MyRunFilterThreadFunction(LPVOID lpParam){ } pDataArray->count++; //report progress - if((i) % 100 == 0){ pDataArray->m->mothurOut(toString(i)); pDataArray->m->mothurOutEndLine(); } + if((i) % 100 == 0){ pDataArray->m->mothurOutJustToScreen(toString(i)+"\n"); } } - if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOut(toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count)+"\n"); } in.close(); out.close(); diff --git a/matrixoutputcommand.cpp b/matrixoutputcommand.cpp index 310e32b..a53a3dc 100644 --- a/matrixoutputcommand.cpp +++ b/matrixoutputcommand.cpp @@ -652,7 +652,7 @@ int MatrixOutputCommand::process(vector thisLookup){ } if (subsample && (thisIter != 0)) { - if((thisIter) % 100 == 0){ m->mothurOut(toString(thisIter)); m->mothurOutEndLine(); } + if((thisIter) % 100 == 0){ m->mothurOutJustToScreen(toString(thisIter)+"\n"); } calcDistsTotals.push_back(calcDists); for (int i = 0; i < calcDists.size(); i++) { for (int j = 0; j < calcDists[i].size(); j++) { diff --git a/mothurout.cpp b/mothurout.cpp index 0efa551..fc16d20 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -348,6 +348,27 @@ void MothurOut::mothurOut(string output) { } } /*********************************************************************************************/ +void MothurOut::mothurOutJustToScreen(string output) { + try { + +#ifdef USE_MPI + int pid; + MPI_Comm_rank(MPI_COMM_WORLD, &pid); + + if (pid == 0) { //only one process should output to screen +#endif + logger() << output; + +#ifdef USE_MPI + } +#endif + } + catch(exception& e) { + errorOut(e, "MothurOut", "MothurOut"); + exit(1); + } +} +/*********************************************************************************************/ void MothurOut::mothurOutEndLine() { try { #ifdef USE_MPI diff --git a/mothurout.h b/mothurout.h index 4a46e05..643ecd5 100644 --- a/mothurout.h +++ b/mothurout.h @@ -40,6 +40,7 @@ class MothurOut { void mothurOutEndLine(); //writes to cout and the logfile void mothurOut(string, ofstream&); //writes to the ofstream, cout and the logfile void mothurOutEndLine(ofstream&); //writes to the ofstream, cout and the logfile + void mothurOutJustToScreen(string); //writes to cout void mothurOutJustToLog(string); void errorOut(exception&, string, string); void closeLog(); diff --git a/myseqdist.cpp b/myseqdist.cpp index 78255d8..2853895 100644 --- a/myseqdist.cpp +++ b/myseqdist.cpp @@ -219,11 +219,11 @@ int correctDist::driver(int start, int end, string distFileName){ } distFile << endl; - if(i % 100 == 0){ m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); } + if(i % 100 == 0){ m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } } distFile.close(); - if((end-1) % 100 != 0){ m->mothurOut(toString(end-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); } + if((end-1) % 100 != 0){ m->mothurOutJustToScreen(toString(end-1) + "\t" + toString(time(NULL) - startTime)+"\n"); } m->mothurOut("Done.\n"); return 0; diff --git a/pairwiseseqscommand.cpp b/pairwiseseqscommand.cpp index c9e5ecf..7d96e31 100644 --- a/pairwiseseqscommand.cpp +++ b/pairwiseseqscommand.cpp @@ -689,11 +689,11 @@ int PairwiseSeqsCommand::driver(int startLine, int endLine, string dFileName, fl if (output == "lt") { outFile << endl; } if(i % 100 == 0){ - m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } } - m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)+"\n"); outFile.close(); delete alignment; @@ -783,11 +783,11 @@ int PairwiseSeqsCommand::driver(int startLine, int endLine, string dFileName, st outFile << endl; if(i % 100 == 0){ - m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } } - m->mothurOut(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(endLine-1) + "\t" + toString(time(NULL) - startTime)+"\n"); outFile.close(); delete alignment; diff --git a/pairwiseseqscommand.h b/pairwiseseqscommand.h index defccb5..cb68e7f 100644 --- a/pairwiseseqscommand.h +++ b/pairwiseseqscommand.h @@ -199,11 +199,11 @@ static DWORD WINAPI MyPairwiseSquareThreadFunction(LPVOID lpParam){ outFile << endl; if(i % 100 == 0){ - pDataArray->m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine(); + pDataArray->m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } } - pDataArray->m->mothurOut(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine(); + pDataArray->m->mothurOutJustToScreen(toString(pDataArray->count) + "\t" + toString(time(NULL) - startTime)+"\n"); outFile.close(); delete alignment; @@ -302,11 +302,11 @@ static DWORD WINAPI MyPairwiseThreadFunction(LPVOID lpParam){ if (pDataArray->output == "lt") { outFile << endl; } if(i % 100 == 0){ - pDataArray->m->mothurOut(toString(i) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine(); + pDataArray->m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - startTime)+"\n"); } } - pDataArray->m->mothurOut(toString(pDataArray->end-1) + "\t" + toString(time(NULL) - startTime)); pDataArray->m->mothurOutEndLine(); + pDataArray->m->mothurOutJustToScreen(toString(pDataArray->end-1) + "\t" + toString(time(NULL) - startTime)+"\n"); outFile.close(); delete alignment; diff --git a/pcrseqscommand.h b/pcrseqscommand.h index 16c1e29..581675e 100644 --- a/pcrseqscommand.h +++ b/pcrseqscommand.h @@ -265,10 +265,10 @@ static DWORD WINAPI MyPcrThreadFunction(LPVOID lpParam){ } //report progress - if((i+1) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(i+1)); pDataArray->m->mothurOutEndLine(); } + if((i+1) % 100 == 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(i+1)+"\n"); } } //report progress - if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOut("Thread Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen("Thread Processing sequence: " + toString(pDataArray->count)+"\n"); } goodFile.close(); inFASTA.close(); diff --git a/prcseqscommand.cpp b/prcseqscommand.cpp index cf93cb7..8db6c24 100644 --- a/prcseqscommand.cpp +++ b/prcseqscommand.cpp @@ -696,10 +696,10 @@ int PcrSeqsCommand::driverPcr(string filename, string goodFasta, string badFasta #endif //report progress - if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count)+"\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count)+"\n"); } badFile.close(); goodFile.close(); diff --git a/preclustercommand.cpp b/preclustercommand.cpp index c2564c1..bbf8df2 100644 --- a/preclustercommand.cpp +++ b/preclustercommand.cpp @@ -597,7 +597,7 @@ int PreClusterCommand::process(string newMapFile){ out << "ideal_seq_" << (i+1) << '\t' << alignSeqs[i].numIdentical << endl << chunk << endl;; }//end if active i - if(i % 100 == 0) { m->mothurOut(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)); m->mothurOutEndLine(); } + if(i % 100 == 0) { m->mothurOutJustToScreen(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)+"\n"); } } }else { map mapFile; @@ -632,7 +632,7 @@ int PreClusterCommand::process(string newMapFile){ }//end abundance check }//end for loop j - if(i % 100 == 0) { m->mothurOut(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)); m->mothurOutEndLine(); } + if(i % 100 == 0) { m->mothurOutJustToScreen(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)+"\n"); } } for (int i = 0; i < numSeqs; i++) { diff --git a/preclustercommand.h b/preclustercommand.h index 12dd2d2..2b93328 100644 --- a/preclustercommand.h +++ b/preclustercommand.h @@ -301,7 +301,7 @@ static DWORD WINAPI MyPreclusterThreadFunction(LPVOID lpParam){ out << "ideal_seq_" << (i+1) << '\t' << alignSeqs[i].numIdentical << endl << chunk << endl; }//end if active i - if(i % 100 == 0) { pDataArray->m->mothurOut(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)); pDataArray->m->mothurOutEndLine(); } + if(i % 100 == 0) { pDataArray->m->mothurOutJustToScreen(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)+"\n"); } } }else { @@ -344,7 +344,7 @@ static DWORD WINAPI MyPreclusterThreadFunction(LPVOID lpParam){ }//end abundance check }//end for loop j - if(i % 100 == 0) { pDataArray->m->mothurOut(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)); pDataArray->m->mothurOutEndLine(); } + if(i % 100 == 0) { pDataArray->m->mothurOutJustToScreen(toString(i) + "\t" + toString(numSeqs - count) + "\t" + toString(count)+"\n"); } } for (int i = 0; i < numSeqs; i++) { diff --git a/screenseqscommand.cpp b/screenseqscommand.cpp index 3718c9a..d2fbe93 100644 --- a/screenseqscommand.cpp +++ b/screenseqscommand.cpp @@ -2409,10 +2409,10 @@ int ScreenSeqsCommand::driver(linePair filePos, string goodFName, string badAccn #endif //report progress - if((count) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count)+"\n"); } } //report progress - if((count) % 100 != 0){ m->mothurOut("Processing sequence: " + toString(count)); m->mothurOutEndLine(); } + if((count) % 100 != 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(count)+"\n"); } goodFile.close(); @@ -2504,7 +2504,7 @@ int ScreenSeqsCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File& } //report progress - if((i) % 100 == 0){ m->mothurOut("Processing sequence: " + toString(i)); m->mothurOutEndLine(); } + if((i) % 100 == 0){ m->mothurOutJustToScreen("Processing sequence: " + toString(i)+"\n"); } } return 1; diff --git a/screenseqscommand.h b/screenseqscommand.h index e290690..aeaddae 100644 --- a/screenseqscommand.h +++ b/screenseqscommand.h @@ -449,10 +449,10 @@ static DWORD WINAPI MySumScreenThreadFunction(LPVOID lpParam){ } //report progress - if((i+1) % 100 == 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(i+1)); pDataArray->m->mothurOutEndLine(); } + if((i+1) % 100 == 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(i+1)+"\n"); } } //report progress - if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOut("Processing sequence: " + toString(pDataArray->count)); pDataArray->m->mothurOutEndLine(); } + if((pDataArray->count) % 100 != 0){ pDataArray->m->mothurOutJustToScreen("Processing sequence: " + toString(pDataArray->count)+"\n"); } diff --git a/seqerrorcommand.cpp b/seqerrorcommand.cpp index 2bd7054..203a71e 100644 --- a/seqerrorcommand.cpp +++ b/seqerrorcommand.cpp @@ -881,7 +881,7 @@ int SeqErrorCommand::driver(string filename, string qFileName, string rFileName, if (queryFile.eof()) { break; } #endif - if(index % 100 == 0){ m->mothurOut(toString(index)); m->mothurOutEndLine(); } + if(index % 100 == 0){ m->mothurOutJustToScreen(toString(index)+"\n"); } } queryFile.close(); outChimeraReport.close(); @@ -892,7 +892,7 @@ int SeqErrorCommand::driver(string filename, string qFileName, string rFileName, else if(qFileName != "" && aligned == false){ qualFile.close(); } //report progress - m->mothurOut(toString(index)); m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(index)+"\n"); return index; } diff --git a/seqsummarycommand.cpp b/seqsummarycommand.cpp index 90a66f8..6d8336c 100644 --- a/seqsummarycommand.cpp +++ b/seqsummarycommand.cpp @@ -494,13 +494,8 @@ int SeqSummaryCommand::driverCreateSummary(vector& startPosition, vectormothurOut(toString(count)); m->mothurOutEndLine(); } } - //report progress - //if((count) % 100 != 0){ m->mothurOut(toString(count)); m->mothurOutEndLine(); } - + in.close(); return count; diff --git a/shhhercommand.cpp b/shhhercommand.cpp index 6315782..e970bab 100644 --- a/shhhercommand.cpp +++ b/shhhercommand.cpp @@ -858,7 +858,7 @@ string ShhherCommand::flowDistMPI(int startSeq, int stopSeq){ } } if(i % 100 == 0){ - m->mothurOut(toString(i) + '\t' + toString(time(NULL) - begTime) + '\t' + toString((clock()-begClock)/CLOCKS_PER_SEC) + '\n'); + m->mothurOutJustToScreen(toString(i) + '\t' + toString(time(NULL) - begTime) + '\t' + toString((clock()-begClock)/CLOCKS_PER_SEC) + '\n'); } } @@ -867,7 +867,7 @@ string ShhherCommand::flowDistMPI(int startSeq, int stopSeq){ if (m->control_pressed) { return fDistFileName; } - m->mothurOut(toString(stopSeq) + '\t' + toString(time(NULL) - begTime) + '\t' + toString((clock()-begClock)/CLOCKS_PER_SEC) + '\n'); + m->mothurOutJustToScreen(toString(stopSeq) + '\t' + toString(time(NULL) - begTime) + '\t' + toString((clock()-begClock)/CLOCKS_PER_SEC) + '\n'); ofstream distFile(fDistFileName.c_str()); distFile << outStream.str(); @@ -2545,9 +2545,8 @@ int ShhherCommand::flowDistParentFork(int numFlowCells, string distFileName, int } } if(i % 100 == 0){ - m->mothurOut(toString(i) + "\t" + toString(time(NULL) - begTime)); - m->mothurOut("\t" + toString((clock()-begClock)/CLOCKS_PER_SEC)); - m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(i) + "\t" + toString(time(NULL) - begTime)); + m->mothurOutJustToScreen("\t" + toString((clock()-begClock)/CLOCKS_PER_SEC)+"\n"); } } @@ -2557,9 +2556,8 @@ int ShhherCommand::flowDistParentFork(int numFlowCells, string distFileName, int if (m->control_pressed) {} else { - m->mothurOut(toString(stopSeq-1) + "\t" + toString(time(NULL) - begTime)); - m->mothurOut("\t" + toString((clock()-begClock)/CLOCKS_PER_SEC)); - m->mothurOutEndLine(); + m->mothurOutJustToScreen(toString(stopSeq-1) + "\t" + toString(time(NULL) - begTime)); + m->mothurOutJustToScreen("\t" + toString((clock()-begClock)/CLOCKS_PER_SEC)+"\n"); } return 0; diff --git a/unifracunweightedcommand.cpp b/unifracunweightedcommand.cpp index ab8afd0..272ae82 100644 --- a/unifracunweightedcommand.cpp +++ b/unifracunweightedcommand.cpp @@ -421,7 +421,7 @@ int UnifracUnweightedCommand::execute() { delete newCt; delete subSampleTree; - if((thisIter+1) % 100 == 0){ m->mothurOut(toString(thisIter+1)); m->mothurOutEndLine(); } + if((thisIter+1) % 100 == 0){ m->mothurOutJustToScreen(toString(thisIter+1)+"\n"); } } if (subsample) { m->mothurOut("It took " + toString(time(NULL) - startSubsample) + " secs to run the subsampling."); m->mothurOutEndLine(); } diff --git a/unifracweightedcommand.cpp b/unifracweightedcommand.cpp index 81ea326..3b0c53b 100644 --- a/unifracweightedcommand.cpp +++ b/unifracweightedcommand.cpp @@ -408,7 +408,7 @@ int UnifracWeightedCommand::execute() { delete newCt; delete subSampleTree; - if((thisIter+1) % 100 == 0){ m->mothurOut(toString(thisIter+1)); m->mothurOutEndLine(); } + if((thisIter+1) % 100 == 0){ m->mothurOutJustToScreen(toString(thisIter+1)+"\n"); } } if (m->control_pressed) { delete ct; for (int i = 0; i < T.size(); i++) { delete T[i]; } if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; } -- 2.39.2