]> git.donarmstrong.com Git - mothur.git/blobdiff - readfasta.cpp
added distance command and filterseqs
[mothur.git] / readfasta.cpp
index 347432f40c0f872e9951592de90b2363d480f25c..e1f22ce228bbb729ce24a75a10d507f243d2179c 100644 (file)
 #include <fstream>
 
 /*******************************************************************************/
-ReadFasta::ReadFasta(string file) {
+ReadFasta::ReadFasta(string file) : ReadSeqs(file) {
        try {
-               openInputFile(file, filehandle);
-               fastaFile = file;
-               globaldata = GlobalData::getInstance();
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the ReadTree class Function ReadTree. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -38,6 +35,7 @@ void ReadFasta::read() {
        string sequence = "";
        string temp;
        int count = 0;
+       
        while(!filehandle.eof()){
                if(count == 0)
                        filehandle >> temp;
@@ -51,10 +49,16 @@ void ReadFasta::read() {
                                count++;
                        name = temp.substr(1,temp.length()-1);
                }
-               else 
+               else {
                        sequence += temp;
+               }
                
                filehandle >> temp;
+               gobble(filehandle);
+               
+               if(filehandle.eof())
+                       sequence += temp;
+                       
        }
        Sequence newSequence(name, sequence);
        sequencedb.add(newSequence);