10 #include <sharg/exceptions.hpp>
19 namespace index_structure
22 using ibf = seqan3::interleaved_bloom_filter<seqan3::data_layout::uncompressed>;
23 using ibf_compressed = seqan3::interleaved_bloom_filter<seqan3::data_layout::compressed>;
27 template <
typename return_t,
typename input_t>
28 concept
compressible_from = (std::same_as<return_t, ibf_compressed> && std::same_as<input_t, ibf>)
29 || (std::same_as<return_t, hibf_compressed> && std::same_as<input_t, hibf>);
33 template <
typename data_t = index_structure::ibf>
37 template <
typename friend_data_t>
40 uint64_t window_size_{};
41 seqan3::shape shape_{};
44 std::vector<std::vector<std::string>> bin_path_{};
59 seqan3::shape
const shape,
62 std::vector<std::vector<std::string>>
const &
bin_path,
74 shape_{arguments.
shape},
75 parts_{arguments.
parts},
78 ibf_{seqan3::bin_count{arguments.bins},
79 seqan3::bin_size{arguments.bits / arguments.
parts},
80 seqan3::hash_function_count{arguments.hash}}
85 template <
typename other_data_t>
88 static_assert(index_structure::compressible_from<data_t, other_data_t>);
89 window_size_ = other.window_size_;
90 shape_ = other.shape_;
91 parts_ = other.parts_;
93 bin_path_ = other.bin_path_;
94 ibf_ = data_t{other.ibf_};
97 template <
typename other_data_t>
100 static_assert(index_structure::compressible_from<data_t, other_data_t>);
101 window_size_ = std::move(other.window_size_);
102 shape_ = std::move(other.shape_);
103 parts_ = std::move(other.parts_);
105 bin_path_ = std::move(other.bin_path_);
106 ibf_ = std::move(data_t{std::move(other.ibf_)});
129 std::vector<std::vector<std::string>>
const &
bin_path()
const
139 data_t
const &
ibf()
const
151 template <seqan3::cereal_archive archive_t>
152 void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
155 archive(parsed_version);
160 archive(window_size_);
163 archive(compressed_);
167 throw sharg::parser_error{
"Data layouts of serialised and specified index differ."};
172 catch (std::exception
const & e)
174 throw sharg::parser_error{
"Cannot read index: " + std::string{e.what()}};
179 throw sharg::parser_error{
"Unsupported index version. Check raptor upgrade."};
190 template <seqan3::cereal_input_archive archive_t>
191 void load_parameters(archive_t & archive)
193 uint32_t parsed_version{};
194 archive(parsed_version);
199 archive(window_size_);
202 archive(compressed_);
206 catch (std::exception
const & e)
208 throw sharg::parser_error{
"Cannot read index: " + std::string{e.what()}};
214 throw sharg::parser_error{
"Unsupported index version. Check raptor upgrade."};
The HIBF binning directory. A data structure that efficiently answers set-membership queries for mult...
Definition: hierarchical_interleaved_bloom_filter.hpp:78
seqan3::shape shape() const
Definition: index.hpp:114
data_t & ibf()
Definition: index.hpp:134
static constexpr uint32_t version
Definition: index.hpp:49
bool compressed() const
Definition: index.hpp:124
raptor_index(raptor_index const &)=default
raptor_index & operator=(raptor_index &&)=default
raptor_index(window const window_size, seqan3::shape const shape, uint8_t const parts, bool const compressed, std::vector< std::vector< std::string >> const &bin_path, data_t &&ibf)
Definition: index.hpp:58
uint8_t parts() const
Definition: index.hpp:119
raptor_index & operator=(raptor_index const &)=default
data_t const & ibf() const
Definition: index.hpp:139
raptor_index(build_arguments const &arguments)
Definition: index.hpp:72
uint64_t window_size() const
Definition: index.hpp:109
std::vector< std::vector< std::string > > const & bin_path() const
Definition: index.hpp:129
raptor_index(raptor_index &&)=default
raptor_index(raptor_index< other_data_t > &&other)
Definition: index.hpp:98
raptor_index(raptor_index< other_data_t > const &other)
Definition: index.hpp:86
static constexpr seqan3::data_layout data_layout_mode
Definition: index.hpp:48
seqan3::interleaved_bloom_filter< seqan3::data_layout::compressed > ibf_compressed
Definition: index.hpp:23
concept compressible_from
Definition: index.hpp:28
seqan3::interleaved_bloom_filter< seqan3::data_layout::uncompressed > ibf
Definition: index.hpp:22
Definition: adjust_seed.hpp:13
Definition: build_arguments.hpp:21
Strong type for passing the window size.
Definition: strong_types.hpp:17