Commit f2450b0d authored by Mathieu Giraud's avatar Mathieu Giraud

vidjil.cpp, core/windows.cpp: All clones should have a representative

Simplification of the code.
parent 09ab61bb
......@@ -57,9 +57,14 @@ Sequence WindowsStorage::getRepresentative(junction window,
repComp.setPercentCoverage(percent_cover);
repComp.setRequiredSequence(window);
repComp.compute();
if (repComp.hasRepresentative())
return repComp.getRepresentative();
return NULL_SEQUENCE;
// We should always have a representative, because
// - there is at least min('min_reads_clone', 'max_auditioned') sequences in auditioned_sequences
// - and 'min_cover' = min('min_reads_clone', 'max_auditioned')
if (!repComp.hasRepresentative())
throw invalid_argument("No representative for junction " + window);
return repComp.getRepresentative();
}
list<Sequence> WindowsStorage::getSample(junction window, size_t nb_sampled,
......
......@@ -1011,7 +1011,6 @@ int main (int argc, char **argv)
// VirtualReadScore *scorer = new KmerAffectReadScore(*(germline->index));
int last_num_clone_on_stdout = 0 ;
int num_clone = 0 ;
int clones_without_representative = 0 ;
ofstream out_edges((out_dir+f_basename + EDGES_FILENAME).c_str());
int nb_edges = 0 ;
......@@ -1092,22 +1091,12 @@ int main (int argc, char **argv)
cout << auditioned.size() << " auditioned sequences, avg length " << total_length / auditioned.size() << endl ;
}
Sequence representative = NULL_SEQUENCE ;
representative
Sequence representative
= windowsStorage->getRepresentative(it->first, seed,
min_cover_representative,
ratio_representative,
max_auditionned);
if (representative == NULL_SEQUENCE) {
clones_without_representative++ ;
if (verbose)
cout << "# (no representative sequence with current parameters)" ;
} else {
//$$ There is one representative
// Store the representative and its label
representatives.push_back(representative);
representatives_labels.push_back(string_of_int(num_clone));
......@@ -1167,9 +1156,6 @@ int main (int argc, char **argv)
out_clone << endl;
} // end if (seg.isSegmented())
} // end if (there is a representative)
if (output_sequences_by_cluster) // -a option, output all sequences
{
......@@ -1197,13 +1183,6 @@ int main (int argc, char **argv)
cout << "#### end of clones" << endl;
cout << endl;
if (clones_without_representative > 0)
{
cout << clones_without_representative << " clones without representatives" ;
cout << " (requiring " << min_cover_representative << "/" << ratio_representative << " supporting reads)" << endl ;
cout << endl ;
}
//$$ Compare representatives of all clones
if (nb_edges)
......
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