Commit 60f395f4 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

core/fasta.{h,cpp}: nb_sequences_in_fasta returns 'unsigned long long'

This will allow somewhat large sets of reads.
parent 37c5597e
......@@ -383,13 +383,13 @@ ostream &operator<<(ostream &out, const Sequence &seq) {
return out;
}
int nb_sequences_in_fasta(string f, bool approx)
unsigned long long nb_sequences_in_fasta(string f, bool approx)
{
if (approx)
return approx_nb_sequences_in_fasta(f);
OnlineFasta *sequences = new OnlineFasta(f, 1, " ");
int nb_sequences = 0 ;
unsigned long long nb_sequences = 0 ;
while (sequences->hasNext())
{
......@@ -406,7 +406,7 @@ int nb_sequences_in_fasta(string f, bool approx)
#define SAMPLE_APPROX_NB_SEQUENCES 200
int approx_nb_sequences_in_fasta(string f)
unsigned long long approx_nb_sequences_in_fasta(string f)
{
OnlineFasta *sequences = new OnlineFasta(f, 1, " ");
int nb_sequences = 0 ;
......@@ -423,7 +423,7 @@ int approx_nb_sequences_in_fasta(string f)
{
cout << "approx. " ;
float ratio = (float) filesize(f.c_str()) / (float) sequences->getPos();
nb_sequences = (int) (ratio * nb_sequences);
nb_sequences = (unsigned long long) (ratio * nb_sequences);
}
cout << nb_sequences << " sequences" << endl;
......
......@@ -213,7 +213,7 @@ const Fasta FASTA_AMBIGUOUS = Fasta(true, "?");
* Count the number of sequences in a Fasta file
* @return the number of sequences
*/
int nb_sequences_in_fasta(string f, bool approx = false);
int approx_nb_sequences_in_fasta(string f);
unsigned long long nb_sequences_in_fasta(string f, bool approx = false);
unsigned long long approx_nb_sequences_in_fasta(string f);
#endif
......@@ -892,7 +892,7 @@ int main (int argc, char **argv)
cout << endl ;
// Number of reads for e-value computation
int nb_reads_for_evalue = (expected_value > NO_LIMIT_VALUE) ? nb_sequences_in_fasta(f_reads, true) : 1 ;
unsigned long long nb_reads_for_evalue = (expected_value > NO_LIMIT_VALUE) ? nb_sequences_in_fasta(f_reads, true) : 1 ;
//////////////////////////////////
......
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