Commit 1aa8fb45 authored by Mathieu Giraud's avatar Mathieu Giraud

core/fasta.{h,cpp}: default constructor also takes extract_field and...

core/fasta.{h,cpp}: default constructor also takes extract_field and extract_separator, factorize constructors

Even if we start from an empty Fasta, we should remember these values.
parent 3cf5b0ce
......@@ -25,21 +25,28 @@
#include <stdexcept>
#include "fasta.h"
Fasta::Fasta(){
void Fasta::init(int extract_field, string extract_separator)
{
this -> extract_field = extract_field ;
this -> extract_separator = extract_separator ;
total_size = 0;
}
Fasta::Fasta(int extract_field, string extract_separator)
{
init(extract_field, extract_separator);
}
Fasta::Fasta(const string &input,
int extract_field, string extract_separator,
ostream &out)
{
init(extract_field, extract_separator);
if (!input.size()) // Do not open empty files (D germline if not segmentD)
return ;
// oout = out;
this -> extract_field = extract_field ;
this -> extract_separator = extract_separator ;
total_size = 0;
add(input);
out << " <== " << input
......
......@@ -29,6 +29,8 @@ typedef enum {
class Fasta
{
void init(int extract_field, string extract_separator);
int total_size;
int extract_field;
string extract_separator;
......@@ -37,7 +39,7 @@ class Fasta
// ostream *oout ;
public:
Fasta();
Fasta(int extract_field=0, string extract_separator="|");
/**
* Read all the sequences in the input filename and record them in the object.
*
......
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