100 template <
typename stream_type,
101 typename seq_legal_alph_type,
bool seq_qual_combined,
109 qual_type & qualities)
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>)
121 if (*stream_it !=
'@')
124 detail::make_printable(*stream_it)};
128 if constexpr (!detail::decays_to_ignore_v<id_type>)
134 std::cpp20::back_inserter(
id));
141 std::cpp20::back_inserter(
id));
152 if constexpr (!detail::decays_to_ignore_v<seq_type>)
154 auto constexpr is_legal_alph = is_in_alphabet<seq_legal_alph_type>;
157 if (!is_legal_alph(c))
161 " evaluated to false on " +
162 detail::make_printable(c)};
167 std::cpp20::back_inserter(
sequence));
172 auto it = begin(seq_view);
173 auto it_end = end(seq_view);
177 ++sequence_size_after;
182 if (*stream_it !=
'+')
185 detail::make_printable(*stream_it)};
190 auto qview = stream_view | std::views::filter(!
is_space)
192 if constexpr (seq_qual_combined)
196 std::ranges::copy(qview |
views::char_to<
typename std::ranges::range_value_t<qual_type>::quality_alphabet_type>,
197 begin(qualities) + sequence_size_before);
199 else if constexpr (!detail::decays_to_ignore_v<qual_type>)
201 std::ranges::copy(qview |
views::char_to<std::ranges::range_value_t<qual_type>>,
202 std::cpp20::back_inserter(qualities));
206 detail::consume(qview);
211 template <
typename stream_type,
219 qual_type && qualities)
221 seqan3::detail::fast_ostreambuf_iterator stream_it{*stream.rdbuf()};
224 if constexpr (detail::decays_to_ignore_v<id_type>)
226 throw std::logic_error{
"The ID field may not be set to ignore when writing FASTQ files."};
230 if (std::ranges::empty(
id))
234 stream_it.write_range(
id);
239 if constexpr (detail::decays_to_ignore_v<seq_type>)
241 throw std::logic_error{
"The SEQ and SEQ_QUAL fields may not both be set to ignore when writing FASTQ files."};
253 if constexpr (!detail::decays_to_ignore_v<id_type>)
258 stream_it.write_range(
id);
264 if constexpr (detail::decays_to_ignore_v<qual_type>)
266 throw std::logic_error{
"The QUAL and SEQ_QUAL fields may not both be set to ignore when writing FASTQ files."};
270 if (std::ranges::empty(qualities))
273 if constexpr (std::ranges::sized_range<seq_type> && std::ranges::sized_range<qual_type>)
Adaptations of algorithms from the Ranges TS.
Provides aliases for qualified.
Provides alphabet adaptations for standard char types.
Provides seqan3::views::char_to.
Provides seqan3::dna5, container aliases and string literals.
constexpr auto is_blank
Checks whether c is a blank character.
Definition: predicate.hpp:163
constexpr auto is_space
Checks whether c is a space character.
Definition: predicate.hpp:146
constexpr auto is_cntrl
Checks whether c is a control character.
Definition: predicate.hpp:110
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:116
seqan3::type_list< trait_t< pack_t >... > transform
Apply a transformation trait to every type in the pack and return a seqan3::type_list of the results.
Definition: traits.hpp:307
auto const to_char
A view that calls seqan3::to_char() on each element in the input range.
Definition: to_char.hpp:65
constexpr auto take_until_or_throw
A view adaptor that returns elements from the underlying range until the functor evaluates to true (t...
Definition: take_until.hpp:624
constexpr auto istreambuf
A view factory that returns a view over the stream buffer of an input stream.
Definition: istreambuf.hpp:113
constexpr auto take_exactly_or_throw
A view adaptor that returns the first size elements from the underlying range and also exposes size i...
Definition: take_exactly.hpp:91
auto const char_to
A view over an alphabet, given a range of characters.
Definition: char_to.hpp:69
constexpr auto take_line_or_throw
A view adaptor that returns a single line from the underlying range (throws if there is no end-of-lin...
Definition: take_line.hpp:90
Provides seqan3::detail::ignore_output_iterator for writing to null stream.
The generic concept for a sequence.
Provides various utility functions.
Provides seqan3::fast_istreambuf_iterator and seqan3::fast_ostreambuf_iterator, as well as,...
Provides seqan3::views::istreambuf.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
Provides character predicates for tokenisation.
Provides various utility functions.
Provides various transformation traits used by the range module.
Adaptations of concepts from the Ranges TS.
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:22
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:39
bool fastq_double_id
Whether to write the ID only '@' or also after '+' line.
Definition: output_options.hpp:34
Provides seqan3::views::take.
Provides seqan3::views::take_exactly and seqan3::views::take_exactly_or_throw.
Provides seqan3::views::take_line and seqan3::views::take_line_or_throw.
Provides seqan3::views::take_until and seqan3::views::take_until_or_throw.
Provides seqan3::views::to_char.