]> git.donarmstrong.com Git - mothur.git/blobdiff - corraxescommand.cpp
added shared file type to get.groups and remove.groups
[mothur.git] / corraxescommand.cpp
index 791ec4978fd82d2fb692723fc105dfd5b6c041f0..ea98dfb4f35d91c0968898a9ab6ef931cc137d5c 100644 (file)
@@ -140,12 +140,12 @@ CorrAxesCommand::CorrAxesCommand(string option)  {
                        sharedfile = validParameter.validFile(parameters, "shared", true);
                        if (sharedfile == "not open") { abort = true; }
                        else if (sharedfile == "not found") { sharedfile = ""; }
-                       else { inputFileName = sharedfile; }
+                       else { inputFileName = sharedfile; m->setSharedFile(sharedfile); }
                        
                        relabundfile = validParameter.validFile(parameters, "relabund", true);
                        if (relabundfile == "not open") { abort = true; }
                        else if (relabundfile == "not found") { relabundfile = ""; }
-                       else { inputFileName = relabundfile; }
+                       else { inputFileName = relabundfile; m->setRelAbundFile(relabundfile); }
                        
                        metadatafile = validParameter.validFile(parameters, "metadata", true);
                        if (metadatafile == "not open") { abort = true; }
@@ -759,6 +759,7 @@ int CorrAxesCommand::eliminateZeroOTUS(vector<SharedRAbundFloatVector*>& thisloo
                }
                
                //for each bin
+               vector<string> newBinLabels;
                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; }
                        
@@ -773,12 +774,19 @@ int CorrAxesCommand::eliminateZeroOTUS(vector<SharedRAbundFloatVector*>& thisloo
                                for (int j = 0; j < thislookup.size(); j++) {
                                        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);
+                               if (i < m->currentBinLabels.size()) {  binLabel = m->currentBinLabels[i]; }
+                               
+                               newBinLabels.push_back(binLabel);
                        }
                }
                
                for (int j = 0; j < thislookup.size(); j++) {  delete thislookup[j];  }
                
                thislookup = newLookup;
+               m->currentBinLabels = newBinLabels;
                
                return 0;
                
@@ -863,14 +871,14 @@ int CorrAxesCommand::getMetadata(){
                //read the first label, because it refers to the groups
                string columnLabel;
                iss >> columnLabel; m->gobble(iss); 
-
+               
                //save names of columns you are reading
                while (!iss.eof()) {
                        iss >> columnLabel; m->gobble(iss);
                        metadataLabels.push_back(columnLabel);
                }
                int count = metadataLabels.size();
-               
+                       
                //read rest of file
                while (!in.eof()) {
                        
@@ -879,7 +887,7 @@ int CorrAxesCommand::getMetadata(){
                        string group = "";
                        in >> group; m->gobble(in);
                        groupNames.push_back(group);
-                       
+                               
                        SharedRAbundFloatVector* tempLookup = new SharedRAbundFloatVector();
                        tempLookup->setGroup(group);
                        tempLookup->setLabel("1");
@@ -887,7 +895,6 @@ int CorrAxesCommand::getMetadata(){
                        for (int i = 0; i < count; i++) {
                                float temp = 0.0;
                                in >> temp; 
-                               
                                tempLookup->push_back(temp, group);
                        }