Commit 8efb5e0e authored by Mathieu Giraud's avatar Mathieu Giraud

core/fasta.{cpp,h}: implements 'nb_sequences_max'

parent 47de0b36
......@@ -150,6 +150,7 @@ OnlineFasta::~OnlineFasta() {
}
void OnlineFasta::init() {
nb_sequences_returned = 0;
char_nb = 0;
line_nb = 0;
line = getInterestingLine();
......@@ -169,7 +170,8 @@ Sequence OnlineFasta::getSequence() {
}
bool OnlineFasta::hasNext() {
return (! input->eof()) || line.length() > 0;
return ((!input->eof()) || line.length() > 0)
&& ((nb_sequences_max == NO_LIMIT_VALUE) || (nb_sequences_returned < nb_sequences_max));
}
void OnlineFasta::next() {
......@@ -194,6 +196,7 @@ void OnlineFasta::next() {
}
// Identifier line
nb_sequences_returned++;
current.label_full = line.substr(1);
current.label = extract_from_label(current.label_full, extract_field, extract_separator);
......
......@@ -97,6 +97,7 @@ class OnlineFasta {
size_t line_nb;
unsigned long long char_nb;
int nb_sequences_returned;
int nb_sequences_max;
int only_nth_sequence;
......
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