A7B0450E106CEEC90046FC83 /* slayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B0450D106CEEC90046FC83 /* slayer.cpp */; };
A7E4A783106913F900688F62 /* getsharedotucommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E4A782106913F900688F62 /* getsharedotucommand.cpp */; };
A7E4A824106A9AD700688F62 /* maligner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E4A823106A9AD700688F62 /* maligner.cpp */; };
+ A7F5759710CEBC0600E20E47 /* libreadline.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A7F5759610CEBC0600E20E47 /* libreadline.a */; };
EB1216880F619B83004A865F /* bergerparker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB1216870F619B83004A865F /* bergerparker.cpp */; };
EB1216E50F61ACFB004A865F /* bstick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB1216E40F61ACFB004A865F /* bstick.cpp */; };
EB1217230F61C9AC004A865F /* sharedkstest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EB1217220F61C9AC004A865F /* sharedkstest.cpp */; };
A7E4A782106913F900688F62 /* getsharedotucommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getsharedotucommand.cpp; sourceTree = SOURCE_ROOT; };
A7E4A822106A9AD700688F62 /* maligner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = maligner.h; sourceTree = SOURCE_ROOT; };
A7E4A823106A9AD700688F62 /* maligner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = maligner.cpp; sourceTree = SOURCE_ROOT; };
+ A7F5759610CEBC0600E20E47 /* libreadline.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libreadline.a; path = "../readline-6.0/libreadline.a"; sourceTree = SOURCE_ROOT; };
C6859E8B029090EE04C91782 /* Mothur.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Mothur.1; sourceTree = "<group>"; };
EB1216860F619B83004A865F /* bergerparker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bergerparker.h; sourceTree = SOURCE_ROOT; };
EB1216870F619B83004A865F /* bergerparker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bergerparker.cpp; sourceTree = SOURCE_ROOT; };
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ A7F5759710CEBC0600E20E47 /* libreadline.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
37D928490F21331F001D4494 /* summarydisplay.h */,
37519AB30F810FAE00FED5E8 /* venn.h */,
37519AB40F810FAE00FED5E8 /* venn.cpp */,
+ A7F5759610CEBC0600E20E47 /* libreadline.a */,
);
name = Source;
sourceTree = "<group>";
"_GLIBCXX_DEBUG_PEDANTIC=1",
);
INSTALL_PATH = /usr/local/bin;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../readline-6.0\"",
+ );
PRODUCT_NAME = mothur;
ZERO_LINK = YES;
};
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
INSTALL_PATH = /usr/local/bin;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../readline-6.0\"",
+ );
PRODUCT_NAME = mothur;
};
name = Release;
"-ansi",
"-pedantic",
"-wall",
+ "-lreadline",
);
PREBINDING = NO;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
break;
}
}
-
//calculate at 0 and the given increment
if((i == 0) || (i+1) % increment == 0){
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = labels;
-
+
//set users groups
util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups, "collect");
util->updateGroupIndex(globaldata->Groups, globaldata->gGroupmap->groupIndex);
#include "engine.hpp"
+
/***********************************************************************/
InteractEngine::InteractEngine(string path){
string options = "";
int quitCommandCalled = 0;
-
while(quitCommandCalled != 1){
mothurOutEndLine();
- mothurOut("mothur > ");
-
- //get input char by char so you can check for use of arrow keys
- //if (_kbhit()){
- // _getch(); // edit : if you want to check the arrow-keys you must call getch twice because special-keys have two values
- // return _getch();
- //}
- //return 0; // if no key is pressed
- //setbuf(stdin, NULL); //no buffering
-/*if(ch==0)
-{
-ch=getch();
-if(ch==72) cout<<"up";
-else if(ch==75) cout<<"left";
-else if(ch==77) cout<<"right";
-else if(ch==80) cout<<"down";
-cout<<endl;
-}
-else break;
-}
-delay(2000);
-return 0;
-}*/
-
- //int letter = 0;
- //while ((letter != 10) && (letter != 13)) {
- // letter = getch();
-
- // cout << "char code = " << letter << endl;
-
- // input += char(letter);
- //}
- // input = input.substr(0, input.length()-1); //cut off newline char
-
- //cout << input << endl;
-
- getline(cin, input);
- if (cin.eof()) { input = "quit()"; }
- //save command
- //previousInputs.push_back(input);
+ input = getCommand();
- mothurOutJustToLog(input);
+ mothurOutJustToLog("mothur > " + input);
mothurOutEndLine();
//allow user to omit the () on the quit command
CommandOptionParser parser(input);
commandName = parser.getCommandString();
- //cout << " command = " << commandName << endl;
+
options = parser.getOptionString();
if (commandName != "") {
}
}
/***********************************************************************/
+string Engine::getCommand() {
+ try {
+ char* nextCommand = NULL;
+
+ nextCommand = readline("mothur > ");
+ if(nextCommand != NULL) { add_history(nextCommand); }
+
+ return nextCommand;
+ }
+ catch(exception& e) {
+ errorOut(e, "Engine", "getCommand");
+ exit(1);
+ }
+}
+/***********************************************************************/
void Engine::terminateCommand(int dummy) {
try {
mothurOut("Stopping command."); mothurOutEndLine();
cFactory->getCommand(); //terminates command
}
catch(exception& e) {
- errorOut(e, "InteractEngine", "terminateCommand");
+ errorOut(e, "Engine", "terminateCommand");
exit(1);
}
}
Engine() { cFactory = new CommandFactory(); }
virtual ~Engine(){ delete cFactory; }
virtual bool getInput() = 0;
-// string getCommand() { return command; }
+ virtual string getCommand();
vector<string> getOptions() { return options; }
virtual void terminateCommand(int);
protected:
-// string command;
vector<string> options;
CommandFactory* cFactory;
};
virtual bool getInput();
private:
GlobalData* globaldata;
- vector<string> previousInputs; //this is used to make the arrow keys work
-
};
#include "getseqscommand.h"
#include "sequence.hpp"
+#include "listvector.hpp"
//**********************************************************************************************************************
else {
//valid paramters for this command
- string Array[] = {"fasta","name", "group", "alignreport", "accnos" };
+ string Array[] = {"fasta","name", "group", "alignreport", "accnos", "list"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
if (alignfile == "not open") { abort = true; }
else if (alignfile == "not found") { alignfile = ""; }
- if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "")) { mothurOut("You must provide one of the following: fasta, name, group, alignreport."); mothurOutEndLine(); abort = true; }
+ listfile = validParameter.validFile(parameters, "list", true);
+ if (listfile == "not open") { abort = true; }
+ else if (listfile == "not found") { listfile = ""; }
- if (parameters.size() > 2) { mothurOut("You may only enter one of the following: fasta, name, group, alignreport."); mothurOutEndLine(); abort = true; }
+ if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == "")) { mothurOut("You must provide one of the following: fasta, name, group, alignreport or listfile."); mothurOutEndLine(); abort = true; }
+
+ if (parameters.size() > 2) { mothurOut("You may only enter one of the following: fasta, name, group, alignreport or listfile."); mothurOutEndLine(); abort = true; }
}
}
void GetSeqsCommand::help(){
try {
- mothurOut("The get.seqs command reads an .accnos file and one of the following file types: fasta, name, group or alignreport file.\n");
+ mothurOut("The get.seqs command reads an .accnos file and one of the following file types: fasta, name, group, list or alignreport file.\n");
mothurOut("It outputs a file containing only the sequences in the .accnos file.\n");
- mothurOut("The get.seqs command parameters are accnos, fasta, name, group and alignreport. You must provide accnos and one of the other parameters.\n");
+ mothurOut("The get.seqs command parameters are accnos, fasta, name, group, list and alignreport. You must provide accnos and one of the other parameters.\n");
mothurOut("The get.seqs command should be in the following format: get.seqs(accnos=yourAccnos, fasta=yourFasta).\n");
mothurOut("Example get.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n");
mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
else if (namefile != "") { readName(); }
else if (groupfile != "") { readGroup(); }
else if (alignfile != "") { readAlign(); }
+ else if (listfile != "") { readList(); }
return 0;
}
exit(1);
}
}
+//**********************************************************************************************************************
+void GetSeqsCommand::readList(){
+ try {
+ string outputFileName = getRootName(listfile) + "pick" + getExtension(listfile);
+ ofstream out;
+ openOutputFile(outputFileName, out);
+
+ ifstream in;
+ openInputFile(listfile, in);
+
+ bool wroteSomething = false;
+
+ while(!in.eof()){
+ //read in list vector
+ ListVector list(in);
+
+ //make a new list vector
+ ListVector newList;
+ newList.setLabel(list.getLabel());
+
+ //for each bin
+ for (int i = 0; i < list.getNumBins(); i++) {
+
+ //parse out names that are in accnos file
+ string binnames = list.get(i);
+
+ string newNames = "";
+ while (binnames.find_first_of(',') != -1) {
+ string name = binnames.substr(0,binnames.find_first_of(','));
+ binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
+
+ //if that name is in the .accnos file, add it
+ if (names.count(name) == 1) { newNames += name + ","; }
+ }
+
+ //get last name
+ if (names.count(binnames) == 1) { newNames += binnames; }
+
+ //if there are names in this bin add to new list
+ if (newNames != "") { newList.push_back(newNames); }
+ }
+
+ //print new listvector
+ if (newList.getNumBins() != 0) {
+ wroteSomething = true;
+ newList.print(out);
+ }
+
+ gobble(in);
+ }
+ in.close();
+ out.close();
+
+ if (wroteSomething == false) {
+ mothurOut("Your file does not contain any sequence from the .accnos file."); mothurOutEndLine();
+ remove(outputFileName.c_str());
+ }
+ }
+ catch(exception& e) {
+ errorOut(e, "GetSeqsCommand", "readList");
+ exit(1);
+ }
+}
//**********************************************************************************************************************
void GetSeqsCommand::readName(){
try {
private:
set<string> names;
- string accnosfile, fastafile, namefile, groupfile, alignfile;
+ string accnosfile, fastafile, namefile, groupfile, alignfile, listfile;
bool abort;
void readFasta();
void readGroup();
void readAlign();
void readAccnos();
+ void readList();
};
//fill lookup
for (int j = 0; j < looktemp.size(); j++) {
//if they are not shared then push to back, if they are not insert in front
- if (count < 2) { lookup[j]->push_back(looktemp[j]->getAbundance(i), i, looktemp[j]->getGroup()); }
+ if (count < 2) { lookup[j]->push_back(looktemp[j]->getAbundance(i), looktemp[j]->getGroup()); }
//they are shared by some
else { lookup[j]->insert(looktemp[j]->getAbundance(i), place[count], looktemp[j]->getGroup()); updatePlace = true; }
}
//header
- mothurOut("mothur v.1.7.0");
+ mothurOut("mothur v.1.7.2");
mothurOutEndLine();
- mothurOut("Last updated: 11/23/2009");
+ mothurOut("Last updated: 12/04/2009");
mothurOutEndLine();
mothurOutEndLine();
mothurOut("by");
#include <cerrno>
#include <ctime>
#include <limits>
+#include <readline/readline.h>
+#include <readline/history.h>
+/***********************************************************************/
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
#include <sys/wait.h>
#include <unistd.h>
+#else
+ #include <conio.h> //allows unbuffered screen capture from stdin
#endif
using namespace std;
return numSeqs;
}
+/***********************************************************************/
+
+inline bool inVector(string member, vector<string> group){
+
+ for (int i = 0; i < group.size(); i++) {
+ if (group[i] == member) { return true; }
+ }
+
+ return false;
+}
/***********************************************************************/
//memory leak prevention
//if (globaldata->gSharedList != NULL) { delete globaldata->gSharedList; }
globaldata->gSharedList = SharedList;
+ delete inputSabund;
+ delete inputRabund;
+ delete inputList;
}
}
catch(exception& e) {
#include "removeseqscommand.h"
#include "sequence.hpp"
+#include "listvector.hpp"
//**********************************************************************************************************************
else {
//valid paramters for this command
- string Array[] = {"fasta","name", "group", "alignreport", "accnos" };
+ string Array[] = {"fasta","name", "group", "alignreport", "accnos", "list" };
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(option);
if (alignfile == "not open") { abort = true; }
else if (alignfile == "not found") { alignfile = ""; }
- if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "")) { mothurOut("You must provide one of the following: fasta, name, group, alignreport."); mothurOutEndLine(); abort = true; }
+ listfile = validParameter.validFile(parameters, "list", true);
+ if (listfile == "not open") { abort = true; }
+ else if (listfile == "not found") { listfile = ""; }
- if (parameters.size() > 2) { mothurOut("You may only enter one of the following: fasta, name, group, alignreport."); mothurOutEndLine(); abort = true; }
+ if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == "")) { mothurOut("You must provide one of the following: fasta, name, group, alignreport or list."); mothurOutEndLine(); abort = true; }
+
+ if (parameters.size() > 2) { mothurOut("You may only enter one of the following: fasta, name, group, alignreport, or list."); mothurOutEndLine(); abort = true; }
}
}
void RemoveSeqsCommand::help(){
try {
- mothurOut("The remove.seqs command reads an .accnos file and one of the following file types: fasta, name, group or alignreport file.\n");
+ mothurOut("The remove.seqs command reads an .accnos file and one of the following file types: fasta, name, group, list or alignreport file.\n");
mothurOut("It outputs a file containing the sequences NOT in the .accnos file.\n");
- mothurOut("The remove.seqs command parameters are accnos, fasta, name, group and alignreport. You must provide accnos and one of the other parameters.\n");
+ mothurOut("The remove.seqs command parameters are accnos, fasta, name, group, list and alignreport. You must provide accnos and one of the other parameters.\n");
mothurOut("The remove.seqs command should be in the following format: remove.seqs(accnos=yourAccnos, fasta=yourFasta).\n");
mothurOut("Example remove.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n");
mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
else if (namefile != "") { readName(); }
else if (groupfile != "") { readGroup(); }
else if (alignfile != "") { readAlign(); }
+ else if (listfile != "") { readList(); }
return 0;
}
exit(1);
}
}
+//**********************************************************************************************************************
+void RemoveSeqsCommand::readList(){
+ try {
+ string outputFileName = getRootName(listfile) + "pick" + getExtension(listfile);
+ ofstream out;
+ openOutputFile(outputFileName, out);
+
+ ifstream in;
+ openInputFile(listfile, in);
+
+ bool wroteSomething = false;
+
+ while(!in.eof()){
+ //read in list vector
+ ListVector list(in);
+
+ //make a new list vector
+ ListVector newList;
+ newList.setLabel(list.getLabel());
+
+ //for each bin
+ for (int i = 0; i < list.getNumBins(); i++) {
+
+ //parse out names that are in accnos file
+ string binnames = list.get(i);
+
+ string newNames = "";
+ while (binnames.find_first_of(',') != -1) {
+ string name = binnames.substr(0,binnames.find_first_of(','));
+ binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
+
+ //if that name is in the .accnos file, add it
+ if (names.count(name) == 0) { newNames += name + ","; }
+ }
+
+ //get last name
+ if (names.count(binnames) == 0) { newNames += binnames; }
+
+ //if there are names in this bin add to new list
+ if (newNames != "") { newList.push_back(newNames); }
+ }
+
+ //print new listvector
+ if (newList.getNumBins() != 0) {
+ wroteSomething = true;
+ newList.print(out);
+ }
+
+ gobble(in);
+ }
+ in.close();
+ out.close();
+
+ if (wroteSomething == false) {
+ mothurOut("Your file contains only sequences from the .accnos file."); mothurOutEndLine();
+ remove(outputFileName.c_str());
+ }
+ }
+ catch(exception& e) {
+ errorOut(e, "RemoveSeqsCommand", "readList");
+ exit(1);
+ }
+}
//**********************************************************************************************************************
void RemoveSeqsCommand::readName(){
try {
private:
set<string> names;
- string accnosfile, fastafile, namefile, groupfile, alignfile;
+ string accnosfile, fastafile, namefile, groupfile, alignfile, listfile;
bool abort;
void readFasta();
void readGroup();
void readAlign();
void readAccnos();
+ void readList();
};
filename = getRootName(filename);
filename = filename + "shared";
openOutputFile(filename, out);
+ pickedGroups = false;
groupMap = globaldata->gGroupmap;
groups = groupMap->namesOfGroups;
}else{ //they have specified groups
groups = globaldata->Groups;
+ pickedGroups = true;
}
//fill filehandles with neccessary ofstreams
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
-
+
while((SharedList != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
-
+
if(globaldata->allLines == 1 || globaldata->labels.count(SharedList->getLabel()) == 1){
lookup = SharedList->getSharedRAbundVector();
+ if (pickedGroups) { //check for otus with no seqs in them
+ eliminateZeroOTUS(lookup);
+ }
mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
printSharedData(lookup); //prints info to the .shared file
SharedList = input->getSharedListVector(lastLabel); //get new list vector to process
lookup = SharedList->getSharedRAbundVector();
+ if (pickedGroups) { //check for otus with no seqs in them
+ eliminateZeroOTUS(lookup);
+ }
mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
printSharedData(lookup); //prints info to the .shared file
SharedList = input->getSharedListVector(lastLabel); //get new list vector to process
lookup = SharedList->getSharedRAbundVector();
+ if (pickedGroups) { //check for otus with no seqs in them
+ eliminateZeroOTUS(lookup);
+ }
mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
printSharedData(lookup); //prints info to the .shared file
}
}
//**********************************************************************************************************************
+void SharedCommand::eliminateZeroOTUS(vector<SharedRAbundVector*>& thislookup) {
+ try {
+
+ vector<SharedRAbundVector*> newLookup;
+ for (int i = 0; i < thislookup.size(); i++) {
+ SharedRAbundVector* temp = new SharedRAbundVector();
+ temp->setLabel(thislookup[i]->getLabel());
+ temp->setGroup(thislookup[i]->getGroup());
+ newLookup.push_back(temp);
+ }
+
+ //for each bin
+ for (int i = 0; i < thislookup[0]->getNumBins(); i++) {
+
+ //look at each sharedRabund and make sure they are not all zero
+ bool allZero = true;
+ for (int j = 0; j < thislookup.size(); j++) {
+ if (thislookup[j]->getAbundance(i) != 0) { allZero = false; break; }
+ }
+
+ //if they are not all zero add this bin
+ if (!allZero) {
+ for (int j = 0; j < thislookup.size(); j++) {
+ newLookup[j]->push_back(thislookup[j]->getAbundance(i), thislookup[j]->getGroup());
+ }
+ }
+ //else{ cout << "bin # " << i << " is all zeros" << endl; }
+ }
+
+ for (int j = 0; j < thislookup.size(); j++) { delete thislookup[j]; }
+ thislookup = newLookup;
+
+
+ }
+ catch(exception& e) {
+ errorOut(e, "SharedCommand", "eliminateZeroOTUS");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
void SharedCommand::createMisMatchFile() {
try {
ofstream outMisMatch;
void printSharedData(vector<SharedRAbundVector*>);
void createMisMatchFile();
bool isValidGroup(string, vector<string>);
+ void eliminateZeroOTUS(vector<SharedRAbundVector*>&);
GlobalData* globaldata;
ReadOTUFile* read;
vector<string> groups;
ofstream out;
string filename, fileroot;
- bool firsttime;
+ bool firsttime, pickedGroups;
map<string, ofstream*> filehandles;
map<string, ofstream*>::iterator it3;
try {
SharedUtil* util;
util = new SharedUtil();
- vector<SharedRAbundVector*> lookup;
- vector<SharedRAbundVector*> lookup2;
- map<string, SharedRAbundVector*> finder;
- map<string, SharedRAbundVector*>::iterator it;
+ vector<SharedRAbundVector*> lookup; //contains just the groups the user selected
+ map<string, SharedRAbundVector*> finder; //contains all groups in groupmap
string group, names, name;
util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups);
finder[globaldata->gGroupmap->namesOfGroups[i]] = temp;
finder[globaldata->gGroupmap->namesOfGroups[i]]->setLabel(label);
finder[globaldata->gGroupmap->namesOfGroups[i]]->setGroup(globaldata->gGroupmap->namesOfGroups[i]);
- //*temp = getSharedRAbundVector(globaldata->Groups[i]);
- lookup.push_back(finder[globaldata->gGroupmap->namesOfGroups[i]]);
+ if (inVector(globaldata->gGroupmap->namesOfGroups[i], globaldata->Groups)) { //if this group is in user groups
+ lookup.push_back(finder[globaldata->gGroupmap->namesOfGroups[i]]);
+ }
}
-//cout << "after blanks" << endl;
+
//fill vectors
for(int i=0;i<numBins;i++){
names = get(i);
name = names.substr(0,names.find_first_of(','));
names = names.substr(names.find_first_of(',')+1, names.length());
group = groupmap->getGroup(name);
-//cout << i << '\t' << name << '\t' << group << endl;
if(group == "not found") { mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
}
//get last name
group = groupmap->getGroup(names);
-//cout << i << '\t' << names << '\t' << group << endl;
if(group == "not found") { mothurOut("Error: Sequence '" + names + "' was not found in the group file, please correct."); mothurOutEndLine(); exit(1); }
finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in
}
- if (globaldata->Groups.size() == globaldata->gGroupmap->namesOfGroups.size()) { //no groups specified
- lookup2 = lookup;
- }else{ //delete unwanted groups
- for (int i = 0; i < globaldata->Groups.size(); i++) {
- SharedRAbundVector* temp = new SharedRAbundVector(*finder[globaldata->Groups[i]]);
- lookup2.push_back(temp);
- delete finder[globaldata->Groups[i]]; //so we don't get dup memory
- }
- }
-
- return lookup2;
+ return lookup;
}
catch(exception& e) {
errorOut(e, "SharedListVector", "getSharedRAbundVector");
for(int i=0;i<num;i++){
f >> inputData;
- lookup[0]->push_back(inputData, i, groupN); //abundance, bin, group
- push_back(inputData, i, groupN);
+ lookup[0]->push_back(inputData, groupN); //abundance, bin, group
+ push_back(inputData, groupN);
numSeqs += inputData;
numBins++;
if (inputData > maxRank) { maxRank = inputData; }
//fill vector.
for(int i=0;i<num;i++){
f >> inputData;
- lookup[count]->push_back(inputData, i, groupN); //abundance, bin, group
+ lookup[count]->push_back(inputData, groupN); //abundance, bin, group
}
gobble(f);
}
/***********************************************************************/
-void SharedRAbundVector::push_back(int binSize, int otu, string groupName){
+void SharedRAbundVector::push_back(int binSize, string groupName){
try {
individual newGuy;
newGuy.abundance = binSize;
newGuy.group = groupName;
- newGuy.bin = otu;
+ newGuy.bin = data.size();
data.push_back(newGuy);
numBins++;
void sortD(); //Sorts the data in descending order.
void push_front(int, int, string); //abundance, otu, groupname
void insert(int, int, string); //abundance, otu, groupname
- void push_back(int, int, string); //abundance, otu, groupname
+ void push_back(int, string); //abundance, groupname
void pop_back();
void resize(int);
int size();
try {
SharedRAbundVector rav;
- int binNumber = 0;
for(int i=1;i<=data.size();i++){
for(int j=0;j<data[i].abundance;j++){
- rav.push_back(i, binNumber, data[i].group);
- binNumber++;
+ rav.push_back(i, data[i].group);
}
}
sort(rav.rbegin(), rav.rend(), compareMembers);
//merge BC and estimate with shared with A
SharedRAbundVector* merge = new SharedRAbundVector();
for (int j = 0; j < lookup[1]->size(); j++) {
- merge->push_back((lookup[1]->getAbundance(j) + lookup[2]->getAbundance(j)), j, "");
+ merge->push_back((lookup[1]->getAbundance(j) + lookup[2]->getAbundance(j)), "");
}
subset.clear();
//merge AC and estimate with shared with B
merge = new SharedRAbundVector();
for (int j = 0; j < lookup[0]->size(); j++) {
- merge->push_back((lookup[0]->getAbundance(j) + lookup[2]->getAbundance(j)), j, "");
+ merge->push_back((lookup[0]->getAbundance(j) + lookup[2]->getAbundance(j)), "");
}
subset.clear();
//merge AB and estimate with shared with C
merge = new SharedRAbundVector();
for (int j = 0; j < lookup[0]->size(); j++) {
- merge->push_back((lookup[0]->getAbundance(j) + lookup[1]->getAbundance(j)), j, "");
+ merge->push_back((lookup[0]->getAbundance(j) + lookup[1]->getAbundance(j)), "");
}
subset.clear();