98 template <
typename stream_type,
99 typename seq_legal_alph_type,
100 typename stream_pos_type,
106 stream_pos_type & position_buffer,
109 qual_type & qualities)
111 auto stream_view = detail::istreambuf(stream);
112 auto stream_it = begin(stream_view);
115 size_t sequence_size_before = 0;
116 size_t sequence_size_after = 0;
117 if constexpr (!detail::decays_to_ignore_v<seq_type>)
119 position_buffer = stream.tellg();
122 if (*stream_it !=
'@')
125 + detail::make_printable(*stream_it)};
129 if constexpr (!detail::decays_to_ignore_v<id_type>)
136 detail::consume(stream_view | detail::take_line_or_throw);
147 detail::consume(stream_view | detail::take_line_or_throw);
151 auto seq_view = stream_view | detail::take_until_or_throw(is_char<'+'>)
153 if constexpr (!detail::decays_to_ignore_v<seq_type>)
155 constexpr auto is_legal_alph = char_is_valid_for<seq_legal_alph_type>;
159 [is_legal_alph](
char const c)
161 if (!is_legal_alph(c))
164 +
"char_is_valid_for<"
165 + detail::type_name_as_string<seq_legal_alph_type>
166 +
"> evaluated to false on " + detail::make_printable(c)};
176 auto it = begin(seq_view);
177 auto it_end = end(seq_view);
181 ++sequence_size_after;
185 detail::consume(stream_view | detail::take_line_or_throw);
188 auto qview = stream_view | std::views::filter(!
is_space)
189 | detail::take_exactly_or_throw(sequence_size_after - sequence_size_before);
190 if constexpr (!detail::decays_to_ignore_v<qual_type>)
197 detail::consume(qview);
202 template <
typename stream_type,
210 qual_type && qualities)
212 seqan3::detail::fast_ostreambuf_iterator stream_it{*stream.rdbuf()};
215 if constexpr (detail::decays_to_ignore_v<id_type>)
217 throw std::logic_error{
"The ID field may not be set to ignore when writing FASTQ files."};
221 if (std::ranges::empty(
id))
225 stream_it.write_range(
id);
230 if constexpr (detail::decays_to_ignore_v<seq_type>)
233 "The SEQ and SEQ_QUAL fields may not both be set to ignore when writing FASTQ files."};
245 if constexpr (!detail::decays_to_ignore_v<id_type>)
250 stream_it.write_range(
id);
256 if constexpr (detail::decays_to_ignore_v<qual_type>)
259 "The QUAL and SEQ_QUAL fields may not both be set to ignore when writing FASTQ files."};
263 if (std::ranges::empty(qualities))
266 if constexpr (std::ranges::sized_range<seq_type> && std::ranges::sized_range<qual_type>)
Provides aliases for qualified.
Core alphabet concept and free function/type trait wrappers.
T back_inserter(T... args)
Provides alphabet adaptations for standard char types.
Provides seqan3::views::char_to.
Provides various utility functions.
Provides various transformation traits used by the range module.
Provides seqan3::dna5, container aliases and string literals.
Provides seqan3::detail::fast_ostreambuf_iterator.
auto const to_char
A view that calls seqan3::to_char() on each element in the input range.
Definition: to_char.hpp:63
auto const char_to
A view over an alphabet, given a range of characters.
Definition: char_to.hpp:67
constexpr auto is_blank
Checks whether c is a blank character.
Definition: predicate.hpp:142
constexpr auto is_space
Checks whether c is a space character.
Definition: predicate.hpp:125
constexpr auto is_cntrl
Checks whether c is a control character.
Definition: predicate.hpp:90
decltype(detail::transform< trait_t >(list_t{})) transform
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results.
Definition: traits.hpp:470
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:146
Provides seqan3::detail::ignore_output_iterator for writing to null stream.
The generic concept for a (biological) sequence.
Provides various utility functions.
Provides seqan3::detail::istreambuf.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
Provides character predicates for tokenisation.
Provides seqan3::sequence_file_output_options.
Thrown if there is a parse error, such as reading an unexpected character from an input stream.
Definition: exception.hpp:48
The options type defines various option members that influence the behaviour of all or some formats.
Definition: output_options.hpp:26
bool add_carriage_return
The default plain text line-ending is "\n", but on Windows an additional carriage return is recommend...
Definition: output_options.hpp:42
bool fastq_double_id
Whether to write the ID only '@' or also after '+' line.
Definition: output_options.hpp:37
Provides seqan3::views::take_exactly and seqan3::views::take_exactly_or_throw.
Provides seqan3::detail::take_line and seqan3::detail::take_line_or_throw.
Provides seqan3::views::take_until and seqan3::views::take_until_or_throw.
Provides seqan3::views::to_char.
Provides traits to inspect some information of a type, for example its name.