]> git.donarmstrong.com Git - mothur.git/blobdiff - classifysharedcommand.cpp
changing command name classify.shared to classifyrf.shared
[mothur.git] / classifysharedcommand.cpp
index 61914629732f3d690ade523b632d28b6b562431f..c7eb6cd0daa18f5627824a94d297270a1ff32147 100755 (executable)
@@ -359,8 +359,11 @@ void ClassifySharedCommand::processSharedAndDesignData(vector<SharedRAbundVector
         
         vector< vector<int> > dataSet(numRows, vector<int>(numColumns, 0));
         
+        vector<string> names;
+        
         for (int i = 0; i < lookup.size(); i++) {
             string sharedGroupName = lookup[i]->getGroup();
+            names.push_back(sharedGroupName);
             string treatmentName = designMap.getGroup(sharedGroupName);
             
             int j = 0;
@@ -375,15 +378,24 @@ void ClassifySharedCommand::processSharedAndDesignData(vector<SharedRAbundVector
         
         randomForest.populateDecisionTrees();
         randomForest.calcForrestErrorRate();
+        randomForest.printConfusionMatrix(intToTreatmentMap);
         
         map<string, string> variables; 
-        variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + ".RF.";
+        variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + "RF.";
         variables["[distance]"] = lookup[0]->getLabel();
         string filename = getOutputFileName("summary", variables);
         outputNames.push_back(filename); outputTypes["summary"].push_back(filename);
-        
         randomForest.calcForrestVariableImportance(filename);
         
+        //
+        map<string, string> variable; 
+        variable["[filename]"] = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + "misclassifications.";
+        variable["[distance]"] = lookup[0]->getLabel();
+        string mc_filename = getOutputFileName("summary", variable);
+        outputNames.push_back(mc_filename); outputTypes["summary"].push_back(mc_filename);
+        randomForest.getMissclassifications(mc_filename, intToTreatmentMap, names);
+        //
+        
         m->mothurOutEndLine();
     }
     catch(exception& e) {