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

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; }
// OnlineFasta
OnlineFasta::OnlineFasta(int extract_field, string extract_separator):
input(NULL), extract_field(extract_field), extract_separator(extract_separator){}
OnlineFasta::OnlineFasta(int extract_field, string 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,
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())),
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()) {
delete this->input;
......@@ -127,9 +132,11 @@ OnlineFasta::OnlineFasta(const string &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),
extract_separator(extract_separator)
extract_separator(extract_separator),
nb_sequences_max(nb_sequences_max), only_nth_sequence(only_nth_sequence)
{
input_allocated = false;
init();
......
......@@ -97,12 +97,16 @@ class OnlineFasta {
size_t line_nb;
unsigned long long char_nb;
int nb_sequences_max;
int only_nth_sequence;
public:
/**
* 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.
......@@ -112,10 +116,12 @@ class OnlineFasta {
* well-formed
*/
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,
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();
......
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