Commit c5c3405e authored by Mikaël Salson's avatar Mikaël Salson

Fasta: add() method for Sequence.

Just consists of what was previously done in operator>>
parent dd0a58d4
......@@ -75,6 +75,11 @@ void Fasta::add(const string &filename, bool verbose) {
is.close();
}
void Fasta::add(Sequence seq) {
reads.push_back(seq);
total_size += seq.sequence.size();
}
int Fasta::size() const{ return (int)reads.size(); }
list<Sequence> Fasta::getAll() const {
list<Sequence> reads;
......@@ -242,8 +247,7 @@ istream& operator>>(istream& in, Fasta& fasta){
while (of.hasNext()) {
of.next();
fasta.reads.push_back(of.getSequence());
fasta.total_size += of.getSequence().sequence.size();
fasta.add(of.getSequence());
}
return in;
}
......
......@@ -71,6 +71,8 @@ public:
* if the content is not valid
*/
void add(const string &filename, bool verbose=true);
void add(const Sequence sequence);
friend istream& operator>>(istream&, Fasta&);
};
......
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