Commit 3b88c113 authored by Mathieu Giraud's avatar Mathieu Giraud

core/{kmerstore.h,representative.cpp}: allow extended nucleotides for representative

b0e3045d ignored all k-mers with extended nucleotides. However, in the representative
computation, one needs to have matching k-mers in every case, even when there are N
or other extended nucleotides.
parent 7ebb8fbe
......@@ -64,7 +64,8 @@ public:
* @post All the k-mers in the sequence have been indexed.
*/
void insert(const seqtype &sequence,
const string &label);
const string &label,
bool ignore_extended_nucleotides=true);
/**
* @param word: a k-mer
......@@ -184,11 +185,12 @@ void IKmerStore<T>::insert(Fasta& input,
template<class T>
void IKmerStore<T>::insert(const seqtype &sequence,
const string &label){
const string &label,
bool ignore_extended_nucleotides){
for(size_t i = 0 ; i + s < sequence.length() + 1 ; i++) {
seqtype kmer = spaced(sequence.substr(i, s), seed);
if (has_extended_nucleotides(kmer))
if (ignore_extended_nucleotides && has_extended_nucleotides(kmer))
continue;
int strand = 1;
......
......@@ -72,9 +72,9 @@ void KmerRepresentativeComputer::compute() {
// First create an index on the set of reads
IKmerStore<Kmer> *index = new MapKmerStore<Kmer>(getSeed(), revcomp);
// Add sequences to the index
// Add sequences to the index, allowing extended nucleotides (false)
for (list<Sequence>::iterator it=sequences.begin(); it != sequences.end(); ++it) {
index->insert(it->sequence, it->label);
index->insert(it->sequence, it->label, false);
}
size_t max = sequences.size();
......
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