]> git.donarmstrong.com Git - mothur.git/commitdiff
added phylip as output file type for commands that output distance matrices. added...
authorSarah Westcott <mothur.westcott@gmail.com>
Tue, 19 Jun 2012 18:09:38 +0000 (14:09 -0400)
committerSarah Westcott <mothur.westcott@gmail.com>
Tue, 19 Jun 2012 18:09:38 +0000 (14:09 -0400)
createdatabasecommand.cpp
createdatabasecommand.h
distancecommand.cpp
mothurout.cpp
mothurout.h
nameassignment.cpp
pairwiseseqscommand.cpp
unifracunweightedcommand.cpp
unifracweightedcommand.cpp
venncommand.cpp

index febd762592acdca2df39b7d8d076f0020dfa444d..5919f0c005888fba82da66d10c8dd657ab5c366b 100644 (file)
@@ -15,7 +15,8 @@ vector<string> CreateDatabaseCommand::setParameters(){
                CommandParameter pfasta("repfasta", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pfasta);
                CommandParameter pname("repname", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pname);
                CommandParameter pcontaxonomy("contaxonomy", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pcontaxonomy);
-               CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(plist);
+               CommandParameter plist("list", "InputTypes", "", "", "ListShared", "ListShared", "none",false,false); parameters.push_back(plist);
+        CommandParameter pshared("shared", "InputTypes", "", "", "ListShared", "ListShared", "none",false,false); parameters.push_back(pshared);
                CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pgroup);
                CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
                CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
