Commit fdbbde92 authored by Mathieu Giraud's avatar Mathieu Giraud

core/fasta.{h,cpp}: Fasta parser, ignore the gaps ('.') and store their number

parent a914a57e
......@@ -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()) {
......
......@@ -93,6 +93,8 @@ public:
class OnlineFasta {
private:
Sequence current;
int current_gaps;
istream *input;
int extract_field;
string extract_separator;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment