-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
66 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
#include <digest_utils.hpp> | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
#include <digest_utils.hpp> | ||
|
||
namespace py = pybind11; | ||
|
||
PYBIND11_MODULE(Digest, m) { | ||
m.doc() = "bindings for Digest"; | ||
m.def("window_minimizer", &window_minimizer, "A function that runs window minimizer digestion", | ||
py::arg("seq"), py::arg("k") = 31, py::arg("w") = 11, py::arg("include_hash") = false); | ||
m.def("modimizer", &modimizer, "A function that runs mod-minimizer digestion", | ||
py::arg("seq"), py::arg("k") = 31, py::arg("mod") = 100, py::arg("include_hash") = false); | ||
m.def("syncmer", &syncmer, "A function that runs syncmer digestion", | ||
py::arg("seq"), py::arg("k") = 31, py::arg("w") = 11, py::arg("include_hash") = false); | ||
m.doc() = "bindings for Digest"; | ||
m.def("window_minimizer", &window_minimizer, | ||
"A function that runs window minimizer digestion", py::arg("seq"), | ||
py::arg("k") = 31, py::arg("w") = 11, | ||
py::arg("include_hash") = false); | ||
m.def("modimizer", &modimizer, | ||
"A function that runs mod-minimizer digestion", py::arg("seq"), | ||
py::arg("k") = 31, py::arg("mod") = 100, | ||
py::arg("include_hash") = false); | ||
m.def("syncmer", &syncmer, "A function that runs syncmer digestion", | ||
py::arg("seq"), py::arg("k") = 31, py::arg("w") = 11, | ||
py::arg("include_hash") = false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,52 @@ | ||
#include <digest/window_minimizer.hpp> | ||
#include <digest/syncmer.hpp> | ||
#include <digest/mod_minimizer.hpp> | ||
#include <digest/syncmer.hpp> | ||
#include <digest/window_minimizer.hpp> | ||
#include <variant> | ||
|
||
std::variant<std::vector<uint32_t>, std::vector<std::pair<uint32_t, uint32_t>>> window_minimizer ( | ||
const std::string &seq, unsigned k, unsigned large_window, bool include_hash=false) { | ||
digest::WindowMin<digest::BadCharPolicy::SKIPOVER, digest::ds::Adaptive> digester (seq, k, large_window); | ||
if (include_hash) { | ||
std::vector<std::pair<uint32_t, uint32_t>> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
else { | ||
std::vector<uint32_t> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
std::variant<std::vector<uint32_t>, std::vector<std::pair<uint32_t, uint32_t>>> | ||
window_minimizer(const std::string &seq, unsigned k, unsigned large_window, | ||
bool include_hash = false) { | ||
digest::WindowMin<digest::BadCharPolicy::SKIPOVER, digest::ds::Adaptive> | ||
digester(seq, k, large_window); | ||
if (include_hash) { | ||
std::vector<std::pair<uint32_t, uint32_t>> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} else { | ||
std::vector<uint32_t> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
} | ||
//std::vector<std::pair<size_t, size_t>> output; | ||
// std::vector<std::pair<size_t, size_t>> output; | ||
|
||
std::variant<std::vector<uint32_t>, std::vector<std::pair<uint32_t, uint32_t>>> modimizer ( | ||
const std::string &seq, unsigned k, uint32_t mod, bool include_hash=false) { | ||
digest::ModMin<digest::BadCharPolicy::SKIPOVER> digester (seq, k, mod); | ||
if (include_hash) { | ||
std::vector<std::pair<uint32_t, uint32_t>> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
else { | ||
std::vector<uint32_t> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
std::variant<std::vector<uint32_t>, std::vector<std::pair<uint32_t, uint32_t>>> | ||
modimizer(const std::string &seq, unsigned k, uint32_t mod, | ||
bool include_hash = false) { | ||
digest::ModMin<digest::BadCharPolicy::SKIPOVER> digester(seq, k, mod); | ||
if (include_hash) { | ||
std::vector<std::pair<uint32_t, uint32_t>> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} else { | ||
std::vector<uint32_t> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
} | ||
|
||
std::variant<std::vector<uint32_t>, std::vector<std::pair<uint32_t, uint32_t>>> syncmer ( | ||
const std::string &seq, unsigned k, unsigned large_window, bool include_hash=false) { | ||
digest::Syncmer<digest::BadCharPolicy::WRITEOVER, digest::ds::Adaptive> digester (seq, k, large_window); | ||
if (include_hash) { | ||
std::vector<std::pair<uint32_t, uint32_t>> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
else { | ||
std::vector<uint32_t> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
std::variant<std::vector<uint32_t>, std::vector<std::pair<uint32_t, uint32_t>>> | ||
syncmer(const std::string &seq, unsigned k, unsigned large_window, | ||
bool include_hash = false) { | ||
digest::Syncmer<digest::BadCharPolicy::WRITEOVER, digest::ds::Adaptive> | ||
digester(seq, k, large_window); | ||
if (include_hash) { | ||
std::vector<std::pair<uint32_t, uint32_t>> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} else { | ||
std::vector<uint32_t> output; | ||
digester.roll_minimizer(seq.length(), output); | ||
return output; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters