X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=collectsharedcommand.cpp;h=dd1ec270334e09f1d316ce060c2ab8c185e0d313;hp=baebeb16298b28c3cd6372fe06a2de547e7bfbdc;hb=d1c97b8c04bb75faca1e76ffad60b37a4d789d3d;hpb=f687723a8357916e86a05116978e6869b039ce36 diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index baebeb1..dd1ec27 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -54,14 +54,14 @@ //********************************************************************************************************************** vector CollectSharedCommand::setParameters(){ try { - CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pshared); - CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel); - CommandParameter pfreq("freq", "Number", "", "100", "", "", "",false,false); parameters.push_back(pfreq); - CommandParameter pcalc("calc", "Multiple", "sharedchao-sharedsobs-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-whittaker-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-structchi2-hamming-gower-memchi2-memchord-memeuclidean-mempearson", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan", "", "", "",true,false); parameters.push_back(pcalc); - CommandParameter pall("all", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pall); - CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups); - CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); - CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir); + CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none","",false,true,true); parameters.push_back(pshared); + CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel); + CommandParameter pfreq("freq", "Number", "", "100", "", "", "","",false,false); parameters.push_back(pfreq); + CommandParameter pcalc("calc", "Multiple", "sharedchao-sharedsobs-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-whittaker-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-structchi2-hamming-gower-memchi2-memchord-memeuclidean-mempearson", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan", "", "", "","",true,false,true); parameters.push_back(pcalc); + CommandParameter pall("all", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(pall); + CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups); + CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); + CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir); vector myArray; for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } @@ -98,63 +98,59 @@ string CollectSharedCommand::getHelpString(){ } } //********************************************************************************************************************** -string CollectSharedCommand::getOutputFileNameTag(string type, string inputName=""){ - try { - string outputFileName = ""; - map >::iterator it; +string CollectSharedCommand::getOutputPattern(string type) { + try { + string pattern = ""; - //is this a type this command creates - it = outputTypes.find(type); - if (it == outputTypes.end()) { m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); } - else { - if (type == "sharedchao") { outputFileName = "shared.chao"; } - else if (type == "sharedsobs") { outputFileName = "shared.sobs"; } - else if (type == "sharedace") { outputFileName = "shared.ace"; } - else if (type == "jabund") { outputFileName = "jabund"; } - else if (type == "sorabund") { outputFileName = "sorabund"; } - else if (type == "jclass") { outputFileName = "jclass"; } - else if (type == "sorclass") { outputFileName = "sorclass"; } - else if (type == "jest") { outputFileName = "jest"; } - else if (type == "sorest") { outputFileName = "sorest"; } - else if (type == "thetayc") { outputFileName = "thetayc"; } - else if (type == "thetan") { outputFileName = "thetan"; } - else if (type == "kstest") { outputFileName = "kstest"; } - else if (type == "whittaker") { outputFileName = "whittaker"; } - else if (type == "sharednseqs") { outputFileName = "shared.nseqs"; } - else if (type == "ochiai") { outputFileName = "ochiai"; } - else if (type == "anderberg") { outputFileName = "anderberg"; } - else if (type == "kulczynski") { outputFileName = "kulczynski"; } - else if (type == "kulczynskicody") { outputFileName = "kulczynskicody"; } - else if (type == "lennon") { outputFileName = "lennon"; } - else if (type == "morisitahorn") { outputFileName = "morisitahorn"; } - else if (type == "braycurtis") { outputFileName = "braycurtis"; } - else if (type == "odum") { outputFileName = "odum"; } - else if (type == "canberra") { outputFileName = "canberra"; } - else if (type == "structeuclidean") { outputFileName = "structeuclidean"; } - else if (type == "structchord") { outputFileName = "structchord"; } - else if (type == "hellinger") { outputFileName = "hellinger"; } - else if (type == "manhattan") { outputFileName = "manhattan"; } - else if (type == "structpearson") { outputFileName = "structpearson"; } - else if (type == "soergel") { outputFileName = "soergel"; } - else if (type == "spearman") { outputFileName = "spearman"; } - else if (type == "structkulczynski") { outputFileName = "structkulczynski";} - else if (type == "structchi2") { outputFileName = "structchi2"; } - else if (type == "speciesprofile") { outputFileName = "speciesprofile"; } - else if (type == "hamming") { outputFileName = "hamming"; } - else if (type == "gower") { outputFileName = "gower"; } - else if (type == "memchi2") { outputFileName = "memchi2"; } - else if (type == "memchord") { outputFileName = "memchord"; } - else if (type == "memeuclidean") { outputFileName = "memeuclidean"; } - else if (type == "mempearson") { outputFileName = "mempearson"; } - else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true; } - } - return outputFileName; - } - catch(exception& e) { - m->errorOut(e, "CollectSharedCommand", "getOutputFileNameTag"); - exit(1); - } + if (type == "sharedchao") { pattern = "[filename],shared.chao"; } + else if (type == "sharedsobs") { pattern = "[filename],shared.sobs"; } + else if (type == "sharedace") { pattern = "[filename],shared.ace"; } + else if (type == "jabund") { pattern = "[filename],jabund"; } + else if (type == "sorabund") { pattern = "[filename],sorabund"; } + else if (type == "jclass") { pattern = "[filename],jclass"; } + else if (type == "sorclass") { pattern = "[filename],sorclass"; } + else if (type == "jest") { pattern = "[filename],jest"; } + else if (type == "sorest") { pattern = "[filename],sorest"; } + else if (type == "thetayc") { pattern = "[filename],thetayc"; } + else if (type == "thetan") { pattern = "[filename],thetan"; } + else if (type == "kstest") { pattern = "[filename],kstest"; } + else if (type == "whittaker") { pattern = "[filename],whittaker"; } + else if (type == "sharednseqs") { pattern = "[filename],shared.nseqs"; } + else if (type == "ochiai") { pattern = "[filename],ochiai"; } + else if (type == "anderberg") { pattern = "[filename],anderberg"; } + else if (type == "kulczynski") { pattern = "[filename],kulczynski"; } + else if (type == "kulczynskicody") { pattern = "[filename],kulczynskicody"; } + else if (type == "lennon") { pattern = "[filename],lennon"; } + else if (type == "morisitahorn") { pattern = "[filename],morisitahorn"; } + else if (type == "braycurtis") { pattern = "[filename],braycurtis"; } + else if (type == "odum") { pattern = "[filename],odum"; } + else if (type == "canberra") { pattern = "[filename],canberra"; } + else if (type == "structeuclidean") { pattern = "[filename],structeuclidean"; } + else if (type == "structchord") { pattern = "[filename],structchord"; } + else if (type == "hellinger") { pattern = "[filename],hellinger"; } + else if (type == "manhattan") { pattern = "[filename],manhattan"; } + else if (type == "structpearson") { pattern = "[filename],structpearson"; } + else if (type == "soergel") { pattern = "[filename],soergel"; } + else if (type == "spearman") { pattern = "[filename],spearman"; } + else if (type == "structkulczynski") { pattern = "[filename],structkulczynski";} + else if (type == "structchi2") { pattern = "[filename],structchi2"; } + else if (type == "speciesprofile") { pattern = "[filename],speciesprofile"; } + else if (type == "hamming") { pattern = "[filename],hamming"; } + else if (type == "gower") { pattern = "[filename],gower"; } + else if (type == "memchi2") { pattern = "[filename],memchi2"; } + else if (type == "memchord") { pattern = "[filename],memchord"; } + else if (type == "memeuclidean") { pattern = "[filename],memeuclidean"; } + else if (type == "mempearson") { pattern = "[filename],mempearson"; } + else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; } + + return pattern; + } + catch(exception& e) { + m->errorOut(e, "CollectSharedCommand", "getOutputPattern"); + exit(1); + } } + //********************************************************************************************************************** CollectSharedCommand::CollectSharedCommand(){ try { @@ -340,128 +336,130 @@ CollectSharedCommand::CollectSharedCommand(string option) { if (abort == false) { string fileNameRoot = outputDir + m->getRootName(m->getSimpleName(sharedfile)); - + map variables; + variables["[filename]"] = fileNameRoot; + ValidCalculators validCalculator; for (int i=0; i