diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2014-03-04 15:48:11 -0500 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-03-04 15:48:11 -0500 |
commit | 615405ae7a95bf9f9453f67e26275cb8d9616527 (patch) | |
tree | ad09331926cd7008ba6f5f8d9071862aa503f2ce | |
parent | 7eabc402f83217e91734c2ee48c41b6d8357415d (diff) |
fakehash
-rw-r--r-- | kmer_utils.c | 14 | ||||
-rw-r--r-- | kmer_utils.h | 15 |
2 files changed, 27 insertions, 2 deletions
diff --git a/kmer_utils.c b/kmer_utils.c index 8f2f324..b96f831 100644 --- a/kmer_utils.c +++ b/kmer_utils.c @@ -8,7 +8,19 @@ using namespace std; -typedef unordered_map<size_t,unsigned long long> kmer_map; +typedef struct { + size_t operator() (const size_t &k) const { + return k; + } +} kmer_noHash_hash; + +typedef struct { + bool operator() (const size_t &x, const size_t &y) const { + return x == y; + } +} kmer_eq; + +typedef unordered_map<size_t, unsigned long long, kmer_noHash_hash, kmer_eq> kmer_map; const unsigned char alpha[256] = {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, diff --git a/kmer_utils.h b/kmer_utils.h index 10d7ea4..a9d9a1d 100644 --- a/kmer_utils.h +++ b/kmer_utils.h @@ -11,7 +11,20 @@ size_t strnstrip(char *s, int c, size_t len); unsigned long long pow_four(unsigned long long x); // Variables -typedef unordered_map<size_t,unsigned long long> kmer_map; +typedef struct { + size_t operator() (const size_t &k) const { + return k; + } +} kmer_noHash_hash; + +typedef struct { + bool operator() (const size_t &x, const size_t &y) const { + return x == y; + } +} kmer_eq; + +typedef unordered_map<size_t,unsigned long long, kmer_noHash_hash, kmer_eq> kmer_map; + unsigned char alpha[256]; // file loading functions kmer_map *get_sparse_kmer_counts_from_filename(const char *fn, const unsigned int kmer); |