-string FastaMap::readSequence(ifstream& in) {
- try{
- string sequence = "";
- string line;
- int pos, c;
-
- while (!in.eof()) {
- //save position in file in case next line is a new name.
- pos = in.tellg();
- line = "";
- in >> line;
- //if you are at a new name
- if (line[0] == '>') {
- //put file pointer back since you are now at a new name
- in.seekg(pos, ios::beg);
- c = in.get(); //because you put it back to a newline char
- break;
- }else { sequence += line; }
- }
-
- return sequence;
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the FastaMap class Function readSequence. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the FastaMap class function readSequence. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
-}
-/*******************************************************************************/