diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 7738e1a9e..1064f0d57 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -165,7 +165,6 @@ 481FB5C01AC1B74F0076CFF3 /* getlineagecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B6F812D37EC400DA6239 /* getlineagecommand.cpp */; }; 481FB5C11AC1B74F0076CFF3 /* getlistcountcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B6FA12D37EC400DA6239 /* getlistcountcommand.cpp */; }; 481FB5C21AC1B74F0076CFF3 /* getoturepcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B6FE12D37EC400DA6239 /* getoturepcommand.cpp */; }; - 481FB5C31AC1B74F0076CFF3 /* getotuscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B70012D37EC400DA6239 /* getotuscommand.cpp */; }; 481FB5C41AC1B74F0076CFF3 /* getotulabelscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70056E5156A93D000924A2D /* getotulabelscommand.cpp */; }; 481FB5C51AC1B74F0076CFF3 /* getrabundcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B70212D37EC400DA6239 /* getrabundcommand.cpp */; }; 481FB5C61AC1B74F0076CFF3 /* getrelabundcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B70412D37EC400DA6239 /* getrelabundcommand.cpp */; }; @@ -221,7 +220,6 @@ 481FB5F91AC1B77E0076CFF3 /* removedistscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B0231416B8244B006BA09E /* removedistscommand.cpp */; }; 481FB5FA1AC1B77E0076CFF3 /* removegroupscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7C312D37EC400DA6239 /* removegroupscommand.cpp */; }; 481FB5FB1AC1B77E0076CFF3 /* removelineagecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7C512D37EC400DA6239 /* removelineagecommand.cpp */; }; - 481FB5FC1AC1B7970076CFF3 /* removeotuscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7C712D37EC400DA6239 /* removeotuscommand.cpp */; }; 481FB5FD1AC1B7970076CFF3 /* removeotulabelscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70056EA156AB6E500924A2D /* removeotulabelscommand.cpp */; }; 481FB5FE1AC1B7970076CFF3 /* removerarecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727864312E9E28C00F86ABA /* removerarecommand.cpp */; }; 481FB5FF1AC1B7970076CFF3 /* removeseqscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7C912D37EC400DA6239 /* removeseqscommand.cpp */; }; @@ -627,7 +625,6 @@ A7E9B8D112D37EC400DA6239 /* getlistcountcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B6FA12D37EC400DA6239 /* getlistcountcommand.cpp */; }; A7E9B8D212D37EC400DA6239 /* getopt_long.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B6FC12D37EC400DA6239 /* getopt_long.cpp */; }; A7E9B8D312D37EC400DA6239 /* getoturepcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B6FE12D37EC400DA6239 /* getoturepcommand.cpp */; }; - A7E9B8D412D37EC400DA6239 /* getotuscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B70012D37EC400DA6239 /* getotuscommand.cpp */; }; A7E9B8D512D37EC400DA6239 /* getrabundcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B70212D37EC400DA6239 /* getrabundcommand.cpp */; }; A7E9B8D612D37EC400DA6239 /* getrelabundcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B70412D37EC400DA6239 /* getrelabundcommand.cpp */; }; A7E9B8D712D37EC400DA6239 /* getsabundcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B70612D37EC400DA6239 /* getsabundcommand.cpp */; }; @@ -716,7 +713,6 @@ A7E9B93012D37EC400DA6239 /* readtree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7BF12D37EC400DA6239 /* readtree.cpp */; }; A7E9B93212D37EC400DA6239 /* removegroupscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7C312D37EC400DA6239 /* removegroupscommand.cpp */; }; A7E9B93312D37EC400DA6239 /* removelineagecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7C512D37EC400DA6239 /* removelineagecommand.cpp */; }; - A7E9B93412D37EC400DA6239 /* removeotuscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7C712D37EC400DA6239 /* removeotuscommand.cpp */; }; A7E9B93512D37EC400DA6239 /* removeseqscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7C912D37EC400DA6239 /* removeseqscommand.cpp */; }; A7E9B93612D37EC400DA6239 /* reportfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7CB12D37EC400DA6239 /* reportfile.cpp */; }; A7E9B93712D37EC400DA6239 /* reversecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B7CD12D37EC400DA6239 /* reversecommand.cpp */; }; @@ -1322,8 +1318,6 @@ A7E9B6FD12D37EC400DA6239 /* getopt_long.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getopt_long.h; path = source/clearcut/getopt_long.h; sourceTree = ""; }; A7E9B6FE12D37EC400DA6239 /* getoturepcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = getoturepcommand.cpp; path = /Users/sarahwestcott/Desktop/mothur/source/commands/getoturepcommand.cpp; sourceTree = ""; }; A7E9B6FF12D37EC400DA6239 /* getoturepcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getoturepcommand.h; path = /Users/sarahwestcott/Desktop/mothur/source/commands/getoturepcommand.h; sourceTree = ""; }; - A7E9B70012D37EC400DA6239 /* getotuscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = getotuscommand.cpp; path = /Users/sarahwestcott/Desktop/mothur/source/commands/getotuscommand.cpp; sourceTree = ""; }; - A7E9B70112D37EC400DA6239 /* getotuscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getotuscommand.h; path = /Users/sarahwestcott/Desktop/mothur/source/commands/getotuscommand.h; sourceTree = ""; }; A7E9B70212D37EC400DA6239 /* getrabundcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = getrabundcommand.cpp; path = /Users/sarahwestcott/Desktop/mothur/source/commands/getrabundcommand.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; A7E9B70312D37EC400DA6239 /* getrabundcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getrabundcommand.h; path = /Users/sarahwestcott/Desktop/mothur/source/commands/getrabundcommand.h; sourceTree = ""; }; A7E9B70412D37EC400DA6239 /* getrelabundcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = getrelabundcommand.cpp; path = /Users/sarahwestcott/Desktop/mothur/source/commands/getrelabundcommand.cpp; sourceTree = ""; }; @@ -1507,8 +1501,6 @@ A7E9B7C412D37EC400DA6239 /* removegroupscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = removegroupscommand.h; path = /Users/sarahwestcott/Desktop/mothur/source/commands/removegroupscommand.h; sourceTree = ""; }; A7E9B7C512D37EC400DA6239 /* removelineagecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = removelineagecommand.cpp; path = /Users/sarahwestcott/Desktop/mothur/source/commands/removelineagecommand.cpp; sourceTree = ""; }; A7E9B7C612D37EC400DA6239 /* removelineagecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = removelineagecommand.h; path = /Users/sarahwestcott/Desktop/mothur/source/commands/removelineagecommand.h; sourceTree = ""; }; - A7E9B7C712D37EC400DA6239 /* removeotuscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = removeotuscommand.cpp; path = /Users/sarahwestcott/Desktop/mothur/source/commands/removeotuscommand.cpp; sourceTree = ""; }; - A7E9B7C812D37EC400DA6239 /* removeotuscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = removeotuscommand.h; path = /Users/sarahwestcott/Desktop/mothur/source/commands/removeotuscommand.h; sourceTree = ""; }; A7E9B7C912D37EC400DA6239 /* removeseqscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = removeseqscommand.cpp; path = /Users/sarahwestcott/Desktop/mothur/source/commands/removeseqscommand.cpp; sourceTree = ""; }; A7E9B7CA12D37EC400DA6239 /* removeseqscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = removeseqscommand.h; path = /Users/sarahwestcott/Desktop/mothur/source/commands/removeseqscommand.h; sourceTree = ""; }; A7E9B7CB12D37EC400DA6239 /* reportfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = reportfile.cpp; path = source/datastructures/reportfile.cpp; sourceTree = ""; }; @@ -2163,8 +2155,6 @@ A7E9B6FA12D37EC400DA6239 /* getlistcountcommand.cpp */, A7E9B6FF12D37EC400DA6239 /* getoturepcommand.h */, A7E9B6FE12D37EC400DA6239 /* getoturepcommand.cpp */, - A7E9B70112D37EC400DA6239 /* getotuscommand.h */, - A7E9B70012D37EC400DA6239 /* getotuscommand.cpp */, A70056E8156A93E300924A2D /* getotulabelscommand.h */, A70056E5156A93D000924A2D /* getotulabelscommand.cpp */, A7E9B70312D37EC400DA6239 /* getrabundcommand.h */, @@ -2279,8 +2269,6 @@ A7E9B7C312D37EC400DA6239 /* removegroupscommand.cpp */, A7E9B7C612D37EC400DA6239 /* removelineagecommand.h */, A7E9B7C512D37EC400DA6239 /* removelineagecommand.cpp */, - A7E9B7C812D37EC400DA6239 /* removeotuscommand.h */, - A7E9B7C712D37EC400DA6239 /* removeotuscommand.cpp */, A70056E9156AB6D400924A2D /* removeotulabelscommand.h */, A70056EA156AB6E500924A2D /* removeotulabelscommand.cpp */, A727864212E9E28C00F86ABA /* removerarecommand.h */, @@ -2872,7 +2860,6 @@ 481FB58C1AC1B6FF0076CFF3 /* slayer.cpp in Sources */, 481FB6531AC1B8100076CFF3 /* gotohoverlap.cpp in Sources */, 481FB66D1AC1B8520076CFF3 /* rftreenode.cpp in Sources */, - 481FB5C31AC1B74F0076CFF3 /* getotuscommand.cpp in Sources */, 481FB65B1AC1B82C0076CFF3 /* mothurfisher.cpp in Sources */, 481FB6721AC1B8820076CFF3 /* refchimeratest.cpp in Sources */, 481FB6051AC1B7970076CFF3 /* seqerrorcommand.cpp in Sources */, @@ -3178,7 +3165,6 @@ 481FB5A21AC1B71B0076CFF3 /* clearcutcommand.cpp in Sources */, 481FB5851AC1B6FF0076CFF3 /* chimeracheckrdp.cpp in Sources */, 481FB55C1AC1B6660076CFF3 /* sharedbraycurtis.cpp in Sources */, - 481FB5FC1AC1B7970076CFF3 /* removeotuscommand.cpp in Sources */, 481FB5BE1AC1B74F0076CFF3 /* getmetacommunitycommand.cpp in Sources */, 481FB6821AC1B8AF0076CFF3 /* svm.cpp in Sources */, 481FB6911AC1BAA60076CFF3 /* phylotree.cpp in Sources */, @@ -3325,7 +3311,6 @@ A7E9B8D112D37EC400DA6239 /* getlistcountcommand.cpp in Sources */, A7E9B8D212D37EC400DA6239 /* getopt_long.cpp in Sources */, A7E9B8D312D37EC400DA6239 /* getoturepcommand.cpp in Sources */, - A7E9B8D412D37EC400DA6239 /* getotuscommand.cpp in Sources */, A7E9B8D512D37EC400DA6239 /* getrabundcommand.cpp in Sources */, A7E9B8D612D37EC400DA6239 /* getrelabundcommand.cpp in Sources */, A7E9B8D712D37EC400DA6239 /* getsabundcommand.cpp in Sources */, @@ -3429,7 +3414,6 @@ A7E9B93012D37EC400DA6239 /* readtree.cpp in Sources */, A7E9B93212D37EC400DA6239 /* removegroupscommand.cpp in Sources */, A7E9B93312D37EC400DA6239 /* removelineagecommand.cpp in Sources */, - A7E9B93412D37EC400DA6239 /* removeotuscommand.cpp in Sources */, A7E9B93512D37EC400DA6239 /* removeseqscommand.cpp in Sources */, 48A52FDE1BC428DF00548F6C /* util.cc in Sources */, A7E9B93612D37EC400DA6239 /* reportfile.cpp in Sources */, diff --git a/makefile-internal b/makefile-internal index 2adaef372..5a5b974c4 100644 --- a/makefile-internal +++ b/makefile-internal @@ -10,7 +10,7 @@ VERSION = "\"1.36.1\"" ifeq ($(strip $(64BIT_VERSION)),yes) #if you are a mac user use the following line - TARGET_ARCH += -arch x86_64 + #TARGET_ARCH += -arch x86_64 #if you using cygwin to build Windows the following line #CXX = x86_64-w64-mingw32-g++ @@ -95,4 +95,4 @@ install : mothur clean : @rm -f $(OBJECTS) - @rm -f uchime \ No newline at end of file + @rm -f uchime diff --git a/source/commandfactory.cpp b/source/commandfactory.cpp index af91caf56..76874a4fb 100644 --- a/source/commandfactory.cpp +++ b/source/commandfactory.cpp @@ -93,8 +93,6 @@ #include "subsamplecommand.h" #include "removegroupscommand.h" #include "getgroupscommand.h" -#include "getotuscommand.h" -#include "removeotuscommand.h" #include "indicatorcommand.h" #include "consensusseqscommand.h" #include "trimflowscommand.h" @@ -303,6 +301,7 @@ CommandFactory::CommandFactory(){ commands["create.database"] = "create.database"; commands["make.biom"] = "make.biom"; commands["get.coremicrobiome"] = "get.coremicrobiome"; + commands["list.otus"] = "list.otus"; commands["list.otulabels"] = "list.otulabels"; commands["get.otulabels"] = "get.otulabels"; commands["remove.otulabels"] = "remove.otulabels"; @@ -518,8 +517,9 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "remove.lineage") { command = new RemoveLineageCommand(optionString); } else if(commandName == "get.groups") { command = new GetGroupsCommand(optionString); } else if(commandName == "remove.groups") { command = new RemoveGroupsCommand(optionString); } - else if(commandName == "get.otus") { command = new GetOtusCommand(optionString); } - else if(commandName == "remove.otus") { command = new RemoveOtusCommand(optionString); } + else if((commandName == "get.otus") || (commandName == "get.otulabels")) { command = new GetOtuLabelsCommand(optionString); } + else if((commandName == "remove.otus") || (commandName == "remove.otulabels")) { command = new RemoveOtuLabelsCommand(optionString); } + else if((commandName == "list.otus") ||(commandName == "list.otulabels")) { command = new ListOtuLabelsCommand(optionString); } else if(commandName == "fastq.info") { command = new ParseFastaQCommand(optionString); } else if(commandName == "pipeline.pds") { command = new PipelineCommand(optionString); } else if(commandName == "deunique.seqs") { command = new DeUniqueSeqsCommand(optionString); } @@ -556,9 +556,6 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "create.database") { command = new CreateDatabaseCommand(optionString); } else if(commandName == "make.biom") { command = new MakeBiomCommand(optionString); } else if(commandName == "get.coremicrobiome") { command = new GetCoreMicroBiomeCommand(optionString); } - else if(commandName == "list.otulabels") { command = new ListOtuLabelsCommand(optionString); } - else if(commandName == "get.otulabels") { command = new GetOtuLabelsCommand(optionString); } - else if(commandName == "remove.otulabels") { command = new RemoveOtuLabelsCommand(optionString); } else if(commandName == "make.contigs") { command = new MakeContigsCommand(optionString); } else if(commandName == "load.logfile") { command = new LoadLogfileCommand(optionString); } else if(commandName == "sff.multiple") { command = new SffMultipleCommand(optionString); } @@ -695,8 +692,9 @@ Command* CommandFactory::getCommand(string commandName, string optionString, str else if(commandName == "get.groups") { pipecommand = new GetGroupsCommand(optionString); } else if(commandName == "remove.lineage") { pipecommand = new RemoveLineageCommand(optionString); } else if(commandName == "remove.groups") { pipecommand = new RemoveGroupsCommand(optionString); } - else if(commandName == "get.otus") { pipecommand = new GetOtusCommand(optionString); } - else if(commandName == "remove.otus") { pipecommand = new RemoveOtusCommand(optionString); } + else if((commandName == "get.otus") || (commandName == "get.otulabels")) { pipecommand = new GetOtuLabelsCommand(optionString); } + else if((commandName == "remove.otus") || (commandName == "remove.otulabels")) { pipecommand = new RemoveOtuLabelsCommand(optionString); } + else if((commandName == "list.otus") ||(commandName == "list.otulabels")) { pipecommand = new ListOtuLabelsCommand(optionString); } else if(commandName == "fastq.info") { pipecommand = new ParseFastaQCommand(optionString); } else if(commandName == "deunique.seqs") { pipecommand = new DeUniqueSeqsCommand(optionString); } else if(commandName == "pairwise.seqs") { pipecommand = new PairwiseSeqsCommand(optionString); } @@ -732,9 +730,6 @@ Command* CommandFactory::getCommand(string commandName, string optionString, str else if(commandName == "create.database") { pipecommand = new CreateDatabaseCommand(optionString); } else if(commandName == "make.biom") { pipecommand = new MakeBiomCommand(optionString); } else if(commandName == "get.coremicrobiome") { pipecommand = new GetCoreMicroBiomeCommand(optionString); } - else if(commandName == "list.otulabels") { pipecommand = new ListOtuLabelsCommand(optionString); } - else if(commandName == "get.otulabels") { pipecommand = new GetOtuLabelsCommand(optionString); } - else if(commandName == "remove.otulabels") { pipecommand = new RemoveOtuLabelsCommand(optionString); } else if(commandName == "make.contigs") { pipecommand = new MakeContigsCommand(optionString); } else if(commandName == "load.logfile") { pipecommand = new LoadLogfileCommand(optionString); } else if(commandName == "sff.multiple") { pipecommand = new SffMultipleCommand(optionString); } @@ -857,8 +852,9 @@ Command* CommandFactory::getCommand(string commandName){ else if(commandName == "remove.lineage") { shellcommand = new RemoveLineageCommand(); } else if(commandName == "get.groups") { shellcommand = new GetGroupsCommand(); } else if(commandName == "remove.groups") { shellcommand = new RemoveGroupsCommand(); } - else if(commandName == "get.otus") { shellcommand = new GetOtusCommand(); } - else if(commandName == "remove.otus") { shellcommand = new RemoveOtusCommand(); } + else if((commandName == "get.otus") || (commandName == "get.otulabels")) { shellcommand = new GetOtuLabelsCommand(); } + else if((commandName == "remove.otus") || (commandName == "remove.otulabels")) { shellcommand = new RemoveOtuLabelsCommand(); } + else if((commandName == "list.otus") ||(commandName == "list.otulabels")) { shellcommand = new ListOtuLabelsCommand(); } else if(commandName == "fastq.info") { shellcommand = new ParseFastaQCommand(); } else if(commandName == "deunique.seqs") { shellcommand = new DeUniqueSeqsCommand(); } else if(commandName == "pairwise.seqs") { shellcommand = new PairwiseSeqsCommand(); } @@ -894,9 +890,6 @@ Command* CommandFactory::getCommand(string commandName){ else if(commandName == "create.database") { shellcommand = new CreateDatabaseCommand(); } else if(commandName == "make.biom") { shellcommand = new MakeBiomCommand(); } else if(commandName == "get.coremicrobiome") { shellcommand = new GetCoreMicroBiomeCommand(); } - else if(commandName == "list.otulabels") { shellcommand = new ListOtuLabelsCommand(); } - else if(commandName == "get.otulabels") { shellcommand = new GetOtuLabelsCommand(); } - else if(commandName == "remove.otulabels") { shellcommand = new RemoveOtuLabelsCommand(); } else if(commandName == "make.contigs") { shellcommand = new MakeContigsCommand(); } else if(commandName == "load.logfile") { shellcommand = new LoadLogfileCommand(); } else if(commandName == "sff.multiple") { shellcommand = new SffMultipleCommand(); } diff --git a/source/commands/clustercommand.cpp b/source/commands/clustercommand.cpp index e0f572514..8b0ef3a38 100644 --- a/source/commands/clustercommand.cpp +++ b/source/commands/clustercommand.cpp @@ -12,7 +12,6 @@ #include "readcolumn.h" #include "readmatrix.hpp" #include "clusterdoturcommand.h" -#include "deconvolutecommand.h" #include "sequence.hpp" #include "vsearch.h" #include "vsearchfileparser.h" diff --git a/source/commands/clustersplitcommand.cpp b/source/commands/clustersplitcommand.cpp index 6da953926..8b38a2771 100644 --- a/source/commands/clustersplitcommand.cpp +++ b/source/commands/clustersplitcommand.cpp @@ -8,7 +8,8 @@ */ #include "clustersplitcommand.h" - +#include "vsearch.h" +#include "vsearchfileparser.h" //********************************************************************************************************************** vector ClusterSplitCommand::setParameters(){ @@ -29,7 +30,7 @@ vector ClusterSplitCommand::setParameters(){ CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pprocessors); CommandParameter pcutoff("cutoff", "Number", "", "0.25", "", "", "","",false,false,true); parameters.push_back(pcutoff); CommandParameter pprecision("precision", "Number", "", "100", "", "", "","",false,false); parameters.push_back(pprecision); - CommandParameter pmethod("method", "Multiple", "furthest-nearest-average-weighted", "average", "", "", "","",false,false); parameters.push_back(pmethod); + CommandParameter pmethod("method", "Multiple", "furthest-nearest-average-weighted-agc-dgc", "average", "", "", "","",false,false,true); parameters.push_back(pmethod); CommandParameter phard("hard", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(phard); CommandParameter pislist("islist", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(pislist); CommandParameter pclassic("classic", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(pclassic); @@ -65,7 +66,7 @@ string ClusterSplitCommand::getHelpString(){ helpString += "The cluster parameter allows you to indicate whether you want to run the clustering or just split the distance matrix, default=t"; helpString += "The cutoff parameter allow you to set the distance you want to cluster to, default is 0.25. \n"; helpString += "The precision parameter allows you specify the precision of the precision of the distances outputted, default=100, meaning 2 decimal places. \n"; - helpString += "The method allows you to specify what clustering algorithm you want to use, default=average, option furthest, nearest, or average. \n"; + helpString += "The method parameter allows you to enter your clustering mothod. Options are furthest, nearest, average, weighted, agc and dgc. Default=average. The agc and dgc methods require a fasta file."; helpString += "The splitmethod parameter allows you to specify how you want to split your distance file before you cluster, default=distance, options distance, classify or fasta. \n"; helpString += "The taxonomy parameter allows you to enter the taxonomy file for your sequences, this is only valid if you are using splitmethod=classify. Be sure your taxonomy file does not include the probability scores. \n"; helpString += "The taxlevel parameter allows you to specify the taxonomy level you want to use to split the distance file, default=3, meaning use the first taxon in each list. \n"; @@ -257,13 +258,13 @@ ClusterSplitCommand::ClusterSplitCommand(string option) { //is there are current file available for either of these? //give priority to column, then phylip, then fasta columnfile = m->getColumnFile(); - if (columnfile != "") { m->mothurOut("Using " + columnfile + " as input file for the column parameter."); m->mothurOutEndLine(); } + if (columnfile != "") { format = "column"; m->mothurOut("Using " + columnfile + " as input file for the column parameter."); m->mothurOutEndLine(); } else { phylipfile = m->getPhylipFile(); - if (phylipfile != "") { m->mothurOut("Using " + phylipfile + " as input file for the phylip parameter."); m->mothurOutEndLine(); } + if (phylipfile != "") { format = "phylip"; m->mothurOut("Using " + phylipfile + " as input file for the phylip parameter."); m->mothurOutEndLine(); } else { fastafile = m->getFastaFile(); - if (fastafile != "") { m->mothurOut("Using " + fastafile + " as input file for the fasta parameter."); m->mothurOutEndLine(); } + if (fastafile != "") { m->mothurOut("Using " + fastafile + " as input file for the fasta parameter."); m->mothurOutEndLine(); } else { m->mothurOut("No valid current files. When executing a cluster.split command you must enter a file, phylip or a column or fastafile."); m->mothurOutEndLine(); abort = true; @@ -344,7 +345,7 @@ ClusterSplitCommand::ClusterSplitCommand(string option) { classic = m->isTrue(temp); //not using file option and don't have fasta method with classic - if (((splitmethod != "fasta") && classic) && (file == "")) { m->mothurOut("splitmethod must be fasta to use cluster.classic, or you must use the file option.\n"); abort=true; } + if (((splitmethod != "fasta") && classic) && (file == "")) { m->mothurOut("[ERROR]: splitmethod must be fasta to use cluster.classic, or you must use the file option.\n"); abort=true; } temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { temp = "0.25"; } m->mothurConvert(temp, cutoff); @@ -355,13 +356,18 @@ ClusterSplitCommand::ClusterSplitCommand(string option) { method = validParameter.validFile(parameters, "method", false); if (method == "not found") { method = "average"; } - if ((method == "furthest") || (method == "nearest") || (method == "average")) { m->mothurOut("Using splitmethod " + splitmethod + ".\n"); } - else { m->mothurOut("Not a valid clustering method. Valid clustering algorithms are furthest, nearest or average."); m->mothurOutEndLine(); abort = true; } - + if ((method == "furthest") || (method == "nearest") || (method == "average") || (method == "weighted") || (method == "agc") || (method == "dgc")) { } + else { m->mothurOut("[ERROR]: Not a valid clustering method. Valid clustering algorithms are furthest, nearest, average, weighted, agc and dgc."); m->mothurOutEndLine(); abort = true; } + + if ((method == "agc") || (method == "dgc")) { + if (fastafile == "") { m->mothurOut("[ERROR]: You must provide a fasta file when using the agc or dgc clustering methods, aborting\n."); abort = true;} + if (classic) { m->mothurOut("[ERROR]: You cannot use cluster.classic with the agc or dgc clustering methods, aborting\n."); abort = true; } + } + if ((splitmethod == "distance") || (splitmethod == "classify") || (splitmethod == "fasta")) { } - else { m->mothurOut(splitmethod + " is not a valid splitting method. Valid splitting algorithms are distance, classify or fasta."); m->mothurOutEndLine(); abort = true; } + else { m->mothurOut("[ERROR]: " + splitmethod + " is not a valid splitting method. Valid splitting algorithms are distance, classify or fasta."); m->mothurOutEndLine(); abort = true; } - if ((splitmethod == "classify") && (taxFile == "")) { m->mothurOut("You need to provide a taxonomy file if you are going to use the classify splitmethod."); m->mothurOutEndLine(); abort = true; } + if ((splitmethod == "classify") && (taxFile == "")) { m->mothurOut("[ERROR]: You need to provide a taxonomy file if you are going to use the classify splitmethod."); m->mothurOutEndLine(); abort = true; } showabund = validParameter.validFile(parameters, "showabund", false); if (showabund == "not found") { showabund = "T"; } @@ -464,7 +470,13 @@ int ClusterSplitCommand::execute(){ SplitMatrix* split; if (splitmethod == "distance") { split = new SplitMatrix(distfile, namefile, countfile, taxFile, cutoff, splitmethod, large); } else if (splitmethod == "classify") { split = new SplitMatrix(distfile, namefile, countfile, taxFile, taxLevelCutoff, splitmethod, large); } - else if (splitmethod == "fasta") { split = new SplitMatrix(fastafile, namefile, countfile, taxFile, taxLevelCutoff, cutoff, splitmethod, processors, classic, outputDir); } + else if (splitmethod == "fasta") { + if ((method == "agc") || (method == "dgc")) { + split = new SplitMatrix(fastafile, namefile, countfile, taxFile, taxLevelCutoff, cutoff, splitmethod, processors, classic, outputDir, "fasta"); + }else{ + split = new SplitMatrix(fastafile, namefile, countfile, taxFile, taxLevelCutoff, cutoff, splitmethod, processors, classic, outputDir, "distance"); + } + } else { m->mothurOut("Not a valid splitting method. Valid splitting algorithms are distance, classify or fasta."); m->mothurOutEndLine(); return 0; } split->split(); @@ -1189,147 +1201,278 @@ string ClusterSplitCommand::clusterFile(string thisDistFile, string thisNamefile try { string listFileName = ""; - Cluster* cluster = NULL; - SparseDistanceMatrix* matrix = NULL; - ListVector* list = NULL; - ListVector oldList; - RAbundVector* rabund = NULL; - - if (m->control_pressed) { return listFileName; } - - m->mothurOutEndLine(); m->mothurOut("Reading " + thisDistFile); m->mothurOutEndLine(); - - ReadMatrix* read = new ReadColumnMatrix(thisDistFile); - read->setCutoff(cutoff); - - NameAssignment* nameMap = NULL; - CountTable* ct = NULL; - if(namefile != ""){ - nameMap = new NameAssignment(thisNamefile); - nameMap->readMap(); - read->read(nameMap); - }else if (countfile != "") { - ct = new CountTable(); - ct->readTable(thisNamefile, false, false); - read->read(ct); - }else { read->read(nameMap); } - - list = read->getListVector(); - oldList = *list; - matrix = read->getDMatrix(); - - if(countfile != "") { - rabund = new RAbundVector(); - createRabund(ct, list, rabund); //creates an rabund that includes the counts for the unique list - delete ct; - }else { rabund = new RAbundVector(list->getRAbundVector()); } - - delete read; read = NULL; - if (namefile != "") { delete nameMap; nameMap = NULL; } - - m->mothurOutEndLine(); m->mothurOut("Clustering " + thisDistFile); m->mothurOutEndLine(); - - //create cluster - float adjust = -1.0; - if (method == "furthest") { cluster = new CompleteLinkage(rabund, list, matrix, cutoff, method, adjust); } - else if(method == "nearest"){ cluster = new SingleLinkage(rabund, list, matrix, cutoff, method, adjust); } - else if(method == "average"){ cluster = new AverageLinkage(rabund, list, matrix, cutoff, method, adjust); } - tag = cluster->getTag(); - - if (outputDir == "") { outputDir += m->hasPath(thisDistFile); } - fileroot = outputDir + m->getRootName(m->getSimpleName(thisDistFile)); - - ofstream listFile; - m->openOutputFile(fileroot+ tag + ".list", listFile); - - listFileName = fileroot+ tag + ".list"; - - float previousDist = 0.00000; - float rndPreviousDist = 0.00000; - - oldList = *list; - - print_start = true; - start = time(NULL); - double saveCutoff = cutoff; - - while (matrix->getSmallDist() < cutoff && matrix->getNNodes() > 0){ + if ((method == "agc") || (method == "dgc")) { runVsearchCluster(thisDistFile, thisNamefile, labels, smallestCutoff); } + else { - if (m->control_pressed) { //clean up - delete matrix; delete list; delete cluster; delete rabund; - listFile.close(); - m->mothurRemove(listFileName); - return listFileName; - } + Cluster* cluster = NULL; + SparseDistanceMatrix* matrix = NULL; + ListVector* list = NULL; + ListVector oldList; + RAbundVector* rabund = NULL; + + if (m->control_pressed) { return listFileName; } + + m->mothurOutEndLine(); m->mothurOut("Reading " + thisDistFile); m->mothurOutEndLine(); + + ReadMatrix* read = new ReadColumnMatrix(thisDistFile); + read->setCutoff(cutoff); + + NameAssignment* nameMap = NULL; + CountTable* ct = NULL; + if(namefile != ""){ + nameMap = new NameAssignment(thisNamefile); + nameMap->readMap(); + read->read(nameMap); + }else if (countfile != "") { + ct = new CountTable(); + ct->readTable(thisNamefile, false, false); + read->read(ct); + }else { read->read(nameMap); } + + list = read->getListVector(); + oldList = *list; + matrix = read->getDMatrix(); + + if(countfile != "") { + rabund = new RAbundVector(); + createRabund(ct, list, rabund); //creates an rabund that includes the counts for the unique list + delete ct; + }else { rabund = new RAbundVector(list->getRAbundVector()); } + + delete read; read = NULL; + if (namefile != "") { delete nameMap; nameMap = NULL; } + + m->mothurOutEndLine(); m->mothurOut("Clustering " + thisDistFile); m->mothurOutEndLine(); + + //create cluster + float adjust = -1.0; + if (method == "furthest") { cluster = new CompleteLinkage(rabund, list, matrix, cutoff, method, adjust); } + else if(method == "nearest"){ cluster = new SingleLinkage(rabund, list, matrix, cutoff, method, adjust); } + else if(method == "average"){ cluster = new AverageLinkage(rabund, list, matrix, cutoff, method, adjust); } + tag = cluster->getTag(); + + if (outputDir == "") { outputDir += m->hasPath(thisDistFile); } + fileroot = outputDir + m->getRootName(m->getSimpleName(thisDistFile)); + + ofstream listFile; + m->openOutputFile(fileroot+ tag + ".list", listFile); + + listFileName = fileroot+ tag + ".list"; + + float previousDist = 0.00000; + float rndPreviousDist = 0.00000; + + oldList = *list; - cluster->update(saveCutoff); + print_start = true; + start = time(NULL); + double saveCutoff = cutoff; - float dist = matrix->getSmallDist(); - float rndDist; - if (hard) { - rndDist = m->ceilDist(dist, precision); - }else{ - rndDist = m->roundDist(dist, precision); + while (matrix->getSmallDist() < cutoff && matrix->getNNodes() > 0){ + + if (m->control_pressed) { //clean up + delete matrix; delete list; delete cluster; delete rabund; + listFile.close(); + m->mothurRemove(listFileName); + return listFileName; + } + + cluster->update(saveCutoff); + + float dist = matrix->getSmallDist(); + float rndDist; + if (hard) { + rndDist = m->ceilDist(dist, precision); + }else{ + rndDist = m->roundDist(dist, precision); + } + + if(previousDist <= 0.0000 && dist != previousDist){ + oldList.setLabel("unique"); + oldList.print(listFile); + if (labels.count("unique") == 0) { labels.insert("unique"); } + } + else if(rndDist != rndPreviousDist){ + oldList.setLabel(toString(rndPreviousDist, length-1)); + oldList.print(listFile); + if (labels.count(toString(rndPreviousDist, length-1)) == 0) { labels.insert(toString(rndPreviousDist, length-1)); } + } + + previousDist = dist; + rndPreviousDist = rndDist; + oldList = *list; } - if(previousDist <= 0.0000 && dist != previousDist){ + + if(previousDist <= 0.0000){ oldList.setLabel("unique"); oldList.print(listFile); - if (labels.count("unique") == 0) { labels.insert("unique"); } + if (labels.count("unique") == 0) { labels.insert("unique"); } } - else if(rndDist != rndPreviousDist){ + else if(rndPreviousDistcontrol_pressed) { //clean up + m->mothurRemove(listFileName); + return listFileName; + } + + if (deleteFiles) { + m->mothurRemove(thisDistFile); + m->mothurRemove(thisNamefile); + } + + if (saveCutoff != cutoff) { + if (hard) { saveCutoff = m->ceilDist(saveCutoff, precision); } + else { saveCutoff = m->roundDist(saveCutoff, precision); } + + m->mothurOut("Cutoff was " + toString(cutoff) + " changed cutoff to " + toString(saveCutoff)); m->mothurOutEndLine(); + } + + if (saveCutoff < smallestCutoff) { smallestCutoff = saveCutoff; } } + return listFileName; - - if(previousDist <= 0.0000){ - oldList.setLabel("unique"); - oldList.print(listFile); - if (labels.count("unique") == 0) { labels.insert("unique"); } - } - else if(rndPreviousDisterrorOut(e, "ClusterSplitCommand", "clusterFile"); + exit(1); + } +} +//********************************************************************************************************************** + +string ClusterSplitCommand::runVsearchCluster(string thisDistFile, string thisNamefile, set& labels, double& smallestCutoff){ + try { + + m->mothurOutEndLine(); m->mothurOut("Clustering " + thisDistFile); m->mothurOutEndLine(); - delete matrix; delete list; delete cluster; delete rabund; - matrix = NULL; list = NULL; cluster = NULL; rabund = NULL; - listFile.close(); + string vsearchFastafile = ""; VsearchFileParser* vParse; + if (namefile != "") { vParse = new VsearchFileParser(thisDistFile, thisNamefile, "name"); } + else if (countfile != "") { vParse = new VsearchFileParser(thisDistFile, thisNamefile, "count"); } + else { m->mothurOut("[ERROR]: Opps, should never get here. ClusterSplitCommand::runVsearchCluster() \n"); m->control_pressed = true; } - if (m->control_pressed) { //clean up - m->mothurRemove(listFileName); - return listFileName; - } + if (m->control_pressed) { return 0; } - if (deleteFiles) { - m->mothurRemove(thisDistFile); - m->mothurRemove(thisNamefile); - } + vsearchFastafile = vParse->getVsearchFile(); - if (saveCutoff != cutoff) { - if (hard) { saveCutoff = m->ceilDist(saveCutoff, precision); } - else { saveCutoff = m->roundDist(saveCutoff, precision); } - - m->mothurOut("Cutoff was " + toString(cutoff) + " changed cutoff to " + toString(saveCutoff)); m->mothurOutEndLine(); - } + if (cutoff > 1.0) { m->mothurOut("You did not set a cutoff, using 0.03.\n"); cutoff = 0.03; } + + //Run vsearch + string ucVsearchFile = m->getSimpleName(vsearchFastafile) + ".clustered.uc"; + string logfile = m->getSimpleName(vsearchFastafile) + ".clustered.log"; + vsearchDriver(vsearchFastafile, ucVsearchFile, logfile); + + if (m->control_pressed) { m->mothurRemove(ucVsearchFile); m->mothurRemove(logfile); m->mothurRemove(vsearchFastafile); return 0; } + + if (outputDir == "") { outputDir += m->hasPath(thisDistFile); } + tag = method; + string listFileName = outputDir + m->getRootName(m->getSimpleName(thisDistFile)) + tag + ".list"; + + //Convert outputted *.uc file into a list file + vParse->createListFile(ucVsearchFile, listFileName, "", "", vParse->getNumBins(logfile), toString(1.0-cutoff)); delete vParse; + + //remove temp files + m->mothurRemove(ucVsearchFile); m->mothurRemove(logfile); m->mothurRemove(vsearchFastafile); + + if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; } - if (saveCutoff < smallestCutoff) { smallestCutoff = saveCutoff; } + labels.insert(toString(cutoff)); smallestCutoff = cutoff; return listFileName; + } + catch(exception& e) { + m->errorOut(e, "ClusterSplitCommand", "runVsearchCluster"); + exit(1); + } +} +//********************************************************************************************************************** + +int ClusterSplitCommand::vsearchDriver(string inputFile, string ucClusteredFile, string logfile){ + try { - } - catch(exception& e) { - m->errorOut(e, "ClusterSplitCommand", "clusterFile"); - exit(1); - } + //vsearch --maxaccepts 16 --usersort --id 0.97 --minseqlength 30 --wordlength 8 --uc $ROOT.clustered.uc --cluster_smallmem $ROOT.sorted.fna --maxrejects 64 --strand both --log $ROOT.clustered.log --sizeorder + + + int numArgs = 11; if (method == "dgc") { numArgs = 10; } //no sizeorder for dgc + char** vsearchParameters; + vsearchParameters = new char*[numArgs]; + + vsearchParameters[0] = new char[8]; + *vsearchParameters[0] = '\0'; strncat(vsearchParameters[0], "vsearch", 7); + + int parameterCount = 1; + //--maxaccepts=16 + vsearchParameters[parameterCount] = new char[16]; *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], "--maxaccepts=16", 15); parameterCount++; + + //--usersort + vsearchParameters[parameterCount] = new char[11]; *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], "--usersort", 10); parameterCount++; + + //--id=0.97 + cutoff = abs(1.0 - cutoff); string cutoffString = toString(cutoff); + if (cutoffString.length() > 4) { cutoffString = cutoffString.substr(0, 4); } + else if (cutoffString.length() < 4) { for (int i = cutoffString.length(); i < 4; i++) { cutoffString += "0"; } } + + cutoffString = "--id=" + cutoffString; + vsearchParameters[parameterCount] = new char[cutoffString.length()+1]; *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], cutoffString.c_str(), cutoffString.length()); parameterCount++; + + //--minseqlength=30 + vsearchParameters[parameterCount] = new char[18]; *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], "--minseqlength=30", 17); parameterCount++; + + //--wordlength=8 + vsearchParameters[parameterCount] = new char[15]; *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], "--wordlength=8", 14); parameterCount++; + + //--uc=$ROOT.clustered.uc + string tempIn = "--uc=" + ucClusteredFile; + vsearchParameters[parameterCount] = new char[tempIn.length()+1]; + *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], tempIn.c_str(), tempIn.length()); + parameterCount++; + + //--cluster_smallmem $ROOT.sorted.fna + string tempSorted = "--cluster_smallmem=" + inputFile; + vsearchParameters[parameterCount] = new char[tempSorted.length()+1]; + *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], tempSorted.c_str(), tempSorted.length()); + parameterCount++; + + //--maxrejects=64 + vsearchParameters[parameterCount] = new char[16]; *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], "--maxrejects=64", 15); parameterCount++; + + //--strand=both + vsearchParameters[parameterCount] = new char[14]; *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], "--strand=both", 13); parameterCount++; + + //--log=$ROOT.clustered.log + string tempLog = "--log=" + logfile; + vsearchParameters[parameterCount] = new char[tempLog.length()+1]; + *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], tempLog.c_str(), tempLog.length()); + parameterCount++; + + + if (method == "agc") { + //--sizeorder + vsearchParameters[parameterCount] = new char[12]; *vsearchParameters[parameterCount] = '\0'; strncat(vsearchParameters[parameterCount], "--sizeorder", 11); parameterCount++; + } + + if (m->debug) { for(int i = 0; i < numArgs; i++) { cout << vsearchParameters[i]; } cout << endl; } + + errno = 0; + vsearch_main(numArgs, vsearchParameters); + + //free memory + for(int i = 0; i < numArgs; i++) { delete[] vsearchParameters[i]; } + delete[] vsearchParameters; + + return 0; + } + catch(exception& e) { + m->errorOut(e, "ClusterSplitCommand", "vsearchDriver"); + exit(1); + } } //********************************************************************************************************************** diff --git a/source/commands/clustersplitcommand.h b/source/commands/clustersplitcommand.h index c4345f4aa..c42c505d2 100644 --- a/source/commands/clustersplitcommand.h +++ b/source/commands/clustersplitcommand.h @@ -67,6 +67,8 @@ class ClusterSplitCommand : public Command { string readFile(vector< map >&); string printFile(string, vector< map >&); int getLabels(string, set& listLabels); + int vsearchDriver(string, string, string); + string runVsearchCluster(string, string, set&, double&); }; /////////////////not working for Windows//////////////////////////////////////////////////////////// diff --git a/source/commands/getotulabelscommand.cpp b/source/commands/getotulabelscommand.cpp index bbaed03a0..64492cb7f 100644 --- a/source/commands/getotulabelscommand.cpp +++ b/source/commands/getotulabelscommand.cpp @@ -35,14 +35,14 @@ vector GetOtuLabelsCommand::setParameters(){ string GetOtuLabelsCommand::getHelpString(){ try { string helpString = ""; - helpString += "The get.otulabels command can be used to select specific otus with the output from classify.otu, otu.association, or corr.axes commands. It can also be used to select a set of otus from a shared or list file.\n"; - helpString += "The get.otulabels parameters are: constaxonomy, otucorr, corraxes, shared, list, label and accnos.\n"; + helpString += "The get.otus command can be used to select specific otus with the output from classify.otu, otu.association, or corr.axes commands. It can also be used to select a set of otus from a shared or list file.\n"; + helpString += "The get.otus parameters are: constaxonomy, otucorr, corraxes, shared, list, label and accnos.\n"; helpString += "The constaxonomy parameter is used to input the results of the classify.otu command.\n"; helpString += "The otucorr parameter is used to input the results of the otu.association command.\n"; helpString += "The corraxes parameter is used to input the results of the corr.axes command.\n"; helpString += "The label parameter is used to analyze specific labels in your input. \n"; - helpString += "The get.otulabels commmand should be in the following format: \n"; - helpString += "get.otulabels(accnos=yourListOfOTULabels, corraxes=yourCorrAxesFile)\n"; + helpString += "The get.otus commmand should be in the following format: \n"; + helpString += "get.otus(accnos=yourListOfOTULabels, corraxes=yourCorrAxesFile)\n"; return helpString; } catch(exception& e) { diff --git a/source/commands/getotulabelscommand.h b/source/commands/getotulabelscommand.h index 06ad27162..60d131936 100644 --- a/source/commands/getotulabelscommand.h +++ b/source/commands/getotulabelscommand.h @@ -24,12 +24,12 @@ class GetOtuLabelsCommand : public Command { ~GetOtuLabelsCommand(){} vector setParameters(); - string getCommandName() { return "get.otulabels"; } + string getCommandName() { return "get.otus"; } string getCommandCategory() { return "OTU-Based Approaches"; } string getHelpString(); string getOutputPattern(string); - string getCitation() { return "http://www.mothur.org/wiki/Get.otulabels"; } + string getCitation() { return "http://www.mothur.org/wiki/Get.otus"; } string getDescription() { return "Can be used with output from classify.otu, otu.association, or corr.axes to select specific otus."; } int execute(); diff --git a/source/commands/removeotulabelscommand.cpp b/source/commands/removeotulabelscommand.cpp index 5fd84b977..de47d8044 100644 --- a/source/commands/removeotulabelscommand.cpp +++ b/source/commands/removeotulabelscommand.cpp @@ -35,14 +35,14 @@ vector RemoveOtuLabelsCommand::setParameters(){ string RemoveOtuLabelsCommand::getHelpString(){ try { string helpString = ""; - helpString += "The remove.otulabels command can be used to remove specific otus with the output from classify.otu, otu.association, or corr.axes. It can also be used to select a set of otus from a shared or list file.\n"; - helpString += "The remove.otulabels parameters are: constaxonomy, otucorr, corraxes, shared, list, label and accnos.\n"; + helpString += "The remove.otus command can be used to remove specific otus with the output from classify.otu, otu.association, or corr.axes. It can also be used to select a set of otus from a shared or list file.\n"; + helpString += "The remove.otus parameters are: constaxonomy, otucorr, corraxes, shared, list, label and accnos.\n"; helpString += "The constaxonomy parameter is input the results of the classify.otu command.\n"; helpString += "The otucorr parameter is input the results of the otu.association command.\n"; helpString += "The corraxes parameter is input the results of the corr.axes command.\n"; helpString += "The label parameter is used to analyze specific labels in your input. \n"; - helpString += "The remove.otulabels commmand should be in the following format: \n"; - helpString += "remove.otulabels(accnos=yourListOfOTULabels, corraxes=yourCorrAxesFile)\n"; + helpString += "The remove.otus commmand should be in the following format: \n"; + helpString += "remove.otus(accnos=yourListOfOTULabels, corraxes=yourCorrAxesFile)\n"; return helpString; } catch(exception& e) { diff --git a/source/commands/removeotulabelscommand.h b/source/commands/removeotulabelscommand.h index 2fdb007f3..2da2690ee 100644 --- a/source/commands/removeotulabelscommand.h +++ b/source/commands/removeotulabelscommand.h @@ -24,12 +24,12 @@ class RemoveOtuLabelsCommand : public Command { ~RemoveOtuLabelsCommand(){} vector setParameters(); - string getCommandName() { return "remove.otulabels"; } + string getCommandName() { return "remove.otus"; } string getCommandCategory() { return "OTU-Based Approaches"; } string getHelpString(); string getOutputPattern(string); - string getCitation() { return "http://www.mothur.org/wiki/Get.otulabels"; } + string getCitation() { return "http://www.mothur.org/wiki/Get.otus"; } string getDescription() { return "Can be used with output from classify.otu, otu.association, or corr.axes to remove specific otus."; } int execute(); diff --git a/source/read/splitmatrix.cpp b/source/read/splitmatrix.cpp index 356ee7499..8dee944d8 100644 --- a/source/read/splitmatrix.cpp +++ b/source/read/splitmatrix.cpp @@ -23,10 +23,11 @@ SplitMatrix::SplitMatrix(string distfile, string name, string count, string tax, taxFile = tax; countfile = count; large = l; + outputType = "distance"; } /***********************************************************************/ -SplitMatrix::SplitMatrix(string ffile, string name, string count, string tax, float c, float cu, string t, int p, bool cl, string output){ +SplitMatrix::SplitMatrix(string ffile, string name, string count, string tax, float c, float cu, string t, int p, bool cl, string output, string ot){ m = MothurOut::getInstance(); fastafile = ffile; namefile = name; @@ -38,6 +39,7 @@ SplitMatrix::SplitMatrix(string ffile, string name, string count, string tax, fl processors = p; classic = cl; outputDir = output; + outputType = ot; } /***********************************************************************/ @@ -183,43 +185,47 @@ int SplitMatrix::createDistanceFilesFromTax(map& seqGroup, int numG if (error) { exit(1); } - //process each distance file - for (int i = 0; i < numGroups; i++) { - - string options = ""; - if (classic) { options = "fasta=" + (fastafile + "." + toString(i) + ".temp") + ", processors=" + toString(processors) + ", output=lt"; } - else { options = "fasta=" + (fastafile + "." + toString(i) + ".temp") + ", processors=" + toString(processors) + ", cutoff=" + toString(distCutoff); } - if (outputDir != "") { options += ", outputdir=" + outputDir; } - - m->mothurCalling = true; - m->mothurOut("/******************************************/"); m->mothurOutEndLine(); - m->mothurOut("Running command: dist.seqs(" + options + ")"); m->mothurOutEndLine(); - m->mothurCalling = true; - - Command* command = new DistanceCommand(options); - - m->mothurOut("/******************************************/"); m->mothurOutEndLine(); - - command->execute(); - delete command; - m->mothurCalling = false; - - m->mothurRemove((fastafile + "." + toString(i) + ".temp")); - - //remove old names files just in case - if (namefile != "") { m->mothurRemove((namefile + "." + toString(i) + ".temp")); } - else { m->mothurRemove((countfile + "." + toString(i) + ".temp")); } - } + if (outputType == "distance") { //create distance matrices for each fasta file + //process each distance file + for (int i = 0; i < numGroups; i++) { + + string options = ""; + if (classic) { options = "fasta=" + (fastafile + "." + toString(i) + ".temp") + ", processors=" + toString(processors) + ", output=lt"; } + else { options = "fasta=" + (fastafile + "." + toString(i) + ".temp") + ", processors=" + toString(processors) + ", cutoff=" + toString(distCutoff); } + if (outputDir != "") { options += ", outputdir=" + outputDir; } + + m->mothurCalling = true; + m->mothurOut("/******************************************/"); m->mothurOutEndLine(); + m->mothurOut("Running command: dist.seqs(" + options + ")"); m->mothurOutEndLine(); + m->mothurCalling = true; + + Command* command = new DistanceCommand(options); + + m->mothurOut("/******************************************/"); m->mothurOutEndLine(); + + command->execute(); + delete command; + m->mothurCalling = false; + + m->mothurRemove((fastafile + "." + toString(i) + ".temp")); + + //remove old names files just in case + if (namefile != "") { m->mothurRemove((namefile + "." + toString(i) + ".temp")); } + else { m->mothurRemove((countfile + "." + toString(i) + ".temp")); } + } + } //restore old fasta file name since dist.seqs overwrites it with the temp files m->setFastaFile(fastafile); vector tempDistFiles; for(int i=0;ihasPath(fastafile); } - string tempDistFile = ""; - if (classic) { tempDistFile = outputDir + m->getRootName(m->getSimpleName((fastafile + "." + toString(i) + ".temp"))) + "phylip.dist";} - else { tempDistFile = outputDir + m->getRootName(m->getSimpleName((fastafile + "." + toString(i) + ".temp"))) + "dist"; } + string tempDistFile = (fastafile + "." + toString(i) + ".temp"); + if (outputType == "distance") { + if (classic) { tempDistFile = outputDir + m->getRootName(m->getSimpleName((fastafile + "." + toString(i) + ".temp"))) + "phylip.dist";} + else { tempDistFile = outputDir + m->getRootName(m->getSimpleName((fastafile + "." + toString(i) + ".temp"))) + "dist"; } + } tempDistFiles.push_back(tempDistFile); } diff --git a/source/read/splitmatrix.h b/source/read/splitmatrix.h index 7b468e998..32a50a757 100644 --- a/source/read/splitmatrix.h +++ b/source/read/splitmatrix.h @@ -20,7 +20,7 @@ class SplitMatrix { public: SplitMatrix(string, string, string, string, float, string, bool); //column formatted distance file, namesfile, countfile, cutoff, method, large - SplitMatrix(string, string, string, string, float, float, string, int, bool, string); //fastafile, namefile, countfile, taxFile, taxcutoff, cutoff, method, processors, classic, outputDir + SplitMatrix(string, string, string, string, float, float, string, int, bool, string, string); //fastafile, namefile, countfile, taxFile, taxcutoff, cutoff, method, processors, classic, outputDir, ("fasta" or "distance") ~SplitMatrix(); int split(); @@ -30,7 +30,7 @@ class SplitMatrix { private: MothurOut* m; - string distFile, namefile, singleton, method, taxFile, fastafile, outputDir, countfile; + string distFile, namefile, singleton, method, taxFile, fastafile, outputDir, countfile, outputType; vector< map< string, string> > dists; float cutoff, distCutoff; bool large, classic; diff --git a/source/vsearch_src/abundance.h b/source/vsearch_src/abundance.h index 71663d95e..6d36474f7 100644 --- a/source/vsearch_src/abundance.h +++ b/source/vsearch_src/abundance.h @@ -61,6 +61,10 @@ */ +#if defined(_WIN32) +#include +#include +#endif typedef struct abundance_s { diff --git a/source/vsearch_src/arch.cc b/source/vsearch_src/arch.cc index 4a4946d04..a22c788f3 100644 --- a/source/vsearch_src/arch.cc +++ b/source/vsearch_src/arch.cc @@ -58,19 +58,29 @@ */ +#if defined(_WIN32) +#include +#include +#endif + #include "vsearch.h" + unsigned long arch_get_memused() { struct rusage r_usage; getrusage(RUSAGE_SELF, & r_usage); - -#if defined __APPLE__ + +#if defined (__APPLE__) || (__MACH__) /* Mac: ru_maxrss gives the size in bytes */ return r_usage.ru_maxrss; -#else +#elif (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) /* Linux: ru_maxrss gives the size in kilobytes */ return r_usage.ru_maxrss * 1024; +#else + PROCESS_MEMORY_COUNTERS info; + GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) ); + return (size_t)info.PeakWorkingSetSize; #endif } diff --git a/source/vsearch_src/vsearch.cc b/source/vsearch_src/vsearch.cc index 9ee05f72e..d1e3352f7 100644 --- a/source/vsearch_src/vsearch.cc +++ b/source/vsearch_src/vsearch.cc @@ -2025,7 +2025,7 @@ int vsearch_main(int argc, char *argv[]) } show_header(); -fprintf(stdout, "show_header\n"); + if (!sse2_present) fatal("Sorry, this program requires a cpu with SSE2."); diff --git a/source/vsearch_src/vsearch.h b/source/vsearch_src/vsearch.h index 753e85043..3e0f06bfb 100644 --- a/source/vsearch_src/vsearch.h +++ b/source/vsearch_src/vsearch.h @@ -154,6 +154,8 @@ #endif #else #define PROG_ARCH "Windows_x86_64" + #include + #include #endif diff --git a/source/vsearch_src/vsearchfileparser.cpp b/source/vsearch_src/vsearchfileparser.cpp index e52a34431..d938fc06d 100644 --- a/source/vsearch_src/vsearchfileparser.cpp +++ b/source/vsearch_src/vsearchfileparser.cpp @@ -185,13 +185,15 @@ int VsearchFileParser::createListFile(string inputFile, string listFile, string }else { list.print(out); - //print sabund and rabund - ofstream sabund, rabund; - m->openOutputFile(sabundFile, sabund); - m->openOutputFile(rabundFile, rabund); + if ((sabundFile != "") && (rabundFile != "")){ + //print sabund and rabund + ofstream sabund, rabund; + m->openOutputFile(sabundFile, sabund); + m->openOutputFile(rabundFile, rabund); - list.getRAbundVector().print(rabund); rabund.close(); - list.getSAbundVector().print(sabund); sabund.close(); + list.getRAbundVector().print(rabund); rabund.close(); + list.getSAbundVector().print(sabund); sabund.close(); + } } out.close();