X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sequence.cpp;h=aa1f1c7eae3c0b1cb08105a070a172169ecf320e;hb=49b8297d25caae7ad4cf1e5208a4a66fdfe071fe;hp=98aa7b01862c494018c710ec607f5132d8ce2db1;hpb=544469443afe44920bdf279aefd26d29534cabaf;p=mothur.git diff --git a/sequence.cpp b/sequence.cpp index 98aa7b0..aa1f1c7 100644 --- a/sequence.cpp +++ b/sequence.cpp @@ -7,8 +7,6 @@ * */ -using namespace std; - #include "sequence.hpp" /***********************************************************************/ @@ -32,11 +30,12 @@ Sequence::Sequence(string newName, string 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; @@ -52,7 +51,6 @@ Sequence::Sequence(ifstream& fastaFile){ 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 @@ -91,7 +89,7 @@ void Sequence::setName(string seqName) { 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