]> git.donarmstrong.com Git - mothur.git/commitdiff
This is v.1.4.0
authorpschloss <pschloss>
Sun, 21 Jun 2009 13:47:29 +0000 (13:47 +0000)
committerpschloss <pschloss>
Sun, 21 Jun 2009 13:47:29 +0000 (13:47 +0000)
46 files changed:
Mothur.xcodeproj/project.pbxproj
aligncommand.cpp
binsequencecommand.cpp
collect.cpp
collectsharedcommand.cpp
deconvolutecommand.cpp
deconvolutecommand.h
dist.h
distancecommand.cpp
engine.cpp
fastamap.cpp
fastamap.h
fullmatrix.h
getlabelcommand.h
getoturepcommand.cpp
mothur.h
nameassignment.cpp
nameassignment.hpp
parselistcommand.cpp
parsimony.h
readcolumn.cpp
readcolumn.h
readdistcommand.cpp
readotu.h
readphylip.h
screenseqscommand.cpp
sharedanderbergs.h
sharedkulczynski.h
sharedkulczynskicody.h
sharedlennon.h
sharedmarczewski.h
sharedmorisitahorn.cpp
sharedochiai.h
sharedordervector.cpp
sharedsobscollectsummary.cpp
sharedutilities.h
summarysharedcommand.cpp
treecalculator.h
treegroupscommand.cpp
unifracunweightedcommand.h
unweighted.h
venncommand.cpp
venncommand.h
weighted.h
whittaker.cpp
whittaker.h

index e6a9c0cc7d46bb0f07a39b0f0ada2936bd0ff287..14071540ef2d94503de27fffe13bba2779fcbbb9 100644 (file)
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                GCC_OPTIMIZATION_LEVEL = 3;
+                               GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO;
+                               GCC_WARN_PEDANTIC = NO;
                                GCC_WARN_UNUSED_VARIABLE = YES;
+                               OTHER_CPLUSPLUSFLAGS = "";
                                PREBINDING = NO;
                                SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+                               WARNING_CFLAGS = "";
                        };
                        name = Debug;
                };
                                        i386,
                                );
                                GCC_OPTIMIZATION_LEVEL = 3;
+                               GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = NO;
+                               GCC_WARN_PEDANTIC = NO;
                                GCC_WARN_UNUSED_VARIABLE = YES;
+                               OTHER_CPLUSPLUSFLAGS = "";
                                PREBINDING = NO;
                                SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+                               WARNING_CFLAGS = "";
                        };
                        name = Release;
                };
