]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed bug with normalize.shared, printed out numbins twice. fixed bug with summary...
authorwestcott <westcott>
Tue, 2 Nov 2010 15:14:07 +0000 (15:14 +0000)
committerwestcott <westcott>
Tue, 2 Nov 2010 15:14:07 +0000 (15:14 +0000)
getseqscommand.cpp
metastats2.c
metastatscommand.cpp
mothur
normalizesharedcommand.cpp
summarycommand.cpp
trimseqscommand.cpp

index b48ba28709acfb2b0f1355743c5a860cee1c8529..4b93d1fdeea1aac9048013d755ceda466e5f37a1 100644 (file)
@@ -300,6 +300,7 @@ int GetSeqsCommand::readFasta(){
                in.close();     
                out.close();
                
+               
                if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
                outputNames.push_back(outputFileName);  outputTypes["fasta"].push_back(outputFileName); 
                
index bbea3ce8deacf3debe2b6f5adfc909e944862345..136c0426f1609964322343157c148ff8971cc4dc 100644 (file)
@@ -23,10 +23,11 @@ int metastat_main (char* outputFileName, int numRows, int numCols, double thresh
  
   // Initialize the matrices
   size = row*col;
+//printf("size = %d\n.", size);
   double matrix[row][col];
   double pmatrix[size],pmatrix2[size],permuted[size];  
   double storage[row][9];
-  
+//printf("here\n.", size);  
   for (i=0;i<row;i++){
        for (j =0;j<9;j++){
       storage[i][j]=0;                 
index 866bc94e07553d417b38036bca46184fad973261..2078584426ffecc4a445a7486825af7fc7bb0077 100644 (file)
@@ -442,7 +442,6 @@ int MetaStatsCommand::driver(int start, int num, vector<SharedRAbundVector*>& th
                                }
                                
                                m->mothurOut("Comparing " + setA + " and " + setB + "..."); m->mothurOutEndLine(); 
-                               
                                metastat_main(output, thisLookUp[0]->getNumBins(), subset.size(), threshold, iters, data, setACount);
                                
                                m->mothurOutEndLine(); 
diff --git a/mothur b/mothur
index 197583b629092aa102b1a90da5223a557a4da7ca..fcb006d68a694becb92b5adcdf4a414946782ff6 100755 (executable)
Binary files a/mothur and b/mothur differ
index 93bc7f29a075126c9cb70bcc6f2590bd222a574d..8aec029d9ec718327cc8c2e677f215e7b9e5cc88 100644 (file)
@@ -12,7 +12,7 @@
 //**********************************************************************************************************************
 vector<string> NormalizeSharedCommand::getValidParameters(){   
        try {
-               string Array[] =  {"groups","label","scale","outputdir","inputdir","norm"};
+               string Array[] =  {"groups","label","method","outputdir","inputdir","norm"};
                vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
                return myArray;
        }
@@ -71,7 +71,7 @@ NormalizeSharedCommand::NormalizeSharedCommand(string option) {
                
                else {
                        //valid paramters for this command
-                       string AlignArray[] =  {"groups","label","scale","outputdir","inputdir","norm"};
+                       string AlignArray[] =  {"groups","label","method","outputdir","inputdir","norm"};
                        vector<string> myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string)));
                        
                        OptionParser parser(option);
@@ -322,7 +322,7 @@ int NormalizeSharedCommand::normalize(vector<SharedRAbundVector*>& thisLookUp, o
                 eliminateZeroOTUS(thisLookUp);
                 
                  for (int i = 0; i < thisLookUp.size(); i++) {
-                       out << thisLookUp[i]->getLabel() << '\t' << thisLookUp[i]->getGroup() << '\t' << thisLookUp[i]->getNumBins() << '\t';
+                       out << thisLookUp[i]->getLabel() << '\t' << thisLookUp[i]->getGroup() << '\t';
                        thisLookUp[i]->print(out);
                 }
                
index d68d00ac6258e0ac10346ce5b67b7d10a2de7495..1e0e8dbc552a872df3fe591d15ea378db3316959 100644 (file)
@@ -506,52 +506,64 @@ string SummaryCommand::createGroupSummaryFile(int numLines, int numCols, vector<
                
                //open each groups summary file
                string newLabel = "";
-               ifstream* temp;
-               map<string, ifstream*> filehandles;
+               map<string, vector<string> > files;
                for (int i=0; i<outputNames.size(); i++) {
-                       temp = new ifstream;
-                       filehandles[outputNames[i]] = temp;
-                       m->openInputFile(outputNames[i], *(temp));
+                       vector<string> thisFilesLines;
+                       
+                       ifstream temp;
+                       m->openInputFile(outputNames[i], temp);
                        
                        //read through first line - labels
                        string tempLabel;
                        if (i == 0) { //we want to save the labels to output below
                                for (int j = 0; j < numCols+1; j++) {  
-                                       *(temp) >> tempLabel; 
+                                       temp >> tempLabel; 
                                        
                                        if (j == 1) {  newLabel += "group\t" + tempLabel + '\t';
                                        }else{  newLabel += tempLabel + '\t';   }
                                }
-                       }else{  for (int j = 0; j < numCols+1; j++) {  *(temp) >> tempLabel;  }  }
+                       }else{  for (int j = 0; j < numCols+1; j++) {  temp >> tempLabel;  }  }
+                       
+                       m->gobble(temp);
+                       
+                       //for each label
+                       for (int k = 0; k < numLines; k++) {
+                               
+                               string thisLine = "";
+                               string tempLabel;
+                                       
+                               for (int j = 0; j < numCols+1; j++) {  
+                                       temp >> tempLabel; 
+                                               
+                                       //save for later
+                                       if (j == 1) { thisLine += groups[i] + "\t" + tempLabel + "\t";  }
+                                       else{  thisLine += tempLabel + "\t";    }
+                               }
+                                       
+                               thisLine += "\n";
+                               
+                               thisFilesLines.push_back(thisLine);
+                                       
+                               m->gobble(temp);
+                       }
+                               
+                       files[outputNames[i]] = thisFilesLines;
                        
-                       m->gobble(*(temp));
+                       temp.close();
                }
                
                //output label line to new file
                out << newLabel << endl;
                
                //for each label
-               for (int i = 0; i < numLines; i++) {
+               for (int k = 0; k < numLines; k++) {
                
                        //grab summary data for each group
                        for (int i=0; i<outputNames.size(); i++) {
-                               string tempLabel;
-                               
-                               for (int j = 0; j < numCols+1; j++) {  
-                                       *(filehandles[outputNames[i]]) >> tempLabel; 
-                                       
-                                       //print to combined file
-                                       if (j == 1) { out << groups[i] << '\t' << tempLabel << '\t';    }
-                                       else{  out << tempLabel << '\t';        }
-                               }
-                               
-                               out << endl;
-                               m->gobble(*(filehandles[outputNames[i]]));
+                               out << files[outputNames[i]][k];
                        }
                }       
                
-               //close each groups summary file
-               for (int i=0; i<outputNames.size(); i++) {  (*(filehandles[outputNames[i]])).close();  remove(outputNames[i].c_str());  }
                outputNames.clear();
                
                out.close();
index f684b66a8e72d18f98172579197fac7cc5a2f543..4e7a12994f4854c487d036dd422aa1f3130e288c 100644 (file)
@@ -758,7 +758,7 @@ int TrimSeqsCommand::setLines(string filename, string qfilename, vector<unsigned
                //seach for filePos of each first name in the qfile and save in qfileFilePos
                ifstream inQual;
                m->openInputFile(qfilename, inQual);
-                       
+               
                string input;
                while(!inQual.eof()){   
                        input = m->getline(inQual);
@@ -784,6 +784,7 @@ int TrimSeqsCommand::setLines(string filename, string qfilename, vector<unsigned
                }
                inQual.close();
                
+               
                if (firstSeqNames.size() != 0) { 
                        for (map<string, int>::iterator it = firstSeqNames.begin(); it != firstSeqNames.end(); it++) {
                                m->mothurOut(it->first + " is in your fasta file and not in your quality file, not using quality file."); m->mothurOutEndLine();