27#include <seqan3/io/detail/record.hpp>
98 requires detail::is_char_adaptation_v<typename t::sequence_alphabet>
143 template <
typename _sequence_alphabet>
150 template <
typename _
id_alphabet>
157 template <
typename _quality_alphabet>
230 for (
field f : selected_field_ids::as_array)
231 if (!field_ids::contains(
f))
235 "You selected a field that is not valid for sequence files, please refer to the documentation "
236 "of sequence_file_input::field_ids for the accepted values.");
272 using iterator = detail::in_file_iterator<sequence_file_input>;
313 primary_stream{new
std::ifstream{}, stream_deleter_default}
315 primary_stream->rdbuf()->pubsetbuf(stream_buffer.
data(), stream_buffer.
size());
317 ->open(filename, std::ios_base::in | std::ios::binary);
319 if (!primary_stream->good())
323 secondary_stream = detail::make_secondary_istream(*primary_stream, filename);
326 using format_variant_t =
327 typename detail::variant_from_tags<valid_formats, detail::sequence_file_input_format_exposer>::type;
328 format_variant_t format_variant{};
329 detail::set_format(format_variant, filename);
332 [&](
auto && selected_format)
335 format = std::make_unique<selected_sequence_format<format_t>>();
360 template <input_stream stream_t, sequence_file_input_format file_format>
361 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
stream_char_type>
365 primary_stream{&stream, stream_deleter_noop},
368 static_assert(list_traits::contains<file_format, valid_formats>,
369 "You selected a format that is not in the valid_formats of this file.");
372 secondary_stream = detail::make_secondary_istream(*primary_stream);
376 template <input_stream stream_t, sequence_file_input_format file_format>
377 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
stream_char_type>
381 primary_stream{new
stream_t{
std::move(stream)}, stream_deleter_default},
384 static_assert(list_traits::contains<file_format, valid_formats>,
385 "You selected a format that is not in the valid_formats of this file.");
388 secondary_stream = detail::make_secondary_istream(*primary_stream);
413 if (!first_record_was_read)
416 first_record_was_read =
true;
503 stream_ptr_t primary_stream{
nullptr, stream_deleter_noop};
505 stream_ptr_t secondary_stream{
nullptr, stream_deleter_noop};
508 bool first_record_was_read{
false};
515 void read_next_record()
518 record_buffer.
clear();
528 format->read_sequence_record(*secondary_stream, record_buffer, position_buffer,
options);
541 struct sequence_format_base
546 sequence_format_base() =
default;
547 sequence_format_base(sequence_format_base
const &) =
default;
548 sequence_format_base(sequence_format_base &&) =
default;
549 sequence_format_base & operator=(sequence_format_base
const &) =
default;
550 sequence_format_base & operator=(sequence_format_base &&) =
default;
551 virtual ~sequence_format_base() =
default;
565 virtual void read_sequence_record(
std::istream & instream,
582 template <
typename format_t>
583 struct selected_sequence_format final :
public sequence_format_base
588 selected_sequence_format() =
default;
589 selected_sequence_format(selected_sequence_format
const &) =
default;
590 selected_sequence_format(selected_sequence_format &&) =
default;
591 selected_sequence_format & operator=(selected_sequence_format
const &) =
default;
592 selected_sequence_format & operator=(selected_sequence_format &&) =
default;
593 ~selected_sequence_format() =
default;
604 _format.read_sequence_record(instream,
607 detail::get_or_ignore<field::seq>(record_buffer),
608 detail::get_or_ignore<field::id>(record_buffer),
609 detail::get_or_ignore<field::qual>(record_buffer));
614 detail::sequence_file_input_format_exposer<format_t> _format{};
630template <input_stream stream_type, sequence_file_input_format file_format>
638template <input_stream stream_type, sequence_file_input_format file_format>
Provides seqan3::aa27, container aliases and string literals.
Provides alphabet adaptations for standard char types.
The twenty-seven letter amino acid alphabet.
Definition aa27.hpp:43
A "pretty printer" for most SeqAn data structures and related types.
Definition debug_stream_type.hpp:79
debug_stream_type()=default
Defaulted.
The 15 letter DNA alphabet, containing all IUPAC smybols minus the gap.
Definition dna15.hpp:48
The five letter DNA alphabet of A,C,G,T and the unknown character N.
Definition dna5.hpp:48
Quality type for traditional Sanger and modern Illumina Phred scores.
Definition phred42.hpp:44
Provides seqan3::dna15, container aliases and string literals.
Provides seqan3::dna5, container aliases and string literals.
field
An enumerator for the fields used in file formats.
Definition record.hpp:60
Provides the seqan3::detail::in_file_iterator class template.
Checks whether from can be explicitly converted to to.
A more refined container concept than seqan3::container.
Refines seqan3::alphabet and adds assignability.
A concept that indicates whether a writable alphabet represents quality scores.
Provides exceptions used in the I/O module.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
SeqAn specific customisations in the standard namespace.
Provides seqan3::phred42 quality scores.
Provides quality alphabet composites.
Provides seqan3::sequence_record.
Thrown if there is an unspecified filesystem or stream error while opening, e.g. permission problem.
Definition io/exception.hpp:36
void clear() noexcept(noexcept(std::apply(expander, std::declval< record & >().as_base())))
Clears containers that provide .clear() and (re-)initialises all other elements with = {}.
Definition record.hpp:242
Provides traits for seqan3::type_list.