31 #include <seqan3/io/detail/record.hpp>
100 template <
typename t>
147 template <
typename _sequence_alphabet>
154 template <
typename _
id_alphabet>
161 template <
typename _quality_alphabet>
338 static_assert([] () constexpr
340 for (
field f : selected_field_ids::as_array)
341 if (!field_ids::contains(f))
345 "You selected a field that is not valid for sequence files, please refer to the documentation "
346 "of sequence_file_input::field_ids for the accepted values.");
348 static_assert([] () constexpr
354 "You may not select field::seq_qual and either of field::seq and field::qual at the same time.");
363 typename traits_type::sequence_alphabet>;
365 using id_type =
typename traits_type::template id_container<
366 typename traits_type::id_alphabet>;
369 typename traits_type::quality_alphabet>;
373 typename traits_type::quality_alphabet>>;
400 using iterator = detail::in_file_iterator<sequence_file_input>;
443 primary_stream->rdbuf()->pubsetbuf(stream_buffer.
data(), stream_buffer.
size());
445 std::ios_base::in | std::ios::binary);
447 if (!primary_stream->good())
448 throw file_open_error{
"Could not open file " + filename.
string() +
" for reading."};
451 secondary_stream = detail::make_secondary_istream(*primary_stream, filename);
454 detail::set_format(format, filename);
477 template <input_stream stream_t,
480 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
stream_char_type>
483 file_format
const & SEQAN3_DOXYGEN_ONLY(format_tag),
485 primary_stream{&stream, stream_deleter_noop},
486 format{detail::sequence_file_input_format_exposer<file_format>{}}
488 static_assert(list_traits::contains<file_format, valid_formats>,
489 "You selected a format that is not in the valid_formats of this file.");
492 secondary_stream = detail::make_secondary_istream(*primary_stream);
496 template <input_stream stream_t,
499 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
stream_char_type>
502 file_format
const & SEQAN3_DOXYGEN_ONLY(format_tag),
504 primary_stream{
new stream_t{
std::move(stream)}, stream_deleter_default},
505 format{detail::sequence_file_input_format_exposer<file_format>{}}
507 static_assert(list_traits::contains<file_format, valid_formats>,
508 "You selected a format that is not in the valid_formats of this file.");
511 secondary_stream = detail::make_secondary_istream(*primary_stream);
536 if (!first_record_was_read)
539 first_record_was_read =
true;
619 stream_ptr_t primary_stream{
nullptr, stream_deleter_noop};
621 stream_ptr_t secondary_stream{
nullptr, stream_deleter_noop};
624 bool first_record_was_read{
false};
629 using format_type =
typename detail::variant_from_tags<
valid_formats,
630 detail::sequence_file_input_format_exposer>::type;
636 void read_next_record()
639 record_buffer.
clear();
649 assert(!
format.valueless_by_exception());
655 f.read_sequence_record(*secondary_stream,
657 detail::get_or_ignore<field::seq_qual>(record_buffer),
658 detail::get_or_ignore<field::id>(record_buffer),
659 detail::get_or_ignore<field::seq_qual>(record_buffer));
663 f.read_sequence_record(*secondary_stream,
665 detail::get_or_ignore<field::seq>(record_buffer),
666 detail::get_or_ignore<field::id>(record_buffer),
667 detail::get_or_ignore<field::qual>(record_buffer));
682 template <input_stream stream_type,
691 template <input_stream stream_type,
700 template <input_stream stream_type,
711 template <input_stream stream_type,
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:46
The 15 letter DNA alphabet, containing all IUPAC smybols minus the gap.
Definition: dna15.hpp:49
The five letter DNA alphabet of A,C,G,T and the unknown character N.
Definition: dna5.hpp:49
Quality type for traditional Sanger and modern Illumina Phred scores.
Definition: phred42.hpp:45
Joins an arbitrary alphabet with a quality alphabet.
Definition: qualified.hpp:59
Provides seqan3::dna15, container aliases and string literals.
Provides seqan3::dna5, container aliases and string literals.
This header includes C++17 filesystem support and imports it into namespace std::filesystem (independ...
field
An enumerator for the fields used in file formats.
Definition: record.hpp:62
@ seq_qual
Sequence and qualities combined in one range.
@ seq
The "sequence", usually a range of nucleotides or amino acids.
@ qual
The qualities, usually in Phred score notation.
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
constexpr bool contains
Whether a type occurs in a type list or not.
Definition: traits.hpp:194
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:70
Provides the seqan3::detail::in_file_iterator class template.
Resolves to std::ranges::explicitly_convertible_to<type1, type2>(). <dl class="no-api">This entity i...
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:29
Provides algorithms for meta programming, parameter packs and seqan3::type_list.
Provides seqan3::phred42 quality scores.
Provides quality alphabet composites.
Provides seqan3::sequence_record.
A class template that holds a choice of seqan3::field.
Definition: record.hpp:163
void clear() noexcept(noexcept(std::apply(expander, std::declval< record & >())))
Clears containers that provide .clear() and (re-)initialises all other elements with = {}.
Definition: record.hpp:267
Provides traits for seqan3::type_list.