Raptor 4.0.0-rc.1
A fast and space-efficient pre-filter
Loading...
Searching...
No Matches
subtree.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2026 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2026 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <cstddef>
13#include <cstdint>
14#include <vector>
15
16#include <raptor/index.hpp>
17
18namespace raptor::detail
19{
20
22inline void
23collect_subtree(std::vector<size_t> & result, raptor_index<index_structure::hibf> const & index, size_t const ibf_idx)
24{
25 result.push_back(ibf_idx);
26 auto const & user_bin_ids = index.ibf().ibf_bin_to_user_bin_id[ibf_idx];
27 for (size_t i = 0; i < user_bin_ids.size(); ++i)
28 {
29 if (user_bin_ids[i] == seqan::hibf::bin_kind::merged)
30 collect_subtree(result, index, index.ibf().next_ibf_id[ibf_idx][i]);
31 }
32}
33
42inline void retire_ibf(raptor_index<index_structure::hibf> & index, size_t const ibf_idx)
43{
44 auto & hibf = index.ibf();
45 // Assigning an empty container releases the memory; `clear()` would keep the capacity.
46 hibf.ibf_vector[ibf_idx] = seqan::hibf::interleaved_bloom_filter{};
47 hibf.next_ibf_id[ibf_idx] = std::vector<uint64_t>{};
48 hibf.prev_ibf_id[ibf_idx] = {seqan::hibf::bin_kind::deleted, seqan::hibf::bin_kind::deleted};
49 hibf.ibf_bin_to_user_bin_id[ibf_idx] = std::vector<uint64_t>{};
50}
51
52} // namespace raptor::detail
Definition index.hpp:48
Provides raptor::raptor_index.
T push_back(T... args)
void collect_subtree(std::vector< size_t > &result, raptor_index< index_structure::hibf > const &index, size_t const ibf_idx)
Collects the indices of all IBFs in the subtree rooted at ibf_idx into result, ibf_idx first.
Definition subtree.hpp:23
void retire_ibf(raptor_index< index_structure::hibf > &index, size_t const ibf_idx)
Retires the IBF at ibf_idx: releases its data and marks it as deleted.
Definition subtree.hpp:42
Hide me