]> git.donarmstrong.com Git - mothur.git/commitdiff
changed read.shared to read.list and incorporated the shared and parselist commands...
authorwestcott <westcott>
Tue, 20 Jan 2009 18:33:14 +0000 (18:33 +0000)
committerwestcott <westcott>
Tue, 20 Jan 2009 18:33:14 +0000 (18:33 +0000)
23 files changed:
Mothur.xcodeproj/project.pbxproj
clustercommand.cpp
commandfactory.cpp
errorchecking.cpp
errorchecking.h
globaldata.cpp
globaldata.hpp
helpcommand.cpp
parselistcommand.cpp
readdistcolumnfilecommand.h [deleted file]
readdistcommand.cpp [new file with mode: 0644]
readdistcommand.h [new file with mode: 0644]
readdistphylipfilecommand.cpp [deleted file]
readdistphylipfilecommand.h [deleted file]
readlistcommand.h [new file with mode: 0644]
readlistfilecommand.h [deleted file]
readotucommand.cpp [new file with mode: 0644]
readotucommand.h [new file with mode: 0644]
readrabundfilecommand.cpp [deleted file]
readsabundfilecommand.cpp [deleted file]
readsabundfilecommand.h [deleted file]
validcommands.cpp
validparameter.cpp

index 61b21c92aa5ead3b111f05ec7f58ac972383772c..8dcff47032eb79dfd55eaff7658f1b52083d6abb 100644 (file)
@@ -7,6 +7,10 @@
        objects = {
 
 /* Begin PBXBuildFile section */
+               372E12700F26365B0095CF7E /* readotucommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E126F0F26365B0095CF7E /* readotucommand.cpp */; };
+               372E12960F263D5A0095CF7E /* readdistcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12950F263D5A0095CF7E /* readdistcommand.cpp */; };
+               372E12C10F2648250095CF7E /* readlistcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12C00F2648250095CF7E /* readlistcommand.cpp */; };
+               372E12ED0F264D320095CF7E /* commandfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12EC0F264D320095CF7E /* commandfactory.cpp */; };
                37D928550F21331F001D4494 /* ace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927B80F21331F001D4494 /* ace.cpp */; };
                37D928560F21331F001D4494 /* averagelinkage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927BA0F21331F001D4494 /* averagelinkage.cpp */; };
                37D928570F21331F001D4494 /* bootstrap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927BB0F21331F001D4494 /* bootstrap.cpp */; };
@@ -17,7 +21,6 @@
                37D9285C0F21331F001D4494 /* collect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927C50F21331F001D4494 /* collect.cpp */; };
                37D9285D0F21331F001D4494 /* collectcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927C70F21331F001D4494 /* collectcommand.cpp */; };
                37D9285E0F21331F001D4494 /* collectsharedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927CB0F21331F001D4494 /* collectsharedcommand.cpp */; };
-               37D9285F0F21331F001D4494 /* commandfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927CE0F21331F001D4494 /* commandfactory.cpp */; };
                37D928600F21331F001D4494 /* commandoptionparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927D00F21331F001D4494 /* commandoptionparser.cpp */; };
                37D928610F21331F001D4494 /* completelinkage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927D20F21331F001D4494 /* completelinkage.cpp */; };
                37D928620F21331F001D4494 /* database.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927D30F21331F001D4494 /* database.cpp */; };
                37D9287A0F21331F001D4494 /* rarefact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928050F21331F001D4494 /* rarefact.cpp */; };
                37D9287B0F21331F001D4494 /* rarefactcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928070F21331F001D4494 /* rarefactcommand.cpp */; };
                37D9287C0F21331F001D4494 /* rarefactsharedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9280A0F21331F001D4494 /* rarefactsharedcommand.cpp */; };
-               37D9287D0F21331F001D4494 /* readdistcolumnfilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9280C0F21331F001D4494 /* readdistcolumnfilecommand.cpp */; };
-               37D9287E0F21331F001D4494 /* readdistphylipfilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9280E0F21331F001D4494 /* readdistphylipfilecommand.cpp */; };
-               37D9287F0F21331F001D4494 /* readlistfilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928100F21331F001D4494 /* readlistfilecommand.cpp */; };
                37D928800F21331F001D4494 /* readmatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928120F21331F001D4494 /* readmatrix.cpp */; };
-               37D928810F21331F001D4494 /* readrabundfilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928140F21331F001D4494 /* readrabundfilecommand.cpp */; };
-               37D928820F21331F001D4494 /* readsabundfilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928160F21331F001D4494 /* readsabundfilecommand.cpp */; };
-               37D928830F21331F001D4494 /* readsharedfilecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928180F21331F001D4494 /* readsharedfilecommand.cpp */; };
                37D928840F21331F001D4494 /* sabundvector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9281A0F21331F001D4494 /* sabundvector.cpp */; };
                37D928850F21331F001D4494 /* sequence.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9281C0F21331F001D4494 /* sequence.cpp */; };
                37D928860F21331F001D4494 /* shannon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9281E0F21331F001D4494 /* shannon.cpp */; };
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+               372E126E0F26365B0095CF7E /* readotucommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readotucommand.h; sourceTree = "<group>"; };
+               372E126F0F26365B0095CF7E /* readotucommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readotucommand.cpp; sourceTree = "<group>"; };
+               372E12940F263D5A0095CF7E /* readdistcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readdistcommand.h; sourceTree = "<group>"; };
+               372E12950F263D5A0095CF7E /* readdistcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readdistcommand.cpp; sourceTree = "<group>"; };
+               372E12BF0F2648250095CF7E /* readlistcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readlistcommand.h; sourceTree = "<group>"; };
+               372E12C00F2648250095CF7E /* readlistcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readlistcommand.cpp; sourceTree = "<group>"; };
+               372E12EC0F264D320095CF7E /* commandfactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commandfactory.cpp; sourceTree = "<group>"; };
                37D927B80F21331F001D4494 /* ace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ace.cpp; sourceTree = "<group>"; };
                37D927B90F21331F001D4494 /* ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ace.h; sourceTree = "<group>"; };
                37D927BA0F21331F001D4494 /* averagelinkage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = averagelinkage.cpp; sourceTree = "<group>"; };
                37D927CB0F21331F001D4494 /* collectsharedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = collectsharedcommand.cpp; sourceTree = "<group>"; };
                37D927CC0F21331F001D4494 /* collectsharedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = collectsharedcommand.h; sourceTree = "<group>"; };
                37D927CD0F21331F001D4494 /* command.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = command.hpp; sourceTree = "<group>"; };
-               37D927CE0F21331F001D4494 /* commandfactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commandfactory.cpp; sourceTree = "<group>"; };
                37D927CF0F21331F001D4494 /* commandfactory.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = commandfactory.hpp; sourceTree = "<group>"; };
                37D927D00F21331F001D4494 /* commandoptionparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commandoptionparser.cpp; sourceTree = "<group>"; };
                37D927D10F21331F001D4494 /* commandoptionparser.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = commandoptionparser.hpp; sourceTree = "<group>"; };
                37D928090F21331F001D4494 /* rarefactioncurvedata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rarefactioncurvedata.h; sourceTree = "<group>"; };
                37D9280A0F21331F001D4494 /* rarefactsharedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rarefactsharedcommand.cpp; sourceTree = "<group>"; };
                37D9280B0F21331F001D4494 /* rarefactsharedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rarefactsharedcommand.h; sourceTree = "<group>"; };
-               37D9280C0F21331F001D4494 /* readdistcolumnfilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readdistcolumnfilecommand.cpp; sourceTree = "<group>"; };
-               37D9280D0F21331F001D4494 /* readdistcolumnfilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readdistcolumnfilecommand.h; sourceTree = "<group>"; };
-               37D9280E0F21331F001D4494 /* readdistphylipfilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readdistphylipfilecommand.cpp; sourceTree = "<group>"; };
-               37D9280F0F21331F001D4494 /* readdistphylipfilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readdistphylipfilecommand.h; sourceTree = "<group>"; };
-               37D928100F21331F001D4494 /* readlistfilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readlistfilecommand.cpp; sourceTree = "<group>"; };
-               37D928110F21331F001D4494 /* readlistfilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readlistfilecommand.h; sourceTree = "<group>"; };
                37D928120F21331F001D4494 /* readmatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readmatrix.cpp; sourceTree = "<group>"; };
                37D928130F21331F001D4494 /* readmatrix.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = readmatrix.hpp; sourceTree = "<group>"; };
-               37D928140F21331F001D4494 /* readrabundfilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readrabundfilecommand.cpp; sourceTree = "<group>"; };
-               37D928150F21331F001D4494 /* readrabundfilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readrabundfilecommand.h; sourceTree = "<group>"; };
-               37D928160F21331F001D4494 /* readsabundfilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readsabundfilecommand.cpp; sourceTree = "<group>"; };
-               37D928170F21331F001D4494 /* readsabundfilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readsabundfilecommand.h; sourceTree = "<group>"; };
-               37D928180F21331F001D4494 /* readsharedfilecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readsharedfilecommand.cpp; sourceTree = "<group>"; };
-               37D928190F21331F001D4494 /* readsharedfilecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readsharedfilecommand.h; sourceTree = "<group>"; };
                37D9281A0F21331F001D4494 /* sabundvector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sabundvector.cpp; sourceTree = "<group>"; };
                37D9281B0F21331F001D4494 /* sabundvector.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = sabundvector.hpp; sourceTree = "<group>"; };
                37D9281C0F21331F001D4494 /* sequence.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sequence.cpp; sourceTree = "<group>"; };
                                37D927C90F21331F001D4494 /* collectdisplay.h */,
                                37D928AC0F213420001D4494 /* containers */,
                                37D927CA0F21331F001D4494 /* collectorscurvedata.h */,
