31 #include <seqan3/io/detail/record.hpp>
143 template <
typename _sequence_alphabet>
150 template <
typename _
id_alphabet>
157 template <
typename _quality_alphabet>
333 static_assert([] () constexpr
335 for (
field f : selected_field_ids::as_array)
336 if (!field_ids::contains(f))
340 "You selected a field that is not valid for sequence files, please refer to the documentation "
341 "of sequence_file_input::field_ids for the accepted values.");
343 static_assert([] () constexpr
349 "You may not select field::seq_qual and either of field::seq and field::qual at the same time.");
358 typename traits_type::sequence_alphabet>;
360 using id_type =
typename traits_type::template id_container<
361 typename traits_type::id_alphabet>;
364 typename traits_type::quality_alphabet>;
365 #ifdef SEQAN3_DEPRECATED_310
371 typename traits_type::quality_alphabet>>;
399 using iterator = detail::in_file_iterator<sequence_file_input>;
442 primary_stream->rdbuf()->pubsetbuf(stream_buffer.
data(), stream_buffer.
size());
444 std::ios_base::in | std::ios::binary);
446 if (!primary_stream->good())
447 throw file_open_error{
"Could not open file " + filename.
string() +
" for reading."};
450 secondary_stream = detail::make_secondary_istream(*primary_stream, filename);
453 detail::set_format(format, filename);
476 template <input_stream stream_t,
479 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
stream_char_type>
482 file_format
const & SEQAN3_DOXYGEN_ONLY(format_tag),
484 primary_stream{&stream, stream_deleter_noop},
485 format{detail::sequence_file_input_format_exposer<file_format>{}}
487 static_assert(list_traits::contains<file_format, valid_formats>,
488 "You selected a format that is not in the valid_formats of this file.");
491 secondary_stream = detail::make_secondary_istream(*primary_stream);
495 template <input_stream stream_t,
498 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
stream_char_type>
501 file_format
const & SEQAN3_DOXYGEN_ONLY(format_tag),
503 primary_stream{
new stream_t{
std::move(stream)}, stream_deleter_default},
504 format{detail::sequence_file_input_format_exposer<file_format>{}}
506 static_assert(list_traits::contains<file_format, valid_formats>,
507 "You selected a format that is not in the valid_formats of this file.");
510 secondary_stream = detail::make_secondary_istream(*primary_stream);
535 if (!first_record_was_read)
538 first_record_was_read =
true;
618 stream_ptr_t primary_stream{
nullptr, stream_deleter_noop};
620 stream_ptr_t secondary_stream{
nullptr, stream_deleter_noop};
623 bool first_record_was_read{
false};
628 using format_type =
typename detail::variant_from_tags<
valid_formats,
629 detail::sequence_file_input_format_exposer>::type;
635 void read_next_record()
638 record_buffer.
clear();
648 assert(!
format.valueless_by_exception());
654 f.read_sequence_record(*secondary_stream,
656 detail::get_or_ignore<field::_seq_qual_deprecated>(record_buffer),
657 detail::get_or_ignore<field::id>(record_buffer),
658 detail::get_or_ignore<field::_seq_qual_deprecated>(record_buffer));
662 f.read_sequence_record(*secondary_stream,
664 detail::get_or_ignore<field::seq>(record_buffer),
665 detail::get_or_ignore<field::id>(record_buffer),
666 detail::get_or_ignore<field::qual>(record_buffer));
681 template <input_stream stream_type,
690 template <input_stream stream_type,
699 template <input_stream stream_type,
710 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:51
The five letter DNA alphabet of A,C,G,T and the unknown character N.
Definition: dna5.hpp:51
Quality type for traditional Sanger and modern Illumina Phred scores.
Definition: phred42.hpp:47
Joins an arbitrary alphabet with a quality alphabet.
Definition: qualified.hpp:61
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_deprecated
[DEPRECATED] Sequence and qualities combined in one range. Use field::seq and field::qual instead.
@ 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:167
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:271
Provides traits for seqan3::type_list.