From 4160a27002f4a3ca436fcd62eca0366b09f8e901 Mon Sep 17 00:00:00 2001 From: westcott Date: Mon, 9 May 2011 15:52:45 +0000 Subject: [PATCH] 1.19.0 --- Mothur.xcodeproj/project.pbxproj | 8 ++++---- listseqscommand.cpp | 24 ++++++++++++------------ mothurout.cpp | 4 ++-- qualityscores.cpp | 5 ++++- splitmatrix.cpp | 1 + trimseqscommand.cpp | 4 ++-- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 321c130..4d37747 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -1982,8 +1982,8 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "MOTHUR_FILES=\"\\\"../release\\\"\"", - "VERSION=\"\\\"1.18.1\\\"\"", - "RELEASE_DATE=\"\\\"4/15/2011\\\"\"", + "VERSION=\"\\\"1.19.0\\\"\"", + "RELEASE_DATE=\"\\\"5/9/2011\\\"\"", ); GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -2015,8 +2015,8 @@ GCC_MODEL_TUNING = ""; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - "VERSION=\"\\\"1.18.1\\\"\"", - "RELEASE_DATE=\"\\\"4/15/2011\\\"\"", + "VERSION=\"\\\"1.19.0\\\"\"", + "RELEASE_DATE=\"\\\"5/9/2011\\\"\"", ); GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/listseqscommand.cpp b/listseqscommand.cpp index 21cb4c7..d60470c 100644 --- a/listseqscommand.cpp +++ b/listseqscommand.cpp @@ -257,11 +257,11 @@ int ListSeqsCommand::readFasta(){ m->openInputFile(fastafile, in); string name; - ofstream out; - string newFastaName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "numsAdded.fasta"; - m->openOutputFile(newFastaName, out); - int count = 1; - string lastName = ""; + //ofstream out; + //string newFastaName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "numsAdded.fasta"; + //m->openOutputFile(newFastaName, out); + //int count = 1; + //string lastName = ""; while(!in.eof()){ @@ -269,20 +269,20 @@ int ListSeqsCommand::readFasta(){ Sequence currSeq(in); name = currSeq.getName(); - if (lastName == "") { lastName = name; } - if (name != lastName) { count = 1; } - lastName = name; + //if (lastName == "") { lastName = name; } + //if (name != lastName) { count = 1; } + // lastName = name; - Sequence newSeq(name+"_"+toString(count), currSeq.getAligned()); - newSeq.printSequence(out); + //Sequence newSeq(name+"_"+toString(count), currSeq.getAligned()); + //newSeq.printSequence(out); if (name != "") { names.push_back(name); } m->gobble(in); - count++; + //count++; } in.close(); - out.close(); + //out.close(); return 0; diff --git a/mothurout.cpp b/mothurout.cpp index 2b06799..c2ef698 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -438,12 +438,12 @@ string MothurOut::getline(ifstream& fileHandle) { string line = ""; - while (!fileHandle.eof()) { + while (fileHandle) { //get next character char c = fileHandle.get(); //are you at the end of the line - if ((c == '\n') || (c == '\r') || (c == '\f')){ break; } + if ((c == '\n') || (c == '\r') || (c == '\f') || (c == EOF)){ break; } else { line += c; } } diff --git a/qualityscores.cpp b/qualityscores.cpp index 3f8722f..c9c6504 100644 --- a/qualityscores.cpp +++ b/qualityscores.cpp @@ -278,7 +278,7 @@ bool QualityScores::stripQualWindowAverage(Sequence& sequence, int stepSize, int int end = windowSize; int start = 0; - + if(seqLength < windowSize) { return 0; } while(start < seqLength){ @@ -300,6 +300,9 @@ bool QualityScores::stripQualWindowAverage(Sequence& sequence, int stepSize, int if(end == -1){ end = seqLength; } + //failed first window + if (end < windowSize) { return 0; } + sequence.setUnaligned(rawSequence.substr(0,end)); trimQScores(-1, end); diff --git a/splitmatrix.cpp b/splitmatrix.cpp index 80f311d..8ccb867 100644 --- a/splitmatrix.cpp +++ b/splitmatrix.cpp @@ -186,6 +186,7 @@ int SplitMatrix::createDistanceFilesFromTax(map& seqGroup, int numG for (int i = 0; i < numGroups; i++) { string options = "fasta=" + (fastafile + "." + toString(i) + ".temp") + ", processors=" + toString(processors) + ", cutoff=" + toString(distCutoff); + if (outputDir != "") { options += ", outputdir=" + outputDir; } Command* command = new DistanceCommand(options); diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp index f685a42..d8a0d1d 100644 --- a/trimseqscommand.cpp +++ b/trimseqscommand.cpp @@ -497,7 +497,7 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string int currentSeqsDiffs = 0; Sequence currSeq(inFASTA); m->gobble(inFASTA); - + QualityScores currQual; if(qFileName != ""){ currQual = QualityScores(qFile); m->gobble(qFile); @@ -546,7 +546,7 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string else if(qRollAverage != 0) { success = currQual.stripQualRollingAverage(currSeq, qRollAverage); } else if(qWindowAverage != 0){ success = currQual.stripQualWindowAverage(currSeq, qWindowStep, qWindowSize, qWindowAverage); } else { success = 1; } - + //you don't want to trim, if it fails above then scrap it if ((!qtrim) && (origLength != currSeq.getNumBases())) { success = 0; } -- 2.39.2