-                               37D927CE0F21331F001D4494 /* commandfactory.cpp */,
                                37D927CF0F21331F001D4494 /* commandfactory.hpp */,
+                               372E12EC0F264D320095CF7E /* commandfactory.cpp */,
                                37D927D00F21331F001D4494 /* commandoptionparser.cpp */,
                                37D927D10F21331F001D4494 /* commandoptionparser.hpp */,
                                37D927D20F21331F001D4494 /* completelinkage.cpp */,
                                37D928080F21331F001D4494 /* rarefactcommand.h */,
                                37D9280A0F21331F001D4494 /* rarefactsharedcommand.cpp */,
                                37D9280B0F21331F001D4494 /* rarefactsharedcommand.h */,
-                               37D9280C0F21331F001D4494 /* readdistcolumnfilecommand.cpp */,
-                               37D9280D0F21331F001D4494 /* readdistcolumnfilecommand.h */,
-                               37D9280E0F21331F001D4494 /* readdistphylipfilecommand.cpp */,
-                               37D9280F0F21331F001D4494 /* readdistphylipfilecommand.h */,
-                               37D928100F21331F001D4494 /* readlistfilecommand.cpp */,
-                               37D928110F21331F001D4494 /* readlistfilecommand.h */,
-                               37D928140F21331F001D4494 /* readrabundfilecommand.cpp */,
-                               37D928150F21331F001D4494 /* readrabundfilecommand.h */,
-                               37D928160F21331F001D4494 /* readsabundfilecommand.cpp */,
-                               37D928170F21331F001D4494 /* readsabundfilecommand.h */,
-                               37D928180F21331F001D4494 /* readsharedfilecommand.cpp */,
-                               37D928190F21331F001D4494 /* readsharedfilecommand.h */,
+                               372E12940F263D5A0095CF7E /* readdistcommand.h */,
+                               372E12950F263D5A0095CF7E /* readdistcommand.cpp */,
+                               372E126E0F26365B0095CF7E /* readotucommand.h */,
+                               372E126F0F26365B0095CF7E /* readotucommand.cpp */,
+                               372E12BF0F2648250095CF7E /* readlistcommand.h */,
+                               372E12C00F2648250095CF7E /* readlistcommand.cpp */,
                                37D928260F21331F001D4494 /* sharedcommand.cpp */,
                                37D928270F21331F001D4494 /* sharedcommand.h */,
                                37D928460F21331F001D4494 /* summarycommand.cpp */,
                                37D9285C0F21331F001D4494 /* collect.cpp in Sources */,
                                37D9285D0F21331F001D4494 /* collectcommand.cpp in Sources */,
                                37D9285E0F21331F001D4494 /* collectsharedcommand.cpp in Sources */,
-                               37D9285F0F21331F001D4494 /* commandfactory.cpp in Sources */,
                                37D928600F21331F001D4494 /* commandoptionparser.cpp in Sources */,
                                37D928610F21331F001D4494 /* completelinkage.cpp in Sources */,
                                37D928620F21331F001D4494 /* database.cpp in Sources */,
                                37D9287A0F21331F001D4494 /* rarefact.cpp in Sources */,
                                37D9287B0F21331F001D4494 /* rarefactcommand.cpp in Sources */,
                                37D9287C0F21331F001D4494 /* rarefactsharedcommand.cpp in Sources */,
-                               37D9287D0F21331F001D4494 /* readdistcolumnfilecommand.cpp in Sources */,
-                               37D9287E0F21331F001D4494 /* readdistphylipfilecommand.cpp in Sources */,
-                               37D9287F0F21331F001D4494 /* readlistfilecommand.cpp in Sources */,
                                37D928800F21331F001D4494 /* readmatrix.cpp in Sources */,
-                               37D928810F21331F001D4494 /* readrabundfilecommand.cpp in Sources */,
-                               37D928820F21331F001D4494 /* readsabundfilecommand.cpp in Sources */,
-                               37D928830F21331F001D4494 /* readsharedfilecommand.cpp in Sources */,
                                37D928840F21331F001D4494 /* sabundvector.cpp in Sources */,
                                37D928850F21331F001D4494 /* sequence.cpp in Sources */,
                                37D928860F21331F001D4494 /* shannon.cpp in Sources */,
                                37D9289D0F21331F001D4494 /* validcalculator.cpp in Sources */,
                                37D9289E0F21331F001D4494 /* validcommands.cpp in Sources */,
                                37D9289F0F21331F001D4494 /* validparameter.cpp in Sources */,
+                               372E12700F26365B0095CF7E /* readotucommand.cpp in Sources */,
+                               372E12960F263D5A0095CF7E /* readdistcommand.cpp in Sources */,
+                               372E12C10F2648250095CF7E /* readlistcommand.cpp in Sources */,
+                               372E12ED0F264D320095CF7E /* commandfactory.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 79728164fcde1cbe0e8f528e6826825dfbb4a752..dc61a6a745eaeddb31a9e573b2b966a1dfde760d 100644 (file)
@@ -108,7 +108,9 @@ int ClusterCommand::execute(){
                }
        
                //saves .list file so you can do the collect, rarefaction and summary commands without doing a read.list
-               globaldata->setDistFile("");
+               if (globaldata->getFormat() == "phylip") { globaldata->setPhylipFile(""); }
+               else if (globaldata->getFormat() == "column") { globaldata->setColumnFile(""); }
+               
                globaldata->setListFile(fileroot+ tag + ".list");
                globaldata->setNameFile("");
                globaldata->setFormat("list");
index 224a4cc7761fe145da05c48297f36a46d29fe09c..edb3fc358b78394f24634c1398e76872324f6df3 100644 (file)
@@ -8,15 +8,11 @@
  */
 
 #include "command.hpp"
