X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=matrixoutputcommand.cpp;h=5665426e537deca591a971a560f58283020eb9d3;hb=aca78ed4a47dff8672ea8fd93cef0dfbaf0f7495;hp=8a7656cee9cda0086fd2aaedd1afd5fb27896952;hpb=ffa535cf04326227080b02594616971a2c3a5195;p=mothur.git diff --git a/matrixoutputcommand.cpp b/matrixoutputcommand.cpp index 8a7656c..5665426 100644 --- a/matrixoutputcommand.cpp +++ b/matrixoutputcommand.cpp @@ -17,7 +17,7 @@ vector MatrixOutputCommand::setParameters(){ CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel); CommandParameter psubsample("subsample", "String", "", "", "", "", "","",false,false); parameters.push_back(psubsample); CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups); - CommandParameter pcalc("calc", "Multiple", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-whittaker-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-hamming-structchi2-gower-memchi2-memchord-memeuclidean-mempearson-jsd", "jclass-thetayc", "", "", "","",true,false,true); parameters.push_back(pcalc); + CommandParameter pcalc("calc", "Multiple", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-whittaker-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-hamming-structchi2-gower-memchi2-memchord-memeuclidean-mempearson-jsd-rjsd", "jclass-thetayc", "", "", "","",true,false,true); parameters.push_back(pcalc); CommandParameter poutput("output", "Multiple", "lt-square-column", "lt", "", "", "","",false,false); parameters.push_back(poutput); CommandParameter pmode("mode", "Multiple", "average-median", "average", "", "", "","",false,false); parameters.push_back(pmode); CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pprocessors); @@ -283,7 +283,8 @@ MatrixOutputCommand::MatrixOutputCommand(string option) { matrixCalculators.push_back(new MemPearson()); }else if (Estimators[i] == "jsd") { matrixCalculators.push_back(new JSD()); - + }else if (Estimators[i] == "rjsd") { + matrixCalculators.push_back(new RJSD()); } } } @@ -431,7 +432,7 @@ int MatrixOutputCommand::execute(){ string current = ""; itTypes = outputTypes.find("phylip"); if (itTypes != outputTypes.end()) { - if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setPhylipFile(current); } + if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; if (!subsample) { m->setPhylipFile(current); } } } m->mothurOutEndLine(); @@ -530,7 +531,7 @@ int MatrixOutputCommand::process(vector thisLookup){ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) //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); @@ -539,7 +540,7 @@ int MatrixOutputCommand::process(vector thisLookup){ driver(thisItersLookup, lines[process].start, lines[process].end, calcDists); - string tempdistFileName = m->getRootName(m->getSimpleName(sharedfile)) + toString(getpid()) + ".dist"; + string tempdistFileName = m->getRootName(m->getSimpleName(sharedfile)) + m->mothurGetpid(process) + ".dist"; ofstream outtemp; m->openOutputFile(tempdistFileName, outtemp); @@ -738,6 +739,8 @@ int MatrixOutputCommand::process(vector thisLookup){ variables["[calc]"] = matrixCalculators[i]->getName(); string distFileName = getOutputFileName("phylip",variables); outputNames.push_back(distFileName); outputTypes["phylip"].push_back(distFileName); + //set current phylip file to average distance matrix + m->setPhylipFile(distFileName); ofstream outAve; m->openOutputFile(distFileName, outAve); outAve.setf(ios::fixed, ios::floatfield); outAve.setf(ios::showpoint);