From: westcott Date: Tue, 21 Sep 2010 14:55:28 +0000 (+0000) Subject: added mothur executable to cvs X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1d7a10dc3dafd1606d6255bdb54e02429cbee47c;p=mothur.git added mothur executable to cvs --- diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 1ac6e0b..cd981c3 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -50,6 +50,7 @@ A747E81C116365E000FB9042 /* chimeraslayercommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chimeraslayercommand.h; sourceTree = ""; }; A747E81D116365E000FB9042 /* chimeraslayercommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chimeraslayercommand.cpp; sourceTree = ""; }; A7639F8D1175DF35008F5578 /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = ""; }; + A768D95D1248FEAA008AB1D0 /* mothur */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = mothur; sourceTree = ""; }; A76AAD02117F322B003D8DA1 /* phylosummary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = phylosummary.h; sourceTree = ""; }; A76AAD03117F322B003D8DA1 /* phylosummary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = phylosummary.cpp; sourceTree = ""; }; A76C4A1011876BAF0009460B /* setlogfilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = setlogfilecommand.h; sourceTree = SOURCE_ROOT; }; @@ -500,6 +501,7 @@ 08FB7794FE84155DC02AAC07 /* mothur */ = { isa = PBXGroup; children = ( + A768D95D1248FEAA008AB1D0 /* mothur */, A7639F8D1175DF35008F5578 /* makefile */, A7DA1FF0113FECD400BF472F /* alignment.cpp */, A7DA1FF1113FECD400BF472F /* alignment.hpp */, diff --git a/filterseqscommand.cpp b/filterseqscommand.cpp index e676f1f..798ae64 100644 --- a/filterseqscommand.cpp +++ b/filterseqscommand.cpp @@ -867,7 +867,7 @@ int FilterSeqsCommand::MPICreateFilter(int start, int num, Filters& F, MPI_File& int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename) { try { #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - int process = 0; + int process = 1; int num = 0; processIDS.clear(); @@ -908,13 +908,16 @@ int FilterSeqsCommand::createProcessesCreateFilter(Filters& F, string filename) }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); } } + //parent do your part + num = driverCreateFilter(F, filename, lines[0]); + //force parent to wait until all the processes are done - for (int i=0;igetNumSeqs(); return data; } - EstOutput getValues(vector) {return data;}; + + EstOutput getValues(vector shared) { //return number of sequences in the sharedotus + + int numGroups = shared.size(); + data.clear(); data.resize(numGroups,0); + + for (int i = 0; i < shared[0]->size(); i++) { + //get bin values and set sharedByAll + bool sharedByAll = true; + for (int j = 0; j < numGroups; j++) { + if (shared[j]->getAbundance(i) == 0) { sharedByAll = false; } + } + + //they are shared + if (sharedByAll == true) { for (int j = 0; j < numGroups; j++) { data[j] += shared[j]->getAbundance(i); } } + } + + return data; + } }; /***********************************************************************/ diff --git a/pintail.cpp b/pintail.cpp index 2362eb5..c0ea904 100644 --- a/pintail.cpp +++ b/pintail.cpp @@ -529,7 +529,7 @@ Sequence* Pintail::findPairs(Sequence* q) { void Pintail::createProcessesQuan() { try { #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - int process = 0; + int process = 1; vector processIDS; //loop through and create all the processes you want @@ -547,7 +547,6 @@ void Pintail::createProcessesQuan() { ofstream out; string s = toString(getpid()) + ".temp"; m->openOutputFile(s, out); - //output observed distances for (int i = 0; i < quantilesMembers.size(); i++) { @@ -564,14 +563,17 @@ void Pintail::createProcessesQuan() { }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); } } + //parent does its part + quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, templateLines[0]->start, templateLines[0]->end); + //force parent to wait until all the processes are done - for (int i=0;iopenInputFile(s, in); @@ -607,7 +609,7 @@ void Pintail::createProcessesQuan() { in.close(); remove(s.c_str()); } - + #else quantilesMembers = decalc->getQuantiles(templateSeqs, windowSizesTemplate, window, probabilityProfile, increment, 0, templateSeqs.size()); #endif diff --git a/validcalculator.cpp b/validcalculator.cpp index bc8c4b8..cf783f3 100644 --- a/validcalculator.cpp +++ b/validcalculator.cpp @@ -386,6 +386,7 @@ void ValidCalculators::initialVennSingle() { vennsingle["chao"] = "chao"; vennsingle["ace"] = "ace"; vennsingle["jack"] = "jack"; + vennsingle["nseqs"] = "nseqs"; vennsingle["default"] = "default"; } catch(exception& e) { @@ -400,6 +401,7 @@ void ValidCalculators::initialVennShared() { vennshared["sharedsobs"] = "sharedsobs"; vennshared["sharedchao"] = "sharedchao"; vennshared["sharedace"] = "sharedace"; + vennshared["nseqs"] = "nseqs"; vennshared["default"] = "default"; } catch(exception& e) { diff --git a/venn.cpp b/venn.cpp index dfa5519..9d117d6 100644 --- a/venn.cpp +++ b/venn.cpp @@ -11,6 +11,7 @@ #include "ace.h" #include "sobs.h" #include "chao1.h" +#include "nseqs.h" #include "sharedchao1.h" #include "sharedsobscollectsummary.h" @@ -101,6 +102,8 @@ vector Venn::getPic(vector lookup, vectorgetName() == "sharedace") { singleCalc = new Ace(10); + }else if (vCalcs[i]->getName() == "nseqs") { + singleCalc = new NSeqs(); } vector data = singleCalc->getValues(sabund); @@ -148,50 +151,63 @@ vector Venn::getPic(vector lookup, vectorcontrol_pressed) { outsvg.close(); return outputNames; } //get estimates for sharedAB - vector shared = vCalcs[i]->getValues(subset); + vector results = vCalcs[i]->getValues(subset); //in essence you want to run it like a single if (vCalcs[i]->getName() == "sharedsobs") { singleCalc = new Sobs(); }else if (vCalcs[i]->getName() == "sharedchao") { singleCalc = new Chao1(); + }else if (vCalcs[i]->getName() == "nseqs") { + singleCalc = new NSeqs(); }//else if (vCalcs[i]->getName() == "sharedace") { //singleCalc = new Ace(10); //} //get estimates for numA - vector numA = singleCalc->getValues(sabundA); + vector resultsA = singleCalc->getValues(sabundA); //get estimates for numB - vector numB = singleCalc->getValues(sabundB); + vector resultsB = singleCalc->getValues(sabundB); + + double numA, numB, shared; + if (vCalcs[i]->getName() == "nseqs") { + shared = results[0] + results[1]; //add both groups sequences + numA = resultsA[0] - results[0]; //what's in A - the number of species in A that are in shared otus + numB = resultsB[0] - results[1]; //what's in B - the number of species in B that are in shared otus + }else{ + shared = results[0]; + numA = resultsA[0] - shared; + numB = resultsB[0] - shared; + } //image window outsvg << "\n"; outsvg << "\n"; - + //draw circles outsvg << ""; outsvg << "Venn Diagram at distance " + lookup[0]->getLabel() + "\n"; outsvg << ""; outsvg << ""; - outsvg << "" + toString(numA[0] - shared[0]) + "\n"; - outsvg << "" + toString(numB[0] - shared[0]) + "\n"; + outsvg << "" + toString(numA) + "\n"; + outsvg << "" + toString(numB) + "\n"; outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.25 * height)) + "\">" + lookup[0]->getGroup() + "\n"; outsvg << "getGroup().length() / 2)) + "\" y=\"" + toString(int(0.25 * height)) + "\">" + lookup[1]->getGroup() + "\n"; - outsvg << "" + toString(shared[0]) + "\n"; - outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(numA[0]); - if (numA.size() == 3) { - outsvg << " the lci is " + toString(numA[1]) + " and the hci is " + toString(numA[2]) + "\n"; + outsvg << "" + toString(shared) + "\n"; + outsvg << "The number of species in group " + lookup[0]->getGroup() + " is " + toString(resultsA[0]); + if (resultsA.size() == 3) { + outsvg << " the lci is " + toString(resultsA[1]) + " and the hci is " + toString(resultsA[2]) + "\n"; }else { outsvg << "\n"; } - outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(numB[0]); - if (numB.size() == 3) { - outsvg << " the lci is " + toString(numB[1]) + " and the hci is " + toString(numB[2]) + "\n"; + outsvg << "The number of species in group " + lookup[1]->getGroup() + " is " + toString(resultsB[0]); + if (resultsB.size() == 3) { + outsvg << " the lci is " + toString(resultsB[1]) + " and the hci is " + toString(resultsB[2]) + "\n"; }else { outsvg << "\n"; } - outsvg << "The number of sepecies shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(shared[0]) + "\n"; - outsvg << "Percentage of species that are shared in groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString((shared[0] / (float)(numA[0] + numB[0] - shared[0]))*100) + "\n"; - outsvg << "The total richness for all groups is " + toString((float)(numA[0] + numB[0] - shared[0])) + "\n"; + outsvg << "The number of species shared between groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString(shared) + "\n"; + outsvg << "Percentage of species that are shared in groups " + lookup[0]->getGroup() + " and " + lookup[1]->getGroup() + " is " + toString((shared / (float)(numA + numB + shared))*100) + "\n"; + outsvg << "The total richness for all groups is " + toString((float)(numA + numB + shared)) + "\n"; //close file outsvg << "\n\n"; @@ -254,7 +270,8 @@ vector Venn::getPic(vector lookup, vector sharedCwithAB; //find possible sharedABC values - float sharedABC1 = 0.0; float sharedABC2 = 0.0; float sharedABC3 = 0.0; float sharedABC = 0.0; + double sharedABC1 = 0.0; double sharedABC2 = 0.0; double sharedABC3 = 0.0; double sharedABC = 0.0; + vector = resultsNseqs; if (vCalcs[i]->getMultiple() == false) { //merge BC and estimate with shared with A @@ -305,12 +322,28 @@ vector Venn::getPic(vector lookup, vector data = vCalcs[i]->getValues(lookup); + resultsNseqs = data; sharedABC = data[0]; sharedAwithBC.push_back(sharedAB[0] + sharedAC[0] - sharedABC); sharedBwithAC.push_back(sharedAB[0] + sharedBC[0] - sharedABC); sharedCwithAB.push_back(sharedAC[0] + sharedBC[0] - sharedABC); } + double numA, numB, numC, numAB, numAC, numBC, numABC; + if (vCalcs[i]->getName() == "nseqs") { + numABC = resultsNseqs[0] + resultsNseqs[1] + resultsNseqs[2]; + numBC = sharedBC[0] + sharedBC[1] - (resultsNseqs[1] + resultsNseqs[2]); + + }else{ + numABC = sharedABC; + numBC = sharedBC[0] - sharedABC; + numAB = sharedAB[0] - sharedABC; + numAC = sharedAC[0] - sharedABC; + numA = numA[0]-sharedAwithBC[0]; + numB = numB[0]-sharedBwithAC[0]; + numC = numC[0]-sharedCwithAB[0]; + } + //image window outsvg << "\n"; outsvg << "\n"; @@ -475,7 +508,7 @@ vector Venn::getPic(vector lookup, vectorgetName() != "sharedsobs") && (vCalcs[i]->getName() != "sharedchao")) { m->mothurOut(vCalcs[i]->getName() + " is not a valid calculator with four groups. It will be disregarded. "); m->mothurOutEndLine(); } + if ((vCalcs[i]->getName() != "sharedsobs") && (vCalcs[i]->getName() != "sharedchao") && (vCalcs[i]->getName() != "nseqs")) { m->mothurOut(vCalcs[i]->getName() + " is not a valid calculator with four groups. It will be disregarded. "); m->mothurOutEndLine(); } else{ string filenamesvg = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + lookup[0]->getLabel() + "." + vCalcs[i]->getName() + "." + lookup[0]->getGroup() + "-" + lookup[1]->getGroup() + "-" + lookup[2]->getGroup() + "-" + lookup[3]->getGroup() + ".svg"; outputNames.push_back(filenamesvg); @@ -488,7 +521,10 @@ vector Venn::getPic(vector lookup, vectorgetName() == "sharedchao") { singleCalc = new Chao1(); + }else if (vCalcs[i]->getName() == "nseqs") { + singleCalc = new NSeqs(); } + //get estimates for numA data = singleCalc->getValues(sabundA); diff --git a/venncommand.cpp b/venncommand.cpp index 608c0a0..8b617d8 100644 --- a/venncommand.cpp +++ b/venncommand.cpp @@ -15,6 +15,7 @@ #include "sharedsobscollectsummary.h" #include "sharedchao1.h" #include "sharedace.h" +#include "nseqs.h" //********************************************************************************************************************** @@ -111,6 +112,8 @@ VennCommand::VennCommand(string option) { if(abund < 5) abund = 10; vennCalculators.push_back(new Ace(abund)); + }else if (Estimators[i] == "nseqs") { + vennCalculators.push_back(new NSeqs()); } } } @@ -123,6 +126,8 @@ VennCommand::VennCommand(string option) { vennCalculators.push_back(new SharedChao1()); }else if (Estimators[i] == "sharedace") { vennCalculators.push_back(new SharedAce()); + }else if (Estimators[i] == "nseqs") { + vennCalculators.push_back(new NSeqs()); } } }