initialize();
name = newName;
- if(sequence.find_first_of('-') != string::npos) {
- setAligned(sequence);
- }
+
+ //setUnaligned removes any gap characters for us
setUnaligned(sequence);
+ setAligned(sequence);
}
//********************************************************************************************************************
Sequence::Sequence(ifstream& fastaFile){
+
initialize();
+ fastaFile >> name;
+ name = name.substr(1);
- string accession; // provided a file handle to a fasta-formatted sequence file, read in the next
- fastaFile >> accession; // accession number and sequence we find...
- setName(accession);
+ while (!fastaFile.eof()) { char c = fastaFile.get(); if (c == 10 || c == 13){ break; } } // get rest of line if there's any crap there
char letter;
string sequence;
if(letter == 'U'){letter = 'T';}
sequence += letter;
}
-
}
- if(sequence.find_first_of('-') != string::npos){ // if there are any gaps in the sequence, assume that it is
- setAligned(sequence); // an alignment file
- }
- setUnaligned(sequence); // also set the unaligned sequence file
+ setAligned(sequence);
+ //setUnaligned removes any gap characters for us
+ setUnaligned(sequence);
}
//********************************************************************************************************************
void Sequence::setUnaligned(string sequence){
- if(sequence.find_first_of('-') != string::npos) {
+ if(sequence.find_first_of('.') != string::npos || sequence.find_first_of('-') != string::npos) {
string temp = "";
for(int j=0;j<sequence.length();j++) {
if(isalpha(sequence[j])) { temp += sequence[j]; }
else { temp += 'N'; }
}
unaligned = temp;
+ aligned = temp;
}