diff --git a/algo/core/fasta.cpp b/algo/core/fasta.cpp index 100c81110db336af446e670aeb633f8c7d7a22e8..49addc70e0329f515965723384fd979626a802ed 100644 --- a/algo/core/fasta.cpp +++ b/algo/core/fasta.cpp @@ -174,6 +174,7 @@ void OnlineFasta::init() { line_nb = 0; line = getInterestingLine(); current.seq = NULL; + current_gaps = 0; } unsigned long long OnlineFasta::getPos() { @@ -213,7 +214,18 @@ void OnlineFasta::skipToNthSequence() { void OnlineFasta::addLineToCurrentSequence(string line) { - current.sequence += line; + for (char& c : line) + { + if (c == ' ') + continue ; + + if (c == '.') { + current_gaps++; + continue ; + } + + current.sequence += c; + } } void OnlineFasta::next() { @@ -227,6 +239,7 @@ void OnlineFasta::next() { if (current.seq) { delete [] current.seq; current.seq = NULL; + current_gaps = 0; } if (hasNextData()) { diff --git a/algo/core/fasta.h b/algo/core/fasta.h index 7246507f37b36beffd7a1335f447753584fa40e1..c5c2f8648b716d4c5b4b8efed5486fd39a1b2f27 100644 --- a/algo/core/fasta.h +++ b/algo/core/fasta.h @@ -93,6 +93,8 @@ public: class OnlineFasta { private: Sequence current; + int current_gaps; + istream *input; int extract_field; string extract_separator;