]> git.donarmstrong.com Git - mothur.git/commitdiff
check in for trip
authorwestcott <westcott>
Sun, 2 Oct 2011 16:00:00 +0000 (16:00 +0000)
committerwestcott <westcott>
Sun, 2 Oct 2011 16:00:00 +0000 (16:00 +0000)
corraxescommand.cpp
normalizesharedcommand.cpp
sharedrabundfloatvector.cpp
sharedrabundvector.cpp
subsamplecommand.cpp
summarytaxcommand.h

index f10fe4de4e385d943460998d62bfa75b61cc2637..b943aa4bf9dd962a4364af7069d24eb64c380a78 100644 (file)
@@ -760,6 +760,7 @@ int CorrAxesCommand::eliminateZeroOTUS(vector<SharedRAbundFloatVector*>& thisloo
                
                //for each bin
                vector<string> newBinLabels;
+               string snumBins = toString(thislookup[0]->getNumBins());
                for (int i = 0; i < thislookup[0]->getNumBins(); i++) {
                        if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) {  delete newLookup[j];  } return 0; }
                        
@@ -776,7 +777,13 @@ int CorrAxesCommand::eliminateZeroOTUS(vector<SharedRAbundFloatVector*>& thisloo
                                }
                                
                                //if there is a bin label use it otherwise make one
-                               string binLabel = "Otu" + toString(i+1);
+                               string binLabel = "Otu";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber; 
                                if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
                                newBinLabels.push_back(binLabel);
index bcec00a0bc6dd47e15ddcf72000dc4a9dbec9469..43c8e2260c4e678bbd2e7718a6313b15d97eed8b 100644 (file)
@@ -632,6 +632,7 @@ int NormalizeSharedCommand::eliminateZeroOTUS(vector<SharedRAbundVector*>& thisl
                
                //for each bin
                vector<string> newBinLabels;
+               string snumBins = toString(thislookup[0]->getNumBins());
                for (int i = 0; i < thislookup[0]->getNumBins(); i++) {
                        if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) {  delete newLookup[j];  } return 0; }
                
@@ -647,7 +648,13 @@ int NormalizeSharedCommand::eliminateZeroOTUS(vector<SharedRAbundVector*>& thisl
                                        newLookup[j]->push_back(thislookup[j]->getAbundance(i), thislookup[j]->getGroup());
                                }
                                //if there is a bin label use it otherwise make one
-                               string binLabel = "Otu" + toString(i+1);
+                               string binLabel = "Otu";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber; 
                                if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
                                newBinLabels.push_back(binLabel);
@@ -681,6 +688,7 @@ int NormalizeSharedCommand::eliminateZeroOTUS(vector<SharedRAbundFloatVector*>&
                
                //for each bin
                vector<string> newBinLabels;
+               string snumBins = toString(thislookup[0]->getNumBins());
                for (int i = 0; i < thislookup[0]->getNumBins(); i++) {
                        if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) {  delete newLookup[j];  } return 0; }
                        
@@ -696,7 +704,13 @@ int NormalizeSharedCommand::eliminateZeroOTUS(vector<SharedRAbundFloatVector*>&
                                        newLookup[j]->push_back(thislookup[j]->getAbundance(i), thislookup[j]->getGroup());
                                }
                                //if there is a bin label use it otherwise make one
-                               string binLabel = "Otu" + toString(i+1);
+                               string binLabel = "Otu";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber; 
                                if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
                                newBinLabels.push_back(binLabel);
