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

core/fasta.{h,cpp}: Fasta objects can have names

These names are the names of the underlying file(s).
Moreover, we define some constants.
parent d49d65af
......@@ -44,6 +44,13 @@ void Fasta::init(int extract_field, string extract_separator)
this -> extract_field = extract_field ;
this -> extract_separator = extract_separator ;
total_size = 0;
name = "";
}
Fasta::Fasta(bool virtualfasta, string name)
{
init(0, "");
this -> name = name;
}
Fasta::Fasta(int extract_field, string extract_separator)
......@@ -77,6 +84,8 @@ void Fasta::add(const string &filename, bool verbose) {
throw invalid_argument(" !! Error in opening file: "+ filename);
}
name += filename + " ";
if (verbose)
cout << " <== " << filename ;
add(is, verbose);
......
......@@ -51,7 +51,10 @@ public:
Fasta(const string &input,
int extract_field=0, string extract_separator="|",
bool verbose=true);
Fasta(bool virtualfasta, const string name); // virtualfasta unused
string name;
int size() const;
int totalSize() const;
......@@ -190,6 +193,9 @@ istream& operator>>(istream& in, Fasta& fasta);
ostream& operator<<(ostream& out, Fasta& fasta);
ostream &operator<<(ostream &out, const Sequence &seq);
const Fasta FASTA_UNKNOWN = Fasta(true, "_");
const Fasta FASTA_AMBIGUOUS = Fasta(true, "?");
/**
* Count the number of sequences in a Fasta file
* @return the number of sequences
......
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