void WindowsStorage::add(junction window, Sequence sequence, int status, Germline *germline) { if (! hasWindow(window)) { // First time we see that window: init status_by_window[window].resize(STATS_SIZE); seqs_by_window[window].init(nb_bins, max_value_bins, &scorer); seqs_by_window[window].setMaxNbReadsStored(getMaximalNbReadsPerWindow()); } seqs_by_window[window].add(sequence); status_by_window[window][status]++; germline_by_window[window] = germline; }
KmerRepresentativeComputer WindowsStorage::getRepresentativeComputer(junction window, string seed, size_t min_cover, float percent_cover, size_t nb_sampled) { assert(! hasLimitForReadsPerWindow() || nb_sampled <= getMaximalNbReadsPerWindow()); list<Sequence> auditioned_sequences = getSample(window,nb_sampled); KmerRepresentativeComputer repComp(auditioned_sequences, seed); repComp.setRevcomp(true); repComp.setMinCover((! isInterestingJunction(window)) ? min_cover : 1); repComp.setPercentCoverage(percent_cover); repComp.setRequiredSequence(window); repComp.setCoverageReferenceLength(getAverageLength(window)); repComp.compute(*scorer); // We should always have a representative, because either the junction is labelled (thus setMinCover(1)), or: // - there is at least min('min_reads_clone', 'max_auditioned') sequences in auditioned_sequences // - and 'min_cover' = min('min_reads_clone', 'max_auditioned') // - and these sequence are at least as long as the seed if (!repComp.hasRepresentative()) throw invalid_argument("No representative for junction " + window); return repComp; }