22 #pragma GCC diagnostic push 23 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 38 #include <seqan3/io/detail/record.hpp> 102 template <
typename t>
105 SEQAN3_CONCEPT sequence_file_input_traits = requires (t v)
107 requires writable_alphabet<typename t::sequence_alphabet>;
108 requires writable_alphabet<typename t::sequence_legal_alphabet>;
109 requires explicitly_convertible_to<typename t::sequence_legal_alphabet, typename t::sequence_alphabet>;
110 requires sequence_container<typename t::template sequence_container<typename t::sequence_alphabet>>;
112 requires writable_alphabet<typename t::id_alphabet>;
113 requires sequence_container<typename t::template id_container<typename t::id_alphabet>>;
115 requires writable_quality_alphabet<typename t::quality_alphabet>;
116 requires sequence_container<typename t::template quality_container<typename t::quality_alphabet>>;
151 template <
typename _sequence_alphabet>
158 template <
typename _
id_alphabet>
165 template <
typename _quality_alphabet>
342 static_assert([] () constexpr
344 for (
field f : selected_field_ids::as_array)
349 "You selected a field that is not valid for sequence files, please refer to the documentation " 350 "of sequence_file_input::field_ids for the accepted values.");
352 static_assert([] () constexpr
358 "You may not select field::seq_qual and either of field::seq and field::qual at the same time.");
367 typename traits_type::sequence_alphabet>;
370 typename traits_type::id_alphabet>;
373 typename traits_type::quality_alphabet>;
377 typename traits_type::quality_alphabet>>;
402 using iterator = detail::in_file_iterator<sequence_file_input>;
443 primary_stream{
new std::ifstream{filename, std::ios_base::in | std::ios::binary}, stream_deleter_default}
445 if (!primary_stream->good())
449 secondary_stream = detail::make_secondary_istream(*primary_stream, filename);
452 detail::set_format(format, filename);
475 template <input_stream stream_t,
481 file_format
const & SEQAN3_DOXYGEN_ONLY(format_tag),
483 primary_stream{&stream, stream_deleter_noop},
484 format{detail::sequence_file_input_format_exposer<file_format>{}}
486 static_assert(list_traits::contains<file_format, valid_formats>,
487 "You selected a format that is not in the valid_formats of this file.");
490 secondary_stream = detail::make_secondary_istream(*primary_stream);
494 template <input_stream stream_t,
497 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
stream_char_type>
500 file_format
const & SEQAN3_DOXYGEN_ONLY(format_tag),
502 primary_stream{
new stream_t{
std::move(stream)}, stream_deleter_default},
503 format{detail::sequence_file_input_format_exposer<file_format>{}}
505 static_assert(list_traits::contains<file_format, valid_formats>,
506 "You selected a format that is not in the valid_formats of this file.");
509 secondary_stream = detail::make_secondary_istream(*primary_stream);
534 if (!first_record_was_read)
537 first_record_was_read =
true;
615 stream_ptr_t primary_stream{
nullptr, stream_deleter_noop};
617 stream_ptr_t secondary_stream{
nullptr, stream_deleter_noop};
620 bool first_record_was_read{
false};
625 using format_type =
typename detail::variant_from_tags<
valid_formats,
626 detail::sequence_file_input_format_exposer>::type;
632 void read_next_record()
635 record_buffer.clear();
645 assert(!format.valueless_by_exception());
651 f.read_sequence_record(*secondary_stream,
653 detail::get_or_ignore<field::seq_qual>(record_buffer),
654 detail::get_or_ignore<field::id>(record_buffer),
655 detail::get_or_ignore<field::seq_qual>(record_buffer));
659 f.read_sequence_record(*secondary_stream,
661 detail::get_or_ignore<field::seq>(record_buffer),
662 detail::get_or_ignore<field::id>(record_buffer),
663 detail::get_or_ignore<field::qual>(record_buffer));
677 template <input_stream stream_type,
687 template <input_stream stream_type,
692 typename sequence_file_input<>::selected_field_ids,
693 type_list<file_format>>;
696 template <input_stream stream_type,
704 type_list<file_format>>;
707 template <input_stream stream_type,
709 detail::fields_specialisation selected_field_ids>
712 selected_field_ids
const &)
715 type_list<file_format>>;
719 #pragma GCC diagnostic pop
Provides quality alphabet composites.
Sequence and qualities combined in one range.
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
Provides exceptions used in the I/O module.
Provides algorithms for meta programming, parameter packs and seqan3::type_list.
Provides traits for seqan3::type_list.
Provides seqan3::aa27, container aliases and string literals.
The 15 letter DNA alphabet, containing all IUPAC smybols minus the gap.
Definition: dna15.hpp:48
The main SeqAn3 namespace.
The "sequence", usually a range of nucleotides or amino acids.
Joins an arbitrary alphabet with a quality alphabet.
Definition: qualified.hpp:55
Provides seqan3::concatenated_sequences.
The qualities, usually in phred-score notation.
The twenty-seven letter amino acid alphabet.
Definition: aa27.hpp:43
Thrown if there is an unspecified filesystem or stream error while opening, e.g. permission problem...
Definition: exception.hpp:39
A class template that holds a choice of seqan3::field.
Definition: record.hpp:165
The five letter DNA alphabet of A,C,G,T and the unknown character N.
Definition: dna5.hpp:48
Provides alphabet adaptations for standard char types.
Provides the seqan3::record template and the seqan3::field enum.
constexpr bool contains
Whether a type occurs in a pack or not.
Definition: traits.hpp:193
Provides seqan3::phred42 quality scores.
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:68
Meta-header for the nucleotide submodule; includes all headers from alphabet/nucleotide/.
field
An enumerator for the fields used in file formats.Some of the fields are shared between formats...
Definition: record.hpp:64
Quality type for traditional Sanger and modern Illumina Phred scores (typical range).
Definition: phred42.hpp:43
The concept std::same_as<T, U> is satisfied if and only if T and U denote the same type...
A more refined container concept than seqan3::container.
Provides the seqan3::detail::in_file_iterator class template.
This header includes C++17 filesystem support and imports it into namespace seqan3::filesystem (indep...