From 0b99c6b6ea875e13febda76903fd4d9cda7add7d Mon Sep 17 00:00:00 2001 From: westcott Date: Fri, 30 Jul 2010 16:53:56 +0000 Subject: [PATCH] changes for 1.12.2 --- getoturepcommand.cpp | 3 ++- makefile | 2 +- nast.cpp | 11 ++++++----- setdircommand.cpp | 15 ++------------- sffinfocommand.cpp | 5 +++-- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/getoturepcommand.cpp b/getoturepcommand.cpp index b872d1a..de7d761 100644 --- a/getoturepcommand.cpp +++ b/getoturepcommand.cpp @@ -790,7 +790,8 @@ int GetOTURepCommand::processNames(string filename, string label) { out << sequence << endl; } } - + + in.close(); out.close(); out2.close(); diff --git a/makefile b/makefile index 3f0893c..a8a0170 100644 --- a/makefile +++ b/makefile @@ -32,7 +32,7 @@ ifeq ($(strip $(64BIT_VERSION)),yes) CXXFLAGS += -DBIT_VERSION #if you are using centos uncomment the following lines - #CC = g++44 + #CXX = g++44 #CXXFLAGS += -mtune=native -march=native -m64 endif diff --git a/nast.cpp b/nast.cpp index 8ed69fa..90c8383 100644 --- a/nast.cpp +++ b/nast.cpp @@ -99,7 +99,7 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl for(int i=0; i move stuff left there's if(leftRoom >= insertLength){ // enough room to the left to move - //cout << "lr newTemplateAlign = " << newTemplateAlign.length() << '\t' << i << '\t' << i+insertLength << endl; + //cout << "lr newTemplateAlign = " << newTemplateAlign.length() << '\t' << i << '\t' << insertLength << endl; string leftTemplateString = newTemplateAlign.substr(0,i); string rightTemplateString = newTemplateAlign.substr((i+insertLength)); newTemplateAlign = leftTemplateString + rightTemplateString; longAlignmentLength = newTemplateAlign.length(); - //cout << "lr candAln = " << candAln.length() << '\t' << leftIndex-insertLength+1 << '\t' << leftIndex+1 << endl; + //cout << "lr candAln = " << candAln.length() << '\t' << leftIndex << '\t' << endl; string leftCandidateString = candAln.substr(0,(leftIndex-insertLength+1)); string rightCandidateString = candAln.substr((leftIndex+1)); candAln = leftCandidateString + rightCandidateString; @@ -145,12 +145,12 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl } else{ // not enough room to the left, have to steal some space to - //cout << "in else lr newTemplateAlign = " << newTemplateAlign.length() << '\t' << i << '\t' << i+insertLength << endl; + //cout << "in else lr newTemplateAlign = " << newTemplateAlign.length() << '\t' << i << '\t' << insertLength << endl; string leftTemplateString = newTemplateAlign.substr(0,i); // the right string rightTemplateString = newTemplateAlign.substr((i+insertLength)); newTemplateAlign = leftTemplateString + rightTemplateString; longAlignmentLength = newTemplateAlign.length(); - //cout << " in else lr candAln = " << candAln.length() << '\t' << leftIndex-leftRoom+1 << '\t' << rightIndex-leftIndex-1 << '\t' << rightIndex+(insertLength-leftRoom) << endl; + //cout << " in else lr candAln = " << candAln.length() << '\t' << " leftIndex = " << leftIndex << " leftroom = " << leftRoom << " rightIndex = " << rightIndex << '\t' << endl; string leftCandidateString = candAln.substr(0,(leftIndex-leftRoom+1)); string insertString = candAln.substr((leftIndex+1),(rightIndex-leftIndex-1)); string rightCandidateString = candAln.substr((rightIndex+(insertLength-leftRoom))); @@ -187,6 +187,7 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl } } i -= insertLength; + //if (i < 0) { cout << " we have a negative i = " << i << endl; } } else{ diff --git a/setdircommand.cpp b/setdircommand.cpp index 1bc78bd..001ae23 100644 --- a/setdircommand.cpp +++ b/setdircommand.cpp @@ -157,19 +157,8 @@ int SetDirectoryCommand::execute(){ if (lastChar != "\\") { tempdefault += "\\"; } #endif - //test to make sure directory exists - tempdefault = getFullPathName(tempdefault); - string inTemp = tempdefault + "temp"; - ofstream in; - in.open(inTemp.c_str(), ios::trunc); - if(!in) { - m->mothurOut(tempdefault + " directory does not exist or is not writable."); m->mothurOutEndLine(); - }else{ - in.close(); - remove(inTemp.c_str()); - m->mothurOut("Changing default directory to " + tempdefault); m->mothurOutEndLine(); - m->setDefaultPath(tempdefault); - } + m->mothurOut("Changing default directory to " + tempdefault); m->mothurOutEndLine(); + m->setDefaultPath(tempdefault); } return 0; diff --git a/sffinfocommand.cpp b/sffinfocommand.cpp index 38322ac..0e860db 100644 --- a/sffinfocommand.cpp +++ b/sffinfocommand.cpp @@ -562,6 +562,7 @@ int SffInfoCommand::printSffTxtSeqData(ofstream& out, seqRead& read, Header& hea for (int i = 0; i < read.flowIndex.size(); i++) { sum += read.flowIndex[i]; out << sum << '\t'; } //make the bases you want to clip lowercase and the bases you want to keep upper case + if(header.clipQualRight == 0){ header.clipQualRight = read.bases.length(); } for (int i = 0; i < (header.clipQualLeft-1); i++) { read.bases[i] = tolower(read.bases[i]); } for (int i = (header.clipQualLeft-1); i < (header.clipQualRight-1); i++) { read.bases[i] = toupper(read.bases[i]); } for (int i = (header.clipQualRight-1); i < read.bases.length(); i++) { read.bases[i] = tolower(read.bases[i]); } @@ -586,7 +587,7 @@ int SffInfoCommand::printFastaSeqData(ofstream& out, seqRead& read, Header& head string seq = read.bases; if (trim) { - if(header.clipQualRight != 0){ + if((header.clipQualRight != 0) && ((header.clipQualRight-header.clipQualLeft) >= 0)){ seq = seq.substr((header.clipQualLeft-1), (header.clipQualRight-header.clipQualLeft)); } else { @@ -619,7 +620,7 @@ int SffInfoCommand::printQualSeqData(ofstream& out, seqRead& read, Header& heade try { if (trim) { - if(header.clipQualRight != 0){ + if((header.clipQualRight != 0) && ((header.clipQualRight-header.clipQualLeft) >= 0)){ out << ">" << header.name << " length=" << (header.clipQualRight-header.clipQualLeft) << endl; for (int i = (header.clipQualLeft-1); i < (header.clipQualRight-1); i++) { out << read.qualScores[i] << '\t'; } } -- 2.39.2