From def3dd3bf1477dd308da23c41f3cb76df567d474 Mon Sep 17 00:00:00 2001 From: vlad0x00 Date: Sat, 9 Apr 2022 19:08:00 -0700 Subject: [PATCH] Update docs --- README.md | 2 +- docs/index.html | 2 +- docs/namespacebtllib.html | 4 + docs/nthash__lowlevel_8hpp_source.html | 583 +++++++++++++------------ scripts/test-wrappers | 2 +- wrappers/python/meson.build | 4 +- 6 files changed, 305 insertions(+), 292 deletions(-) diff --git a/README.md b/README.md index aeab101e..65ffb986 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ For users * `btllib` uses `C++11` features, so that standard should be enabled at a minimum. - Python wrappers * The wrappers correspond one-to-one with C++ code so any functions and classes can be used under the same name. The only exception are nested classes which are prefixed with outer class name (e.g. `btllib::SeqReader::Flag` in C++ versus `btllib.SeqReaderFlag` in Python). - * Use `PYTHONPATH` environment variable or `sys.path.append()` in your Python code to include `/path/to/btllib/install/lib/btllib` directory + * Use `PYTHONPATH` environment variable or `sys.path.append()` in your Python code to include `/path/to/btllib/install/lib/btllib/python` directory * Include the library with `import btllib` - Executables * btllib generated executables can be found in `/path/to/btllib/install/bin` directory. Append that path to the `PATH` environment variable to make it available to your shell. diff --git a/docs/index.html b/docs/index.html index 84dd0d64..bc8cd503 100644 --- a/docs/index.html +++ b/docs/index.html @@ -108,7 +108,7 @@

  • Python wrappers
    • The wrappers correspond one-to-one with C++ code so any functions and classes can be used under the same name. The only exception are nested classes which are prefixed with outer class name (e.g. btllib::SeqReader::Flag in C++ versus btllib.SeqReaderFlag in Python).
    • -
    • Use PYTHONPATH environment variable or sys.path.append() in your Python code to include /path/to/btllib/install/python directory
    • +
    • Use PYTHONPATH environment variable or sys.path.append() in your Python code to include /path/to/btllib/install/lib/btllib/python directory
    • Include the library with import btllib
  • diff --git a/docs/namespacebtllib.html b/docs/namespacebtllib.html index 0391f0ce..a847c36d 100644 --- a/docs/namespacebtllib.html +++ b/docs/namespacebtllib.html @@ -230,6 +230,10 @@  ntmsm64l (nthash.seq+nthash.pos - 1, blocks, monomers, nthash.k, blocks.size(), hash_num_per_seed, fh_no_monomers_tmp.get(), rh_no_monomers_tmp.get(), forward_hash_tmp.get(), reverse_hash_tmp.get(), nthash.hashes_array.get())   + +template<typename T > +T canonical (const T fwd, const T rev) +  uint64_t srol (const uint64_t x)   uint64_t srol (const uint64_t x, const unsigned d) diff --git a/docs/nthash__lowlevel_8hpp_source.html b/docs/nthash__lowlevel_8hpp_source.html index d38f7b7c..a0192d8e 100644 --- a/docs/nthash__lowlevel_8hpp_source.html +++ b/docs/nthash__lowlevel_8hpp_source.html @@ -79,7 +79,7 @@
    8#ifndef BTLLIB_NTHASH_LOWLEVEL_HPP
    9#define BTLLIB_NTHASH_LOWLEVEL_HPP
    10
    -
    11#include "nthash_consts.hpp"
    +
    11#include "btllib/nthash_consts.hpp"
    12#include <array>
    13#include <cstddef>
    14#include <cstdint>
    @@ -88,300 +88,309 @@
    17
    18namespace btllib {
    19
    -
    20#define CANONICAL(FORWARD, REVERSE) ((FORWARD) + (REVERSE))
    -
    21
    -
    22// Data structures for spaced seeds
    -
    23
    -
    24// List of don't care positions
    -
    25using SpacedSeed = std::vector<unsigned>;
    +
    20template<typename T>
    +
    21inline T
    +
    22canonical(const T fwd, const T rev)
    +
    23{
    +
    24 return fwd + rev;
    +
    25}
    26
    -
    27// Bx2 array representing block start and end positions.
    -
    28using SpacedSeedBlocks = std::vector<std::array<unsigned, 2>>;
    -
    29
    -
    30// List of blocks with sizes of one.
    -
    31using SpacedSeedMonomers = std::vector<unsigned>;
    +
    27static_assert(std::numeric_limits<unsigned>::max() + 1 == 0,
    +
    28 "Integers don't overflow on this platform which is necessary for "
    +
    29 "ntHash canonical hash computation.");
    +
    30
    +
    31// Data structures for spaced seeds
    32
    -
    41inline uint64_t
    -
    42srol(const uint64_t x)
    -
    43{
    -
    44 uint64_t m = ((x & 0x8000000000000000ULL) >> 30) | // NOLINT
    -
    45 ((x & 0x100000000ULL) >> 32); // NOLINT
    -
    46 return ((x << 1) & 0xFFFFFFFDFFFFFFFFULL) | m; // NOLINT
    -
    47}
    -
    48
    -
    58inline uint64_t
    -
    59srol(const uint64_t x, const unsigned d)
    -
    60{
    -
    61 uint64_t v = (x << d) | (x >> (64 - d)); // NOLINT
    -
    62 uint64_t y = (v ^ (v >> 33)) & // NOLINT
    -
    63 (std::numeric_limits<uint64_t>::max() >> (64 - d)); // NOLINT
    -
    64 return v ^ (y | (y << 33)); // NOLINT
    -
    65}
    -
    66
    -
    75inline uint64_t
    -
    76sror(const uint64_t x)
    -
    77{
    -
    78 uint64_t m = ((x & 0x200000000ULL) << 30) | ((x & 1ULL) << 32); // NOLINT
    -
    79 return ((x >> 1) & 0xFFFFFFFEFFFFFFFFULL) | m; // NOLINT
    -
    80}
    -
    81
    -
    90uint64_t
    -
    91ntf64(const char* kmer_seq, unsigned k);
    -
    92
    -
    102uint64_t
    -
    103ntr64(const char* kmer_seq, unsigned k);
    -
    104
    -
    116uint64_t
    -
    117ntf64(uint64_t fh_val,
    -
    118 unsigned k,
    -
    119 unsigned char char_out,
    -
    120 unsigned char char_in);
    -
    121
    -
    134uint64_t
    -
    135ntr64(uint64_t rh_val,
    -
    136 unsigned k,
    -
    137 unsigned char char_out,
    -
    138 unsigned char char_in);
    -
    139
    -
    148uint64_t
    -
    149ntc64(const char* kmer_seq, unsigned k);
    -
    150
    -
    162uint64_t
    -
    163ntc64(const char* kmer_seq, unsigned k, uint64_t& fh_val, uint64_t& rh_val);
    -
    164
    -
    176uint64_t
    -
    177ntc64(unsigned char char_out,
    -
    178 unsigned char char_in,
    -
    179 unsigned k,
    -
    180 uint64_t& fh_val,
    -
    181 uint64_t& rh_val);
    -
    182
    -
    193uint64_t
    -
    194ntf64l(uint64_t rh_val,
    -
    195 unsigned k,
    -
    196 unsigned char char_out,
    -
    197 unsigned char char_in);
    -
    198
    -
    209uint64_t
    -
    210ntr64l(uint64_t fh_val,
    -
    211 unsigned k,
    -
    212 unsigned char char_out,
    -
    213 unsigned char char_in);
    -
    214
    -
    227uint64_t
    -
    228ntc64l(unsigned char char_out,
    -
    229 unsigned char char_in,
    -
    230 unsigned k,
    -
    231 uint64_t& fh_val,
    -
    232 uint64_t& rh_val);
    -
    233
    -
    242void
    -
    243nte64(uint64_t bh_val, unsigned k, unsigned h, uint64_t* h_val);
    -
    244
    -
    253void
    -
    254ntmc64(const char* kmer_seq, unsigned k, unsigned m, uint64_t* h_val);
    -
    255
    -
    267void
    -
    268ntmc64(const char* kmer_seq,
    -
    269 unsigned k,
    -
    270 unsigned m,
    -
    271 uint64_t& fh_val,
    -
    272 uint64_t& rh_val,
    -
    273 uint64_t* h_val);
    -
    274
    -
    286void
    -
    287ntmc64(unsigned char char_out,
    -
    288 unsigned char char_in,
    -
    289 unsigned k,
    -
    290 unsigned m,
    -
    291 uint64_t& fh_val,
    -
    292 uint64_t& rh_val,
    -
    293 uint64_t* h_val);
    -
    294
    -
    306void
    -
    307ntmc64l(unsigned char char_out,
    -
    308 unsigned char char_in,
    -
    309 unsigned k,
    -
    310 unsigned m,
    -
    311 uint64_t& fh_val,
    -
    312 uint64_t& rh_val,
    -
    313 uint64_t* h_val);
    -
    314
    -
    327bool
    -
    328ntc64(const char* kmer_seq, unsigned k, uint64_t& h_val, unsigned& loc_n);
    -
    329
    -
    343bool
    -
    344ntmc64(const char* kmer_seq,
    -
    345 unsigned k,
    -
    346 unsigned m,
    -
    347 unsigned& loc_n,
    -
    348 uint64_t* h_val);
    -
    349
    -
    364bool
    -
    365ntc64(const char* kmer_seq,
    -
    366 unsigned k,
    -
    367 uint64_t& fh_val,
    -
    368 uint64_t& rh_val,
    -
    369 uint64_t& h_val,
    -
    370 unsigned& loc_n);
    -
    371
    -
    387bool
    -
    388ntmc64(const char* kmer_seq,
    -
    389 unsigned k,
    -
    390 unsigned m,
    -
    391 uint64_t& fh_val,
    -
    392 uint64_t& rh_val,
    -
    393 unsigned& loc_n,
    -
    394 uint64_t* h_val);
    -
    395
    -
    413bool
    -
    414ntmc64(const char* kmer_seq,
    -
    415 unsigned k,
    -
    416 unsigned m,
    -
    417 uint64_t& fh_val,
    -
    418 uint64_t& rh_val,
    -
    419 unsigned& loc_n,
    -
    420 uint64_t* h_val,
    -
    421 bool& h_stn);
    -
    422
    -
    436void
    -
    437ntmc64(unsigned char char_out,
    -
    438 unsigned char char_in,
    -
    439 unsigned k,
    -
    440 unsigned m,
    -
    441 uint64_t& fh_val,
    -
    442 uint64_t& rh_val,
    -
    443 uint64_t* h_val,
    -
    444 bool& h_stn);
    -
    445
    -
    459uint64_t
    -
    460mask_hash(uint64_t& fk_val,
    -
    461 uint64_t& rk_val,
    -
    462 const char* seed_seq,
    -
    463 const char* kmer_seq,
    -
    464 unsigned k);
    -
    465
    -
    480void
    -
    481sub_hash(uint64_t fh_val,
    -
    482 uint64_t rh_val,
    -
    483 const char* kmer_seq,
    -
    484 const std::vector<unsigned>& positions,
    -
    485 const std::vector<unsigned char>& new_bases,
    -
    486 unsigned k,
    -
    487 unsigned m,
    -
    488 uint64_t* h_val);
    -
    489
    -
    514bool
    -
    515ntmsm64(const char* kmer_seq,
    -
    516 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    -
    517 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    -
    518 unsigned k,
    -
    519 unsigned m,
    -
    520 unsigned m2,
    -
    521 uint64_t* fh_nomonos,
    -
    522 uint64_t* rh_nomonos,
    -
    523 uint64_t* fh_val,
    -
    524 uint64_t* rh_val,
    -
    525 unsigned& loc_n,
    -
    526 uint64_t* h_val);
    -
    527
    -
    528#define NTMSM64(ROL_HANDLING, IN_HANDLING, OUT_HANDLING, ROR_HANDLING) \
    -
    529 unsigned char char_out, char_in; \
    -
    530 uint64_t fh_seed, rh_seed; \
    -
    531 unsigned i_out, i_in, i_base; \
    -
    532 for (unsigned i_seed = 0; i_seed < m; i_seed++) { \
    -
    533 ROL_HANDLING /* NOLINT(bugprone-macro-parentheses) */ \
    -
    534 for (const auto& block : seeds_blocks[i_seed]) \
    -
    535 { \
    -
    536 IN_HANDLING \
    -
    537 OUT_HANDLING \
    -
    538 fh_seed ^= MS_TAB(char_out, k - i_out); \
    -
    539 fh_seed ^= MS_TAB(char_in, k - i_in); \
    -
    540 rh_seed ^= MS_TAB(char_out & CP_OFF, i_out); \
    -
    541 rh_seed ^= MS_TAB(char_in & CP_OFF, i_in); \
    -
    542 } \
    -
    543 ROR_HANDLING /* NOLINT(bugprone-macro-parentheses) */ \
    -
    544 fh_nomonos[i_seed] = fh_seed; \
    -
    545 rh_nomonos[i_seed] = rh_seed; \
    -
    546 for (const auto& pos : seeds_monomers[i_seed]) { \
    -
    547 fh_seed ^= MS_TAB((unsigned char)kmer_seq[pos + 1], k - 1 - pos); \
    -
    548 rh_seed ^= MS_TAB((unsigned char)kmer_seq[pos + 1] & CP_OFF, pos); \
    -
    549 } \
    -
    550 fh_val[i_seed] = fh_seed; \
    -
    551 rh_val[i_seed] = rh_seed; \
    -
    552 i_base = i_seed * m2; \
    -
    553 h_val[i_base] = CANONICAL(fh_seed, rh_seed); \
    -
    554 for (unsigned i_hash = 1; i_hash < m2; i_hash++) { \
    -
    555 h_val[i_base + i_hash] = h_val[i_base] * (i_hash ^ k * MULTISEED); \
    -
    556 h_val[i_base + i_hash] ^= h_val[i_base + i_hash] >> MULTISHIFT; \
    -
    557 } \
    -
    558 }
    -
    559
    -
    581void
    -
    582ntmsm64(const char* kmer_seq,
    -
    583 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    -
    584 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    -
    585 unsigned k,
    -
    586 unsigned m,
    -
    587 unsigned m2,
    -
    588 uint64_t* fh_nomonos,
    -
    589 uint64_t* rh_nomonos,
    -
    590 uint64_t* fh_val,
    -
    591 uint64_t* rh_val,
    -
    592 uint64_t* h_val);
    -
    593
    -
    615void
    -
    616ntmsm64l(const char* kmer_seq,
    -
    617 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    -
    618 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    -
    619 unsigned k,
    -
    620 unsigned m,
    -
    621 unsigned m2,
    -
    622 uint64_t* fh_nomonos,
    -
    623 uint64_t* rh_nomonos,
    -
    624 uint64_t* fh_val,
    -
    625 uint64_t* rh_val,
    -
    626 uint64_t* h_val);
    -
    627
    -
    649void
    -
    650ntmsm64(const char* kmer_seq,
    -
    651 char in,
    -
    652 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    -
    653 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    -
    654 unsigned k,
    -
    655 unsigned m,
    -
    656 unsigned m2,
    -
    657 uint64_t* fh_nomonos,
    -
    658 uint64_t* rh_nomonos,
    -
    659 uint64_t* fh_val,
    -
    660 uint64_t* rh_val,
    -
    661 uint64_t* h_val);
    -
    662
    -
    684void
    -
    685ntmsm64l(const char* kmer_seq,
    -
    686 char in,
    -
    687 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    -
    688 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    -
    689 unsigned k,
    -
    690 unsigned m,
    -
    691 unsigned m2,
    -
    692 uint64_t* fh_nomonos,
    -
    693 uint64_t* rh_nomonos,
    -
    694 uint64_t* fh_val,
    -
    695 uint64_t* rh_val,
    -
    696 uint64_t* h_val);
    -
    697
    -
    698} // namespace btllib
    -
    699
    -
    700#endif
    +
    33// List of don't care positions
    +
    34using SpacedSeed = std::vector<unsigned>;
    +
    35
    +
    36// Bx2 array representing block start and end positions.
    +
    37using SpacedSeedBlocks = std::vector<std::array<unsigned, 2>>;
    +
    38
    +
    39// List of blocks with sizes of one.
    +
    40using SpacedSeedMonomers = std::vector<unsigned>;
    +
    41
    +
    50inline uint64_t
    +
    51srol(const uint64_t x)
    +
    52{
    +
    53 uint64_t m = ((x & 0x8000000000000000ULL) >> 30) | // NOLINT
    +
    54 ((x & 0x100000000ULL) >> 32); // NOLINT
    +
    55 return ((x << 1) & 0xFFFFFFFDFFFFFFFFULL) | m; // NOLINT
    +
    56}
    +
    57
    +
    67inline uint64_t
    +
    68srol(const uint64_t x, const unsigned d)
    +
    69{
    +
    70 uint64_t v = (x << d) | (x >> (64 - d)); // NOLINT
    +
    71 uint64_t y = (v ^ (v >> 33)) & // NOLINT
    +
    72 (std::numeric_limits<uint64_t>::max() >> (64 - d)); // NOLINT
    +
    73 return v ^ (y | (y << 33)); // NOLINT
    +
    74}
    +
    75
    +
    84inline uint64_t
    +
    85sror(const uint64_t x)
    +
    86{
    +
    87 uint64_t m = ((x & 0x200000000ULL) << 30) | ((x & 1ULL) << 32); // NOLINT
    +
    88 return ((x >> 1) & 0xFFFFFFFEFFFFFFFFULL) | m; // NOLINT
    +
    89}
    +
    90
    +
    99uint64_t
    +
    100ntf64(const char* kmer_seq, unsigned k);
    +
    101
    +
    111uint64_t
    +
    112ntr64(const char* kmer_seq, unsigned k);
    +
    113
    +
    125uint64_t
    +
    126ntf64(uint64_t fh_val,
    +
    127 unsigned k,
    +
    128 unsigned char char_out,
    +
    129 unsigned char char_in);
    +
    130
    +
    143uint64_t
    +
    144ntr64(uint64_t rh_val,
    +
    145 unsigned k,
    +
    146 unsigned char char_out,
    +
    147 unsigned char char_in);
    +
    148
    +
    157uint64_t
    +
    158ntc64(const char* kmer_seq, unsigned k);
    +
    159
    +
    171uint64_t
    +
    172ntc64(const char* kmer_seq, unsigned k, uint64_t& fh_val, uint64_t& rh_val);
    +
    173
    +
    185uint64_t
    +
    186ntc64(unsigned char char_out,
    +
    187 unsigned char char_in,
    +
    188 unsigned k,
    +
    189 uint64_t& fh_val,
    +
    190 uint64_t& rh_val);
    +
    191
    +
    202uint64_t
    +
    203ntf64l(uint64_t rh_val,
    +
    204 unsigned k,
    +
    205 unsigned char char_out,
    +
    206 unsigned char char_in);
    +
    207
    +
    218uint64_t
    +
    219ntr64l(uint64_t fh_val,
    +
    220 unsigned k,
    +
    221 unsigned char char_out,
    +
    222 unsigned char char_in);
    +
    223
    +
    236uint64_t
    +
    237ntc64l(unsigned char char_out,
    +
    238 unsigned char char_in,
    +
    239 unsigned k,
    +
    240 uint64_t& fh_val,
    +
    241 uint64_t& rh_val);
    +
    242
    +
    251void
    +
    252nte64(uint64_t bh_val, unsigned k, unsigned h, uint64_t* h_val);
    +
    253
    +
    262void
    +
    263ntmc64(const char* kmer_seq, unsigned k, unsigned m, uint64_t* h_val);
    +
    264
    +
    276void
    +
    277ntmc64(const char* kmer_seq,
    +
    278 unsigned k,
    +
    279 unsigned m,
    +
    280 uint64_t& fh_val,
    +
    281 uint64_t& rh_val,
    +
    282 uint64_t* h_val);
    +
    283
    +
    295void
    +
    296ntmc64(unsigned char char_out,
    +
    297 unsigned char char_in,
    +
    298 unsigned k,
    +
    299 unsigned m,
    +
    300 uint64_t& fh_val,
    +
    301 uint64_t& rh_val,
    +
    302 uint64_t* h_val);
    +
    303
    +
    315void
    +
    316ntmc64l(unsigned char char_out,
    +
    317 unsigned char char_in,
    +
    318 unsigned k,
    +
    319 unsigned m,
    +
    320 uint64_t& fh_val,
    +
    321 uint64_t& rh_val,
    +
    322 uint64_t* h_val);
    +
    323
    +
    336bool
    +
    337ntc64(const char* kmer_seq, unsigned k, uint64_t& h_val, unsigned& loc_n);
    +
    338
    +
    352bool
    +
    353ntmc64(const char* kmer_seq,
    +
    354 unsigned k,
    +
    355 unsigned m,
    +
    356 unsigned& loc_n,
    +
    357 uint64_t* h_val);
    +
    358
    +
    373bool
    +
    374ntc64(const char* kmer_seq,
    +
    375 unsigned k,
    +
    376 uint64_t& fh_val,
    +
    377 uint64_t& rh_val,
    +
    378 uint64_t& h_val,
    +
    379 unsigned& loc_n);
    +
    380
    +
    396bool
    +
    397ntmc64(const char* kmer_seq,
    +
    398 unsigned k,
    +
    399 unsigned m,
    +
    400 uint64_t& fh_val,
    +
    401 uint64_t& rh_val,
    +
    402 unsigned& loc_n,
    +
    403 uint64_t* h_val);
    +
    404
    +
    422bool
    +
    423ntmc64(const char* kmer_seq,
    +
    424 unsigned k,
    +
    425 unsigned m,
    +
    426 uint64_t& fh_val,
    +
    427 uint64_t& rh_val,
    +
    428 unsigned& loc_n,
    +
    429 uint64_t* h_val,
    +
    430 bool& h_stn);
    +
    431
    +
    445void
    +
    446ntmc64(unsigned char char_out,
    +
    447 unsigned char char_in,
    +
    448 unsigned k,
    +
    449 unsigned m,
    +
    450 uint64_t& fh_val,
    +
    451 uint64_t& rh_val,
    +
    452 uint64_t* h_val,
    +
    453 bool& h_stn);
    +
    454
    +
    468uint64_t
    +
    469mask_hash(uint64_t& fk_val,
    +
    470 uint64_t& rk_val,
    +
    471 const char* seed_seq,
    +
    472 const char* kmer_seq,
    +
    473 unsigned k);
    +
    474
    +
    489void
    +
    490sub_hash(uint64_t fh_val,
    +
    491 uint64_t rh_val,
    +
    492 const char* kmer_seq,
    +
    493 const std::vector<unsigned>& positions,
    +
    494 const std::vector<unsigned char>& new_bases,
    +
    495 unsigned k,
    +
    496 unsigned m,
    +
    497 uint64_t* h_val);
    +
    498
    +
    523bool
    +
    524ntmsm64(const char* kmer_seq,
    +
    525 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    +
    526 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    +
    527 unsigned k,
    +
    528 unsigned m,
    +
    529 unsigned m2,
    +
    530 uint64_t* fh_nomonos,
    +
    531 uint64_t* rh_nomonos,
    +
    532 uint64_t* fh_val,
    +
    533 uint64_t* rh_val,
    +
    534 unsigned& loc_n,
    +
    535 uint64_t* h_val);
    +
    536
    +
    537#define NTMSM64(ROL_HANDLING, IN_HANDLING, OUT_HANDLING, ROR_HANDLING) \
    +
    538 unsigned char char_out, char_in; \
    +
    539 uint64_t fh_seed, rh_seed; \
    +
    540 unsigned i_out, i_in, i_base; \
    +
    541 for (unsigned i_seed = 0; i_seed < m; i_seed++) { \
    +
    542 ROL_HANDLING /* NOLINT(bugprone-macro-parentheses) */ \
    +
    543 for (const auto& block : seeds_blocks[i_seed]) \
    +
    544 { \
    +
    545 IN_HANDLING \
    +
    546 OUT_HANDLING \
    +
    547 fh_seed ^= MS_TAB(char_out, k - i_out); \
    +
    548 fh_seed ^= MS_TAB(char_in, k - i_in); \
    +
    549 rh_seed ^= MS_TAB(char_out & CP_OFF, i_out); \
    +
    550 rh_seed ^= MS_TAB(char_in & CP_OFF, i_in); \
    +
    551 } \
    +
    552 ROR_HANDLING /* NOLINT(bugprone-macro-parentheses) */ \
    +
    553 fh_nomonos[i_seed] = fh_seed; \
    +
    554 rh_nomonos[i_seed] = rh_seed; \
    +
    555 for (const auto& pos : seeds_monomers[i_seed]) { \
    +
    556 fh_seed ^= MS_TAB((unsigned char)kmer_seq[pos + 1], k - 1 - pos); \
    +
    557 rh_seed ^= MS_TAB((unsigned char)kmer_seq[pos + 1] & CP_OFF, pos); \
    +
    558 } \
    +
    559 fh_val[i_seed] = fh_seed; \
    +
    560 rh_val[i_seed] = rh_seed; \
    +
    561 i_base = i_seed * m2; \
    +
    562 h_val[i_base] = canonical(fh_seed, rh_seed); \
    +
    563 for (unsigned i_hash = 1; i_hash < m2; i_hash++) { \
    +
    564 h_val[i_base + i_hash] = h_val[i_base] * (i_hash ^ k * MULTISEED); \
    +
    565 h_val[i_base + i_hash] ^= h_val[i_base + i_hash] >> MULTISHIFT; \
    +
    566 } \
    +
    567 }
    +
    568
    +
    590void
    +
    591ntmsm64(const char* kmer_seq,
    +
    592 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    +
    593 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    +
    594 unsigned k,
    +
    595 unsigned m,
    +
    596 unsigned m2,
    +
    597 uint64_t* fh_nomonos,
    +
    598 uint64_t* rh_nomonos,
    +
    599 uint64_t* fh_val,
    +
    600 uint64_t* rh_val,
    +
    601 uint64_t* h_val);
    +
    602
    +
    624void
    +
    625ntmsm64l(const char* kmer_seq,
    +
    626 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    +
    627 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    +
    628 unsigned k,
    +
    629 unsigned m,
    +
    630 unsigned m2,
    +
    631 uint64_t* fh_nomonos,
    +
    632 uint64_t* rh_nomonos,
    +
    633 uint64_t* fh_val,
    +
    634 uint64_t* rh_val,
    +
    635 uint64_t* h_val);
    +
    636
    +
    658void
    +
    659ntmsm64(const char* kmer_seq,
    +
    660 char in,
    +
    661 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    +
    662 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    +
    663 unsigned k,
    +
    664 unsigned m,
    +
    665 unsigned m2,
    +
    666 uint64_t* fh_nomonos,
    +
    667 uint64_t* rh_nomonos,
    +
    668 uint64_t* fh_val,
    +
    669 uint64_t* rh_val,
    +
    670 uint64_t* h_val);
    +
    671
    +
    693void
    +
    694ntmsm64l(const char* kmer_seq,
    +
    695 char in,
    +
    696 const std::vector<SpacedSeedBlocks>& seeds_blocks,
    +
    697 const std::vector<SpacedSeedMonomers>& seeds_monomers,
    +
    698 unsigned k,
    +
    699 unsigned m,
    +
    700 unsigned m2,
    +
    701 uint64_t* fh_nomonos,
    +
    702 uint64_t* rh_nomonos,
    +
    703 uint64_t* fh_val,
    +
    704 uint64_t* rh_val,
    +
    705 uint64_t* h_val);
    +
    706
    +
    707} // namespace btllib
    +
    708
    +
    709#endif
    Definition: bloom_filter.hpp:16
    uint64_t ntf64l(uint64_t rh_val, unsigned k, unsigned char char_out, unsigned char char_in)
    void sub_hash(uint64_t fh_val, uint64_t rh_val, const char *kmer_seq, const std::vector< unsigned > &positions, const std::vector< unsigned char > &new_bases, unsigned k, unsigned m, uint64_t *h_val)
    uint64_t ntr64l(uint64_t fh_val, unsigned k, unsigned char char_out, unsigned char char_in)
    -
    uint64_t srol(const uint64_t x)
    Definition: nthash_lowlevel.hpp:42
    +
    uint64_t srol(const uint64_t x)
    Definition: nthash_lowlevel.hpp:51
    uint64_t mask_hash(uint64_t &fk_val, uint64_t &rk_val, const char *seed_seq, const char *kmer_seq, unsigned k)
    uint64_t ntc64l(unsigned char char_out, unsigned char char_in, unsigned k, uint64_t &fh_val, uint64_t &rh_val)
    -
    uint64_t sror(const uint64_t x)
    Definition: nthash_lowlevel.hpp:76
    +
    uint64_t sror(const uint64_t x)
    Definition: nthash_lowlevel.hpp:85
    uint64_t ntc64(const char *kmer_seq, unsigned k)
    uint64_t ntr64(const char *kmer_seq, unsigned k)
    void nte64(uint64_t bh_val, unsigned k, unsigned h, uint64_t *h_val)
    diff --git a/scripts/test-wrappers b/scripts/test-wrappers index 7cefd0eb..032094a4 100755 --- a/scripts/test-wrappers +++ b/scripts/test-wrappers @@ -9,5 +9,5 @@ set -e cd "${MESON_SOURCE_ROOT}" -cd install/python +cd install/lib/btllib/python python3 -c 'import btllib; nt = btllib.NtHash("ACTG", 2, 3); nt.roll(); b = btllib.BloomFilter(1024, 2); b.insert(nt.hashes())' \ No newline at end of file diff --git a/wrappers/python/meson.build b/wrappers/python/meson.build index 0540f895..1b0ee4a9 100644 --- a/wrappers/python/meson.build +++ b/wrappers/python/meson.build @@ -28,8 +28,8 @@ btllib_py = shared_module('_btllib', cpp_args : cpp_extra_args, link_args : link_extra_args, install : true, - install_dir : 'lib/btllib', + install_dir : 'lib/btllib/python', name_prefix : '') python_files = ['btllib.py'] -install_data(python_files, install_dir : 'lib/btllib') \ No newline at end of file +install_data(python_files, install_dir : 'lib/btllib/python') \ No newline at end of file