-#include "readdistphylipfilecommand.h"
-#include "readdistcolumnfilecommand.h"
-#include "readlistfilecommand.h"
-#include "readrabundfilecommand.h"
-#include "readsabundfilecommand.h"
-#include "readsharedfilecommand.h"
+#include "readdistcommand.h"
+#include "readotucommand.h"
+#include "readlistcommand.h"
 #include "clustercommand.h"
 #include "parselistcommand.h"
-#include "sharedcommand.h"
 #include "collectcommand.h"
 #include "collectsharedcommand.h"
 #include "rarefactcommand.h"
@@ -52,23 +48,18 @@ Command* CommandFactory::getCommand(string commandName){
        try {
                delete command;   //delete the old command
 
-                        if(commandName == "read.phylip")                       {       command = new ReadDistPhylipFileCommand();      }
-               else if(commandName == "read.column")                   {       command = new ReadDistColumnFileCommand();      }
+                        if(commandName == "read.dist")                         {       command = new ReadDistCommand();        }
+               else if(commandName == "read.otu")                              {       command = new ReadOtuCommand(); }
                else if(commandName == "read.list")                             {       command = new ReadListFileCommand();    }
-               else if(commandName == "read.rabund")                   {       command = new ReadRAbundFileCommand();  }
-               else if(commandName == "read.sabund")                   {       command = new ReadSAbundFileCommand();  }
-               else if(commandName == "read.shared")                   {       command = new ReadSharedFileCommand();  }
                else if(commandName == "cluster")                               {       command = new ClusterCommand();                 }
                else if(commandName == "help")                                  {       command = new HelpCommand();                    }
                else if(commandName == "quit")                                  {       command = new QuitCommand();                    }
                else if(commandName == "collect.single")                {       command = new CollectCommand();                 }
-               else if(commandName == "shared")                                {       command = new SharedCommand();                  }
                else if(commandName == "collect.shared")                {       command = new CollectSharedCommand();   }
                else if(commandName == "rarefaction.single")    {       command = new RareFactCommand();                }
                else if(commandName == "rarefaction.shared")    {       command = new RareFactSharedCommand();  }
                else if(commandName == "summary.single")                {       command = new SummaryCommand();                 }
                else if(commandName == "summary.shared")                {       command = new SummarySharedCommand();   }
-               else if(commandName == "parselist")                             {       command = new ParseListCommand();               }
                else                                                                                    {       command = new NoCommand();                              }
 
                return command;
index 78b082d3e2b3c76108845a3bd15a749d4ff465b6..903c58137c1de81036dd43adf6cc3619a861a3c6 100644 (file)
@@ -18,7 +18,8 @@ ErrorCheck::ErrorCheck() {
        validCommand = new ValidCommands();
        validParameter = new ValidParameters();
        validCalculator = new ValidCalculators();
-       distfile = globaldata->getDistFile();
+       columnfile = globaldata->getColumnFile();
+       phylipfile = globaldata->getPhylipFile();
        listfile = globaldata->getListFile();
        rabundfile = globaldata->getRabundFile();
        sabundfile = globaldata->getSabundFile();
@@ -69,7 +70,8 @@ bool ErrorCheck::checkInput(string input) {
                                //is it a valid parameter
                                if (validParameter->isValidParameter(parameter) != true) { return false; }
                                
-                               if (parameter == "distfile" )           { distfile = value; }
+                               if (parameter == "phylipfile" )         { phylipfile = value; }
+                               if (parameter == "columnfile" )         { columnfile = value; }
                                if (parameter == "listfile" )           { listfile = value; }
                                if (parameter == "rabundfile" )         { rabundfile = value; }
                                if (parameter == "sabundfile" )         { sabundfile = value; }
@@ -135,7 +137,8 @@ bool ErrorCheck::checkInput(string input) {
                                //is it a valid parameter
                                if (validParameter->isValidParameter(parameter) != true) { return false; }
                                
-                               if (parameter == "distfile" )           { distfile = value; }
+                               if (parameter == "phylipfile" )         { phylipfile = value; }
+                               if (parameter == "columnfile" )         { columnfile = value; }                         
                                if (parameter == "listfile" )           { listfile = value; }
                                if (parameter == "rabundfile" )         { rabundfile = value; }
                                if (parameter == "sabundfile" )         { sabundfile = value; }
@@ -198,20 +201,16 @@ bool ErrorCheck::checkInput(string input) {
                
                //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; }
+       
                
-               //validate files
-               if (commandName == "parselist") {
-                       validateParseFiles(commandName);
-               }
-               if ((commandName == "read.phylip") || (commandName == "read.column")) { 
+               if (commandName == "read.dist") { 
                        validateReadFiles();
                        validateReadDist();
-               }else if ((commandName == "read.list") || (commandName == "read.rabund") || (commandName == "read.sabund")){ 
-                       validateReadFiles();
-                       validateReadPhil(commandName);  
-               }else if (commandName == "read.shared") { 
+               }else if (commandName == "read.otu") { 
                        validateReadFiles();
-                       validateParseFiles(commandName); //checks the listfile and groupfile parameters
+                       validateReadPhil();     
+               }else if (commandName == "read.list") { 
+                       validateParseFiles(); //checks the listfile and groupfile parameters
                }
                
                //are you trying to cluster before you have read something                      
@@ -251,13 +250,20 @@ void ErrorCheck::validateReadFiles() {
                ifstream filehandle;
                int ableToOpen;
        
-               //are we reading a distfile
-               if (distfile != "") {
-                       ableToOpen = openInputFile(distfile, filehandle);
+               //are we reading a phylipfile
+               if (phylipfile != "") {
+                       ableToOpen = openInputFile(phylipfile, filehandle);
+                       filehandle.close();
+                       //unable to open
+                       if (ableToOpen == 1) { errorFree = false; }
+                       else { globaldata->inputFileName = phylipfile; }
+               //are we reading a phylipfile
+               }else if (columnfile != "") {
+                       ableToOpen = openInputFile(columnfile, filehandle);
                        filehandle.close();
                        //unable to open
                        if (ableToOpen == 1) { errorFree = false; }
-                       else { globaldata->inputFileName = distfile; }
+                       else { globaldata->inputFileName = columnfile; }
                //are we reading a listfile
                }else if (listfile!= "") {
                        ableToOpen = openInputFile(listfile, filehandle);
@@ -303,9 +309,10 @@ void ErrorCheck::validateReadDist() {
                ifstream filehandle;
                int ableToOpen;
                
-               if (distfile == "") { cout << "When executing a read.phylip or read.column you must enter a distfile." << endl; errorFree = false; }
+               if ((phylipfile == "") && (columnfile == "")) { cout << "When executing a read.dist you must enter a phylipfile or a columnfile." << endl; errorFree = false; }
+               else if ((phylipfile != "") && (columnfile != "")) { cout << "When executing a read.dist you must enter ONLY ONE of the following: phylipfile or columnfile." << endl; errorFree = false; }
                
-               if (commandName == "read.column") {
+               if (columnfile != "") {
                        if (namefile == "") {
                                cout << "You need to provide a namefile name if you are going to use the column format." << endl;
                                errorFree = false; 
@@ -331,20 +338,16 @@ void ErrorCheck::validateReadDist() {
 /******************************************************/
 //This function checks to make sure the user entered appropriate
 // format parameters on a parselistcommand
-void ErrorCheck::validateParseFiles(string command) {
+void ErrorCheck::validateParseFiles() {
        try {
                ifstream filehandle;
                int ableToOpen;
                
                //checks for valid files
-               if (command == "read.shared" ) {
-                       if (listfile == "") { cout << "When executing a read.shared you must enter a listfile and a groupfile." << endl; errorFree = false; }
-                       else if (groupfile == "") { cout << "When executing a read.shared you must enter a listfile and a groupfile." << endl; errorFree = false; }
-               }else if (command == "parselist" ) {
-                       if (listfile == "") { cout << "When executing a parselist you must enter a listfile and a groupfile." << endl; errorFree = false; }
-                       else if (groupfile == "") { cout << "When executing a parselist you must enter a listfile and a groupfile." << endl; errorFree = false; }
-               }
-               
+       
+               if (listfile == "") { cout << "When executing a read.list you must enter a listfile and a groupfile." << endl; errorFree = false; }
+               else if (groupfile == "") { cout << "When executing a read.list you must enter a listfile and a groupfile." << endl; errorFree = false; }
+       
                //checks parameters on the read command
                if (listfile != "") {
                        ableToOpen = openInputFile(listfile, filehandle);
@@ -376,18 +379,23 @@ void ErrorCheck::validateParseFiles(string command) {
 /******************************************************/
 //This function checks to make sure the user entered appropriate
 // format parameters on a distfile read
-void ErrorCheck::validateReadPhil(string command) {
+void ErrorCheck::validateReadPhil() {
        try {
                ifstream filehandle;
                int ableToOpen;
                
-               //checks for valid files
-               if (command == "read.list" ) {
-                       if (listfile == "") { cout << "When executing a read.list you must enter a listfile." << endl; errorFree = false; }
-               }else if (command == "read.sabund" ) {
-                       if (sabundfile == "") { cout << "When executing a read.sabund you must enter a sabundfile." << endl; errorFree = false; }
-               }else if (command == "read.rabund" ) {
-                       if (rabundfile == "") { cout << "When executing a read.rabund you must enter a rabundfile." << endl; errorFree = false; }
+               //checks to make sure only one file type is given
+               if (listfile != "") { 
+                       if ((rabundfile != "") || (sabundfile != "")) { 
+                               cout << "When executing a read.otu you must enter ONLY ONE of the following: listfile, rabundfile or sabundfile." << endl; errorFree = false; }
+               }else if (rabundfile != "") { 
+                       if ((listfile != "") || (sabundfile != "")) { 
+                               cout << "When executing a read.otu you must enter ONLY ONE of the following: listfile, rabundfile or sabundfile." << endl; errorFree = false; }
+               }else if (sabundfile != "") { 
+                       if ((listfile != "") || (rabundfile != "")) { 
+                               cout << "When executing a read.otu you must enter ONLY ONE of the following: listfile, rabundfile or sabundfile." << endl; errorFree = false; }
+               }else if ((listfile == "") && (rabundfile == "") && (sabundfile == "")) {
+                           cout << "When executing a read.otu you must enter one of the following: listfile, rabundfile or sabundfile." << endl; errorFree = false; 
                }
                
                //checks parameters on the read command
@@ -414,7 +422,8 @@ void ErrorCheck::validateReadPhil(string command) {
 
 void ErrorCheck::clear() {
        //option definitions should go here...
-       distfile                =       "";
+       phylipfile              =       "";
+       columnfile              =       "";
        listfile                =       "";
        rabundfile              =       "";
        sabundfile              =       "";
index 55795b2d97cdfb3c194ccf5d27a2dc1d1bd65e3b..58161d46886a6b99b73f853d0a36465a6f4b056e 100644 (file)
@@ -33,10 +33,10 @@ class ErrorCheck {
                void splitAtDash(string&, set<string>&);
                void validateReadFiles();
                void validateReadDist();
-               void validateReadPhil(string);
-               void validateParseFiles(string);
+               void validateReadPhil();
+               void validateParseFiles();
                void clear();
-               string distfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, cutoff, format; 
+               string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, cutoff, format; 
                string precision, method, fileroot, label, line, iters, jumble, freq, single, rarefaction, shared, summary;
                string commandName, optionText;
                bool errorFree;
index c28321d5a74879492975f2c0e4ed0e019f67b8e6..aba99444049cbad7c94576314e6c1347469e0d2f 100644 (file)
@@ -94,10 +94,11 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                                splitAtComma(value, optionText);
                                splitAtEquals(key, value);
                                
-                               if (key == "distfile" )         { distfile = value; inputFileName = value; fileroot = value;}
-                               if (key == "listfile" )         { listfile = value; inputFileName = value; fileroot = value;}
-                               if (key == "rabundfile" )       { rabundfile = value; inputFileName = value; fileroot = value;}
-                               if (key == "sabundfile" )       { sabundfile = value; inputFileName = value; fileroot = value;}
+                               if (key == "phylipfile" )       { phylipfile = value; inputFileName = value; fileroot = value; format = "phylip";}
+                               if (key == "columnfile" )       { columnfile = value; inputFileName = value; fileroot = value; format = "column";}
+                               if (key == "listfile" )         { listfile = value; inputFileName = value; fileroot = value; format = "list"; }
+                               if (key == "rabundfile" )       { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund"; }
+                               if (key == "sabundfile" )       { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund"; } 
                                if (key == "namefile" )         { namefile = value; }
                                if (key == "orderfile" )        { orderfile = value; }
                                if (key == "groupfile" )        { groupfile = value; }
@@ -156,10 +157,11 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
                        //saves the last parameter
                        value = optionText;
                        splitAtEquals(key, value);
-                       if (key == "distfile" )         { distfile = value; inputFileName = value; fileroot = value; }
-                       if (key == "listfile" )         { listfile = value; inputFileName = value; fileroot = value; }
-                       if (key == "rabundfile" )       { rabundfile = value; inputFileName = value; fileroot = value; }
-                       if (key == "sabundfile" )       { sabundfile = value; inputFileName = value; fileroot = value; }
+                       if (key == "phylipfile" )       { phylipfile = value; inputFileName = value; fileroot = value; format = "phylip"; }
+                       if (key == "columnfile" )       { columnfile = value; inputFileName = value; fileroot = value; format = "column"; }
+                       if (key == "listfile" )         { listfile = value; inputFileName = value; fileroot = value; format = "list"; }
+                       if (key == "rabundfile" )       { rabundfile = value; inputFileName = value; fileroot = value; format = "rabund"; }
+                       if (key == "sabundfile" )       { sabundfile = value; inputFileName = value; fileroot = value; format = "sabund"; }
                        if (key == "namefile" )         { namefile = value; }
                        if (key == "orderfile" )        { orderfile = value; }
                        if (key == "groupfile" )        { groupfile = value; }
@@ -254,21 +256,10 @@ void GlobalData::parseGlobalData(string commandString, string optionText){
 /******************************************************/
 void GlobalData::setReadFormat(string command){
        try {
-               if (command == "read.phylip") { 
+               if (command == "read.dist") { 
                        clear();
-                       format = "phylip";
-               }else if (command == "read.column") { 
+               }else if (command == "read.otu") { 
                        clear();
-                       format = "column";
-               }else if (command == "read.list") { 
-                       clear();
-                       format = "list";
-               }else if (command == "read.rabund") { 
-                       clear();
-                       format = "rabund";
-               }else if (command == "read.sabund") { 
-                       clear();
-                       format = "sabund";
                }else if (command == "read.shared") { 
                        clear();
                        format = "shared";
@@ -288,7 +279,8 @@ void GlobalData::setReadFormat(string command){
 
 /******************************************************/
 // These functions give you the option parameters of the commands
-string GlobalData::getDistFile()               {       return distfile;        }
+string GlobalData::getPhylipFile()             {       return phylipfile;      }
+string GlobalData::getColumnFile()             {       return columnfile;      }
 string GlobalData::getListFile()               {       return listfile;        }
 string GlobalData::getRabundFile()             {       return rabundfile;      }
 string GlobalData::getSabundFile()             {       return sabundfile;      }
@@ -306,7 +298,9 @@ string GlobalData::getFreq()                        {       return freq;            }
 void GlobalData::setListFile(string file)      {       listfile = file;        inputFileName = file;}
 void GlobalData::setRabundFile(string file)    {       rabundfile = file;      inputFileName = file;}
 void GlobalData::setSabundFile(string file)    {       sabundfile = file;      inputFileName = file;}
-void GlobalData::setDistFile(string file)      {       distfile = file;    inputFileName = file;}
+void GlobalData::setPhylipFile(string file)    {       phylipfile = file;    inputFileName = file;}
+void GlobalData::setColumnFile(string file)    {       columnfile = file;    inputFileName = file;}
+//void GlobalData::setGroupFile(string file)   {       groupfile = file;       }
 void GlobalData::setNameFile(string file)      {       namefile = file;        }
 void GlobalData::setFormat(string Format)      {       format = Format;        }
 
@@ -326,12 +320,13 @@ GlobalData::GlobalData() {
 
 void GlobalData::clear() {
        //option definitions should go here...
-       distfile                =       "";
-       listfile                =       "";///users/westcott/desktop/s.list
+       phylipfile              =       "";
+       columnfile              =       "";
+       listfile                =       "";
        rabundfile              =       "";
        sabundfile              =       "";
        namefile                =       "";
-       groupfile               =       ""; ///users/westcott/desktop/s.names
+       groupfile               =       ""; 
        orderfile               =       "";
        cutoff                  =       "10.00";
        format                  =       "";
index fbad525ab673467b9a0bc8e125df482c88d91893..a5477fff1d06b95aa35b6c1dc7d697bb0288246a 100644 (file)
@@ -31,7 +31,8 @@ public:
        set<int> lines; //hold lines to be used
        set<string> labels; //holds labels to be used
        
-       string getDistFile();
+       string getPhylipFile();
+       string getColumnFile();
        string getListFile();
        string getRabundFile();
        string getSabundFile();
@@ -47,7 +48,8 @@ public:
        string getJumble();
        string getFreq();
        void setListFile(string);
-       void setDistFile(string);
+       void setPhylipFile(string);
+       void setColumnFile(string);
        void setNameFile(string);
        void setRabundFile(string);
        void setSabundFile(string);
@@ -66,7 +68,7 @@ public:
        void splitAtDash(string&, set<string>&);
        
 private:
-       string distfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, line, label;
+       string phylipfile, columnfile, listfile, rabundfile, sabundfile, namefile, groupfile, orderfile, line, label;
        string cutoff, format, precision, method, fileroot, iters, jumble, freq, single, rarefaction, shared, summary, sharedsummary, sharedrarefaction;
        static GlobalData* _uniqueInstance;
        GlobalData( const GlobalData& ); // Disable copy constructor
index f1cf89367b2c62dfead85d70547cfb94a53c50db..b2acc375ed9bbaf60f5cec2caeeb34fa59e0d905 100644 (file)
@@ -23,41 +23,26 @@ int HelpCommand::execute(){
 
        globaldata = GlobalData::getInstance();
        
-       if (globaldata->helpRequest == "read.phylip") {
-               cout << "The read.phylip command parameter options are distfile, namefile, cutoff and precision" << "\n";
-               cout << "The read.phylip command should be in the following format: " << "\n";
-               cout << "read.phylip(distfile=yourDistFile, namefile=yourNameFile, cutoff=yourCutoff, precision=yourPrecision) " << "\n";
-               cout << "The distfile parameter is required.  If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed." << "\n";
-               cout << "Note: No spaces between parameter labels (i.e. distfile), '=' and parameters (i.e.yourDistfile)." << "\n" << "\n";
-       }else if (globaldata->helpRequest == "read.column") {
-               cout << "The read.column command parameter options are distfile, namefile, cutoff and precision" << "\n";
-               cout << "The read.column command should be in the following format: " << "\n";
-               cout << "read.column(distfile=yourDistFile, namefile=yourNameFile, cutoff=yourCutoff, precision=yourPrecision) " << "\n";
-               cout << "The distfile and namefile parameters are required.  If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed." << "\n";
+       if (globaldata->helpRequest == "read.dist") {
+               cout << "The read.dist command parameter options are phylipfile or columnfile, namefile, cutoff and precision" << "\n";
+               cout << "The read.dist command should be in the following format: " << "\n";
+               cout << "read.dist(phylipfile=yourDistFile, namefile=yourNameFile, cutoff=yourCutoff, precision=yourPrecision) " << "\n";
+               cout << "The phylipfile or columnfile parameter is required, but only one may be used.  If you use a columnfile the namefile is required. " << "\n";
+               cout << "If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. distfile), '=' and parameters (i.e.yourDistfile)." << "\n" << "\n";
+       }else if (globaldata->helpRequest == "read.otu") {
+               cout << "The read.otu command parameter options are listfile, rabundfile, sabundfile or orderfile." << "\n";
+               cout << "The read.otu command should be in the following format: " << "\n";
+               cout << "read.otu(listfile=yourListFile, orderfile=yourOrderFile) " << "\n";
+               cout << "The read.otu requires one of hte following parameters: listfile, rabundfile or sabundfile. Only one may be used at a time." << "\n";
+               cout << "Note: No spaces between parameter labels (i.e. listfile), '=' and parameters (i.e.yourListfile)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "read.list") {
-               cout << "The read.list command parameter options are listfile and orderfile." << "\n";
+               cout << "The read.list command parameter options are listfile and groupfile." << "\n";
                cout << "The read.list command should be in the following format: " << "\n";
-               cout << "read.list(listfile=yourListFile, orderfile=yourOrderFile) " << "\n";
-               cout << "The listfile parameter is required." << "\n";
-               cout << "Note: No spaces between parameter labels (i.e. listfile), '=' and parameters (i.e.yourListfile)." << "\n" << "\n";
-       }else if (globaldata->helpRequest == "read.rabund") {
-               cout << "The read.rabund command parameter options are rabundfile and orderfile." << "\n";
-               cout << "The read.rabund command should be in the following format: " << "\n";
-               cout << "read.rabund(rabundfile=yourRAbundFile, orderfile=yourOrderFile) " << "\n";
-               cout << "The rabundfile parameter is required." << "\n";
-               cout << "Note: No spaces between parameter labels (i.e. rabundfile), '=' and parameters (i.e.yourRAbundfile)." << "\n" << "\n";
-       }else if (globaldata->helpRequest == "read.sabund") {
-               cout << "The read.sabund command parameter options are sabundfile and orderfile." << "\n";
-               cout << "The read.sabund command should be in the following format: " << "\n";
-               cout << "read.sabund(sabundfile=yourSAbundFile, orderfile=yourOrderFile) " << "\n";
-               cout << "The sabundfile parameter is required." << "\n";
-               cout << "Note: No spaces between parameter labels (i.e. sabundfile), '=' and parameters (i.e.yourSAbundfile)." << "\n" << "\n";
-       }else if (globaldata->helpRequest == "read.shared") {
-               cout << "The read.shared command parameter options are listfile and groupfile." << "\n";
-               cout << "The read.shared command should be in the following format: " << "\n";
-               cout << "read.shared(listfile=yourListFile, groupfile=yourGroupFile) " << "\n";
+               cout << "read.list(listfile=yourListFile, groupfile=yourGroupFile) " << "\n";
                cout << "The listfile parameter and groupfile paramaters are required." << "\n";
+               cout << "The read.list command parses a list file and separates it into groups." << "\n";
+               cout << "It outputs a .shared file containing the otu information for each group as well as a .list file for each group." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. listfile), '=' and parameters (i.e.yourListfile)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "cluster") {
                cout << "The cluster command can only be executed after a successful read.phylip or read.column command." << "\n";
@@ -122,25 +107,11 @@ int HelpCommand::execute(){
                cout << "The default value for jumble is 0 (meaning don’t jumble, if it’s set to 1 then it will jumble) and sharedsummary is sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN" << "\n";
                cout << "The label and line parameters are used to analyze specific lines in your input." << "\n";
                cout << "Note: No spaces between parameter labels (i.e. listfile), '=' and parameters (i.e.yourListfile)." << "\n" << "\n";
-       }else if (globaldata->helpRequest == "shared") { 
-               cout << "The shared command can only be executed after a successful read.shared command." << "\n";
-               cout << "The shared command parses a list file and separates it into groups." << "\n";
-               cout << "It outputs a shared file containing the otu information for each group.  There are no shared command parameters." << "\n";
-               cout << "The shared command should be in the following format: shared()." << "\n";
-               cout << "Example shared()." << "\n";
-       }else if (globaldata->helpRequest == "parselist") { 
-               cout << "The parselist command parses a list file and separates it into groups." << "\n";
-               cout << "It outputs a list file for each group." << "\n";
-               cout << "The parselist command parameter options are listfile and groupfile." << "\n";
-               cout << "The parselist command should be in the following format: " << "\n";
-               cout << "parselist(listfile=yourListFile, groupfile=yourGroupFile) " << "\n";
-               cout << "The listfile parameter and groupfile paramater are required." << "\n";
-               cout << "Note: No spaces between parameter labels (i.e. listfile), '=' and parameters (i.e.yourListfile)." << "\n" << "\n";
        }else if (globaldata->helpRequest == "quit") {
                cout << "The quit command will terminate Dotur and should be in the following format: " << "\n";
                cout << "quit()" << "\n" << "\n";
        }else if (globaldata->helpRequest == "") {
-               cout << "Valid commands are read.phylip(), read.column(), read.list(), read.rabund(), read.sabund(), cluster(), collect.single(), rarefaction.single(), summary.single(), collect.shared(), rarefaction.shared(), summary.shared(), shared(), pareselist(), quit(), help()." << "\n";
+               cout << "Valid commands are read.dist(), read.list(), read.otu(), cluster(), collect.single(), rarefaction.single(), summary.single(), collect.shared(), rarefaction.shared(), summary.shared(), quit(), help()." << "\n";
                cout << "For more information about a specific command type 'help(commandName)' i.e. 'help(read.phylip)'" << endl;
        }else {
                cout << "not a valid command" << endl;
index 8a848e768fd5c4c2775bec636be6acf64dd5d2ac..451a375d4d705d2831f790fc259a28882e52c393 100644 (file)
@@ -27,12 +27,7 @@ ParseListCommand::ParseListCommand(){
                }
                
                //set fileroot
-               if(globaldata->getFileRoot() != ""){
-                       fileroot = globaldata->getFileRoot();
-               }
-               else{
-                       fileroot = getRootName(globaldata->getDistFile());
-               }
+               fileroot = getRootName(globaldata->getListFile());
                
                //open output list files
                for (i=0; i<groupMap->getNumGroups(); i++) {//opens an output file for each group
@@ -130,6 +125,10 @@ int ParseListCommand::execute(){
                                }
                                list = input->getListVector();
                        }
+                       
+                       //set groupmap for .shared commands
+                       globaldata->gGroupmap = groupMap; 
+                       
                        return 0;
        }
        catch(exception& e) {
@@ -146,7 +145,6 @@ int ParseListCommand::execute(){
 
 ParseListCommand::~ParseListCommand(){
        delete list;
-       delete groupMap;
        delete input;
        delete read;    
 }
diff --git a/readdistcolumnfilecommand.h b/readdistcolumnfilecommand.h
deleted file mode 100644 (file)
index 79ec5a7..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef READDISTCOLUMNFILECOMMAND_H
-#define READDISTCOLUMNFILECOMMAND_H
-/*
- *  readdistcolumnfilecommand.h
- *  Dotur
- *
- *  Created by Sarah Westcott on 1/2/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include <Carbon/Carbon.h>
-#include <iostream>
-#include <fstream>
-#include "command.hpp"
-#include "readmatrix.hpp"
-
-/* The read.column command is used to read a distance matrix file in column format.  
-The read.column command parameter options are distfile, namefile, cutoff and precision. 
-The read.column command should be in the following format: read.column (distfile=yourDistFile, 
-namefile=yourNameFile, cutoff=yourCutoff, precision=yourPrecision). The distfile and namefile parameters are required.  
-If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.  */
-
-class NameAssignment;
-class GlobalData;
-
-
-class ReadDistColumnFileCommand : public Command {
-public:
-       ReadDistColumnFileCommand();
-       ~ReadDistColumnFileCommand();
-       int execute();
-       
-private:
-       GlobalData* globaldata;
-       double cutoff;
-       int precision;
-       ReadMatrix* read;
-       string filename, format, method;
-       NameAssignment* nameMap;
-};
-
-#endif
\ No newline at end of file
diff --git a/readdistcommand.cpp b/readdistcommand.cpp
new file mode 100644 (file)
index 0000000..4feddfd
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ *  readdistcommand.cpp
+ *  Mothur
+ *
+ *  Created by Sarah Westcott on 1/20/09.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "readdistcommand.h"
+
+ReadDistCommand::ReadDistCommand(){
+       try {
+               globaldata = GlobalData::getInstance();
+               
+               filename = globaldata->inputFileName;
+               format = globaldata->getFormat();       
+               
+               if (format == "column") { read = new ReadColumnMatrix(filename); }      
+               else if (format == "phylip") { read = new ReadPhylipMatrix(filename); } 
+                       
+               if(globaldata->getPrecision() != ""){
+                       convert(globaldata->getPrecision(), precision); 
+               }
+               
+               if(globaldata->getCutOff() != ""){
+                       convert(globaldata->getCutOff(), cutoff);       
+                       cutoff += (5 / (precision * 10.0));
+               }
+               read->setCutoff(cutoff);
+       
+               if(globaldata->getNameFile() != ""){    
+                       nameMap = new NameAssignment(globaldata->getNameFile());
+                       nameMap->readMap(1,2);
+               }
+               else{
+                       nameMap = NULL;
+               }
+                       
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the ReadDistCommand class Function ReadDistCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the ReadDistCommand class function ReadDistCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+}
+
+//**********************************************************************************************************************
+ReadDistCommand::~ReadDistCommand(){
+       delete read;
+       delete nameMap;
+}
+
+//**********************************************************************************************************************
+int ReadDistCommand::execute(){
+       try {
+               read->read(nameMap);
+               globaldata->setListVector(read->getListVector());
+               globaldata->setSparseMatrix(read->getMatrix());
+               return 0;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the ReadDistCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the ReadDistCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+}
\ No newline at end of file
diff --git a/readdistcommand.h b/readdistcommand.h
new file mode 100644 (file)
index 0000000..3dfda1b
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef READDISTCOMMAND_H
+#define READDISTCOMMAND_H
+/*
+ *  readdistcommand.h
+ *  Mothur
+ *
+ *  Created by Sarah Westcott on 1/20/09.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+#include <iostream>
+#include <fstream>
+#include "command.hpp"
+#include "readmatrix.hpp"
+
+/* The read.dist command is used to read a distance matrix file.  
+The read.dist command parameter options are phylipfile, columnfile, namefile, cutoff and precision. 
+The read.dist command should be in the following format: read.dist(phylipfile=yourDistFile, 
+namefile=yourNameFile, cutoff=yourCutoff, precision=yourPrecision). The phylipfile or columnfile are required and if you use a columnfile the namefile is required.  
+If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.  */
+
+class NameAssignment;
+class GlobalData;
+
+
+class ReadDistCommand : public Command {
+public:
+       ReadDistCommand();
+       ~ReadDistCommand();
+       int execute();
+       
+private:
+       GlobalData* globaldata;
+       double cutoff;
+       int precision;
+       ReadMatrix* read;
+       string filename, format, method;
+       NameAssignment* nameMap;
+};
+
+#endif
\ No newline at end of file
diff --git a/readdistphylipfilecommand.cpp b/readdistphylipfilecommand.cpp
deleted file mode 100644 (file)
index 90804b2..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  readdistphylipfilecommand.cpp
- *  Dotur
- *
- *  Created by Sarah Westcott on 1/2/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include "readdistphylipfilecommand.h"
-
-//**********************************************************************************************************************
-
-ReadDistPhylipFileCommand::ReadDistPhylipFileCommand(){
-       try {
-               globaldata = GlobalData::getInstance();
-               
-               filename = globaldata->inputFileName;
-                               
-               format = globaldata->getFormat();       
-               read = new ReadPhylipMatrix(filename);  
-               
-               if(globaldata->getPrecision() != ""){
-                       convert(globaldata->getPrecision(), precision); 
-               }
-               
-               if(globaldata->getCutOff() != ""){
-                       convert(globaldata->getCutOff(), cutoff);       
-                       cutoff += (5 / (precision * 10.0));
-               }
-               read->setCutoff(cutoff);
-       
-               if(globaldata->getNameFile() != ""){    
-                       nameMap = new NameAssignment(globaldata->getNameFile());
-                       nameMap->readMap(1,2);
-               }
-               else{
-                       nameMap = NULL;
-               }
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ReadDistPhylipFileCommand class Function ReadDistPhylipFileCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ReadDistPhylipFileCommand class function ReadDistPhylipFileCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-//**********************************************************************************************************************
-
-ReadDistPhylipFileCommand::~ReadDistPhylipFileCommand(){
-       delete read;
-       delete nameMap;
-}
-
-//**********************************************************************************************************************
-
-int ReadDistPhylipFileCommand::execute(){
-       try {
-               read->read(nameMap);
-               globaldata->setListVector(read->getListVector());
-               globaldata->setSparseMatrix(read->getMatrix());
-               return 0;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ReadDistPhylipFileCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ReadDistPhylipFileCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
diff --git a/readdistphylipfilecommand.h b/readdistphylipfilecommand.h
deleted file mode 100644 (file)
index 9133c92..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef READDISTPHYLIPFILECOMMAND_H
-#define READDISTPHYLIPFILECOMMAND_H
-/*
- *  readdistphylipfilecommand.h
- *  Dotur
- *
- *  Created by Sarah Westcott on 1/2/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include <Carbon/Carbon.h>
-
-#include <iostream>
-#include <fstream>
-#include "command.hpp"
-#include "readmatrix.hpp"
-
-/* The read.phylip command is used to read a distance matrix file in phylip format.  
-The read.phylip command parameter options are distfile, namefile, cutoff and precision. 
-The read.phylip command should be in the following format: read.phylip(distfile=yourDistFile, 
-namefile=yourNameFile, cutoff=yourCutoff, precision=yourPrecision). The distfile parameter is required.  
-If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.  */
-
-
-class NameAssignment;
-class GlobalData;
-
-
-class ReadDistPhylipFileCommand : public Command {
-public:
-       ReadDistPhylipFileCommand();
-       ~ReadDistPhylipFileCommand();
-       int execute();
-       
-private:
-       GlobalData* globaldata;
-       double cutoff;
-       int precision;
-       ReadMatrix* read;
-       string filename, format, method;
-       NameAssignment* nameMap;
-};
-
-#endif
\ No newline at end of file
diff --git a/readlistcommand.h b/readlistcommand.h
new file mode 100644 (file)
index 0000000..01b8519
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ *  readlistcommand.h
+ *  Mothur
+ *
+ *  Created by Sarah Westcott on 1/20/09.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#ifndef READLISTFILECOMMAND_H
+#define READLISTFILECOMMAND_H
+/*
+ *  readlistcommand.h
+ *  Mothur
+ *
+ *  Created by Sarah Westcott on 1/20/09.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+#include <iostream>
+#include <fstream>
+#include "command.hpp"
+#include "readmatrix.hpp"
+#include "inputdata.h"
+#include "groupmap.h"
+#include "sharedcommand.h"
+#include "parselistcommand.h"
+
+
+/* The read.list command parameter options are listfile and groupfile.  
+The read.list command should be in the following format: 
+read.shared(listfile=yourListFile, groupfile=yourGroupFile).  
+The listfile parameter and groupfile paramaters are required. */               
+
+
+class GlobalData;
+
+class ReadListFileCommand : public Command {
+public:
+       ReadListFileCommand();
+       ~ReadListFileCommand();
+       int execute();
+       
+private:
+       GlobalData* globaldata;
+       Command* shared;
+       Command* parselist;
+       GroupMap* groupMap;
+       ReadMatrix* read;
+       InputData* input;
+       string filename;
+};
+
+#endif
\ No newline at end of file
diff --git a/readlistfilecommand.h b/readlistfilecommand.h
deleted file mode 100644 (file)
index b444b38..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef READLISTFILECOMMAND_H
-#define READLISTFILECOMMAND_H
-/*
- *  readlistfilecommand.h
- *  Dotur
- *
- *  Created by Sarah Westcott on 1/2/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include <Carbon/Carbon.h>
-#include <iostream>
-#include <fstream>
-#include "command.hpp"
-#include "readmatrix.hpp"
-#include "inputdata.h"
-
-/* The read.list command parameter options are listfile and orderfile.  
-The read.list command should be in the following format: 
-read.list(listfile=yourListFile, orderfile=yourOrderFile). The listfile parameter is required. */
-
-class GlobalData;
-
-class ReadListFileCommand : public Command {
-public:
-       ReadListFileCommand();
-       ~ReadListFileCommand();
-       int execute();
-       
-private:
-       GlobalData* globaldata;
-       ReadMatrix* read;
-       InputData* input;
-       string filename;
-};
-
-#endif
\ No newline at end of file
diff --git a/readotucommand.cpp b/readotucommand.cpp
new file mode 100644 (file)
index 0000000..130ecd0
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ *  readotu.cpp
+ *  Mothur
+ *
+ *  Created by Sarah Westcott on 1/20/09.
+ *  Copyright 2009 Schloss Lab UMASS AMherst. All rights reserved.
+ *
+ */
+
+#include "readotucommand.h"
+
+//**********************************************************************************************************************
+ReadOtuCommand::ReadOtuCommand(){
+       try {
+               globaldata = GlobalData::getInstance();
+               filename = globaldata->inputFileName;
+               read = new ReadPhilFile(filename);
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the ReadOtuCommand class Function ReadOtuCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the ReadOtuCommand class function ReadOtuCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+}
+
+//**********************************************************************************************************************
+
+ReadOtuCommand::~ReadOtuCommand(){
+       delete read;
+}
+
+//**********************************************************************************************************************
+
+int ReadOtuCommand::execute(){
+       try {
+               read->read(&*globaldata); 
+               return 0;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the ReadOtuCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the ReadOtuCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
\ No newline at end of file
diff --git a/readotucommand.h b/readotucommand.h
new file mode 100644 (file)
index 0000000..972f30e
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef READOTUCOMMAND_H
+#define READOTUCOMMAND_H
+/*
+ *  readotu.h
+ *  Mothur
+ *
+ *  Created by Sarah Westcott on 1/20/09.
+ *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include <Carbon/Carbon.h>
+#include <iostream>
+#include <fstream>
+#include "command.hpp"
+#include "readmatrix.hpp"
+#include "inputdata.h"
+
+/* The read.otu command parameter options are listfile, sabundfile, rabundfile and orderfile.  
+The read.otu command should be in the following format: 
+read.otu(listfile=yourListFile, orderfile=yourOrderFile). The listfile, sabundfile or rabundfile are required, but only one may be used. */
+
+class GlobalData;
+
+class ReadOtuCommand : public Command {
+public:
+       ReadOtuCommand();
+       ~ReadOtuCommand();
+       int execute();
+       
+private:
+       GlobalData* globaldata;
+       ReadMatrix* read;
+       InputData* input;
+       string filename;
+};
+
+#endif
\ No newline at end of file
diff --git a/readrabundfilecommand.cpp b/readrabundfilecommand.cpp
deleted file mode 100644 (file)
index 315cdaf..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  readrabundfilecommand.cpp
- *  Dotur
- *
- *  Created by Sarah Westcott on 1/2/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include "readrabundfilecommand.h"
-
-//**********************************************************************************************************************
-ReadRAbundFileCommand::ReadRAbundFileCommand(){
-       try {
-               globaldata = GlobalData::getInstance();
-               filename = globaldata->inputFileName;
-               read = new ReadPhilFile(filename);
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ReadRAbundFileCommand class Function ReadRAbundFileCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ReadRAbundFileCommand class function ReadRAbundFileCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-//**********************************************************************************************************************
-
-ReadRAbundFileCommand::~ReadRAbundFileCommand(){
-       delete read;
-}
-
-//**********************************************************************************************************************
-
-int ReadRAbundFileCommand::execute(){
-       try {
-               read->read(&*globaldata); 
-               return 0;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ReadRAbundFileCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ReadRAbundFileCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-//**********************************************************************************************************************
diff --git a/readsabundfilecommand.cpp b/readsabundfilecommand.cpp
deleted file mode 100644 (file)
index 443b79e..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  readsabundfilecommand.cpp
- *  Dotur
- *
- *  Created by Sarah Westcott on 1/2/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include "readsabundfilecommand.h"
-
-//**********************************************************************************************************************
-ReadSAbundFileCommand::ReadSAbundFileCommand(){
-       try {
-               globaldata = GlobalData::getInstance();
-               filename = globaldata->inputFileName;   
-               read = new ReadPhilFile(filename);
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ReadSAbundFileCommand class Function ReadSAbundFileCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ReadSAbundFileCommand class function ReadSAbundFileCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-//**********************************************************************************************************************
-
-ReadSAbundFileCommand::~ReadSAbundFileCommand(){
-       delete read;
-}
-
-//**********************************************************************************************************************
-
-int ReadSAbundFileCommand::execute(){
-       try {
-               read->read(&*globaldata); 
-               return 0;
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the ReadSAbundFileCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the ReadSAbundFileCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-//**********************************************************************************************************************
diff --git a/readsabundfilecommand.h b/readsabundfilecommand.h
deleted file mode 100644 (file)
index 8e2526b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef READSABUNDFILECOMMAND_H
-#define READSABUNDFILECOMMAND_H
-/*
- *  readsabundfilecommand.h
- *  Dotur
- *
- *  Created by Sarah Westcott on 1/2/09.
- *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include <Carbon/Carbon.h>
-#include <iostream>
-#include <fstream>
-#include "command.hpp"
-#include "readmatrix.hpp"
-#include "inputdata.h"
-
-/* The read.sabund command parameter options are sabundfile and orderfile.  
-The read.sabund command should be in the following format: 
-read.sabund(sabundfile=yourSabundFile, orderfile=yourOrderFile). The sabundfile parameter is required.*/
-
-class GlobalData;
-
-class ReadSAbundFileCommand : public Command {
-public:
-       ReadSAbundFileCommand();
-       ~ReadSAbundFileCommand();
-       int execute();
-       
-private:
-       GlobalData* globaldata;
-       ReadMatrix* read;
-       InputData* input;
-       string filename;
-};
-
-#endif
\ No newline at end of file
index 9b6aeed326a4a27aa9c687bf3817985a9fcb4d61..72a38f71977e949e38d9adfecfd1729b29dab061 100644 (file)
 ValidCommands::ValidCommands() {
        try {
        
-               commands["read.phylip"]                 = "read.phylip"; 
-               commands["read.column"]                 = "read.column"; 
+               commands["read.dist"]                   = "read.dist"; 
+               commands["read.otu"]                    = "read.otu"; 
                commands["read.list"]                   = "read.list"; 
-               commands["read.rabund"]                 = "read.rabund"; 
-               commands["read.sabund"]                 = "read.sabund"; 
-               commands["read.shared"]                 = "read.shared"; 
                commands["cluster"]                             = "cluster"; 
                commands["help"]                                = "help"; 
                commands["quit"]                                = "quit"; 
                commands["collect.single"]              = "collect.single"; 
-               commands["shared"]                              = "shared"; 
                commands["collect.shared"]              = "collect.shared"; 
                commands["rarefaction.single"]  = "rarefaction.single"; 
                commands["rarefaction.shared"]  = "rarefaction.shared"; 
                commands["summary.single"]              = "summary.single"; 
                commands["summary.shared"]              = "summary.shared"; 
-               commands["parselist"]                   = "parselist"; 
-               
+                               
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function ValidCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -55,7 +50,7 @@ bool ValidCommands::isValidCommand(string command) {
                if ((commands.find(command)) != (commands.end())) {
                        return true;
                }else{
-                       cout << command << " is not a valid command in Mothur.  Valid commands are read.phylip(), read.column(), read.list(), read.rabund(), read.sabund(), read.shared(), cluster(), collect.single(), collect.shared(), parselist(), shared(), rarefaction.single(), rarefaction.shared(), summary.single(), summary.shared(), quit(), help()." << endl;
+                       cout << command << " is not a valid command in Mothur.  Valid commands are read.dist(), read.list(), cluster(), collect.single(), collect.shared(), rarefaction.single(), rarefaction.shared(), summary.single(), summary.shared(), quit(), help()." << endl;
                        return false;
                }
                
index fd9998e8246792388c563f327d5610271452edb6..dc4ec6276a5b23d38358096373c802830c8e3756 100644 (file)
@@ -14,7 +14,8 @@
 ValidParameters::ValidParameters() {
        try {
        
-               parameters["distfile"]                  = "distfile"; 
+               parameters["phylipfile"]                = "phylipfile";
+               parameters["columnfile"]                = "columnfile";
                parameters["listfile"]                  = "listfile"; 
                parameters["rabundfile"]                = "rabundfile"; 
                parameters["sabundfile"]                = "sabundfile";