]> git.donarmstrong.com Git - mothur.git/commitdiff
classify.seqs allows sequences to be in taxonomy file that are not in template. ...
authorSarah Westcott <mothur.westcott@gmail.com>
Tue, 30 Oct 2012 18:04:45 +0000 (14:04 -0400)
committerSarah Westcott <mothur.westcott@gmail.com>
Tue, 30 Oct 2012 18:04:45 +0000 (14:04 -0400)
18 files changed:
Mothur.xcodeproj/project.pbxproj
bayesian.cpp
classify.cpp
classifyseqscommand.cpp
clearcutcommand.cpp
clustercommand.cpp
clustersplitcommand.cpp
getlineagecommand.cpp
listvector.cpp
makefile
matrixoutputcommand.cpp
mothurout.cpp
phylosummary.cpp
removelineagecommand.cpp
splitgroupscommand.cpp
splitmatrix.cpp
treegroupscommand.cpp
unifracweightedcommand.cpp

index ecb0619a39d993201f9bd102813c9b10b7cc3f0b..df58a36026bed6961481c3e31efeccf6a8086810 100644 (file)
                8DD76FAF0486AB0100D96B5E /* CopyFiles */ = {
                        isa = PBXCopyFilesBuildPhase;
                        buildActionMask = 8;
-                       dstPath = /usr/share/man/man1/;
-                       dstSubfolderSpec = 0;
+                       dstPath = Users/SarahsWork/desktop/debug;
+                       dstSubfolderSpec = 16;
                        files = (
                                8DD76FB00486AB0100D96B5E /* mothur.1 in CopyFiles */,
                        );
                                A7E9B67112D37EC400DA6239 /* canberra.h */,
                                A7E9B67612D37EC400DA6239 /* chao1.cpp */,
                                A7E9B67712D37EC400DA6239 /* chao1.h */,
-                               A7E9B6A412D37EC400DA6239 /* cmdargs.cpp */,
-                               A7E9B6A512D37EC400DA6239 /* cmdargs.h */,
                                A7E9B6BB12D37EC400DA6239 /* coverage.cpp */,
                                A7E9B6BC12D37EC400DA6239 /* coverage.h */,
                                A7E9B6CA12D37EC400DA6239 /* dist.h */,
                        children = (
                                A7E9B69412D37EC400DA6239 /* clearcut.cpp */,
                                A7E9B69512D37EC400DA6239 /* clearcut.h */,
+                               A7E9B6A412D37EC400DA6239 /* cmdargs.cpp */,
+                               A7E9B6A512D37EC400DA6239 /* cmdargs.h */,
                                A7E9B6B312D37EC400DA6239 /* common.h */,
                                A7E9B6CF12D37EC400DA6239 /* distclearcut.cpp */,
                                A7E9B6D012D37EC400DA6239 /* distclearcut.h */,
                                ALWAYS_SEARCH_USER_PATHS = NO;
                                COPY_PHASE_STRIP = NO;
                                DEPLOYMENT_LOCATION = YES;
+                               DSTROOT = TARGET_BUILD_DIR;
+                               "DSTROOT[sdk=*]" = TARGET_BUILD_DIR;
                                GCC_DYNAMIC_NO_PIC = NO;
                                GCC_MODEL_TUNING = G5;
                                GCC_OPTIMIZATION_LEVEL = 3;
+                               "INSTALL_PATH[sdk=*]" = TARGET_BUILD_DIR;
                                PRODUCT_NAME = mothur;
                                SDKROOT = macosx10.6;
                                SKIP_INSTALL = NO;
                                ALWAYS_SEARCH_USER_PATHS = NO;
                                DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
                                DEPLOYMENT_LOCATION = YES;
+                               DSTROOT = TARGET_BUILD_DIR;
                                GCC_MODEL_TUNING = G5;
                                GCC_OPTIMIZATION_LEVEL = 3;
                                GCC_WARN_UNUSED_VALUE = YES;
                                1DEB928708733DD80010E9CD /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
+                       defaultConfigurationName = Debug;
                };
                1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "Mothur" */ = {
                        isa = XCConfigurationList;
                                1DEB928B08733DD80010E9CD /* Release */,
                        );
                        defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
+                       defaultConfigurationName = Debug;
                };
 /* End XCConfigurationList section */
        };
