]> git.donarmstrong.com Git - mothur.git/blobdiff - fastamap.cpp
done testing 1.13.0
[mothur.git] / fastamap.cpp
index f5ac122112a633de7768b251568edda33623a81c..95d3f3cfe34397f603aecca3dc62bd65dc38c634 100644 (file)
 void FastaMap::readFastaFile(string inFileName) {
        try {
                ifstream in;
-               openInputFile(inFileName, in);
+               m->openInputFile(inFileName, in);
                string name, sequence, line;
                sequence = "";
                string temp;
 
                while(!in.eof()){
+                       if (m->control_pressed) { break; }
+                       
                        Sequence currSeq(in);
                        name = currSeq.getName();
                        
@@ -39,12 +41,12 @@ void FastaMap::readFastaFile(string inFileName) {
                                        //                              data[sequence].groupnumber++;
                                }       
                        }
-                       gobble(in);
+                       m->gobble(in);
                }
                in.close();             
        }
        catch(exception& e) {
-               errorOut(e, "FastaMap", "readFastaFile");
+               m->errorOut(e, "FastaMap", "readFastaFile");
                exit(1);
        }
 }
@@ -54,21 +56,25 @@ void FastaMap::readFastaFile(string inFileName) {
 void FastaMap::readFastaFile(string inFastaFile, string oldNameFileName){ //prints data
        
        ifstream oldNameFile;
-       openInputFile(oldNameFileName, oldNameFile);
+       m->openInputFile(oldNameFileName, oldNameFile);
        
        map<string,string> oldNameMap;
        string name, list;
        while(!oldNameFile.eof()){
+               if (m->control_pressed) { break; }
+               
                oldNameFile >> name >> list;
                oldNameMap[name] = list;
-               gobble(oldNameFile);
+               m->gobble(oldNameFile);
        }
        oldNameFile.close();
        
        ifstream inFASTA;
-       openInputFile(inFastaFile, inFASTA);
+       m->openInputFile(inFastaFile, inFASTA);
        string sequence;
        while(!inFASTA.eof()){
+               if (m->control_pressed) { break; }
+               
                Sequence currSeq(inFASTA);
                name = currSeq.getName();
                
@@ -87,7 +93,7 @@ void FastaMap::readFastaFile(string inFastaFile, string oldNameFileName){ //prin
                                //                      data[sequence].groupnumber++;
                        }       
                }
-               gobble(inFASTA);
+               m->gobble(inFASTA);
        }
        
        
@@ -141,16 +147,17 @@ int FastaMap::sizeUnique(){ //returns datas size which is the number of unique s
 void FastaMap::printNamesFile(string outFileName){ //prints data
        try {
                ofstream outFile;
-               openOutputFile(outFileName, outFile);
+               m->openOutputFile(outFileName, outFile);
                
                // two column file created with groupname and them list of identical sequence names
                for (map<string,group>::iterator it = data.begin(); it != data.end(); it++) {
+                       if (m->control_pressed) { break; }
                        outFile << it->second.groupname << '\t' << it->second.names << endl;
                }
                outFile.close();
        }
        catch(exception& e) {
-               errorOut(e, "FastaMap", "printNamesFile");
+               m->errorOut(e, "FastaMap", "printNamesFile");
                exit(1);
        }
 }
@@ -160,16 +167,17 @@ void FastaMap::printNamesFile(string outFileName){ //prints data
 void FastaMap::printCondensedFasta(string outFileName){ //prints data
        try {
                ofstream out;
-               openOutputFile(outFileName, out);
+               m->openOutputFile(outFileName, out);
                //creates a fasta file
                for (map<string,group>::iterator it = data.begin(); it != data.end(); it++) {
+                       if (m->control_pressed) { break; }
                        out << ">" << it->second.groupname << endl;
                        out << it->first << endl;
                }
                out.close();
        }
        catch(exception& e) {
-               errorOut(e, "FastaMap", "printCondensedFasta");
+               m->errorOut(e, "FastaMap", "printCondensedFasta");
                exit(1);
        }
 }