]> git.donarmstrong.com Git - mothur.git/commitdiff
working on testing
authorwestcott <westcott>
Fri, 3 Sep 2010 10:34:35 +0000 (10:34 +0000)
committerwestcott <westcott>
Fri, 3 Sep 2010 10:34:35 +0000 (10:34 +0000)
13 files changed:
engine.cpp
filterseqscommand.cpp
getseqscommand.cpp
globaldata.cpp
globaldata.hpp
nast.cpp
pintail.cpp
removeseqscommand.cpp
sharedrabundfloatvector.cpp
sharedrabundvector.cpp
summarysharedcommand.cpp
treegroupscommand.cpp
trimseqscommand.cpp

index 5e82d1344d9fa068078e0176b1e655a8290cd42b..54524ba9e6a8aa3fe8b678abf060db68529b7177 100644 (file)
@@ -199,7 +199,7 @@ string Engine::getCommand()  {
                                string nextCommand = "";
                                
                                mout->mothurOut("mothur > ");
-                               m->getline(cin, nextCommand);
+                               getline(cin, nextCommand);
                                mout->mothurOutJustToLog(toString(nextCommand));
                                
                                return nextCommand;
index 4ee674856223d3ef6ec2e9605437ae915f6e3ac7..1b3b3cfd415cd51605fe3c09a8b3b5a9f11b160d 100644 (file)
@@ -362,7 +362,7 @@ int FilterSeqsCommand::filterSequences() {
                                
                                if (m->control_pressed) {  return 1; }
                #else
-                               numFastaSeqs = driverRunFilter(filter, filteredFasta, fastafileNames[s], lines[0]);
+                               int numFastaSeqs = driverRunFilter(filter, filteredFasta, fastafileNames[s], lines[0]);
                                numSeqs += numFastaSeqs;
 
                                if (m->control_pressed) {  return 1; }
@@ -662,7 +662,7 @@ string FilterSeqsCommand::createFilter() {
                                
                                if (m->control_pressed) {  return filterString; }
                #else
-                               numFastaSeqs = driverCreateFilter(F, fastafileNames[s], lines[0]);
+                               int numFastaSeqs = driverCreateFilter(F, fastafileNames[s], lines[0]);
                                numSeqs += numFastaSeqs;
                                if (m->control_pressed) {  return filterString; }
                #endif
index e7226ceca0b1e959040fbea6d78818ba23731a6e..1926ae0b017abc926c2256e2c3b0396de1dbae40 100644 (file)
@@ -206,8 +206,9 @@ int GetSeqsCommand::execute(){
 //**********************************************************************************************************************
 int GetSeqsCommand::readFasta(){
        try {
-               if (outputDir == "") { outputDir += m->hasPath(fastafile); }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" +  m->getExtension(fastafile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(fastafile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" +  m->getExtension(fastafile);
                ofstream out;
                m->openOutputFile(outputFileName, out);
                
@@ -252,8 +253,9 @@ int GetSeqsCommand::readFasta(){
 //**********************************************************************************************************************
 int GetSeqsCommand::readList(){
        try {
-               if (outputDir == "") { outputDir += m->hasPath(listfile); }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" +  m->getExtension(listfile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(listfile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" +  m->getExtension(listfile);
                ofstream out;
                m->openOutputFile(outputFileName, out);
                
@@ -323,8 +325,9 @@ int GetSeqsCommand::readList(){
 //**********************************************************************************************************************
 int GetSeqsCommand::readName(){
        try {
-               if (outputDir == "") { outputDir += m->hasPath(namefile); }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" +  m->getExtension(namefile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(namefile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" +  m->getExtension(namefile);
                ofstream out;
                m->openOutputFile(outputFileName, out);
                
@@ -416,8 +419,9 @@ int GetSeqsCommand::readName(){
 //**********************************************************************************************************************
 int GetSeqsCommand::readGroup(){
        try {
-               if (outputDir == "") { outputDir += m->hasPath(groupfile); }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(groupfile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
                ofstream out;
                m->openOutputFile(outputFileName, out);
                
@@ -462,8 +466,9 @@ int GetSeqsCommand::readGroup(){
 //**********************************************************************************************************************
 int GetSeqsCommand::readTax(){
        try {
-               if (outputDir == "") { outputDir += m->hasPath(taxfile); }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(taxfile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
                ofstream out;
                m->openOutputFile(outputFileName, out);
                
@@ -507,8 +512,9 @@ int GetSeqsCommand::readTax(){
 //alignreport file has a column header line then all other lines contain 16 columns.  we just want the first column since that contains the name
 int GetSeqsCommand::readAlign(){
        try {
-               if (outputDir == "") { outputDir += m->hasPath(alignfile); }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(alignfile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
                ofstream out;
                m->openOutputFile(outputFileName, out);
                
index 74daaa2cc87cea237619fec03afdf28a8095f65f..b18324b8766f9d498295a6e630caaec1b5cc9595 100644 (file)
@@ -67,6 +67,7 @@ GlobalData::GlobalData() {
        gTreemap = NULL;
        gSequenceDB = NULL;
        nameMap = NULL;
+       saveNextLabel = "";
 }
 /*******************************************************/
 
@@ -87,6 +88,7 @@ void GlobalData::clear() {
        sharedfile              =       "";
        relAbundfile    =       "";
        format = "";
+       saveNextLabel = "";
 }
 
 
index bfb8a0688e1fe6e811ef83dc08a803c2753fae46..b5e8c7cfc7cb246b9fbf9ca24097b1f3d190366c 100644 (file)
@@ -48,6 +48,7 @@ public:
        set<string> labels; //holds labels to be used
        vector<string> Treenames;
        map<string, string> names;
+       string saveNextLabel;
        
        
        string getPhylipFile();
index 9cdf1b26619a170b7f7d67cc9edc60d89d66559a..b2887523532c6b6bcaef1ca61b2c748a9ad77d14 100644 (file)
--- a/nast.cpp
+++ b/nast.cpp
@@ -223,7 +223,7 @@ void Nast::removeExtraGaps(string& candAln, string tempAln, string newTemplateAl
 
 void Nast::regapSequences(){   //This is essentially part B in Fig 2. of DeSantis et al.
        try { 
-       
+       //cout << candidateSeq->getName() << endl;
                string candPair = candidateSeq->getPairwise();
                string candAln = "";
                
@@ -252,6 +252,7 @@ void Nast::regapSequences(){        //This is essentially part B in Fig 2. of DeSantis
                string lastLoop = "";
                
                while(pairwiseAlignIndex<pairwiseLength){
+       //cout << pairwiseAlignIndex << '\t' << fullAlignIndex << '\t' << pairwiseLength << endl;
                        if(isalpha(tempPair[pairwiseAlignIndex]) && isalpha(tempAln[fullAlignIndex])
                           && isalpha(candPair[pairwiseAlignIndex])){
                                //  the template and candidate pairwise and template aligned have characters
@@ -358,6 +359,7 @@ void Nast::regapSequences(){        //This is essentially part B in Fig 2. of DeSantis
                }                                                                                               //      2 of Desantis et al.
 
                candidateSeq->setAligned(candAln);
+       //cout << "here" << endl;
        }
        catch(exception& e) {
                m->errorOut(e, "Nast", "regapSequences");
index 4ad60c50742e36c630fbbc81a7f1f73ad527ec42..2362eb5ac80416f6aa86d8b7d011e275d7d3a88d 100644 (file)
@@ -92,7 +92,7 @@ int Pintail::doPrep() {
                m->mothurOut("Getting conservation... "); cout.flush();
                if (consfile == "") { 
                        m->mothurOut("Calculating probability of conservation for your template sequences.  This can take a while...  I will output the frequency of the highest base in each position to a .freq file so that you can input them using the conservation parameter next time you run this command.  Providing the .freq file will improve speed.    "); cout.flush();
-                       probabilityProfile = decalc->calcFreq(templateSeqs, outputDir + m->getSimpleName(templateFileName)); 
+                       probabilityProfile = decalc->calcFreq(templateSeqs, templateFileName); 
                        if (m->control_pressed) {  return 0;  }
                        m->mothurOut("Done."); m->mothurOutEndLine();
                }else                           {   probabilityProfile = readFreq();    m->mothurOut("Done.");            }
@@ -170,13 +170,13 @@ int Pintail::doPrep() {
                        string noOutliers, outliers;
                        
                        if ((!filter) && (seqMask == "")) {
-                               noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.quan";
+                               noOutliers = templateFileName + "pintail.quan";
                        }else if ((!filter) && (seqMask != "")) { 
-                               noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.masked.quan";
+                               noOutliers =templateFileName + "pintail.masked.quan";
                        }else if ((filter) && (seqMask != "")) { 
-                               noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "masked.quan";
+                               noOutliers = templateFileName + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "masked.quan";
                        }else if ((filter) && (seqMask == "")) { 
-                               noOutliers = outputDir + m->getRootName(m->getSimpleName(templateFileName)) + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "quan";
+                               noOutliers = templateFileName + "pintail.filtered." + m->getSimpleName(m->getRootName(fastafile)) + "quan";
                        }
 
                        decalc->removeObviousOutliers(quantilesMembers, templateSeqs.size());
index b77e69f665b078c0bf52956099f455833eb81749..0ab181b411738d38b769a0255baeaf5968308d35 100644 (file)
@@ -210,8 +210,10 @@ int RemoveSeqsCommand::execute(){
 //**********************************************************************************************************************
 int RemoveSeqsCommand::readFasta(){
        try {
-               if (outputDir == "") {  outputDir += m->hasPath(fastafile);  }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" + m->getExtension(fastafile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(fastafile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" + m->getExtension(fastafile);
+               
                ofstream out;
                m->openOutputFile(outputFileName, out);
                
@@ -254,8 +256,10 @@ int RemoveSeqsCommand::readFasta(){
 //**********************************************************************************************************************
 int RemoveSeqsCommand::readList(){
        try {
-               if (outputDir == "") {  outputDir += m->hasPath(listfile);  }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" +  m->getExtension(listfile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(listfile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" +  m->getExtension(listfile);
+               
                ofstream out;
                m->openOutputFile(outputFileName, out);
                
@@ -323,8 +327,9 @@ int RemoveSeqsCommand::readList(){
 //**********************************************************************************************************************
 int RemoveSeqsCommand::readName(){
        try {
-               if (outputDir == "") {  outputDir += m->hasPath(namefile);  }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" + m->getExtension(namefile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(namefile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" + m->getExtension(namefile);
 
                ofstream out;
                m->openOutputFile(outputFileName, out);
@@ -408,8 +413,10 @@ int RemoveSeqsCommand::readName(){
 //**********************************************************************************************************************
 int RemoveSeqsCommand::readGroup(){
        try {
-               if (outputDir == "") {  outputDir += m->hasPath(groupfile);  }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(groupfile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
+               
                ofstream out;
                m->openOutputFile(outputFileName, out);
 
@@ -449,8 +456,9 @@ int RemoveSeqsCommand::readGroup(){
 //**********************************************************************************************************************
 int RemoveSeqsCommand::readTax(){
        try {
-               if (outputDir == "") {  outputDir += m->hasPath(taxfile);  }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(taxfile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
                ofstream out;
                m->openOutputFile(outputFileName, out);
 
@@ -491,8 +499,10 @@ int RemoveSeqsCommand::readTax(){
 //alignreport file has a column header line then all other lines contain 16 columns.  we just want the first column since that contains the name
 int RemoveSeqsCommand::readAlign(){
        try {
-               if (outputDir == "") {  outputDir += m->hasPath(alignfile);  }
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
+               string thisOutputDir = outputDir;
+               if (outputDir == "") {  thisOutputDir += m->hasPath(alignfile);  }
+               string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
+               
                ofstream out;
                m->openOutputFile(outputFileName, out);
 
index f7405aefab95989d77bf3efec0ead7a44197b752..84b1cf56d60fc4f046218f2e5422e32fcad4ea21 100644 (file)
@@ -45,8 +45,12 @@ SharedRAbundFloatVector::SharedRAbundFloatVector(ifstream& f) : DataVector(), ma
                for (int i = 0; i < lookup.size(); i++) {  delete lookup[i]; lookup[i] = NULL; }
                lookup.clear();
                
+               if (globaldata->saveNextLabel == "") {  f >> label;  }
+               else { label = globaldata->saveNextLabel; }
+               
                //read in first row since you know there is at least 1 group.
-               f >> label >> groupN >> num;
+               f >> groupN >> num;
+
                holdLabel = label;
                
                //add new vector to lookup
@@ -103,8 +107,7 @@ SharedRAbundFloatVector::SharedRAbundFloatVector(ifstream& f) : DataVector(), ma
                        if (f.eof() != true) { f >> nextLabel; }
                }
                
-               //put file pointer back since you are now at a new distance label
-               for (int i = 0; i < nextLabel.length(); i++) { f.unget();  }
+               globaldata->saveNextLabel = nextLabel;
        
                if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap;  }
                
index 6259ba2b03796ff2dc71bf9125217287eb545f4c..9328cbd2b3da8cef5a0067bedced912ddbea399b 100644 (file)
@@ -73,8 +73,12 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                for (int i = 0; i < lookup.size(); i++) {  delete lookup[i]; lookup[i] = NULL; }
                lookup.clear();
                
+               if (globaldata->saveNextLabel == "") {  f >> label;  }
+               else { label = globaldata->saveNextLabel; }
+               
                //read in first row since you know there is at least 1 group.
-               f >> label >> groupN >> num;
+               f >> groupN >> num;
+
                holdLabel = label;
                
                //add new vector to lookup
@@ -98,13 +102,12 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                        //numSeqs += inputData;
                        //numBins++;
                        if (inputData > maxRank) { maxRank = inputData; }
-                       
                }
                
                m->gobble(f);
                
-               if (f.eof() != true) { f >> nextLabel; }
-               
+               if (!(f.eof())) { f >> nextLabel; }
+       
                //read the rest of the groups info in
                while ((nextLabel == holdLabel) && (f.eof() != true)) {
                        f >> groupN >> num;
@@ -133,9 +136,8 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                                
                        if (f.eof() != true) { f >> nextLabel; }
                }
-               
-               //put file pointer back since you are now at a new distance label
-               for (int i = 0; i < nextLabel.length(); i++) { f.unget();  }
+       
+               globaldata->saveNextLabel = nextLabel;
        
                if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap;  }
                
index 3828a38afe65fd2e09febea09a23ab59cd6a96e5..f44a2cd540345424e946c48ef733768ff4691ae8 100644 (file)
@@ -422,7 +422,8 @@ int SummarySharedCommand::process(vector<SharedRAbundVector*> thisLookup) {
        
                                int n = 1; 
                                vector<SharedRAbundVector*> subset;
-                               for (int k = 0; k < (thisLookup.size() - 1); k++) { // pass cdd each set of groups to commpare
+                               for (int k = 0; k < (thisLookup.size() - 1); k++) { // pass cdd each set of groups to compare
+       
                                        for (int l = n; l < thisLookup.size(); l++) {
                                                
                                                outputFileHandle << thisLookup[0]->getLabel() << '\t';
index 9594767f81ad234a969db760d7cc0be6e1575111..637eccedfc77e74556de6bf3f201270b28874d96 100644 (file)
@@ -50,6 +50,8 @@ TreeGroupCommand::TreeGroupCommand(string option)  {
                                if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
                        }
                        
+                       globaldata->newRead();
+                       
                        //if the user changes the input directory command factory will send this info to us in the output parameter 
                        string inputDir = validParameter.validFile(parameters, "inputdir", false);              
                        if (inputDir == "not found"){   inputDir = "";          }
index 3c1367a17eadd176edf05078c46b4e4a398d4640..acdf475a17ccc544c96e6d519d58867cf50b3374 100644 (file)
@@ -315,7 +315,7 @@ int TrimSeqsCommand::execute(){
                                
                                if (m->control_pressed) {  return 0; }
                #else
-                               driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, groupFile, fastaFileNames, qualFileNames, lines[0], qlines[0]);
+                               driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, groupFile, fastaFileNames, qualFileNames, lines[0], qLines[0]);
                                
                                for (int j = 0; j < fastaFileNames.size(); j++) {
                                        rename((fastaFileNames[j] + toString(j) + ".temp").c_str(), fastaFileNames[j].c_str());