ChainStatsVisitor(int nodes, int longest) : counts_(nodes) { for(CountVector::iterator it=counts_.begin(); it!=counts_.end(); ++it) { it->resize(longest); } }
virtual bool process (size_t partId, const typename Kmer<span>::Type& kmer, const CountVector& count, CountNumber sum) { // get a mutex LocalSynchronizer sync (synchro); // output kmer and counts cout << kmer.toString(kmerSize) << " "; for (size_t i=0; i<count.size(); i++) { cout << count[i] << " "; } cout << endl; return true; }
// We refine the 'process' method virtual bool process (size_t partId, const typename Kmer<span>::Type& kmer, const CountVector& count, CountNumber sum) { // We try each possible pair (i,j) through the 'i' and 'j' loops for (size_t i=0; i<count.size(); i++) { if (_range.includes(count[i]) == true) { for (size_t j=i; j<count.size(); j++) { if (_range.includes(count[j]) == true) { // Both 'i' and 'j' banks hold the current kmer with an abundance in the correct range // so we increase the number of common kmers for this pair (i,j) _countTotal [offset(i,j)] ++; } } } } return true; }
void print() const { Rprintf("Chain position counts\n"); for(CountVector::size_type node=0; node<counts_.size(); ++node) { CountVector::const_reference v = counts_[node]; Rprintf("[%d] ", node); for(CountVector::value_type::size_type pos=0; pos!=v.size(); ++pos) { Rprintf("%d:%lu, ", pos, v[pos]); } Rprintf("\n"); } }