@@ -34,8 +35,8 @@ vector<string> CreateDatabaseCommand::setParameters(){
 string CreateDatabaseCommand::getHelpString(){ 
        try {
                string helpString = "";
-               helpString += "The create.database command reads a listfile, *.cons.taxonomy, *.rep.fasta, *.rep.names and optional groupfile, and creates a database file.\n";
-               helpString += "The create.database command parameters are repfasta, list, repname, contaxonomy, group and label. List, repfasta, repnames, and contaxonomy are required.\n";
+               helpString += "The create.database command reads a list file or a shared file, *.cons.taxonomy, *.rep.fasta, *.rep.names and optional groupfile, and creates a database file.\n";
+               helpString += "The create.database command parameters are repfasta, list, shared, repname, contaxonomy, group and label. List, repfasta, repnames, and contaxonomy are required.\n";
         helpString += "The repfasta file is fasta file outputted by get.oturep(fasta=yourFastaFile, list=yourListfile, column=yourDistFile, name=yourNameFile).\n";
         helpString += "The repname file is the name file outputted by get.oturep(fasta=yourFastaFile, list=yourListfile, column=yourDistFile, name=yourNameFile).\n";
         helpString += "The contaxonomy file is the taxonomy file outputted by classify.otu(list=yourListfile, taxonomy=yourTaxonomyFile).\n";
@@ -159,6 +160,14 @@ CreateDatabaseCommand::CreateDatabaseCommand(string option)  {
                                        //if the user has not given a path then, add inputdir. else leave path alone.
                                        if (path == "") {       parameters["group"] = inputDir + it->second;            }
                                }
+                
+                it = parameters.find("shared");
+                               //user has given a template file
+                               if(it != parameters.end()){ 
+                                       path = m->hasPath(it->second);
+                                       //if the user has not given a path then, add inputdir. else leave path alone.
+                                       if (path == "") {       parameters["shared"] = inputDir + it->second;           }
+                               }
                        }
             
                        
@@ -167,14 +176,33 @@ CreateDatabaseCommand::CreateDatabaseCommand(string option)  {
                        
                        //check for required parameters
                        listfile = validParameter.validFile(parameters, "list", true);
-                       if (listfile == "not found") {                          
-                               //if there is a current list file, use it
+                       if (listfile == "not found") {  listfile = "";                  }
+                       else if (listfile == "not open") { listfile = ""; abort = true; }       
+                       else { m->setListFile(listfile); }
+            
+            sharedfile = validParameter.validFile(parameters, "shared", true);
+                       if (sharedfile == "not found") {        sharedfile = "";                        }
+                       else if (sharedfile == "not open") { sharedfile = ""; abort = true; }   
+                       else { m->setSharedFile(sharedfile); }
+            
+            if ((sharedfile == "") && (listfile == "")) { 
+                               //is there are current file available for either of these?
+                               //give priority to list, then shared
                                listfile = m->getListFile(); 
                                if (listfile != "") {  m->mothurOut("Using " + listfile + " as input file for the list parameter."); m->mothurOutEndLine(); }
-                               else {  m->mothurOut("You have no current listfile and the list parameter is required."); m->mothurOutEndLine(); abort = true; }
+                               else { 
+                                       sharedfile = m->getSharedFile(); 
+                                       if (sharedfile != "") {  m->mothurOut("Using " + sharedfile + " as input file for the shared parameter."); m->mothurOutEndLine(); }
+                                       else { 
+                                               m->mothurOut("No valid current files. You must provide a shared or list file before you can use the create.database command."); m->mothurOutEndLine(); 
+                                               abort = true;
+                                       }
+                               }
                        }
-                       else if (listfile == "not open") { abort = true; }      
-                       else { m->setListFile(listfile); }
+                       else if ((sharedfile != "") && (listfile != "")) { m->mothurOut("When executing a create.database command you must enter ONLY ONE of the following: shared or list."); m->mothurOutEndLine(); abort = true; }
+            
+            if (sharedfile != "") { if (outputDir == "") { outputDir = m->hasPath(sharedfile); } }
+            else { if (outputDir == "") { outputDir = m->hasPath(listfile); } }
                        
                        contaxonomyfile = validParameter.validFile(parameters, "contaxonomy", true);
                        if (contaxonomyfile == "not found") {  //if there is a current list file, use it
@@ -219,7 +247,8 @@ int CreateDatabaseCommand::execute(){
         //taxonomies holds the taxonomy info for each Otu
         //classifyOtuSizes holds the size info of each Otu to help with error checking
         vector<string> taxonomies;
-        vector<int> classifyOtuSizes = readTax(taxonomies);
+        vector<string> otuLabels;
+        vector<int> classifyOtuSizes = readTax(taxonomies, otuLabels);
         
         if (m->control_pressed) { return 0; }
         
@@ -230,7 +259,7 @@ int CreateDatabaseCommand::execute(){
         
         //names redundants to uniques. backwards to how we normally do it, but each bin is the list file will be a key entry in the map.
         map<string, string> repNames;
-        int numUniqueNamesFile = m->readNames(repnamesfile, repNames);
+        int numUniqueNamesFile = m->readNames(repnamesfile, repNames, 1);
         
         //are there the same number of otus in the fasta and name files
         if (repOtusSizes.size() != numUniqueNamesFile) { m->mothurOut("[ERROR]: you have " + toString(numUniqueNamesFile) + " unique seqs in your repname file, but " + toString(repOtusSizes.size()) + " seqs in your repfasta file.  These should match.\n"); m->control_pressed = true; }
@@ -251,86 +280,130 @@ int CreateDatabaseCommand::execute(){
         
         if (m->control_pressed) { return 0; }
         
-        //at this point we are fairly sure the repfasta, repnames and contaxonomy files match so lets proceed with the listfile
-        ListVector* list = getList();
-        
-        if (m->control_pressed) { delete list; return 0; }
         
-        GroupMap* groupmap = NULL;
-        if (groupfile != "") {
-                       groupmap = new GroupMap(groupfile);
-                       groupmap->readMap();
-               }
-        
-        if (m->control_pressed) { delete list; if (groupfile != "") { delete groupmap; } return 0; }
-        
-        if (outputDir == "") { outputDir += m->hasPath(listfile); }
-        string outputFileName = outputDir + m->getRootName(m->getSimpleName(listfile)) + getOutputFileNameTag("database");
+        string outputFileName = "";
+        if (listfile != "") { outputFileName = outputDir + m->getRootName(m->getSimpleName(listfile)) + getOutputFileNameTag("database"); }
+        else { outputFileName = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + getOutputFileNameTag("database"); }
         outputNames.push_back(outputFileName); outputTypes["database"].push_back(outputFileName);
         
         ofstream out;
         m->openOutputFile(outputFileName, out);
         
         string header = "OTUNumber\tAbundance\t";
-        if (groupfile != "") { 
-            header = "OTUNumber\t";
-            for (int i = 0; i < groupmap->getNamesOfGroups().size(); i++) { header += (groupmap->getNamesOfGroups())[i] + '\t'; }
-        }
-        header += "repSeqName\trepSeq\tOTUConTaxonomy";
-        out << header << endl;
+
         
-        for (int i = 0; i < list->getNumBins(); i++) {
+        if (listfile != "") {
+            //at this point we are fairly sure the repfasta, repnames and contaxonomy files match so lets proceed with the listfile
+            ListVector* list = getList();
             
-            if (m->control_pressed) { break; }
+            if (otuLabels.size() != list->getNumBins()) { 
+                m->mothurOut("[ERROR]: you have " + toString(otuLabels.size()) + " otus in your contaxonomy file, but your list file has " + toString(list->getNumBins()) + " otus. These should match. Make sure you are using files for the same distance.\n"); m->control_pressed = true;  }
             
-            out << (i+1) << '\t';
+            if (m->control_pressed) { delete list; return 0; }
             
-            vector<string> binNames;
-            string bin = list->get(i);
-            
-            map<string, string>::iterator it = repNames.find(bin);
-            if (it == repNames.end()) {
-                m->mothurOut("[ERROR: OTU " + toString(i+1) + " is not in the repnames file. Make sure you are using files for the same distance.\n"); m->control_pressed = true;   break;
+            GroupMap* groupmap = NULL;
+            if (groupfile != "") {
+                groupmap = new GroupMap(groupfile);
+                groupmap->readMap();
             }
             
-            m->splitAtComma(bin, binNames);
+            if (m->control_pressed) { delete list; if (groupfile != "") { delete groupmap; } return 0; }
             
-            //sanity check
-            if (binNames.size() != classifyOtuSizes[i]) {
-                 m->mothurOut("[ERROR: OTU " + toString(i+1) + " contains " + toString(binNames.size()) + " sequence, but the rep and taxonomy files indicated this OTU should have " + toString(classifyOtuSizes[i]) + ". Make sure you are using files for the same distance.\n"); m->control_pressed = true;   break;
+            if (groupfile != "") { 
+                header = "OTUNumber\t";
+                for (int i = 0; i < groupmap->getNamesOfGroups().size(); i++) { header += (groupmap->getNamesOfGroups())[i] + '\t'; }
             }
+            header += "repSeqName\trepSeq\tOTUConTaxonomy";
+            out << header << endl;
             
-            //output abundances
-            if (groupfile != "") {
-                string groupAbunds = "";
-                map<string, int> counts;
-                //initialize counts to 0
-                for (int j = 0; j < groupmap->getNamesOfGroups().size(); j++) { counts[(groupmap->getNamesOfGroups())[j]] = 0; }
+            for (int i = 0; i < list->getNumBins(); i++) {
+                
+                if (m->control_pressed) { break; }
+                
+                out << otuLabels[i] << '\t';
+                
+                vector<string> binNames;
+                string bin = list->get(i);
                 
-                //find abundances by group
-                bool error = false;
-                for (int j = 0; j < binNames.size(); j++) {
-                    string group = groupmap->getGroup(binNames[j]);
-                    if (group == "not found") {
-                        m->mothurOut("[ERROR]: " + binNames[j] + " is not in your groupfile, please correct.\n");
-                        error = true;
-                    }else { counts[group]++; }
+                map<string, string>::iterator it = repNames.find(bin);
+                if (it == repNames.end()) {
+                    m->mothurOut("[ERROR: OTU " + otuLabels[i] + " is not in the repnames file. Make sure you are using files for the same distance.\n"); m->control_pressed = true;   break;
                 }
                 
-                //output counts
-                for (int j = 0; j < groupmap->getNamesOfGroups().size(); j++) { out << counts[(groupmap->getNamesOfGroups())[j]] << '\t';  }
+                m->splitAtComma(bin, binNames);
                 
-                if (error) { m->control_pressed = true; }
-            }else { out << binNames.size() << '\t'; }
+                //sanity check
+                if (binNames.size() != classifyOtuSizes[i]) {
+                    m->mothurOut("[ERROR: OTU " + otuLabels[i] + " contains " + toString(binNames.size()) + " sequence, but the rep and taxonomy files indicated this OTU should have " + toString(classifyOtuSizes[i]) + ". Make sure you are using files for the same distance.\n"); m->control_pressed = true;   break;
+                }
+                
+                //output abundances
+                if (groupfile != "") {
+                    string groupAbunds = "";
+                    map<string, int> counts;
+                    //initialize counts to 0
+                    for (int j = 0; j < groupmap->getNamesOfGroups().size(); j++) { counts[(groupmap->getNamesOfGroups())[j]] = 0; }
+                    
+                    //find abundances by group
+                    bool error = false;
+                    for (int j = 0; j < binNames.size(); j++) {
+                        string group = groupmap->getGroup(binNames[j]);
+                        if (group == "not found") {
+                            m->mothurOut("[ERROR]: " + binNames[j] + " is not in your groupfile, please correct.\n");
+                            error = true;
+                        }else { counts[group]++; }
+                    }
+                    
+                    //output counts
+                    for (int j = 0; j < groupmap->getNamesOfGroups().size(); j++) { out << counts[(groupmap->getNamesOfGroups())[j]] << '\t';  }
+                    
+                    if (error) { m->control_pressed = true; }
+                }else { out << binNames.size() << '\t'; }
+                
+                //output repSeq
+                out << it->second << '\t' << seqs[i].getAligned() << '\t' << taxonomies[i] << endl;
+            }
+            
+            
+            delete list;
+            if (groupfile != "") { delete groupmap; }
+           
+        }else {
+            vector<SharedRAbundVector*> lookup = getShared();
+            
+            header = "OTUNumber\t";
+            for (int i = 0; i < lookup.size(); i++) { header += lookup[i]->getGroup() + '\t'; }
+            header += "repSeqName\trepSeq\tOTUConTaxonomy";
+            out << header << endl;
             
-            //output repSeq
-            out << it->second << '\t' << seqs[i].getAligned() << '\t' << taxonomies[i] << endl;
+            for (int h = 0; h < lookup[0]->getNumBins(); h++) {
+                
+                if (m->control_pressed) { break; }
+                
+                int index = findIndex(otuLabels, m->currentBinLabels[h]);
+                if (index == -1) {  m->mothurOut("[ERROR]: " + m->currentBinLabels[h] + " is not in your constaxonomy file, aborting.\n"); m->control_pressed = true; }
+                
+                if (m->control_pressed) { break; }
+                
+                out << otuLabels[index] << '\t';
+                
+                int totalAbund = 0;
+                for (int i = 0; i < lookup.size(); i++) { 
+                    int abund = lookup[i]->getAbundance(h);
+                    totalAbund += abund; 
+                    out << abund << '\t';
+                }
+                
+                //sanity check
+                if (totalAbund != classifyOtuSizes[index]) {
+                    m->mothurOut("[ERROR: OTU " + m->currentBinLabels[h] + " contains " + toString(totalAbund) + " sequence, but the rep and taxonomy files indicated this OTU should have " + toString(classifyOtuSizes[index]) + ". Make sure you are using files for the same distance.\n"); m->control_pressed = true;   break;
+                }
+                
+                //output repSeq
+                out << seqs[index].getName() << '\t' << seqs[index].getAligned() << '\t' << taxonomies[index] << endl;
+            }
         }
         out.close();
-        
-        delete list;
-        if (groupfile != "") { delete groupmap; }
-        
         if (m->control_pressed) { m->mothurRemove(outputFileName); return 0; }
         
         m->mothurOutEndLine();
@@ -347,7 +420,21 @@ int CreateDatabaseCommand::execute(){
        }
 }
 //**********************************************************************************************************************
-vector<int> CreateDatabaseCommand::readTax(vector<string>& taxonomies){
+int CreateDatabaseCommand::findIndex(vector<string>& otuLabels, string label){
+       try {
+        int index = -1;
+        for (int i = 0; i < otuLabels.size(); i++) {
+            if (otuLabels[i] == label) { index = i; break; }
+        }
+               return index;
+    }
+       catch(exception& e) {
+               m->errorOut(e, "CreateDatabaseCommand", "findIndex");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<int> CreateDatabaseCommand::readTax(vector<string>& taxonomies, vector<string>& otuLabels){
        try {
                
         vector<int> sizes; 
@@ -369,6 +456,7 @@ vector<int> CreateDatabaseCommand::readTax(vector<string>& taxonomies){
             
             sizes.push_back(size);
             taxonomies.push_back(tax);
+            otuLabels.push_back(otu);
         }
         in.close();
         
@@ -493,5 +581,81 @@ ListVector* CreateDatabaseCommand::getList(){
        }
 }
 //**********************************************************************************************************************
+vector<SharedRAbundVector*> CreateDatabaseCommand::getShared(){
+       try {
+               InputData input(sharedfile, "sharedfile");
+               vector<SharedRAbundVector*> lookup = input.getSharedRAbundVectors();
+               string lastLabel = lookup[0]->getLabel();
+               
+               if (label == "") { label = lastLabel; return lookup; }
+               
+               //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
+               set<string> labels; labels.insert(label);
+               set<string> processedLabels;
+               set<string> userLabels = labels;
+               
+               //as long as you are not at the end of the file or done wih the lines you want
+               while((lookup[0] != NULL) && (userLabels.size() != 0)) {
+                       if (m->control_pressed) {  return lookup;  }
+                       
+                       if(labels.count(lookup[0]->getLabel()) == 1){
+                               processedLabels.insert(lookup[0]->getLabel());
+                               userLabels.erase(lookup[0]->getLabel());
+                               break;
+                       }
+                       
+                       if ((m->anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+                               string saveLabel = lookup[0]->getLabel();
+                               
+                               for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
+                               lookup = input.getSharedRAbundVectors(lastLabel);
+                               
+                               processedLabels.insert(lookup[0]->getLabel());
+                               userLabels.erase(lookup[0]->getLabel());
+                               
+                               //restore real lastlabel to save below
+                               lookup[0]->setLabel(saveLabel);
+                               break;
+                       }
+                       
+                       lastLabel = lookup[0]->getLabel();                      
+                       
+                       //get next line to process
+                       //prevent memory leak
+                       for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
+                       lookup = input.getSharedRAbundVectors();
+               }
+               
+               
+               if (m->control_pressed) { return lookup;  }
+               
+               //output error messages about any remaining user labels
+               set<string>::iterator it;
+               bool needToRun = false;
+               for (it = userLabels.begin(); it != userLabels.end(); it++) {  
+                       m->mothurOut("Your file does not include the label " + *it); 
+                       if (processedLabels.count(lastLabel) != 1) {
+                               m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
+                               needToRun = true;
+                       }else {
+                               m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
+                       }
+               }
+               
+               //run last label if you need to
+               if (needToRun == true)  {
+                       for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
+                       lookup = input.getSharedRAbundVectors(lastLabel);
+               }       
+        
+        return lookup;
+    }
+       catch(exception& e) {
+               m->errorOut(e, "CreateDatabaseCommand", "getList");
+               exit(1);
+       }
+}
+
+//**********************************************************************************************************************
 
 
index 85e23675b2b770d476dfff45b901da03f6581546..741feba082958ae8e4f2ec73f7a188255208b069 100644 (file)
@@ -34,13 +34,15 @@ public:
 private:
        
        bool abort;
-       string listfile, groupfile, repfastafile, repnamesfile, contaxonomyfile, label, outputDir;
+       string sharedfile, listfile, groupfile, repfastafile, repnamesfile, contaxonomyfile, label, outputDir;
        
        vector<string> outputNames;
                
        vector<int> readFasta(vector<Sequence>&);
-    vector<int> readTax(vector<string>&);
+    vector<int> readTax(vector<string>&, vector<string>&);
        ListVector* getList();
+    vector<SharedRAbundVector*> getShared();
+    int findIndex(vector<string>&, string);
        
 };
 
index 99e89bafecdf8c2d5740aeb12446d04b8d9e4fdd..16407d59b9819183edb70748d0b3a0ca1ff9acda 100644 (file)
@@ -15,7 +15,7 @@ vector<string> DistanceCommand::setParameters(){
                CommandParameter pcolumn("column", "InputTypes", "", "", "none", "none", "OldFastaColumn",false,false); parameters.push_back(pcolumn);
                CommandParameter poldfasta("oldfasta", "InputTypes", "", "", "none", "none", "OldFastaColumn",false,false); parameters.push_back(poldfasta);
                CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pfasta);
-               CommandParameter poutput("output", "Multiple", "column-lt-square", "column", "", "", "",false,false); parameters.push_back(poutput);
+               CommandParameter poutput("output", "Multiple", "column-lt-square-phylip", "column", "", "", "",false,false); parameters.push_back(poutput);
                CommandParameter pcalc("calc", "Multiple", "nogaps-eachgap-onegap", "onegap", "", "", "",false,false); parameters.push_back(pcalc);
                CommandParameter pcountends("countends", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pcountends);
                CommandParameter pcompress("compress", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pcompress);
@@ -210,6 +210,7 @@ DistanceCommand::DistanceCommand(string option) {
                        convert(temp, compress);
 
                        output = validParameter.validFile(parameters, "output", false);         if(output == "not found"){      output = "column"; }
+            if (output == "phylip") { output = "lt";  }
                        
                        if (((column != "") && (oldfastafile == "")) || ((column == "") && (oldfastafile != ""))) { m->mothurOut("If you provide column or oldfasta, you must provide both."); m->mothurOutEndLine(); abort=true; }
                        
index eacad376e1e91a519feff3c8e57727662042599b..64f0bc88713d2c3f56cfb6f98cc1cbc387ee7966 100644 (file)
@@ -1631,6 +1631,46 @@ int MothurOut::readNames(string namefile, map<string, string>& nameMap, bool red
        }
 }
 /**********************************************************************************************************************/
+int MothurOut::readNames(string namefile, map<string, string>& nameMap, int flip) { 
+       try {
+               
+               //open input file
+               ifstream in;
+               openInputFile(namefile, in);
+        
+        string rest = "";
+        char buffer[4096];
+        bool pairDone = false;
+        bool columnOne = true;
+        string firstCol, secondCol;
+        
+               while (!in.eof()) {
+                       if (control_pressed) { break; }
+                       
+            in.read(buffer, 4096);
+            vector<string> pieces = splitWhiteSpace(rest, buffer, in.gcount());
+            
+            for (int i = 0; i < pieces.size(); i++) {
+                if (columnOne) {  firstCol = pieces[i]; columnOne=false; }
+                else  { secondCol = pieces[i]; pairDone = true; columnOne=true; }
+                
+                if (pairDone) { 
+                    nameMap[secondCol] = firstCol;
+                    pairDone = false; 
+                }
+            }
+               }
+               in.close();
+               
+               return nameMap.size();
+               
+       }
+       catch(exception& e) {
+               errorOut(e, "MothurOut", "readNames");
+               exit(1);
+       }
+}
+/**********************************************************************************************************************/
 int MothurOut::readNames(string namefile, map<string, string>& nameMap, map<string, int>& nameCount) { 
        try {
                nameMap.clear(); nameCount.clear();
index b2c638a167d1ebf507106cc300231f0f693471b0..968ff97221ab7e277dfba48efc01682648998f0f 100644 (file)
@@ -106,6 +106,7 @@ class MothurOut {
         int readNames(string, map<string, string>&, map<string, int>&);
                int readNames(string, map<string, string>&);
         int readNames(string, map<string, string>&, bool);
+        int readNames(string, map<string, string>&, int);
                int readNames(string, map<string, vector<string> >&);
                int readNames(string, vector<seqPriorityNode>&, map<string, string>&);
                int mothurRemove(string);
index 3d99551cc6a2a5f01932329c34c339a6fa5d9450..126c4e0c594b6745ec6a7c4fcd5228c717d67677 100644 (file)
@@ -22,7 +22,7 @@ void NameAssignment::readMap(){
                int rowIndex = 0;
                
                while(fileHandle){
-                       fileHandle >> firstCol;                         //read from first column
+                       fileHandle >> firstCol; m->gobble(fileHandle);                  //read from first column
                        fileHandle >> secondCol;                        //read from second column
                                                
                        itData = (*this).find(firstCol);
index 1fa96e3e9d4c6cf8ce9a4e99af30d01c5562a009..f69faff477aee954801f0d04bb3bce67f785d1e5 100644 (file)
@@ -19,7 +19,7 @@ vector<string> PairwiseSeqsCommand::setParameters(){
                CommandParameter pgapopen("gapopen", "Number", "", "-2.0", "", "", "",false,false); parameters.push_back(pgapopen);
                CommandParameter pgapextend("gapextend", "Number", "", "-1.0", "", "", "",false,false); parameters.push_back(pgapextend);
                CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
-               CommandParameter poutput("output", "Multiple", "column-lt-square", "column", "", "", "",false,false); parameters.push_back(poutput);
+               CommandParameter poutput("output", "Multiple", "column-lt-square-phylip", "column", "", "", "",false,false); parameters.push_back(poutput);
                CommandParameter pcalc("calc", "Multiple", "nogaps-eachgap-onegap", "onegap", "", "", "",false,false); parameters.push_back(pcalc);
                CommandParameter pcountends("countends", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pcountends);
                CommandParameter pcompress("compress", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pcompress);
@@ -249,6 +249,7 @@ PairwiseSeqsCommand::PairwiseSeqsCommand(string option)  {
                        align = validParameter.validFile(parameters, "align", false);           if (align == "not found"){      align = "needleman";    }
                        
                        output = validParameter.validFile(parameters, "output", false);         if(output == "not found"){      output = "column"; }
+            if (output=="phylip") { output = "lt"; }
                        if ((output != "column") && (output != "lt") && (output != "square")) { m->mothurOut(output + " is not a valid output form. Options are column, lt and square. I will use column."); m->mothurOutEndLine(); output = "column"; }
                        
                        calc = validParameter.validFile(parameters, "calc", false);                     
index 0650ea0e8e42e564213d285183e48594f54fc722..0749cb79ff41e03c55ca2a9defeb1b70e44645d8 100644 (file)
@@ -22,7 +22,7 @@ vector<string> UnifracUnweightedCommand::setParameters(){
                CommandParameter piters("iters", "Number", "", "1000", "", "", "",false,false); parameters.push_back(piters);
                CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
                CommandParameter prandom("random", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(prandom);
-               CommandParameter pdistance("distance", "Multiple", "column-lt-square", "column", "", "", "",false,false); parameters.push_back(pdistance);
+               CommandParameter pdistance("distance", "Multiple", "column-lt-square-phylip", "column", "", "", "",false,false); parameters.push_back(pdistance);
         CommandParameter psubsample("subsample", "String", "", "", "", "", "",false,false); parameters.push_back(psubsample);
         CommandParameter pconsensus("consensus", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pconsensus);
         CommandParameter proot("root", "Boolean", "F", "", "", "", "",false,false); parameters.push_back(proot);
@@ -204,6 +204,7 @@ UnifracUnweightedCommand::UnifracUnweightedCommand(string option)  {
                        string temp = validParameter.validFile(parameters, "distance", false);                  
                        if (temp == "not found") { phylip = false; outputForm = ""; }
                        else{
+                if (temp=="phylip") { temp = "lt"; }
                                if ((temp == "lt") || (temp == "column") || (temp == "square")) {  phylip = true;  outputForm = temp; }
                                else { m->mothurOut("Options for distance are: lt, square, or column. Using lt."); m->mothurOutEndLine(); phylip = true; outputForm = "lt"; }
                        }
index 13d10fd5f4d6c690777fcc4730f06fea8832341f..d1e883382890081495dac72238cd05b3c5ad644e 100644 (file)
@@ -24,7 +24,7 @@ vector<string> UnifracWeightedCommand::setParameters(){
         CommandParameter psubsample("subsample", "String", "", "", "", "", "",false,false); parameters.push_back(psubsample);
         CommandParameter pconsensus("consensus", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pconsensus);
         CommandParameter prandom("random", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(prandom);
-               CommandParameter pdistance("distance", "Multiple", "column-lt-square", "column", "", "", "",false,false); parameters.push_back(pdistance);
+               CommandParameter pdistance("distance", "Multiple", "column-lt-square-phylip", "column", "", "", "",false,false); parameters.push_back(pdistance);
                CommandParameter proot("root", "Boolean", "F", "", "", "", "",false,false); parameters.push_back(proot);
                CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
                CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
@@ -204,6 +204,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        string temp = validParameter.validFile(parameters, "distance", false);                  
                        if (temp == "not found") { phylip = false; outputForm = ""; }
                        else{
+                if (temp=="phylip") { temp = "lt"; }
                                if ((temp == "lt") || (temp == "column") || (temp == "square")) {  phylip = true;  outputForm = temp; }
                                else { m->mothurOut("Options for distance are: lt, square, or column. Using lt."); m->mothurOutEndLine(); phylip = true; outputForm = "lt"; }
                        }
index 18bb635010bc07a1787e2847ae84c4eaf923e8cf..c918500270a537ac909326f3edc10ad068dc3ac5 100644 (file)
@@ -250,8 +250,7 @@ int VennCommand::execute(){
                                        }else if (Estimators[i] == "chao") { 
                                                vennCalculators.push_back(new Chao1());
                                        }else if (Estimators[i] == "ace") {
-                                               if(abund < 5)
-                                                       abund = 10;
+                                               if(abund < 5) { abund = 10; }
                                                vennCalculators.push_back(new Ace(abund));
                                        }
                                }