]> git.donarmstrong.com Git - mothur.git/blobdiff - getmetacommunitycommand.cpp
added oligos class. added check orient parameter to trim.flows, sffinfo, fastq.info...
[mothur.git] / getmetacommunitycommand.cpp
index 2b944153a92e5c919a0e2269916f0ffbbc9d2395..5b86c7420e1e5e2cbe564fd766edb63919388ea3 100644 (file)
@@ -46,9 +46,9 @@ string GetMetaCommunityCommand::getHelpString(){
         helpString += "The label parameter is used to analyze specific labels in your input. labels are separated by dashes.\n";
                helpString += "The groups parameter allows you to specify which of the groups in your shared file you would like analyzed.  Group names are separated by dashes.\n";
         helpString += "The method parameter allows to select the method you would like to use.  Options are dmm, kmeans and pam. Default=dmm.\n";
-        helpString += "The calc parameter allows to select the calculator you would like to use to calculate the distance matrix used by the pam method. By default the jsd calculator is used.\n";
-        helpString += "The iters parameter allows you to choose the number of times you would like to run the subsample while calculating the distance matirx for the pam method.\n";
-        helpString += "The subsample parameter allows you to enter the size pergroup of the sample or you can set subsample=T and mothur will use the size of your smallest group while calculating the distance matrix for the pam method.\n";
+        helpString += "The calc parameter allows to select the calculator you would like to use to calculate the distance matrix used by the pam and kmeans method. By default the rjsd calculator is used.\n";
+        helpString += "The iters parameter allows you to choose the number of times you would like to run the subsample while calculating the distance matrix for the pam and kmeans method.\n";
+        helpString += "The subsample parameter allows you to enter the size pergroup of the sample or you can set subsample=T and mothur will use the size of your smallest group while calculating the distance matrix for the pam and kmeans methods.\n";
                helpString += "The minpartitions parameter is used to .... Default=5.\n";
         helpString += "The maxpartitions parameter is used to .... Default=10.\n";
         helpString += "The optimizegap parameter is used to .... Default=3.\n";
@@ -66,12 +66,12 @@ string GetMetaCommunityCommand::getOutputPattern(string type) {
     try {
         string pattern = "";
         
-        if (type == "fit")              {  pattern = "[filename],[distance],mix.fit"; }
-        else if (type == "relabund")    {  pattern = "[filename],[distance],[tag],mix.relabund"; }
-        else if (type == "design")      {  pattern = "[filename],[distance],mix.design"; }
-        else if (type == "matrix")      {  pattern = "[filename],[distance],[tag],mix.posterior"; }
-        else if (type == "parameters")  {  pattern = "[filename],[distance],mix.parameters"; }
-        else if (type == "summary")  {  pattern = "[filename],[distance],mix.summary"; }
+        if (type == "fit")              {  pattern = "[filename],[distance],[method],mix.fit"; }
+        else if (type == "relabund")    {  pattern = "[filename],[distance],[method],[tag],mix.relabund"; }
+        else if (type == "design")      {  pattern = "[filename],[distance],[method],mix.design"; }
+        else if (type == "matrix")      {  pattern = "[filename],[distance],[method],[tag],mix.posterior"; }
+        else if (type == "parameters")  {  pattern = "[filename],[distance],[method],mix.parameters"; }
+        else if (type == "summary")  {  pattern = "[filename],[distance],[method],mix.summary"; }
         else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true;  }
         
         return pattern;
@@ -366,6 +366,7 @@ int GetMetaCommunityCommand::createProcesses(vector<SharedRAbundVector*>& thislo
         map<string, string> variables;
         variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(sharedfile));
         variables["[distance]"] = thislookup[0]->getLabel();
+        variables["[method]"] = method;
                string outputFileName = getOutputFileName("fit", variables);
         outputNames.push_back(outputFileName); outputTypes["fit"].push_back(outputFileName);
                 
@@ -407,18 +408,18 @@ int GetMetaCommunityCommand::createProcesses(vector<SharedRAbundVector*>& thislo
                
                //loop through and create all the processes you want
                while (process != processors) {
-                       int pid = fork();
+                       pid_t pid = fork();
                        
                        if (pid > 0) {
                                processIDS.push_back(pid);  //create map from line number to pid so you can append files in correct order later
                                process++;
                        }else if (pid == 0){
                 outputNames.clear();
-                               num = processDriver(thislookup, dividedPartitions[process], (outputFileName + toString(getpid())), rels[process], matrix[process], doneFlags, process);
+                               num = processDriver(thislookup, dividedPartitions[process], (outputFileName + m->mothurGetpid(process)), rels[process], matrix[process], doneFlags, process);
                 
                 //pass numSeqs to parent
                                ofstream out;
-                               string tempFile = toString(getpid()) + ".outputNames.temp";
+                               string tempFile = m->mothurGetpid(process) + ".outputNames.temp";
                                m->openOutputFile(tempFile, out);
                 out << num << endl;
                 out << outputNames.size() << endl;
@@ -755,6 +756,7 @@ int GetMetaCommunityCommand::generateSummaryFile(int numPartitions, map<string,s
         map<string, string> variables;
         variables["[filename]"] = v["[filename]"];
         variables["[distance]"] = v["[distance]"];
+        variables["[method]"] = method;
         variables["[tag]"] = "1";
         string reference = getOutputFileName("relabund", variables);
         m->openInputFile(reference, referenceFile); //((fileRoot + label + ".1mix.relabund").c_str());