Commit 6d7519cf authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

core/fasta.{h,cpp}: stores 'nb_sequences_max' and 'nth_only_sequence' in OnlineFasta

parent a9c4a9c6
...@@ -107,14 +107,19 @@ const string& Fasta::sequence(int index) const{ return reads[index].sequence; } ...@@ -107,14 +107,19 @@ const string& Fasta::sequence(int index) const{ return reads[index].sequence; }
// OnlineFasta // OnlineFasta
OnlineFasta::OnlineFasta(int extract_field, string extract_separator): OnlineFasta::OnlineFasta(int extract_field, string extract_separator,
input(NULL), extract_field(extract_field), extract_separator(extract_separator){} int nb_sequences_max, int only_nth_sequence):
input(NULL),
extract_field(extract_field), extract_separator(extract_separator),
nb_sequences_max(nb_sequences_max), only_nth_sequence(only_nth_sequence){}
OnlineFasta::OnlineFasta(const string &input, OnlineFasta::OnlineFasta(const string &input,
int extract_field, string extract_separator) int extract_field, string extract_separator,
int nb_sequences_max, int only_nth_sequence)
:input(new igzstream(input.c_str())), :input(new igzstream(input.c_str())),
extract_field(extract_field), extract_field(extract_field),
extract_separator(extract_separator) extract_separator(extract_separator),
nb_sequences_max(nb_sequences_max), only_nth_sequence(only_nth_sequence)
{ {
if (this->input->fail()) { if (this->input->fail()) {
delete this->input; delete this->input;
...@@ -127,9 +132,11 @@ OnlineFasta::OnlineFasta(const string &input, ...@@ -127,9 +132,11 @@ OnlineFasta::OnlineFasta(const string &input,
} }
OnlineFasta::OnlineFasta(istream &input, OnlineFasta::OnlineFasta(istream &input,
int extract_field, string extract_separator) int extract_field, string extract_separator,
int nb_sequences_max, int only_nth_sequence)
:input(&input), extract_field(extract_field), :input(&input), extract_field(extract_field),
extract_separator(extract_separator) extract_separator(extract_separator),
nb_sequences_max(nb_sequences_max), only_nth_sequence(only_nth_sequence)
{ {
input_allocated = false; input_allocated = false;
init(); init();
......
...@@ -97,12 +97,16 @@ class OnlineFasta { ...@@ -97,12 +97,16 @@ class OnlineFasta {
size_t line_nb; size_t line_nb;
unsigned long long char_nb; unsigned long long char_nb;
int nb_sequences_max;
int only_nth_sequence;
public: public:
/** /**
* Default constructor * Default constructor
*/ */
OnlineFasta(int extract_field=0, string extract_separator="|"); OnlineFasta(int extract_field=0, string extract_separator="|",
int nb_sequences_max=NO_LIMIT_VALUE, int only_nth_sequence=1);
/** /**
* Open the file. No sequence is read at first. * Open the file. No sequence is read at first.
...@@ -112,10 +116,12 @@ class OnlineFasta { ...@@ -112,10 +116,12 @@ class OnlineFasta {
* well-formed * well-formed
*/ */
OnlineFasta(const string &input, OnlineFasta(const string &input,
int extract_field=0, string extract_separator="|"); int extract_field=0, string extract_separator="|",
int nb_sequences_max=NO_LIMIT_VALUE, int only_nth_sequence=1);
OnlineFasta(istream &input, OnlineFasta(istream &input,
int extract_field=0, string extract_separator="|"); int extract_field=0, string extract_separator="|",
int nb_sequences_max=NO_LIMIT_VALUE, int only_nth_sequence=1);
~OnlineFasta(); ~OnlineFasta();
......
Supports Markdown
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