Exemple #1
0
uint64_t NumericKMer::sequenceToInt(const Sequence& s) {
  uint64_t kmer = 0;  
  for (size_t i = 0; i < k; ++i) {    
    kmer <<= 2;
    char c = s.getBaseAt(i);
    // TODO: It may be worth to add a (fast) check for 'c'
    uint64_t base = DNAAlphabet2Bits::charToInt(c);
    kmer |= (base & 0x03);   
  }
  return kmer;
}
Exemple #2
0
FullQuality<C>::FullQuality(const Quality& qual, const Sequence& seq) {
  this->length = MIN(qual.length(), seq.getSequenceLength());
  this->symbolCount = C::length();
  this->probVector = initProbMatrix(this->symbolCount, this->length);
  // get the probabilities vector
  double* probs = qual.getProbabilities();
  // loop through all elements
  for (size_t pos = 0; pos < this->length; ++pos) {
    // get the index for the actual symbol
    size_t symbolIndex = C::getIndex(seq.getBaseAt(pos));
    double remind_p = (probs[pos] ) / ((double)(this->symbolCount - 1));
    // loop through all symbols
    for (size_t sym = 0; sym < this->symbolCount; ++sym) {
      this->probVector[sym][pos] = remind_p;
    }
    this->probVector[symbolIndex][pos] = 1.0 - probs[pos];
  }
}