Skip to content

Commit

Permalink
Try to construct stellar_matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
eaasna committed Jun 28, 2024
1 parent 955a465 commit cbcc763
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/utilities/alphabet_wrapper/seqan/alphabet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ namespace seqan3::custom
};

template <seqan3::alphabet wrapped_t>
struct alphabet<seqan::alphabet_adaptor<wrapped_t>>
struct alphabet<seqan2::alphabet_adaptor<wrapped_t>>
{
using alphabet_t = seqan::alphabet_adaptor<wrapped_t>;
using alphabet_t = seqan2::alphabet_adaptor<wrapped_t>;
using rank_t = seqan3::alphabet_rank_t<wrapped_t>;
using char_t = seqan3::alphabet_char_t<wrapped_t>;

Expand Down
19 changes: 19 additions & 0 deletions include/valik/search/iterate_queries.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <utilities/alphabet_wrapper/matcher/stellar_matcher.hpp>
#include <utilities/alphabet_wrapper/seqan/alphabet.hpp>
#include <valik/search/producer_threads_parallel.hpp>
#include <valik/search/search_time_statistics.hpp>

Expand All @@ -8,6 +10,8 @@

#include <seqan/seq_io.h>

#include <seqan3/io/sequence_file/all.hpp>

namespace valik::app
{

Expand Down Expand Up @@ -38,6 +42,11 @@ void iterate_distributed_queries(search_arguments const & arguments,
}
}

struct adaptor_traits : seqan3::sequence_file_input_default_traits_dna
{
using sequence_alphabet = seqan2::alphabet_adaptor<seqan3::dna4>; // instead of dna5
};

/**
* @brief Function that creates a query record from each query sequence and sends it to Stellar search.
*
Expand All @@ -50,6 +59,16 @@ void iterate_all_queries(size_t const ref_seg_count,
search_arguments const & arguments,
cart_queue<shared_query_record<TSequence>> & queue)
{
seqan3::sequence_file_input<adaptor_traits> fin{std::istringstream{arguments.query_file}, seqan3::format_fasta{}};
using record_type = typename decltype(fin)::record_type;

std::vector<record_type> rec_vec{};
for (auto & record : fin)
{
rec_vec.emplace_back(record);
}
jst::contrib::stellar_matcher<decltype(rec_vec)> matcher(rec_vec, (double) arguments.error_rate, (unsigned) arguments.minLength);

using TId = seqan2::CharString;
std::vector<shared_query_record<TSequence>> query_records{};
constexpr uint64_t chunk_size = (1ULL << 20) * 10;
Expand Down
1 change: 0 additions & 1 deletion include/valik/search/query_record.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <sstream>

#include <valik/split/metadata.hpp>
#include <utilities/alphabet_wrapper/matcher/stellar_matcher.hpp>

#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan/sequence.h>
Expand Down

0 comments on commit cbcc763

Please sign in to comment.