3746109D0F40657600460C57 /* unifracunweightedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3746109C0F40657600460C57 /* unifracunweightedcommand.cpp */; };
374CD63F0F65832000D90B4A /* libshuffcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 374CD63E0F65832000D90B4A /* libshuffcommand.cpp */; };
374CD6F10F65A4C100D90B4A /* coverage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 374CD6F00F65A4C100D90B4A /* coverage.cpp */; };
+ 3765B47A0F77D15900C3EDC5 /* nocommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3765B4780F77D15900C3EDC5 /* nocommands.cpp */; };
3782163D0F616079008E1F6D /* fullmatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3782163C0F616079008E1F6D /* fullmatrix.cpp */; };
379293C30F2DE73400B9034A /* treemap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379293C20F2DE73400B9034A /* treemap.cpp */; };
379294700F2E191800B9034A /* parsimonycommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3792946F0F2E191800B9034A /* parsimonycommand.cpp */; };
374CD63E0F65832000D90B4A /* libshuffcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libshuffcommand.cpp; sourceTree = "<group>"; };
374CD6EF0F65A4C100D90B4A /* coverage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = coverage.h; sourceTree = "<group>"; };
374CD6F00F65A4C100D90B4A /* coverage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = coverage.cpp; sourceTree = "<group>"; };
+ 3765B4780F77D15900C3EDC5 /* nocommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nocommands.cpp; sourceTree = "<group>"; };
+ 3765B4790F77D15900C3EDC5 /* nocommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nocommands.h; sourceTree = "<group>"; };
3782163B0F616079008E1F6D /* fullmatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fullmatrix.h; sourceTree = "<group>"; };
3782163C0F616079008E1F6D /* fullmatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fullmatrix.cpp; sourceTree = "<group>"; };
379293C10F2DE73400B9034A /* treemap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = treemap.h; sourceTree = "<group>"; };
37D927E30F21331F001D4494 /* helpcommand.cpp */,
374CD63D0F65832000D90B4A /* libshuffcommand.h */,
374CD63E0F65832000D90B4A /* libshuffcommand.cpp */,
+ 3765B4790F77D15900C3EDC5 /* nocommands.h */,
+ 3765B4780F77D15900C3EDC5 /* nocommands.cpp */,
37D927FA0F21331F001D4494 /* parselistcommand.h */,
37D927F90F21331F001D4494 /* parselistcommand.cpp */,
3792946E0F2E191800B9034A /* parsimonycommand.h */,
3782163D0F616079008E1F6D /* fullmatrix.cpp in Sources */,
374CD63F0F65832000D90B4A /* libshuffcommand.cpp in Sources */,
374CD6F10F65A4C100D90B4A /* coverage.cpp in Sources */,
+ 3765B47A0F77D15900C3EDC5 /* nocommands.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
#include "unifracweightedcommand.h"
#include "libshuffcommand.h"
#include "mothur.h"
+#include "nocommand.h"
/***********************************************************/
/***********************************************************/
-CommandFactory::CommandFactory(){}
-
+CommandFactory::CommandFactory(){
+ command = new NoCommand();
+}
/***********************************************************/
/***********************************************************/
else if(commandName == "get.label") { command = new GetlabelCommand(); }
else if(commandName == "get.line") { command = new GetlineCommand(); }
else if(commandName == "libshuff") { command = new LibShuffCommand(); }
+ else { command = new NoCommand(); }
return command;
}
/******************************************************/
-ErrorCheck::~ErrorCheck() {}
+ErrorCheck::~ErrorCheck() {
+ delete validCommand;
+ delete validParameter;
+}
/*******************************************************/
splitAtComma(value, optionText);
splitAtEquals(parameter, value);
- //is it a valid parameter
+ //is it a valid parameter for the command
if (validParameter->isValidParameter(parameter, commandName) != true) { return false; }
if (parameter == "phylip" ) { phylipfile = value; }
if (errorFree) { //gets the last parameter and value
value = optionText;
splitAtEquals(parameter, value);
- //is it a valid parameter
+
+ //is it a valid parameter for the command
if (validParameter->isValidParameter(parameter, commandName) != true) { return false; }
if (parameter == "phylip" ) { phylipfile = value; }
//make sure the user does not use both the line and label parameters
if ((line != "") && (label != "")) { cout << "You may use either the line or label parameters, but not both." << endl; return false; }
+ //check for valid files
if (commandName == "read.dist") {
validateReadFiles();
validateReadDist();
//you want to do shared commands
if ((listfile != "") && (groupfile != "")) {
validateParseFiles(); //checks the listfile and groupfile parameters
- }else if (listfile != "") { //you want to do single commands
+ //you want to do single commands
+ }else if ((listfile != "") || (rabundfile != "") || (sabundfile != "")){
validateReadFiles();
validateReadPhil();
- }else if ((listfile == "") && (sharedfile == "")) {
- cout << "You must enter either a listfile or a sharedfile with the read.otu command. " << endl; return false;
- }else{//you are reading a shared file
+ //you have not given a file
+ }else if ((listfile == "") && (sharedfile == "") && (rabundfile == "") && (sabundfile == "")) {
+ cout << "You must enter either a listfile, rabundfile, sabundfile or a sharedfile with the read.otu command. " << endl; return false;
+ //you want to do shared commands with a shared file
+ }else if (sharedfile != "") {//you are reading a shared file
validateReadFiles();
}
}else if (commandName == "read.tree") {
}
if ((commandName == "libshuff") && ((globaldata->gMatrix == NULL) || (globaldata->gGroupmap == NULL))) {
- cout << "You must read in a matrix and groupfile before you use the libshuff command. " << endl; return false;
+ cout << "You must read in a matrix and groupfile using the read.dist command, before you use the libshuff command. " << endl; return false;
}
if (commandName == "parsimony") {
coverage->getValues(matrix, cValues, dist, "user");
+ float distDiff = dist[0];
+
//loop through each distance and load rsumdelta
for (int p = 0; p < cValues.size(); p++) {
//find delta values
//don't save AA to AA
if (i != j) {
//(Caa - Cab)^2
- deltaValues[p].push_back((cValues[p][i][i]-cValues[p][i][j]) * (cValues[p][i][i]-cValues[p][i][j]));
+ deltaValues[p].push_back(((cValues[p][i][i]-cValues[p][i][j]) * (cValues[p][i][i]-cValues[p][i][j])) * distDiff);
sumDelta[count] += deltaValues[p][count];
count++;
}
}
}
+ if (p < cValues.size() - 1) {
+ distDiff = dist[p+1] - dist[p];
+//cout << distDiff << endl;
+ }
}
printCoverageFile();
coverage->getValues(matrix, cValues, dist, "random");
+ distDiff = 1;
+
//loop through each distance and load rsumdelta
for (int p = 0; p < cValues.size(); p++) {
//find delta values
//don't save AA to AA
if (i != j) {
//(Caa - Cab)^2
- rsumDelta[count][m] += ((cValues[p][i][i]-cValues[p][i][j]) * (cValues[p][i][i]-cValues[p][i][j]));
+ rsumDelta[count][m] += (((cValues[p][i][i]-cValues[p][i][j]) * (cValues[p][i][i]-cValues[p][i][j])) * distDiff);
count++;
}
}
}
+ if (p < cValues.size() - 1) {
+ distDiff = dist[p+1] - dist[p];
+ }
}
//clear out old Values
//srand(54321);
srand( (unsigned)time( NULL ) );
- Engine* dotur;
+ Engine* mothur;
bool bail = 0;
if(argc>1){
- dotur = new BatchEngine(argv[1]);
+ mothur = new BatchEngine(argv[1]);
}
else{
- dotur = new InteractEngine();
+ mothur = new InteractEngine();
}
- while(bail == 0) { bail = dotur->getInput(); }
+ while(bail == 0) { bail = mothur->getInput(); }
- delete dotur;
+ delete mothur;
return 0;
}
--- /dev/null
+/*
+ * nocommand.cpp
+ * Dotur
+ *
+ * Created by Sarah Westcott on 1/2/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "nocommands.h"
+
+//**********************************************************************************************************************
+
+NoCommand::NoCommand(){}
+
+//**********************************************************************************************************************
+
+NoCommand::~NoCommand(){}
+
+//**********************************************************************************************************************
+
+int NoCommand::execute(){
+ //Could choose to give more help here?fdsah
+ cout << "Invalid command." << "\n";
+ cout << "For more information on command parameters use the help() command." << "\n";
+ return 0;
+}
+
+//**********************************************************************************************************************
--- /dev/null
+#ifndef NOCOMMAND_H
+#define NOCOMMAND_H
+/*
+ * nocommand.h
+ * Dotur
+ *
+ * Created by Sarah Westcott on 1/2/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+/* This command is run if the user enters an invalid command. */
+
+#include "command.hpp"
+
+class NoCommand : public Command {
+
+public:
+ NoCommand();
+ ~NoCommand();
+ int execute();
+
+private:
+
+};
+
+#endif
}
//set groupmap for .shared commands
- if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
+ //if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
globaldata->gGroupmap = groupMap;
return 0;
//reset globaldata's treemap if you just did random distrib
if (randomtree != "") {
//memory leak prevention
- if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
+ //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
globaldata->gTreemap = savetmap;
}
//save tmap for later
//memory leak prevention
- if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
+ //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
globaldata->gTreemap = tmap;
}
else if (format == "matrix") {
groupMap = new GroupMap(globaldata->getGroupFile());
groupMap->readMap();
- if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
+ //if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
globaldata->gGroupmap = groupMap;
}
openInputFile(filename, in);
matrix = new FullMatrix(in); //reads the matrix file
//memory leak prevention
- if (globaldata->gMatrix != NULL) { delete globaldata->gMatrix; }
+ //if (globaldata->gMatrix != NULL) { delete globaldata->gMatrix; }
globaldata->gMatrix = matrix; //save matrix for coverage commands
}else {
read->read(nameMap);
}
//memory leak prevention
- if (globaldata->ginput != NULL) { delete globaldata->ginput; }
+ //if (globaldata->ginput != NULL) { delete globaldata->ginput; }
globaldata->ginput = input; //saving to be used by collector and rarefact commands.
if ((globaldata->getFormat() == "list") || (globaldata->getFormat() == "rabund") || (globaldata->getFormat() == "sabund")) {//you are reading a list, rabund or sabund file for collect, rarefaction or summary.
order = input->getOrderVector();
//memory leak prevention
- if (globaldata->gorder != NULL) { delete globaldata->gorder; }
+ //if (globaldata->gorder != NULL) { delete globaldata->gorder; }
globaldata->gorder = order; //saving to be used by collect and rarefact commands.
sabund = inputSabund->getSAbundVector();
globaldata->sabund = sabund; //saving to be used by summary command.
}else if (globaldata->getFormat() == "shared") {
SharedList = input->getSharedListVector(); //you are reading for collect.shared, rarefaction.shared, summary.shared, parselist command, or shared commands.
//memory leak prevention
- if (globaldata->gSharedList != NULL) { delete globaldata->gSharedList; }
+ //if (globaldata->gSharedList != NULL) { delete globaldata->gSharedList; }
globaldata->gSharedList = SharedList;
}
}
if (globaldata->getFormat() == "shared") {
groupMap->readMap();
- if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
+ //if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
globaldata->gGroupmap = groupMap;
shared = new SharedCommand();
treeMap->readMap();
//memory leak prevention
- if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
+ //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
globaldata->gTreemap = treeMap;
read = new ReadNewickTree(filename);