index 49be4af57ff66f46ac04912535d7918518cc75d2..cf70010e76a6b9cba77b8ade2fcd7d18713391d3 100644 (file)
@@ -255,9 +255,8 @@ Classify(), kmerSize(ksize), confidenceThreshold(cutoff), iters(i) {
 /**************************************************************************************************/
 Bayesian::~Bayesian() {
        try {
-               
-                delete phyloTree; 
-                if (database != NULL) {  delete database; }
+        if (phyloTree != NULL) { delete phyloTree; }
+        if (database != NULL) {  delete database; }
        }
        catch(exception& e) {
                m->errorOut(e, "Bayesian", "~Bayesian");
index 15ef0aa75dfc5793d1d1bef68996f477134e99a3..36179f471da4ac5d40b563e609feb2f8d3d32e6c 100644 (file)
@@ -236,7 +236,7 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me
        }
 }
 /**************************************************************************************************/
-Classify::Classify() {         m = MothurOut::getInstance();   database = NULL;        flipped=false; }
+Classify::Classify() {         m = MothurOut::getInstance();   database = NULL;        phyloTree=NULL; flipped=false; }
 /**************************************************************************************************/
 
 int Classify::readTaxonomy(string file) {
index 7f262bf9019de7e26d611e9d8b6c37c9f47e7cc6..0012cd246e5f9e708c7fcbdc52c22f2176200578 100644 (file)
@@ -634,7 +634,7 @@ int ClassifySeqsCommand::execute(){
                        m->mothurOut("Classifying sequences from " + fastaFileNames[s] + " ..." ); m->mothurOutEndLine();
                        
                        string baseTName = m->getSimpleName(taxonomyFileName);
-                       if (taxonomyFileName == "saved") {baseTName = rdb->getSavedTaxonomy();  }
+                       if (taxonomyFileName == "saved") {  baseTName = rdb->getSavedTaxonomy();        }
                        
             //set rippedTaxName to 
                        string RippedTaxName = "";
@@ -897,6 +897,7 @@ int ClassifySeqsCommand::execute(){
                                }
                        #endif
                }
+        delete classify;
         
         m->mothurOutEndLine();
         m->mothurOut("Output File Names: "); m->mothurOutEndLine();
@@ -916,7 +917,7 @@ int ClassifySeqsCommand::execute(){
                        if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setAccnosFile(current); }
                }
                
-               delete classify;
+               
                
                return 0;
        }
