Skip to content

Commit

Permalink
Metadata struct interface through functions
Browse files Browse the repository at this point in the history
  • Loading branch information
eaasna committed Sep 15, 2023
1 parent 28ac171 commit c80d99c
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 180 deletions.
6 changes: 2 additions & 4 deletions include/valik/build/index_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ class index_factory
metadata meta(arguments->ref_meta_path);

auto & ibf = index.ibf();
int i = 0;
size_t i = 0;
for (auto && [seq] : sequence_file_t{arguments->bin_file})
{
// get the relevant segments for each reference
auto ref_seg = [&](metadata::segment_stats & seg) {return meta.sequences.at(i).ind == seg.seq_ind;};
for (auto & seg : meta.segments | std::views::filter(ref_seg))
for (auto & seg : meta.segments_from_ind(i))
{
for (auto && value : seq | seqan3::views::slice(seg.start, seg.start + seg.len) | hash_view())
ibf.emplace(value, seqan3::bin_index{seg.id});
Expand Down
4 changes: 1 addition & 3 deletions include/valik/search/iterate_queries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,9 @@ void iterate_split_queries(search_arguments const & arguments,

auto query_ptr = std::make_shared<TSequence>(seq);

auto segments_from_id = [&](metadata::segment_stats & seg) {return seqCount == seg.seq_ind;};
for (auto const & seg : meta.segments | std::views::filter(segments_from_id))
for (auto const & seg : meta.segments_from_ind(seqCount))
{
seqan2::Segment<TSequence const, seqan2::InfixSegment> inf = seqan2::infixWithLength(*query_ptr, seg.start, seg.len);

std::vector<seqan3::dna4> seg_vec{};
for (auto & c : inf)
{
Expand Down
Loading

0 comments on commit c80d99c

Please sign in to comment.