}
}
- while (!fastaString.eof()) { char c = fastaString.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
+ //while (!fastaString.eof()) { char c = fastaString.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
+ comment = getCommentString(fastaString);
int numAmbig = 0;
sequence = getSequenceString(fastaString, numAmbig);
}
}
- while (!fastaString.eof()) { char c = fastaString.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
+ //while (!fastaString.eof()) { char c = fastaString.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
+ comment = getCommentString(fastaString);
int numAmbig = 0;
sequence = getSequenceString(fastaString, numAmbig);
}
}
- //read real sequence
- while (!fastaFile.eof()) { char c = fastaFile.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
+ //while (!fastaFile.eof()) { char c = fastaFile.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
+ comment = getCommentString(fastaFile);
int numAmbig = 0;
sequence = getSequenceString(fastaFile, numAmbig);
//read info after sequence name
while (!fastaFile.eof()) {
char c = fastaFile.get();
- if (c == 10 || c == 13 || c == -1){ break; }
+ if (c == 10 || c == 13 || c == -1){ break; }
extraInfo += c;
- }
+ }
+
+ comment = extraInfo;
int numAmbig = 0;
sequence = getSequenceString(fastaFile, numAmbig);
}
}
- //read real sequence
- while (!fastaFile.eof()) { char c = fastaFile.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
+ //while (!fastaFile.eof()) { char c = fastaFile.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
+ comment = getCommentString(fastaFile);
int numAmbig = 0;
sequence = getSequenceString(fastaFile, numAmbig);
string Sequence::getCommentString(ifstream& fastaFile) {
try {
char letter;
- string sequence = "";
+ string temp = "";
while(fastaFile){
letter=fastaFile.get();
- if((letter == '\r') || (letter == '\n')){
+ if((letter == '\r') || (letter == '\n') || letter == -1){
m->gobble(fastaFile); //in case its a \r\n situation
break;
- }
+ }else {
+ temp += letter;
+ }
}
- return sequence;
+ return temp;
}
catch(exception& e) {
m->errorOut(e, "Sequence", "getCommentString");
string Sequence::getCommentString(istringstream& fastaFile) {
try {
char letter;
- string sequence = "";
+ string temp = "";
while(fastaFile){
letter=fastaFile.get();
- if((letter == '\r') || (letter == '\n')){
+ if((letter == '\r') || (letter == '\n') || letter == -1){
m->gobble(fastaFile); //in case its a \r\n situation
break;
- }
+ }else {
+ temp += letter;
+ }
}
- return sequence;
+ return temp;
}
catch(exception& e) {
m->errorOut(e, "Sequence", "getCommentString");
unaligned = "";
aligned = "";
pairwise = "";
+ comment = "";
numBases = 0;
alignmentLength = 0;
void Sequence::printSequence(ostream& out){
- out << ">" << name << endl;
+ out << ">" << name << comment << endl;
if(isAligned){
out << aligned << endl;
}