15#include <seqan3/io/sequence_file/input.hpp>
16#include <seqan3/search/views/minimiser_hash.hpp>
30template <file_types file_type>
45 explicit file_reader(seqan3::shape
const shape, uint32_t
const window_size) :
46 minimiser_view{seqan3::views::minimiser_hash(shape,
47 seqan3::window_size{window_size},
48 seqan3::seed{adjust_seed(shape.count())})}
51 template <std::output_iterator<u
int64_t> it_t>
54 for (
auto && filename : filenames)
55 hash_into(filename, target);
58 template <std::output_iterator<u
int64_t> it_t>
59 void hash_into(
std::string const & filename, it_t target)
const
61 sequence_file_t fin{filename};
62 for (
auto && record : fin)
66 template <std::output_iterator<u
int64_t> it_t>
69 for (
auto && filename : filenames)
70 hash_into_if(filename, target, pred);
73 template <std::output_iterator<u
int64_t> it_t>
74 void hash_into_if(
std::string const & filename, it_t target,
auto && pred)
const
76 sequence_file_t fin{filename};
77 for (
auto && record : fin)
83 for (
auto && filename : filenames)
84 on_hash(filename, callback);
87 void on_hash(
std::string const & filename,
auto && callback)
const
89 sequence_file_t fin{filename};
90 for (
auto && record : fin)
91 callback(record.sequence() | minimiser_view);
96 for (
auto && filename : filenames)
97 for_each_hash(filename, callback);
100 void for_each_hash(
std::string const & filename,
auto && callback)
const
102 sequence_file_t fin{filename};
103 for (
auto && record : fin)
108 using sequence_file_t = seqan3::sequence_file_input<dna4_traits, seqan3::fields<seqan3::field::seq>>;
109 using view_t =
decltype(seqan3::views::minimiser_hash(seqan3::shape{}, seqan3::window_size{}, seqan3::seed{}));
110 view_t minimiser_view = seqan3::views::minimiser_hash(seqan3::shape{}, seqan3::window_size{}, seqan3::seed{});
124 explicit file_reader(seqan3::shape
const, uint32_t
const)
127 template <std::output_iterator<u
int64_t> it_t>
130 for (
auto && filename : filenames)
131 hash_into(filename, target);
134 template <std::output_iterator<u
int64_t> it_t>
135 void hash_into(
std::string const & filename, it_t target)
const
139 while (fin.read(
reinterpret_cast<char *
>(&value),
sizeof(value)))
146 template <std::output_iterator<u
int64_t> it_t>
149 for (
auto && filename : filenames)
150 hash_into_if(filename, target, pred);
153 template <std::output_iterator<u
int64_t> it_t>
154 void hash_into_if(
std::string const & filename, it_t target,
auto && pred)
const
158 while (fin.read(
reinterpret_cast<char *
>(&value),
sizeof(value)))
168 for (
auto && filename : filenames)
169 for_each_hash(filename, callback);
172 void for_each_hash(
std::string const & filename,
auto && callback)
const
176 while (fin.read(
reinterpret_cast<char *
>(&value),
sizeof(value)))
Provides raptor::adjust_seed.
Definition: file_reader.hpp:32
Provides raptor::dna4_traits.