index bda49bf3dcd50b7171eb2d3aaa9f1668692f1fd8..bea2f8c83808b287428bc309f513b8b64d548366 100644 (file)
@@ -252,12 +252,19 @@ int SharedRAbundFloatVector::size(){
 /***********************************************************************/
 void SharedRAbundFloatVector::printHeaders(ostream& output){
        try {
+               string snumBins = toString(numBins);
                output << "label\tGroup\tnumOtus\t";
                if (m->sharedHeaderMode == "tax") {
                        for (int i = 0; i < numBins; i++) {  
                                
                                //if there is a bin label use it otherwise make one
-                               string binLabel = "PhyloType" + toString(i+1);
+                               string binLabel = "PhyloType";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber;
                                if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
                                output << binLabel << '\t'; 
@@ -266,7 +273,13 @@ void SharedRAbundFloatVector::printHeaders(ostream& output){
                }else {
                        for (int i = 0; i < numBins; i++) {  
                                //if there is a bin label use it otherwise make one
-                               string binLabel = "Otu" + toString(i+1);
+                               string binLabel = "Otu";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber;
                                if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
                                output << binLabel << '\t'; 
@@ -484,6 +497,7 @@ int SharedRAbundFloatVector::eliminateZeroOTUS(vector<SharedRAbundFloatVector*>&
                
                //for each bin
                vector<string> newBinLabels;
+               string snumBins = toString(thislookup[0]->getNumBins());
                for (int i = 0; i < thislookup[0]->getNumBins(); i++) {
                        if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) {  delete newLookup[j];  } return 0; }
                        
@@ -499,7 +513,13 @@ int SharedRAbundFloatVector::eliminateZeroOTUS(vector<SharedRAbundFloatVector*>&
                                        newLookup[j]->push_back(thislookup[j]->getAbundance(i), thislookup[j]->getGroup());
                                }
                                //if there is a bin label use it otherwise make one
-                               string binLabel = "Otu" + toString(i+1);
+                               string binLabel = "Otu";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber; 
                                if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
                                newBinLabels.push_back(binLabel);
index 51e277a659ce33789482ea837db6c7a6d0075b25..f42d24ba4081cd95c1aa2f89367054755f136807 100644 (file)
@@ -336,13 +336,19 @@ int SharedRAbundVector::size(){
 /***********************************************************************/
 void SharedRAbundVector::printHeaders(ostream& output){
        try {
-               
+               string snumBins = toString(numBins);
                output << "label\tGroup\tnumOtus\t";
                if (m->sharedHeaderMode == "tax") {
                        for (int i = 0; i < numBins; i++) {  
                                
                                //if there is a bin label use it otherwise make one
-                               string binLabel = "PhyloType" + toString(i+1);
+                               string binLabel = "PhyloType";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber;
                                if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
                                output << binLabel << '\t'; 
@@ -351,10 +357,16 @@ void SharedRAbundVector::printHeaders(ostream& output){
                }else {
                        for (int i = 0; i < numBins; i++) {  
                                //if there is a bin label use it otherwise make one
-                               string mybinLabel = "Otu" + toString(i+1);
-                               if (i < m->currentBinLabels.size()) {  mybinLabel = m->currentBinLabels[i]; }
+                               string binLabel = "Otu";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber;
+                               if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
-                               output << mybinLabel << '\t'; 
+                               output << binLabel << '\t'; 
                        }
                        
                        output << endl;
@@ -461,6 +473,7 @@ int SharedRAbundVector::eliminateZeroOTUS(vector<SharedRAbundVector*>& thislooku
                        
                        //for each bin
                        vector<string> newBinLabels;
+                       string snumBins = toString(thislookup[0]->getNumBins());
                        for (int i = 0; i < thislookup[0]->getNumBins(); i++) {
                                if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) {  delete newLookup[j];  } return 0; }
                                
@@ -477,7 +490,13 @@ int SharedRAbundVector::eliminateZeroOTUS(vector<SharedRAbundVector*>& thislooku
                                        }
                                        
                                        //if there is a bin label use it otherwise make one
-                                       string binLabel = "Otu" + toString(i+1);
+                                       string binLabel = "Otu";
+                                       string sbinNumber = toString(i+1);
+                                       if (sbinNumber.length() < snumBins.length()) { 
+                                               int diff = snumBins.length() - sbinNumber.length();
+                                               for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                                       }
+                                       binLabel += sbinNumber; 
                                        if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                        
                                        newBinLabels.push_back(binLabel);
index 28cfc3493e5b2ac6ac790445a4acaa397405b2ad..49a821045e122b5097fde092a5845378e21afc60 100644 (file)
@@ -1522,6 +1522,7 @@ int SubSampleCommand::eliminateZeroOTUS(vector<SharedRAbundVector*>& thislookup)
                
                //for each bin
                vector<string> newBinLabels;
+               string snumBins = toString(thislookup[0]->getNumBins());
                for (int i = 0; i < thislookup[0]->getNumBins(); i++) {
                        if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) {  delete newLookup[j];  } return 0; }
                        
@@ -1537,7 +1538,13 @@ int SubSampleCommand::eliminateZeroOTUS(vector<SharedRAbundVector*>& thislookup)
                                        newLookup[j]->push_back(thislookup[j]->getAbundance(i), thislookup[j]->getGroup());
                                }
                                //if there is a bin label use it otherwise make one
-                               string binLabel = "Otu" + toString(i+1);
+                               string binLabel = "Otu";
+                               string sbinNumber = toString(i+1);
+                               if (sbinNumber.length() < snumBins.length()) { 
+                                       int diff = snumBins.length() - sbinNumber.length();
+                                       for (int h = 0; h < diff; h++) { binLabel += "0"; }
+                               }
+                               binLabel += sbinNumber; 
                                if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
                                
                                newBinLabels.push_back(binLabel);
index acef7ee7ce74ff0e2863cfaa2451b26e04d73208..b5bdab15ab977b97b1d1a813869ff0dbe38d8deb 100644 (file)
@@ -37,4 +37,7 @@ class SummaryTaxCommand : public Command {
                map<string, int> nameMap;
 };
 
+/**************************************************************************************************/
+
+
 #endif