index 064189b1423434f24e88fb05df3ad67a7ea4967f..4bf18d7712276da69d5fc4eb488bc249a213d9c7 100644 (file)
@@ -193,7 +193,7 @@ int AlignCommand::execute(){
                        
                        while(!inFASTA.eof()){
                                char c = inFASTA.get();
-                               if(c == '>'){   positions.push_back(inFASTA.tellg());   }
+                               if(c == '>'){   int pos = inFASTA.tellg(); positions.push_back(pos-1);  }
                                while (!inFASTA.eof())  {       c = inFASTA.get(); if (c == 10 || c == 13){     break;  }       } // get rest of line if there's any crap there
                        }
                        inFASTA.close();
@@ -343,22 +343,15 @@ void AlignCommand::createProcesses(string alignFileName, string reportFileName)
 void AlignCommand::appendAlignFiles(string temp, string filename) {
        try{
                
-               //open output file in append mode
                ofstream output;
-               openOutputFileAppend(filename, output);
-               
-               //open temp file for reading
                ifstream input;
+               openOutputFileAppend(filename, output);
                openInputFile(temp, input);
                
-               string line;
-               //read input file and write to output file
-               while(input.eof() != true) {
-                       getline(input, line); //getline removes the newline char
-                       if (line != "") {
-                               output << line << endl;   // Appending back newline char 
-                       }
-               }       
+               while(char c = input.get()){
+                       if(input.eof())         {       break;                  }
+                       else                            {       output << c;    }
+               }
                
                input.close();
                output.close();
@@ -378,23 +371,17 @@ void AlignCommand::appendAlignFiles(string temp, string filename) {
 void AlignCommand::appendReportFiles(string temp, string filename) {
        try{
                
-               //open output file in append mode
                ofstream output;
-               openOutputFileAppend(filename, output);
-               
-               //open temp file for reading
                ifstream input;
+               openOutputFileAppend(filename, output);
                openInputFile(temp, input);
+
                while (!input.eof())    {       char c = input.get(); if (c == 10 || c == 13){  break;  }       } // get header line
-               
-               string line;
-               //read input file and write to output file
-               while(input.eof() != true) {
-                       getline(input, line); //getline removes the newline char
-                       if (line != "") {
-                               output << line << endl;   // Appending back newline char 
-                       }
-               }       
+                               
+               while(char c = input.get()){
+                       if(input.eof())         {       break;                  }
+                       else                            {       output << c;    }
+               }
                
                input.close();
                output.close();
index 1627b42d7bec5090a708c77d7491b93fa3bc7cdd..0ae5d9e46f30fb777593223a5618beaf1ea7aad9 100644 (file)
@@ -79,7 +79,7 @@ BinSeqCommand::BinSeqCommand(string option){
                        else if (groupfile == "not found") { groupfile = ""; }
                        
                        if (abort == false) { 
-                               openInputFile(fastafile, in);
+//                             openInputFile(fastafile, in);
                                fasta = new FastaMap();
                                if (groupfile != "") {
                                        groupMap = new GroupMap(groupfile);
@@ -147,9 +147,8 @@ int BinSeqCommand::execute(){
                int error = 0;
                
                //read fastafile
-               fasta->readFastaFile(in);
+               fasta->readFastaFile(fastafile);
                
-               in.close();
                
                //set format to list so input can get listvector
 //             globaldata->setFormat("list");
index 76481d1739c2f652b60028c592aabe18d3d54736..ac4aa4dc431a6fff7709546ccca9e0a34736fda3 100644 (file)
@@ -193,4 +193,4 @@ void Collect::getGroupComb() {
 
 }
 
-/**************************************************************************************/
\ No newline at end of file
+/**************************************************************************************/
index 86d5ffca4278cc8ce14f5ef9a1071d25cb850fab..4d0306d9809d802f5c37d06ddeb69991d2dad807 100644 (file)
@@ -328,4 +328,3 @@ int CollectSharedCommand::execute(){
 }
 
 /***********************************************************/
-
index 2fe7a251ca41a5d833ad7f643970a1d9847a8361..fba2d27ebf470c968f50f64c71c54917f0e8f5df 100644 (file)
@@ -19,7 +19,7 @@ DeconvoluteCommand::DeconvoluteCommand(string option) {
                
                else {
                        //valid paramters for this command
-                       string Array[] =  {"fasta"};
+                       string Array[] =  {"fasta", "name"};
                        vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
                        
                        OptionParser parser(option);
@@ -33,10 +33,13 @@ DeconvoluteCommand::DeconvoluteCommand(string option) {
                        }
                        
                        //check for required parameters
-                       filename = validParameter.validFile(parameters, "fasta", true);
-                       if (filename == "not open") { abort = true; }
-                       else if (filename == "not found") { filename = ""; cout << "fasta is a required parameter for the unique.seqs command." << endl; abort = true;  }       
+                       inFastaName = validParameter.validFile(parameters, "fasta", true);
+                       if (inFastaName == "not open") { abort = true; }
+                       else if (inFastaName == "not found") { inFastaName = ""; cout << "fasta is a required parameter for the unique.seqs command." << endl; abort = true;  } 
                        
+                       oldNameMapFName = validParameter.validFile(parameters, "name", true);
+                       if (oldNameMapFName == "not open") { abort = true; }
+                       else if (oldNameMapFName == "not found"){       oldNameMapFName = "";   }
                }
 
        }
@@ -75,31 +78,19 @@ int DeconvoluteCommand::execute() {
        try {
                
                if (abort == true) { return 0; }
-       
+
                //prepare filenames and open files
-               outputFileName = (getRootName(filename) + "names");
-               outFastafile = (getRootName(filename) + "unique.fasta");
+               string outNameFile = (getRootName(inFastaName) + "names");
+               string outFastaFile = (getRootName(inFastaName) + "unique" + getExtension(inFastaName));
                
-               openInputFile(filename, in);
-               openOutputFile(outputFileName, out);
-               openOutputFile(outFastafile, outFasta);
-
-               //constructor reads in file and store internally
-               fastamap = new FastaMap();
+               FastaMap fastamap;
        
-               //two columns separated by tabs sequence name and then sequence
-               fastamap->readFastaFile(in);
+               if(oldNameMapFName == "")       {       fastamap.readFastaFile(inFastaName);                                    }
+               else                                            {       fastamap.readFastaFile(inFastaName, oldNameMapFName);   }
                
-               //print out new names file 
-               //file contains 2 columns separated by tabs.  the first column is the groupname(name of first sequence found.
-               //the second column is the list of names of identical sequences separated by ','.
-               fastamap->printNamesFile(out);
-               fastamap->printCondensedFasta(outFasta);
+               fastamap.printCondensedFasta(outFastaFile);
+               fastamap.printNamesFile(outNameFile);
                
-               in.close();
-               out.close();
-               outFasta.close();
-       
                return 0;
        }
        catch(exception& e) {
index b6bda8faa00a274369e7a23803440025c241e612..635e53fe455ab05eacdb2a19e09837b30ef4c955 100644 (file)
@@ -20,15 +20,12 @@ class DeconvoluteCommand : public Command {
 
 public:
        DeconvoluteCommand(string);     
-       ~DeconvoluteCommand() { delete fastamap; };
+       ~DeconvoluteCommand() { };
        int execute();
        void help();    
        
 private:
-       FastaMap* fastamap;
-       ifstream in;
-       ofstream out, outFasta;
-       string filename, outputFileName, outFastafile;
+       string inFastaName, oldNameMapFName;
 
        bool abort;
 };
diff --git a/dist.h b/dist.h
index 6e42ae33d095be047bffc222cbf07bde85a8424e..6a461f53a4622dc3f775d1db2200e104255f0734 100644 (file)
--- a/dist.h
+++ b/dist.h
@@ -27,4 +27,4 @@ protected:
 
 /**************************************************************************************************/
 
-#endif
\ No newline at end of file
+#endif
index 0c9d011503370886d2f802d2903c72f985cbc40e..67ad7beb77b69d72f11914579246eb35dfa707e4 100644 (file)
@@ -309,18 +309,12 @@ void DistanceCommand::appendFiles(string temp, string filename) {
        
                //open output file in append mode
                openOutputFileAppend(filename, output);
-               
-               //open temp file for reading
                openInputFile(temp, input);
                
-               string line;
-               //read input file and write to output file
-               while(input.eof() != true) {
-                       getline(input, line); //getline removes the newline char
-                       if (line != "") {
-                               output << line << endl;   // Appending back newline char 
-                       }
-               }       
+               while(char c = input.get()){
+                       if(input.eof())         {       break;                  }
+                       else                            {       output << c;    }
+               }
                
                input.close();
                output.close();
@@ -334,4 +328,4 @@ void DistanceCommand::appendFiles(string temp, string filename) {
                exit(1);
        }       
 }
-/**************************************************************************************************/
\ No newline at end of file
+/**************************************************************************************************/
index a2d525011ad2823d1c72e07e24a6c4974d98644c..d2a4cad7396acb6afb7153c436dc2b8704c73288 100644 (file)
@@ -301,4 +301,4 @@ string ScriptEngine::getNextCommand(string& commandString) {
                exit(1);
        }
 }
-/***********************************************************************/
\ No newline at end of file
+/***********************************************************************/
index a0652d996fa648a7130928e93c7f3c6b0fae583a..9b2438f4e18986f7fc362c71f77c3e71caa448a3 100644 (file)
 
 /*******************************************************************************/
 
-void FastaMap::readFastaFile(ifstream& in) {
+void FastaMap::readFastaFile(string inFileName) {
        try {
+               ifstream in;
+               openInputFile(inFileName, in);
                string name, sequence, line;
                sequence = "";
-//             int c;
                string temp;
-               
-               
-               //read through file
-//             while ((c = in.get()) != EOF) {
-//                     name = ""; sequence = ""; 
-//                     //is this a name
-//                     if (c == '>') { 
-//                             name = readName(in); 
-//                             sequence = readSequence(in); 
-//                     }else {  cout << "Error fasta in your file. Please correct." << endl; }
-
-                       //store info in map
-                       //input sequence info into map
+
                while(!in.eof()){
                        Sequence currSeq(in);
                        name = currSeq.getName();
-                       sequence = currSeq.getUnaligned();
+                       
+                       if(currSeq.getIsAligned())      {       sequence = currSeq.getAligned();        }
+                       else                                            {       sequence = currSeq.getUnaligned();      }
+                       
                        seqmap[name] = sequence;  
-                       it = data.find(sequence);
+                       map<string,group>::iterator it = data.find(sequence);
                        if (it == data.end()) {         //it's unique.
                                data[sequence].groupname = name;  //group name will be the name of the first duplicate sequence found.
-                               data[sequence].groupnumber = 1;
+//                             data[sequence].groupnumber = 1;
                                data[sequence].names = name;
                        }else { // its a duplicate.
                                data[sequence].names += "," + name;
-                               data[sequence].groupnumber++;
+//                             data[sequence].groupnumber++;
                        }       
                        
                        gobble(in);
                }
-                                       
+               in.close();             
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the FastaMap class Function readFastaFile. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -62,46 +54,81 @@ void FastaMap::readFastaFile(ifstream& in) {
 
 /*******************************************************************************/
 
-string FastaMap::getGroupName(string seq) {  //pass a sequence name get its group
-       return data[seq].groupname;
+void FastaMap::readFastaFile(string inFastaFile, string oldNameFileName){ //prints data
+       
+       ifstream oldNameFile;
+       openInputFile(oldNameFileName, oldNameFile);
+       
+       map<string,string> oldNameMap;
+       string name, list;
+       while(!oldNameFile.eof()){
+               oldNameFile >> name >> list;
+               oldNameMap[name] = list;
+               gobble(oldNameFile);
+       }
+       oldNameFile.close();
+       
+       ifstream inFASTA;
+       openInputFile(inFastaFile, inFASTA);
+       string sequence;
+       while(!inFASTA.eof()){
+               Sequence currSeq(inFASTA);
+               name = currSeq.getName();
+               
+               if(currSeq.getIsAligned())      {       sequence = currSeq.getAligned();        }
+               else                                            {       sequence = currSeq.getUnaligned();      }
+               
+               seqmap[name] = sequence;  
+               map<string,group>::iterator it = data.find(sequence);
+               if (it == data.end()) {         //it's unique.
+                       data[sequence].groupname = name;  //group name will be the name of the first duplicate sequence found.
+//                     data[sequence].groupnumber = 1;
+                       data[sequence].names = oldNameMap[name];
+               }else { // its a duplicate.
+                       data[sequence].names += "," + oldNameMap[name];
+//                     data[sequence].groupnumber++;
+               }       
+               
+               gobble(inFASTA);
+       }
+       
+       
+       inFASTA.close();
 }
 
 /*******************************************************************************/
 
-string FastaMap::getNames(string seq) {        //pass a sequence get the string of names in the group separated by ','s.
-       return data[seq].names;
+string FastaMap::getGroupName(string seq) {  //pass a sequence name get its group
+       return data[seq].groupname;
 }
 
 /*******************************************************************************/
 
-int FastaMap::getGroupNumber(string seq) {     //pass a sequence get the number of identical sequences.
-       return data[seq].groupnumber;
+string FastaMap::getNames(string seq) {        //pass a sequence get the string of names in the group separated by ','s.
+       return data[seq].names;
 }
 
 /*******************************************************************************/
 
 string FastaMap::getSequence(string name) {
-       it2 = seqmap.find(name);
-       if (it2 == seqmap.end()) {      //it's not found
-               return "not found";
-       }else { // found it
-               return it2->second;
-       }
+       
+       map<string,string>::iterator it = seqmap.find(name);
+       if (it == seqmap.end()) {       return "not found";             }
+       else                                    {       return it->second;              }
+       
 }      
 
 /*******************************************************************************/
 
 void FastaMap::push_back(string name, string seq) {
-       it = data.find(seq);
+       
+       map<string,group>::iterator it = data.find(seq);
        if (it == data.end()) {         //it's unique.
                data[seq].groupname = name;  //group name will be the name of the first duplicate sequence found.
-               data[seq].groupnumber = 1;
                data[seq].names = name;
        }else { // its a duplicate.
                data[seq].names += "," + name;
-               data[seq].groupnumber++;
        }
-       
        seqmap[name] = seq;
 }
 
@@ -113,12 +140,16 @@ int FastaMap::sizeUnique(){ //returns datas size which is the number of unique s
 
 /*******************************************************************************/
 
-void FastaMap::printNamesFile(ostream& out){ //prints data
+void FastaMap::printNamesFile(string outFileName){ //prints data
        try {
+               ofstream outFile;
+               openOutputFile(outFileName, outFile);
+               
                // two column file created with groupname and them list of identical sequence names
-               for (it = data.begin(); it != data.end(); it++) {
-                       out << it->second.groupname << '\t' << it->second.names << endl;
+               for (map<string,group>::iterator it = data.begin(); it != data.end(); it++) {
+                       outFile << it->second.groupname << '\t' << it->second.names << endl;
                }
+               outFile.close();
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the FastaMap class Function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -132,13 +163,16 @@ void FastaMap::printNamesFile(ostream& out){ //prints data
 
 /*******************************************************************************/
 
-void FastaMap::printCondensedFasta(ostream& out){ //prints data
+void FastaMap::printCondensedFasta(string outFileName){ //prints data
        try {
+               ofstream out;
+               openOutputFile(outFileName, out);
                //creates a fasta file
-               for (it = data.begin(); it != data.end(); it++) {
+               for (map<string,group>::iterator it = data.begin(); it != data.end(); it++) {
                        out << ">" << it->second.groupname << endl;
                        out << it->first << endl;
                }
+               out.close();
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the FastaMap class Function print. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
index 6051874e3f6802cf0234945502749ad35f474e4f..e628aedbc460af82c19fd1b124dec5235b421c2e 100644 (file)
@@ -25,29 +25,23 @@ public:
        ~FastaMap() {};
        
        string getGroupName(string);  //pass a sequence name get its group
-       int getGroupNumber(string);  //pass a sequence name get number of sequence in its group
        string getNames(string);        //pass a sequence get the string of names in the group separated by ','s.
        void push_back(string, string); //sequencename, sequence
        int sizeUnique();                                       //returns number of unique sequences
-       void printNamesFile(ostream&);          //produces a 2 column file with the groupname in the first column and the names in the second column - a names file.
-       void printCondensedFasta(ostream&);             //produces a fasta file.
-       void readFastaFile(ifstream&);
+       void printNamesFile(string);            //produces a 2 column file with the groupname in the first column and the names in the second column - a names file.
+       void printCondensedFasta(string);               //produces a fasta file.
+       void readFastaFile(string);
+       void readFastaFile(string, string);
        string getSequence(string);             //pass it a name of a sequence, it returns the sequence.
 
 private:
        struct group {
                string groupname;                                       //the group name for identical sequences, will be set to the first sequence found.
-               int groupnumber;                                        //the number of sequence names with the same sequence.
                string names;                                           //the names of the sequence separated by ','.
        };
 
        map<string, group>  data;  //sequence, groupinfo        - condensed representation of file
        map<string, string>  seqmap;  //name, sequence  -  uncondensed representation of file
-       map<string, group>::iterator it;
-       map<string, string>::iterator it2;
-       
-       string readName(ifstream&);
-       string readSequence(ifstream&);
 };
 
 #endif
index 95c472fd4f1951f5bbee064a764eb6016a2ed956..a669f70a1aa80428823ada2c40b42e209c6db8f8 100644 (file)
@@ -51,4 +51,4 @@ private:
        GlobalData* globaldata;
 };
 
-#endif
\ No newline at end of file
+#endif
index 326d894ae83ea89f8a3e614393940c19021a2012..3e18026f327d1836a8f2d623c10ad1c966a21525 100644 (file)
@@ -28,4 +28,4 @@ private:
        bool abort;
 };
 
-#endif
\ No newline at end of file
+#endif
index 65c18061cec3193da3de5e4f9678aa9655ba18d9..8008079b3d2c84681d1e0c81cce7f617e66ee52e 100644 (file)
@@ -112,7 +112,7 @@ GetOTURepCommand::GetOTURepCommand(string option){
                                        }
                                }else { cout << "error, no listvector." << endl; }
                                
-                               openInputFile(fastafile, in);
+//                             openInputFile(fastafile, in);
                                fasta = new FastaMap();
                        }
                
@@ -177,7 +177,7 @@ int GetOTURepCommand::execute(){
                int error;
                
                //read fastafile
-               fasta->readFastaFile(in);
+               fasta->readFastaFile(fastafile);
                
                in.close();
                
index ec56c506c8c0c7654c4e436afa16222f14b1224f..e5d1113790decbacf45913e7d6ce11d2826de598 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -1,7 +1,6 @@
 #ifndef MOTHUR_H
 #define MOTHUR_H
 
-using namespace std;
 
 
 /*
@@ -40,13 +39,24 @@ using namespace std;
 #include <cmath>
 #include <math.h>
 #include <algorithm>
+
+//misc
+#include <cerrno>
 #include <ctime>
+#include <limits>
+
+using namespace std;
 
 #ifdef _WIN32
        #define exp(x) (exp((double) x))
        #define sqrt(x) (sqrt((double) x))
        #define log10(x) (log10((double) x))
        #define log2(x) (log10(x)/log10(2))
+       #define isnan(x) ((x) != (x))
+       #define isinf(x) (fabs(x) == std::numeric_limits<double>::infinity())
+#else
+       #include <sys/wait.h>
+       #include <unistd.h>
 #endif
 
 
index 21703e43fa965b4d8a6cc9dedf055c2ea406466e..cf4e6774c32706d506d472963bda6f9ac86df7f1 100644 (file)
@@ -12,37 +12,33 @@ NameAssignment::NameAssignment(string nameMapFile){
 
 //**********************************************************************************************************************
 
-void NameAssignment::readMap(int colA, int colB){
+void NameAssignment::readMap(){
        try{
                string firstCol, secondCol, skip;
        //      int index = 0;
        
-               int skipNCols = colB-colA-1;
-       
-               map<string, string> data;
        
+//             map<string, string> data;
+               int rowIndex = 0;
+
                while(fileHandle){
                        fileHandle >> firstCol;                         //read from first column
-               
-                       for(int i=0;i<skipNCols;i++){           //allows for anticipated file format
-                               fileHandle >> skip;
-                       }
-               
                        fileHandle >> secondCol;                        //read from second column
-               
-                       data[firstCol] = secondCol;                     //store data in map
-               
+                       
+//                     data[firstCol] = secondCol;                     //store data in map
+
+                       list.push_back(secondCol);              //adds data's value to list
+                       (*this)[firstCol] = rowIndex++;
                        gobble(fileHandle);
                }
                fileHandle.close();
        
-               int rowIndex = 0;
-               map<string, string>::iterator it = data.begin();
-               for(it;it!=data.end();it++){
-                       list.push_back(it->second);             //adds data's value to list
-                       (*this)[it->first] = rowIndex;
-                       rowIndex++;
-               }
+//             map<string, string>::iterator it = data.begin();
+//             for(it;it!=data.end();it++){
+//                     cout << it->first << endl;
+//                     (*this)[it->first] = rowIndex;
+//                     rowIndex++;
+//             }
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the NameAssignment class Function readMap. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
index 93299cceac3518abb2b89418af9ce739af3d407a..e36a76396b96d3221cc77ce60f05b18f3202378e 100644 (file)
@@ -7,7 +7,7 @@
 class NameAssignment : public map<string,int> {
 public:
        NameAssignment(string);
-       void readMap(int, int);
+       void readMap();
        ListVector getListVector();
        int get(string);
        void print();
index c12bd47aa0152bf266d0e3445f0f42b67b6bed39..f0403078d2a1b0c7c96c5e65c576c9beba3c981b 100644 (file)
@@ -220,4 +220,4 @@ void ParseListCommand::process(SharedListVector* thisList) {
                cout << "An unknown error has occurred in the ParseListCommand class function process. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
                exit(1);
        }
-}
\ No newline at end of file
+}
index a22f5bda875b467fee13b369c9a1c639ad5e5662..d4f71abb9511b71f96fbdd4cbc11b080117db364 100644 (file)
@@ -34,4 +34,5 @@ class Parsimony : public TreeCalculator  {
 };
 
 /***********************************************************************/
-#endif
\ No newline at end of file
+
+#endif
index 59c3bd5520929f40086279d744c666ab18fe6d8b..c03c37f1feeb888c341ca4daa01c644069c155a5 100644 (file)
@@ -22,122 +22,109 @@ ReadColumnMatrix::ReadColumnMatrix(string df) : distFile(df){
 
 void ReadColumnMatrix::read(NameAssignment* nameMap){
        try {           
+
+               string firstName, secondName;
+               float distance;
+               int nseqs = nameMap->size();
+
+               list = new ListVector(nameMap->getListVector());
        
-                       string firstName, secondName;
-                       float distance;
-                       int nseqs = nameMap->size();
+               Progress* reading = new Progress("Reading matrix:     ", nseqs * nseqs);
 
-                       list = new ListVector(nameMap->getListVector());
-               
-                       Progress* reading = new Progress("Reading matrix:     ", nseqs * nseqs);
+               int lt = 1;
+               int refRow = 0; //we'll keep track of one cell - Cell(refRow,refCol) - and see if it's transpose
+               int refCol = 0; //shows up later - Cell(refCol,refRow).  If it does, then its a square matrix
+
+               //need to see if this is a square or a triangular matrix...
        
-                       int lt = 1;
-                       int refRow = 0; //we'll keep track of one cell - Cell(refRow,refCol) - and see if it's transpose
-                       int refCol = 0; //shows up later - Cell(refCol,refRow).  If it does, then its a square matrix
+               while(fileHandle && lt == 1){  //let's assume it's a triangular matrix...
+               
+                       fileHandle >> firstName >> secondName >> distance;      // get the row and column names and distance
        
-                       //need to see if this is a square or a triangular matrix...
-                       while(fileHandle && lt == 1){  //let's assume it's a triangular matrix...
+                       map<string,int>::iterator itA = nameMap->find(firstName);
+                       map<string,int>::iterator itB = nameMap->find(secondName);
                        
-                               fileHandle >> firstName >> secondName >> distance;      // get the row and column names and distance
-               
-                               if(nameMap->count(firstName)==0){
-                                       cerr << "AError: Sequence '" << firstName << "' was not found in the names file, please correct\n";
-                               }
-                               if(nameMap->count(secondName)==0){
-                                       cerr << "AError: Sequence '" << secondName << "' was not found in the names file, please correct\n";
-                               }
-                               
-                               if (distance == -1) { distance = 1000000; }
-                               
-                               if(distance < cutoff && nameMap->get(firstName) != nameMap->get(secondName)){
-                                       if(nameMap->get(firstName) > nameMap->get(secondName)){
-                                               PCell value(nameMap->get(firstName), nameMap->get(secondName), distance);
-                               
-                                               if(refRow == refCol){           // in other words, if we haven't loaded refRow and refCol...
-                                                       refRow = nameMap->get(firstName);
-                                                       refCol = nameMap->get(secondName);
-                                                       D->addCell(value);
-                                               }
-                                               else if(refRow == nameMap->get(firstName) && refCol == nameMap->get(secondName)){
-                                                       lt = 0;
-                                               }
-                                               else{
-                                                       D->addCell(value);
-                                               }
-                                       }
-                                       else if(nameMap->get(firstName) < nameMap->get(secondName)){
-                                               PCell value(nameMap->get(secondName), nameMap->get(firstName), distance);
-                               
-                                               if(refRow == refCol){           // in other words, if we haven't loaded refRow and refCol...
-                                                       refRow = nameMap->get(firstName);
-                                                       refCol = nameMap->get(secondName);
-                                                       D->addCell(value);
-                                               }
-                                               else if(refRow == nameMap->get(secondName) && refCol == nameMap->get(firstName)){
-                                                       lt = 0;
-                                               }
-                                               else{
-                                                       D->addCell(value);
-                                               }
-                                       }
-                                       reading->update(nameMap->get(firstName) * nseqs);
-                               }
-                               gobble(fileHandle);
+                       if(itA == nameMap->end()){
+                               cerr << "AAError: Sequence '" << firstName << "' was not found in the names file, please correct\n";
+                       }
+                       if(itB == nameMap->end()){
+                               cerr << "ABError: Sequence '" << secondName << "' was not found in the names file, please correct\n";
                        }
 
-                       if(lt == 0){  // oops, it was square
-                               fileHandle.close();  //let's start over
-                               D->clear();  //let's start over
-                          
-                               openInputFile(distFile, fileHandle);  //let's start over
-
-                               while(fileHandle){
-                                       fileHandle >> firstName >> secondName >> distance;
+                       if (distance == -1) { distance = 1000000; }
+                       
+                       if(distance < cutoff && itA != itB){
+                               if(itA->second > itB->second){
+                                       PCell value(itA->second, itB->second, distance);
                        
-                                       if(nameMap->count(firstName)==0){
-                                               cerr << "BError: Sequence '" << firstName << "' was not found in the names file, please correct\n";
+                                       if(refRow == refCol){           // in other words, if we haven't loaded refRow and refCol...
+                                               refRow = itA->second;
+                                               refCol = itB->second;
+                                               D->addCell(value);
                                        }
-                                       if(nameMap->count(secondName)==0){
-                                               cerr << "BError: Sequence '" << secondName << "' was not found in the names file, please correct\n";
+                                       else if(refRow == itA->second && refCol == itB->second){
+                                               lt = 0;
                                        }
-                                       
-                                       if (distance == -1) { distance = 1000000; }
-                                       
-                                       if(distance < cutoff && nameMap->get(firstName) > nameMap->get(secondName)){
-                                               PCell value(nameMap->get(firstName), nameMap->get(secondName), distance);
+                                       else{
                                                D->addCell(value);
-                                               reading->update(nameMap->get(firstName) * nseqs);
                                        }
+                               }
+                               else if(itA->second < itB->second){
+                                       PCell value(itB->second, itA->second, distance);
                        
-                                       gobble(fileHandle);
+                                       if(refRow == refCol){           // in other words, if we haven't loaded refRow and refCol...
+                                               refRow = itA->second;
+                                               refCol = itB->second;
+                                               D->addCell(value);
+                                       }
+                                       else if(refRow == itB->second && refCol == itA->second){
+                                               lt = 0;
+                                       }
+                                       else{
+                                               D->addCell(value);
+                                       }
                                }
+                               reading->update(itA->second * nseqs);
                        }
-               //      else if(lt == 0){
-               //              while(fileHandle){
-               //                      fileHandle >> firstName >> secondName >> distance;
-               //                      
-               //                      if(nameMap->count(firstName)==0){
-               //                              cerr << "CError: Sequence '" << firstName << "' was not found in the names file, please correct\n";
-               //                      }
-               //                      if(nameMap->count(secondName)==0){
-               //                              cerr << "CError: Sequence '" << secondName << "' was not found in the names file, please correct\n";
-               //                      }
-               //                      if (distance == -1) { distance = 1000000; }
+                       gobble(fileHandle);
+               }
+
+               if(lt == 0){  // oops, it was square
+                       fileHandle.close();  //let's start over
+                       D->clear();  //let's start over
+                  
+                       openInputFile(distFile, fileHandle);  //let's start over
+
+                       while(fileHandle){
+                               fileHandle >> firstName >> secondName >> distance;
                
-               //                      if(distance < cutoff && (*nameMap)[firstName].second < (*nameMap)[secondName].second){
-               ////                            cout << (*nameMap)[secondName] << ' ' << (*nameMap)[firstName] << ' ' << distance << endl;
-               //                              D->addCell(Cell((*nameMap)[secondName].second, (*nameMap)[firstName].second, distance));
-               //                              reading->update((*nameMap)[secondName].second * nseqs);
-               //                      }
-               //
-               //                      gobble(fileHandle);
-               //              }
-               //      }       
-                       reading->finish();
-                       fileHandle.close();
-       
-                       list->setLabel("0");
-       
+                               map<string,int>::iterator itA = nameMap->find(firstName);
+                               map<string,int>::iterator itB = nameMap->find(secondName);
+                               
+                               if(itA == nameMap->end()){
+                                       cerr << "BError: Sequence '" << firstName << "' was not found in the names file, please correct\n";
+                               }
+                               if(itB == nameMap->end()){
+                                       cerr << "BError: Sequence '" << secondName << "' was not found in the names file, please correct\n";
+                               }
+                               
+                               if (distance == -1) { distance = 1000000; }
+                               
+                               if(distance < cutoff && itA->second > itB->second){
+                                       PCell value(itA->second, itB->second, distance);
+                                       D->addCell(value);
+                                       reading->update(itA->second * nseqs);
+                               }
+               
+                               gobble(fileHandle);
+                       }
+               }
+
+               reading->finish();
+               fileHandle.close();
+
+               list->setLabel("0");
+
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the ReadColumnMatrix class Function read. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
index 2e0120f41ca531d37401ba0463c9fb676f58d742..fea6f5934c61a5519086402156369c45da594c20 100644 (file)
@@ -26,4 +26,4 @@ private:
 
 /******************************************************/
 
-#endif
\ No newline at end of file
+#endif
index 392d12b059d52b2cee4d8f5a4f97037403203943..744a35d6715867e64697461d88d648982479f0f5 100644 (file)
@@ -61,7 +61,6 @@ ReadDistCommand::ReadDistCommand(string option){
                        if (namefile == "not open") { abort = true; }   
                        else if (namefile == "not found") { namefile = ""; }
                        else {  globaldata->setNameFile(namefile);      }
-
                        
                        //you are doing a list and group shared
                        if ((phylipfile != "") && (groupfile != "")) { 
@@ -103,7 +102,7 @@ ReadDistCommand::ReadDistCommand(string option){
        
                                        if(namefile != ""){     
                                                nameMap = new NameAssignment(namefile);
-                                               nameMap->readMap(1,2);
+                                               nameMap->readMap();
                                        }else{
                                                nameMap = NULL;
                                        }
index b259733875eb201fbceb87778a6ecd89d8f6c62b..399316de394f1daea988aaeed19fb8c826ba7e36 100644 (file)
--- a/readotu.h
+++ b/readotu.h
@@ -43,4 +43,4 @@ private:
 };
 
 
-#endif
\ No newline at end of file
+#endif
index eab0df422ccd6bfe25e7e0171967f45f60993cdd..9277338c81fafed9daa6068fdf4e2a0c84d7682e 100644 (file)
@@ -26,4 +26,4 @@ private:
 
 /******************************************************/
 
-#endif
\ No newline at end of file
+#endif
index 70094f2f3afe77711dcb4fe7b46d70f3d35f4835..d0f0af0976bd9e2feba32f8757b6b22067eebbc8 100644 (file)
@@ -156,9 +156,9 @@ int ScreenSeqsCommand::execute(){
                        }
                        gobble(inFASTA);
                }       
-               if(namefile != "")              {       screenNameGroupFile(badSeqNames);       }
-               if(groupfile != "")             {       screenGroupFile(badSeqNames);           }
-               if(alignreport != "")   {       screenAlignReport(badSeqNames);         }
+               if(namefile != "" && groupfile != "")   {       screenNameGroupFile(badSeqNames);       }       // this screens both names and groups
+               else if(groupfile != "")                                {       screenGroupFile(badSeqNames);           }       // this screens just the groups
+               if(alignreport != "")                                   {       screenAlignReport(badSeqNames);         }
                
                goodSeqOut.close();
                badSeqOut.close();
index 2460cfe03ea64d6e9a7211609d3e07e6b20df41b..becfe7d090e968f3040c57b3fee17be2491fa345 100644 (file)
@@ -25,6 +25,4 @@ class Anderberg : public Calculator  {
 
 /***********************************************************************/
 
-
-
-#endif
\ No newline at end of file
+#endif
index 58594c69f3f1c12db7ffeed5cd58444ec9f06924..0bace819b5f71f1087a7e3e6b8d471c4a2862b36 100644 (file)
@@ -26,6 +26,4 @@ private:
 
 /***********************************************************************/
 
-
-
-#endif
\ No newline at end of file
+#endif
index c09be3a0bb095cb0866ec383553a0d235a946ee0..1df563addfb2e9bc87aac225942d7fb0009f6fb9 100644 (file)
@@ -27,6 +27,4 @@ private:
 
 /***********************************************************************/
 
-
-
-#endif
\ No newline at end of file
+#endif
index cd2ebf690b48589c211ee44dc5e62e647403d24e..77eb6295d0fcd284b5aa1bb40236217d1e0c8092 100644 (file)
@@ -27,6 +27,4 @@ private:
 
 /***********************************************************************/
 
-
-
-#endif
\ No newline at end of file
+#endif
index 40cc9a4a48e76828fa40a1a10adee9ebf9fc91b3..2bbd62255f633aace94e65be27861d9d76ae55b4 100644 (file)
@@ -25,4 +25,4 @@ private:
 
 /***********************************************************************/
 
-#endif
\ No newline at end of file
+#endif
index eeb01d3b568d414ac23c7341793dfbd06b57a6bc..28ff4fec9f2e2ee3c8e99b0f167630152acca802 100644 (file)
@@ -59,4 +59,4 @@ EstOutput MorHorn::getValues(vector<SharedRAbundVector*> shared) {
        }       
 }
 
-/***********************************************************************/
\ No newline at end of file
+/***********************************************************************/
index 99003e6ee417d4e9a31b420e0995692dd07bc7cb..78ec0ae647d153c23a34eeba5499f1cf7299f7f3 100644 (file)
@@ -26,4 +26,4 @@ private:
 /***********************************************************************/
 
 
-#endif
\ No newline at end of file
+#endif
index a009db16546d647b902dc31a6f00713485d03126..218ed8709dd6ce4b624c233c4d60aa8c3cb4a27f 100644 (file)
@@ -33,7 +33,7 @@ SharedOrderVector::SharedOrderVector(ifstream& f) : DataVector() {  //reads in a
                
                if (globaldata->gGroupmap == NULL) {  groupmap = new GroupMap(); }
                
-               int num, inputData, pos, count;
+               int num, inputData, count;
                count = 0;  numSeqs = 0;
                string holdLabel, nextLabel, groupN;
                individual newguy;
index 6815d875fa6d0bf5f1ad88f0fa7e26aeda20568b..c0cc50700d9f9fc38523991a1c08cf287fb1fc29 100644 (file)
@@ -43,4 +43,4 @@ EstOutput SharedSobsCS::getValues(vector<SharedRAbundVector*> shared){
        }       
 }
 
-/***********************************************************************/
\ No newline at end of file
+/***********************************************************************/
index 75ecf232bf422d062b5ac8d06560e6ed4448612f..f6b95e351341a3248642a68e49b2f519f697a3d6 100644 (file)
@@ -37,6 +37,4 @@ class SharedUtil {
 
 /**************************************************************************************************/
 
-
-
-#endif
\ No newline at end of file
+#endif
index 4006b2d661ab02dc01c1e0f2c0a1fbee9f147fa7..1a3ecf058c898529b17f2d7c67209949722ccb0b 100644 (file)
@@ -417,4 +417,4 @@ void SummarySharedCommand::process(vector<SharedRAbundVector*> thisLookup) {
        }               
 }
 
-/***********************************************************/
\ No newline at end of file
+/***********************************************************/
index 35d061c382f9857e7cfac0c965fb4f1935c7715c..797c45723f835fea908fe2829397b682edc32c6f 100644 (file)
@@ -38,4 +38,4 @@ protected:
 
 /***********************************************************************/
 
-#endif
\ No newline at end of file
+#endif
index 88b1b46997a4e52d215bf2f5c2b67a75bdf300d3..83443d021d13f7ff74b69242bbd05608cb2b1967 100644 (file)
@@ -251,7 +251,7 @@ int TreeGroupCommand::execute(){
        
                        if(namefile != ""){     
                                nameMap = new NameAssignment(namefile);
-                               nameMap->readMap(1,2);
+                               nameMap->readMap();
                        }
                        else{
                                nameMap = NULL;
index 7707df4126172061cef898db12a2a10352dee7a8..2fca41a8388e7d3a6f20bbe79536cae9246eb2fb 100644 (file)
@@ -58,6 +58,4 @@ class UnifracUnweightedCommand : public Command {
                
 };
 
-
-
-#endif
\ No newline at end of file
+#endif
index 87514699b35b74e3b580f4d26dfbc90ca948f6c8..007fef7911918ba7c6505f8fc1213cdd8e9be43a 100644 (file)
@@ -34,6 +34,4 @@ class Unweighted : public TreeCalculator  {
 
 /***********************************************************************/
 
-
-
-#endif
\ No newline at end of file
+#endif
index 343461af0a697c72af7a00a3fc219a5a544e707c..6821e1d29ed94e559f586c00e8cc621e66431e59 100644 (file)
@@ -358,4 +358,4 @@ int VennCommand::execute(){
        }               
 }
 
-//**********************************************************************************************************************
\ No newline at end of file
+//**********************************************************************************************************************
index 0b891437a51e99ea7c17ae18b5be63be51b6ed20..79a22d9bf6127a222382a6878ac026ebf1d5ae2b 100644 (file)
@@ -51,4 +51,4 @@ private:
 
 
 
-#endif
\ No newline at end of file
+#endif
index 3fed6f5e90757ef699e7c4e68c1c7ccd954f9109..3914ef229112d8cf4bd5b55033de0f459bbef25a 100644 (file)
@@ -35,4 +35,4 @@ class Weighted : public TreeCalculator  {
 /***********************************************************************/
 
 
-#endif
\ No newline at end of file
+#endif
index 3b179111a854e934b6f9d05e231649796e5565a3..4b66ec9ef049cf0cb086bef586d6b9ce3889aebd 100644 (file)
@@ -36,4 +36,4 @@ EstOutput Whittaker::getValues(vector<SharedRAbundVector*> shared){
        }       
 }
 
-/***********************************************************************/
\ No newline at end of file
+/***********************************************************************/
index bcd72fcc1d9e5f25baa2779aeb71eb553eb0672d..540dc0b28d2dd152c188a03e78f878b3194272bb 100644 (file)
@@ -26,4 +26,4 @@ public:
 
 /***********************************************************************/
 
-#endif
\ No newline at end of file
+#endif