index 6a0eb259379df8480341a5542a7456fc674aea74..55fbe0a1dceb9a2d2c16e2f6936646d3e851ee19 100644 (file)
@@ -269,51 +269,50 @@ int ClearcutCommand::execute() {
                
                vector<char*> cPara;
                
-               char* tempClearcut = new char[8];  
-               strcpy(tempClearcut, "clearcut"); 
+               char* tempClearcut = new char[9];  
+               *tempClearcut = '\0'; strncat(tempClearcut, "clearcut", 8); 
                cPara.push_back(tempClearcut);
                                
                //you gave us a distance matrix
-               if (phylipfile != "") {  char* temp = new char[10];  strcpy(temp, "--distance");  cPara.push_back(temp);        }
+               if (phylipfile != "") {  char* temp = new char[11];  *temp = '\0'; strncat(temp, "--distance", 10);  cPara.push_back(temp);     }
                
                //you gave us a fastafile
-               if (fastafile != "") { char* temp = new char[11];  strcpy(temp, "--alignment");  cPara.push_back(temp);         }
+               if (fastafile != "") { char* temp = new char[12];  *temp = '\0'; strncat(temp, "--alignment", 11);  cPara.push_back(temp);      }
                
-               if (version)                    {  char* temp = new char[9];  strcpy(temp, "--version");  cPara.push_back(temp);        }
-               if (verbose)                    {  char* temp = new char[9];  strcpy(temp, "--verbose");  cPara.push_back(temp);        }
-               if (quiet)                              {  char* temp = new char[7];  strcpy(temp, "--quiet");  cPara.push_back(temp);  }
+               if (version)                    {  char* temp = new char[10];  *temp = '\0'; strncat(temp, "--version", 9);  cPara.push_back(temp);     }
+               if (verbose)                    {  char* temp = new char[10];  *temp = '\0'; strncat(temp, "--verbose", 9);  cPara.push_back(temp);     }
+               if (quiet)                              {  char* temp = new char[8];  *temp = '\0'; strncat(temp, "--quiet", 7);  cPara.push_back(temp);        }
                if (seed != "*")                {  
                        string tempSeed = "--seed=" + seed;
-                       char* temp = new char[tempSeed.length()];
-                       strcpy(temp, tempSeed.c_str());
+                       char* temp = new char[tempSeed.length()+1];
+                       *temp = '\0'; strncat(temp, tempSeed.c_str(), tempSeed.length());
                        cPara.push_back(temp);
                }
-               if (norandom)                   {  char* temp = new char[10];  strcpy(temp, "--norandom");  cPara.push_back(temp);      }
-               if (shuffle)                    {  char* temp = new char[9];  strcpy(temp, "--shuffle");  cPara.push_back(temp);        }
-               if (neighbor)                   {  char* temp = new char[10];  strcpy(temp, "--neighbor");  cPara.push_back(temp);      }
+               if (norandom)                   {  char* temp = new char[11];  *temp = '\0'; strncat(temp, "--norandom", 10);  cPara.push_back(temp);   }
+               if (shuffle)                    {  char* temp = new char[10];  *temp = '\0'; strncat(temp, "--shuffle", 9);  cPara.push_back(temp);     }
+               if (neighbor)                   {  char* temp = new char[11];  *temp = '\0'; strncat(temp, "--neighbor", 10);  cPara.push_back(temp);   }
                
                string tempIn = "--in=" + inputFile;  
-               char* tempI = new char[tempIn.length()];
-               strcpy(tempI, tempIn.c_str());
+               char* tempI = new char[tempIn.length()+1];
+               *tempI = '\0'; strncat(tempI, tempIn.c_str(), tempIn.length());
                cPara.push_back(tempI);
                
-               if (stdoutWanted)               {  char* temp = new char[8];  strcpy(temp, "--stdout");  cPara.push_back(temp); }
+               if (stdoutWanted)               {  char* temp = new char[9];  *temp = '\0'; strncat(temp, "--stdout", 8);  cPara.push_back(temp);       }
                else{  
                        string tempOut = "--out=" + outputName;  
-                       
-                       char* temp = new char[tempOut.length()];
-                       strcpy(temp, tempOut.c_str());
+                       char* temp = new char[tempOut.length()+1];
+                       *temp = '\0'; strncat(temp, tempOut.c_str(), tempOut.length());
                        cPara.push_back(temp);
                }
                        
-               if (DNA)                                {  char* temp = new char[5];  strcpy(temp, "--DNA");  cPara.push_back(temp);            }
-               if (protein)                    {  char* temp = new char[9];  strcpy(temp, "--protein");  cPara.push_back(temp);        }
-               if (jukes)                              {  char* temp = new char[7];  strcpy(temp, "--jukes");  cPara.push_back(temp);          }
-               if (kimura)                             { char* temp = new char[8];  strcpy(temp, "--kimura");  cPara.push_back(temp);          }
+               if (DNA)                                {  char* temp = new char[6];  *temp = '\0'; strncat(temp, "--DNA", 5);  cPara.push_back(temp);          }
+               if (protein)                    {  char* temp = new char[10];  *temp = '\0'; strncat(temp, "--protein", 9);  cPara.push_back(temp);     }
+               if (jukes)                              {  char* temp = new char[8];  *temp = '\0'; strncat(temp, "--jukes", 7);  cPara.push_back(temp);                }
+               if (kimura)                             { char* temp = new char[9];  *temp = '\0'; strncat(temp, "--kimura", 8);  cPara.push_back(temp);                }
                if (matrixout != "")    {  
                        string tempMatrix =  "--matrixout=" + outputDir + matrixout; 
-                       char* temp = new char[tempMatrix.length()];
-                       strcpy(temp, tempMatrix.c_str());
+                       char* temp = new char[tempMatrix.length()+1];
+                       *temp = '\0'; strncat(temp, tempMatrix.c_str(), tempMatrix.length());
                        cPara.push_back(temp);
                        outputNames.push_back((outputDir + matrixout));
                        outputTypes["matrixout"].push_back((outputDir + matrixout));
@@ -321,13 +320,13 @@ int ClearcutCommand::execute() {
 
                if (ntrees != "1")              {  
                        string tempNtrees = "--ntrees=" + ntrees; 
-                       char* temp = new char[tempNtrees.length()];
-                       strcpy(temp, tempNtrees.c_str());
+                       char* temp = new char[tempNtrees.length()+1];
+                       *temp = '\0'; strncat(temp, tempNtrees.c_str(), tempNtrees.length());
                        cPara.push_back(temp);
                }
 
-               if (expblen)                    { char* temp = new char[9];  strcpy(temp, "--expblen");  cPara.push_back(temp);         }
-               if (expdist)                    { char* temp = new char[9];  strcpy(temp, "--expdist");  cPara.push_back(temp); }
+               if (expblen)                    { char* temp = new char[10];  *temp = '\0'; strncat(temp, "--expblen", 9);  cPara.push_back(temp);      }
+               if (expdist)                    { char* temp = new char[10];  *temp = '\0'; strncat(temp, "--expdist", 9);  cPara.push_back(temp);      }
                
                char** clearcutParameters;
                clearcutParameters = new char*[cPara.size()];
index 06e627a615dacf69fe80464db0123582bef510ed..b46e1fb14f9aaf9c34a94216ffd5692c4f043148 100644 (file)
@@ -312,7 +312,7 @@ int ClusterCommand::execute(){
             ct = new CountTable();
             ct->readTable(countfile);
             read->read(ct);
-        }
+        }else { read->read(nameMap); }
                
                list = read->getListVector();
                matrix = read->getDMatrix();
index b3ce0f938c90d55fcfb86360677e3fd5e93a01b5..09c2da84c64b2d0558ede1bf5bde35b1ddfc43cd 100644 (file)
@@ -1285,7 +1285,7 @@ string ClusterSplitCommand::clusterFile(string thisDistFile, string thisNamefile
             ct = new CountTable();
             ct->readTable(thisNamefile);
             read->read(ct);
-        }
+        }else { read->read(nameMap); }
                
                list = read->getListVector();
         oldList = *list;
index 645655d03f72bbebac45cfa108c499cc1daf8e3b..99359bd882e1e2b668cd6bef2b2ec7cfc32fc0bf 100644 (file)
@@ -814,20 +814,27 @@ int GetLineageCommand::readTax(){
 /**************************************************************************************************/
 vector< map<string, float> > GetLineageCommand::getTaxons(string tax) {
        try {
-               
+        
                vector< map<string, float> > t;
                string taxon = "";
                int taxLength = tax.length();
+        
                for(int i=0;i<taxLength;i++){
                        if(tax[i] == ';'){
-               
-                               int openParen = taxon.find_first_of('(');
+                
+                               int openParen = taxon.find_last_of('(');
                                int closeParen = taxon.find_last_of(')');
                                
                                string newtaxon, confidence;
                                if ((openParen != string::npos) && (closeParen != string::npos)) {
-                                       newtaxon = taxon.substr(0, openParen); //rip off confidence
-                                       confidence = taxon.substr((openParen+1), (closeParen-openParen-1));  
+                    string confidenceScore = taxon.substr(openParen+1, (closeParen-(openParen+1)));
+                    if (m->isNumeric1(confidenceScore)) {  //its a confidence
+                        newtaxon = taxon.substr(0, openParen); //rip off confidence
+                        confidence = taxon.substr((openParen+1), (closeParen-openParen-1));  
+                    }else { //its part of the taxon
+                        newtaxon = taxon;
+                        confidence = "0";
+                    }
                                }else{
                                        newtaxon = taxon;
                                        confidence = "0";
@@ -837,12 +844,13 @@ vector< map<string, float> > GetLineageCommand::getTaxons(string tax) {
                                
                                map<string, float> temp;
                                temp[newtaxon] = con;
+                
                                t.push_back(temp);
-                               
                                taxon = "";
                        }
                        else{
                                taxon += tax[i];
+                
                        }
                }
                
index 9369a12280b35cd41a6a6e3548258f27ebb36b5c..2758c94264a1ba527e8d7c3970e0bac53254579b 100644 (file)
 #include "ordervector.hpp"
 #include "listvector.hpp"
 
+//sorts highest to lowest
+/***********************************************************************/
+inline bool abundNamesSort(string left, string right){
+    
+    int countLeft = 0;
+    if(left != ""){
+        countLeft = 1;
+        for(int i=0;i<left.size();i++){  if(left[i] == ','){  countLeft++;  }  }
+    }
+    
+    int countRight = 0;
+    if(right != ""){
+        countRight = 1;
+        for(int i=0;i<right.size();i++){  if(right[i] == ','){  countRight++;  }  }
+    }
+    
+       if (countLeft > countRight) {
+        return true;
+    }
+    return false;      
+} 
 
 /***********************************************************************/
 
@@ -135,9 +156,12 @@ void ListVector::print(ostream& output){
        try {
                output << label << '\t' << numBins << '\t';
        
-               for(int i=0;i<data.size();i++){
-                       if(data[i] != ""){
-                               output << data[i] << '\t';
+        vector<string> hold = data;
+        sort(hold.begin(), hold.end(), abundNamesSort);
+        
+               for(int i=0;i<hold.size();i++){
+                       if(hold[i] != ""){
+                               output << hold[i] << '\t';
                        }
                }
                output << endl;
index bc5a569e31cd2e12526bb20244adb75e58333ece..458450570c000e848f217d995a9d8d976e9d637d 100644 (file)
--- a/makefile
+++ b/makefile
@@ -15,9 +15,9 @@ USEREADLINE ?= yes
 CYGWIN_BUILD ?= no
 USECOMPRESSION ?= no
 MOTHUR_FILES="\"Enter_your_default_path_here\""
-RELEASE_DATE = "\"7/9/2012\""
-VERSION = "\"1.26.0\""
-FORTAN_COMPILER = /usr/local/gfortran/bin/gfortran
+RELEASE_DATE = "\"11/2/2012\""
+VERSION = "\"1.28.0\""
+FORTAN_COMPILER = gfortran
 FORTRAN_FLAGS = 
 
 # Optimize to level 3:
index a886992a1120f36ff361e7f2a9b02921140bb731..ccd4f538ab03f7ea86c59b2d3381d2de1a2de52f 100644 (file)
@@ -199,7 +199,7 @@ MatrixOutputCommand::MatrixOutputCommand(string option)  {
                 else { subsample = false; }
             }
             
-            if (subsample == false) { iters = 1; }
+            if (subsample == false) { iters = 0; }
             
                        if (abort == false) {
                        
@@ -675,6 +675,7 @@ int MatrixOutputCommand::process(vector<SharedRAbundVector*> thisLookup){
                     
                     string distFileName = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + matrixCalculators[i]->getName() + "." + thisLookup[0]->getLabel()  + "." + output + "." + getOutputFileNameTag("phylip");
                     outputNames.push_back(distFileName); outputTypes["phylip"].push_back(distFileName);
+                    
                     ofstream outDist;
                     m->openOutputFile(distFileName, outDist);
                     outDist.setf(ios::fixed, ios::floatfield); outDist.setf(ios::showpoint);
@@ -687,7 +688,7 @@ int MatrixOutputCommand::process(vector<SharedRAbundVector*> thisLookup){
             for (int i = 0; i < calcDists.size(); i++) {  calcDists[i].clear(); }
                }
                
-        if (iters != 1) {
+        if (iters != 0) {
             //we need to find the average distance and standard deviation for each groups distance
             
             vector< vector<seqDist>  > calcAverages; calcAverages.resize(matrixCalculators.size()); 
index 37c0916d4c49e1f8ed8ca979c7ff61b7e1a13ef3..124fbb876b38def3d61f1bf425ef15f36237fa5f 100644 (file)
@@ -1183,7 +1183,7 @@ string MothurOut::sortFile(string distFile, string outputDir){
 
                        string firstName, secondName;
                        float dist;
-                       while (input) {
+                       while (!input.eof()) {
                                input >> firstName >> secondName >> dist;
                                output << dist << '\t' << firstName << '\t' << secondName << endl;
                                gobble(input);
@@ -1199,16 +1199,17 @@ string MothurOut::sortFile(string distFile, string outputDir){
                
                        //read in sorted file and put distance at end again
                        ifstream input2;
+            ofstream output2;
                        openInputFile(tempOutfile, input2);
-                       openOutputFile(outfile, output);
+                       openOutputFile(outfile, output2);
                
-                       while (input2) {
+            while (!input2.eof()) {
                                input2 >> dist >> firstName >> secondName;
-                               output << firstName << '\t' << secondName << '\t' << dist << endl;
+                               output2 << firstName << '\t' << secondName << '\t' << dist << endl;
                                gobble(input2);
                        }
                        input2.close();
-                       output.close();
+                       output2.close();
                
                        //remove temp files
                        mothurRemove(tempDistFile);
@@ -2470,6 +2471,9 @@ void MothurOut::getNumSeqs(ifstream& file, int& numSeqs){
 //This function parses the estimator options and puts them in a vector
 void MothurOut::splitAtChar(string& estim, vector<string>& container, char symbol) {
        try {
+        
+        if (symbol == '-') { splitAtDash(estim, container); return; }
+        
                string individual = "";
                int estimLength = estim.size();
                for(int i=0;i<estimLength;i++){
index ab6bb831dfae73bb56c75eb8b144963701dc02be..9717087d72a55a6bc28ce2d77f02545a7eb5b612 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "phylosummary.h"
+#include "referencedb.h"
 /**************************************************************************************************/
 
 PhyloSummary::PhyloSummary(string refTfile, CountTable* c){
@@ -21,6 +22,7 @@ PhyloSummary::PhyloSummary(string refTfile, CountTable* c){
         groupmap = NULL;
         
                //check for necessary files
+        if (refTfile == "saved") { ReferenceDB* rdb = ReferenceDB::getInstance(); refTfile = rdb->getSavedTaxonomy(); }
                string taxFileNameTest = m->getFullPathName((refTfile.substr(0,refTfile.find_last_of(".")+1) + "tree.sum"));
                ifstream FileTest(taxFileNameTest.c_str());
                
@@ -72,6 +74,7 @@ PhyloSummary::PhyloSummary(string refTfile, GroupMap* g){
         ct = NULL;
                                
                //check for necessary files
+        if (refTfile == "saved") { ReferenceDB* rdb = ReferenceDB::getInstance(); refTfile = rdb->getSavedTaxonomy(); }
                string taxFileNameTest = m->getFullPathName((refTfile.substr(0,refTfile.find_last_of(".")+1) + "tree.sum"));
                ifstream FileTest(taxFileNameTest.c_str());
                
index 2b930b5e2450cc15b7871923fb02dbcc1c5824ee..56b24cd99d359c312fbac29f3457fe3f8dba3749 100644 (file)
@@ -814,25 +814,30 @@ vector< map<string, float> > RemoveLineageCommand::getTaxons(string tax) {
                int taxLength = tax.length();
                for(int i=0;i<taxLength;i++){
                        if(tax[i] == ';'){
-                               
-                               int openParen = taxon.find_first_of('(');
+                
+                               int openParen = taxon.find_last_of('(');
                                int closeParen = taxon.find_last_of(')');
                                
                                string newtaxon, confidence;
                                if ((openParen != string::npos) && (closeParen != string::npos)) {
-                                       newtaxon = taxon.substr(0, openParen); //rip off confidence
-                                       confidence = taxon.substr((openParen+1), (closeParen-openParen-1));  
+                    string confidenceScore = taxon.substr(openParen+1, (closeParen-(openParen+1)));
+                    if (m->isNumeric1(confidenceScore)) {  //its a confidence
+                        newtaxon = taxon.substr(0, openParen); //rip off confidence
+                        confidence = taxon.substr((openParen+1), (closeParen-openParen-1));  
+                    }else { //its part of the taxon
+                        newtaxon = taxon;
+                        confidence = "0";
+                    }
                                }else{
                                        newtaxon = taxon;
                                        confidence = "0";
-                               }
+                               } 
                                float con = 0;
                                convert(confidence, con);
                                
                                map<string, float> temp;
                                temp[newtaxon] = con;
                                t.push_back(temp);
-                               
                                taxon = "";
                        }
                        else{
index f3c6cd9e2b7a5e5308bc6624bb4489062f71b2a8..bc521127a57a8c3a4537ab0dfdd4ed187543d46d 100644 (file)
@@ -36,14 +36,14 @@ vector<string> SplitGroupCommand::setParameters(){
 string SplitGroupCommand::getHelpString(){     
        try {
                string helpString = "";
-               helpString += "The split.group command reads a group or count file, and parses your fasta and names or count files by groups. \n";
-               helpString += "The split.group command parameters are fasta, name, group, count and groups.\n";
+               helpString += "The split.groups command reads a group or count file, and parses your fasta and names or count files by groups. \n";
+               helpString += "The split.groups command parameters are fasta, name, group, count and groups.\n";
                helpString += "The fasta and group or count parameters are required.\n";
                helpString += "The groups parameter allows you to select groups to create files for.  \n";
                helpString += "For example if you set groups=A-B-C, you will get a .A.fasta, .A.names, .B.fasta, .B.names, .C.fasta, .C.names files.  \n";
                helpString += "If you want .fasta and .names files for all groups, set groups=all.  \n";
-               helpString += "The split.group command should be used in the following format: split.group(fasta=yourFasta, group=yourGroupFile).\n";
-               helpString += "Example: split.group(fasta=abrecovery.fasta, group=abrecovery.groups).\n";
+               helpString += "The split.groups command should be used in the following format: split.group(fasta=yourFasta, group=yourGroupFile).\n";
+               helpString += "Example: split.groups(fasta=abrecovery.fasta, group=abrecovery.groups).\n";
                helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n";
                return helpString;
        }
index 28bc5d4cec4fc4ec409bca26359ed103951c8701..aea99ef2cccc3dbc070b251d4691209efacd2cbc 100644 (file)
@@ -637,7 +637,7 @@ int SplitMatrix::splitNames(map<string, int>& seqGroup, int numGroups, vector<st
                     ofstream out;
                     string newtempNameFile = tempNameFile + "2";
                     m->openOutputFile(newtempNameFile, out);
-                    out << headers << endl;
+                    out << "Representative_Sequence\ttotal" << endl;
                     out.close();
                     m->appendFiles(tempNameFile, newtempNameFile);
                     m->mothurRemove(tempNameFile);
@@ -671,7 +671,7 @@ int SplitMatrix::splitNames(map<string, int>& seqGroup, int numGroups, vector<st
             ofstream out;
             string newtempNameFile = singleton + "2";
             m->openOutputFile(newtempNameFile, out);
-            out << headers << endl;
+            out << "Representative_Sequence\ttotal" << endl; 
             out.close();
             m->appendFiles(singleton, newtempNameFile);
             m->mothurRemove(singleton);
index bba6289ada54856c25d683126b0d181badab4c15..8ee11d3421f19a19b49ad9d797dfb25db0abc405 100644 (file)
@@ -453,6 +453,7 @@ int TreeGroupCommand::execute(){
                        readMatrix->setCutoff(cutoff);
        
             ct = NULL;
+            nameMap = NULL;
             if(namefile != ""){        
                 nameMap = new NameAssignment(namefile);
                 nameMap->readMap();
@@ -461,6 +462,8 @@ int TreeGroupCommand::execute(){
                 ct = new CountTable();
                 ct->readTable(countfile);
                 readMatrix->read(ct);
+            }else {
+                readMatrix->read(nameMap);
             }
 
                        list = readMatrix->getListVector();
index e698fffb58e435ddae9d3f496f5f19d33923c5c2..541131efd5b15401c229a21966655d39e320a496 100644 (file)
@@ -305,7 +305,8 @@ int UnifracWeightedCommand::execute() {
                string s; //to make work with setgroups
                Groups = m->getGroups();
                vector<string> nameGroups = ct->getNamesOfGroups();
-               util.setGroups(Groups, nameGroups, s, numGroups, "weighted");   //sets the groups the user wants to analyze
+        if (nameGroups.size() < 2) { m->mothurOut("[ERROR]: You cannot run unifrac.weighted with less than 2 groups, aborting.\n"); delete ct; for (int i = 0; i < T.size(); i++) { delete T[i]; } return 0; }
+               util.setGroups(Groups, nameGroups, s, numGroups, "weighted");   //sets the groups the user wants to analyze
                m->setGroups(Groups);
                
         if (m->control_pressed) {  delete ct; for (int i = 0; i < T.size(); i++) { delete T[i]; } return 0; }