File: kmer_hashing.cpp

package info (click to toggle)
nthash 2.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 576 kB
  • sloc: cpp: 4,131; sh: 36; makefile: 13
file content (20 lines) | stat: -rw-r--r-- 510 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "nthash/nthash.hpp"
#include <iostream>
#include <string>

int
main()
{
  const std::string seq = "ATCGTACGATGCATGCATGCTGACG";
  const unsigned num_hashes = 3;
  const unsigned kmer_size = 6;
  nthash::NtHash nth(seq, num_hashes, kmer_size);
  while (nth.roll()) {
    std::cout << seq.substr(nth.get_pos(), nth.get_k()) << '\t';
    for (unsigned i = 0; i < nth.get_hash_num(); i++) {
      std::cout << std::hex << "0x" << nth.hashes()[i] << '\t';
    }
    std::cout << std::endl;
  }
  return 0;
}