Commit a6edb097 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

windows.{h,cpp}: getRepresentativeComputer() returns a KmerRepresentativeComputer

This should be directly moved into some KmerRepresentativeComputer() constructor.
parent d674c2ba
...@@ -57,7 +57,7 @@ list<Sequence> WindowsStorage::getReads(junction window) { ...@@ -57,7 +57,7 @@ list<Sequence> WindowsStorage::getReads(junction window) {
return seqs_by_window[window].getReads(); return seqs_by_window[window].getReads();
} }
Sequence WindowsStorage::getRepresentative(junction window, KmerRepresentativeComputer WindowsStorage::getRepresentativeComputer(junction window,
string seed, size_t min_cover, string seed, size_t min_cover,
float percent_cover, float percent_cover,
size_t nb_sampled, size_t nb_sampled,
...@@ -79,7 +79,7 @@ Sequence WindowsStorage::getRepresentative(junction window, ...@@ -79,7 +79,7 @@ Sequence WindowsStorage::getRepresentative(junction window,
if (!repComp.hasRepresentative()) if (!repComp.hasRepresentative())
throw invalid_argument("No representative for junction " + window); throw invalid_argument("No representative for junction " + window);
return repComp.getRepresentative(); return repComp;
} }
list<Sequence> WindowsStorage::getSample(junction window, size_t nb_sampled, list<Sequence> WindowsStorage::getSample(junction window, size_t nb_sampled,
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "germline.h" #include "germline.h"
#include "read_storage.h" #include "read_storage.h"
#include "read_score.h" #include "read_score.h"
#include "representative.h"
#define NB_BINS 15 #define NB_BINS 15
#define MAX_VALUE_BINS 500 #define MAX_VALUE_BINS 500
...@@ -84,10 +85,10 @@ class WindowsStorage { ...@@ -84,10 +85,10 @@ class WindowsStorage {
* algorithm. * algorithm.
* @param nb_buckets: Number of buckets for sampling (see SequenceSampler) * @param nb_buckets: Number of buckets for sampling (see SequenceSampler)
* @pre nb_sampled <= getMaximalNbReadsPerWindow() if hasLimitForReadsPerWindow() * @pre nb_sampled <= getMaximalNbReadsPerWindow() if hasLimitForReadsPerWindow()
* @return the representative sequence of a window or NULL_SEQUENCE if we * @return the representative computer
* cannot find any representative
*/ */
Sequence getRepresentative(junction window, string seed, size_t min_cover,
KmerRepresentativeComputer getRepresentativeComputer(junction window, string seed, size_t min_cover,
float percent_cover, size_t nb_sampled, float percent_cover, size_t nb_sampled,
size_t nb_buckets=HISTOGRAM_SIZE_AUDITIONED); size_t nb_buckets=HISTOGRAM_SIZE_AUDITIONED);
......
...@@ -1162,12 +1162,14 @@ int main (int argc, char **argv) ...@@ -1162,12 +1162,14 @@ int main (int argc, char **argv)
cout << auditioned.size() << " auditioned sequences, avg length " << total_length / auditioned.size() << endl ; cout << auditioned.size() << " auditioned sequences, avg length " << total_length / auditioned.size() << endl ;
} }
Sequence representative KmerRepresentativeComputer repComp
= windowsStorage->getRepresentative(it->first, seed, = windowsStorage->getRepresentativeComputer(it->first, seed,
min_cover_representative, min_cover_representative,
ratio_representative, ratio_representative,
max_auditionned); max_auditionned);
Sequence representative = repComp.getRepresentative();
// Store the representative and its label // Store the representative and its label
representatives.push_back(representative); representatives.push_back(representative);
representatives_labels.push_back(string_of_int(num_clone)); representatives_labels.push_back(string_of_int(num_clone));
......
Supports Markdown
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