Commit 43023e4f authored by Cyprien Borée's avatar Cyprien Borée

Fix Sequences copy in reallocate, and variable in init

For more informations, see #3393.
parent 85ff19d8
Pipeline #35204 failed with stages
in 2 minutes and 40 seconds
......@@ -21,7 +21,7 @@ void BinReadStorage::init(size_t nb_bins, size_t max_score, const VirtualReadSco
if (inited)
return;
this->nb_bins = 1;
this->nb_bins = 0;
this->max_bins = nb_bins;
this->max_score = max_score;
if (no_list)
......@@ -37,10 +37,14 @@ void BinReadStorage::init(size_t nb_bins, size_t max_score, const VirtualReadSco
}
void BinReadStorage::reallocate(){
list<Sequence> tmpList(bins[0]);
list<Sequence> tmpBin;
nb_bins = max_bins;
for(std::list<Sequence>::iterator it = bins[0].begin(); it != bins[0].end(); ++it){
tmpBin.push_back(*it);
}
if(bins){
delete [] bins;
}
......@@ -54,11 +58,17 @@ void BinReadStorage::reallocate(){
bins = new list<Sequence>[nb_bins+1];
score_bins = new double[nb_bins+1];
nb_scores = new size_t[nb_bins+1];
for(auto s : tmpList){
for(int i = 0; i <= nb_bins; ++i){
score_bins[i] = 0;
nb_scores[i] = 0;
}
all_read_lengths = 0;
for(auto s : tmpBin){
float score = scorer->getScore(s);
size_t bin = scoreToBin(score);
addScore(bin, score);
all_read_lengths += s.sequence.length();
bins[bin].push_back(s);
}
}
......
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