Commit c0f63104 authored by Mathieu Giraud's avatar Mathieu Giraud

core/fasta.{cpp,h}: nb_sequences_in_fasta()

Couting the sequences in a Fasta file. Not very efficient, but for debug purposes.
parent 5e2a1a53
......@@ -269,3 +269,18 @@ ostream &operator<<(ostream &out, const Sequence &seq) {
}
return out;
}
int nb_sequences_in_fasta(string f)
{
OnlineFasta *sequences = new OnlineFasta(f, 1, " ");
int nb_sequences = 0 ;
while (sequences->hasNext())
{
sequences->next();
nb_sequences++ ;
}
cout << " ==> " << nb_sequences << " sequences" << endl;
return nb_sequences ;
}
......@@ -160,4 +160,10 @@ istream& operator>>(istream& in, Fasta& fasta);
ostream& operator<<(ostream& out, Fasta& fasta);
ostream &operator<<(ostream &out, const Sequence &seq);
/**
* Count the number of sequences in a Fasta file
* @return the number of sequences
*/
int nb_sequences_in_fasta(string f);
#endif
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