initialize();
name = newName;
- for (int i = 0; i < name.length(); i++) {
- if (name[i] == ':') { name[i] = '_'; m->changedSeqNames = true; }
- }
+ m->checkName(name);
//setUnaligned removes any gap characters for us
setUnaligned(sequence);
initialize();
name = newName;
- for (int i = 0; i < name.length(); i++) {
- if (name[i] == ':') { name[i] = '_'; m->changedSeqNames = true; }
- }
+ m->checkName(name);
//setUnaligned removes any gap characters for us
setUnaligned(sequence);
}
}
- 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);
name = name.substr(1);
- for (int i = 0; i < name.length(); i++) {
- if (name[i] == ':') { name[i] = '_'; m->changedSeqNames = true; }
- }
+ m->checkName(name);
}else{ m->mothurOut("Error in reading your fastafile, at position " + toString(fastaFile.tellg()) + ". Blank name."); m->mothurOutEndLine(); m->control_pressed = true; }
name = name.substr(1);
- for (int i = 0; i < name.length(); i++) {
- if (name[i] == ':') { name[i] = '_'; m->changedSeqNames = true; }
- }
+ m->checkName(name);
}else{ m->mothurOut("Error in reading your fastafile, at position " + toString(fastaFile.tellg()) + ". Blank name."); m->mothurOutEndLine(); m->control_pressed = true; }
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;
}
if (start > aligned.length()) { start = aligned.length(); m->mothurOut("[ERROR]: start to large.\n"); }
- for(int j = 0; j < start-1; j++) {
+ for(int j = 0; j < start; j++) {
aligned[j] = '.';
}
//things like ......----------AT become ................AT
- for(int j = start-1; j < aligned.length(); j++) {
+ for(int j = start; j < aligned.length(); j++) {
if (isalpha(aligned[j])) { break; }
else { aligned[j] = '.'; }
}