102 #ifdef SEQAN3_DEPRECATED_310
103 template <
typename stream_type,
104 typename seq_legal_alph_type,
bool seq_qual_combined,
112 qual_type & qualities)
114 template <
typename stream_type,
115 typename seq_legal_alph_type,
123 qual_type & qualities)
126 auto stream_view = detail::istreambuf(stream);
127 auto stream_it = begin(stream_view);
130 size_t sequence_size_before = 0;
131 size_t sequence_size_after = 0;
132 if constexpr (!detail::decays_to_ignore_v<seq_type>)
136 if (*stream_it !=
'@')
139 detail::make_printable(*stream_it)};
143 if constexpr (!detail::decays_to_ignore_v<id_type>)
147 std::ranges::copy(stream_view | detail::take_until_or_throw(
is_cntrl ||
is_blank)
149 std::cpp20::back_inserter(
id));
150 detail::consume(stream_view | detail::take_line_or_throw);
154 std::ranges::copy(stream_view | detail::take_line_or_throw
156 std::cpp20::back_inserter(
id));
161 detail::consume(stream_view | detail::take_line_or_throw);
165 auto seq_view = stream_view | detail::take_until_or_throw(is_char<'+'>)
167 if constexpr (!detail::decays_to_ignore_v<seq_type>)
169 auto constexpr is_legal_alph = char_is_valid_for<seq_legal_alph_type>;
172 if (!is_legal_alph(c))
175 "char_is_valid_for<" +
176 detail::type_name_as_string<seq_legal_alph_type> +
177 "> evaluated to false on " +
178 detail::make_printable(c)};
183 std::cpp20::back_inserter(
sequence));
188 auto it = begin(seq_view);
189 auto it_end = end(seq_view);
193 ++sequence_size_after;
197 detail::consume(stream_view | detail::take_line_or_throw);
200 auto qview = stream_view | std::views::filter(!
is_space)
201 | detail::take_exactly_or_throw(sequence_size_after - sequence_size_before);
202 #ifdef SEQAN3_DEPRECATED_310
203 if constexpr (seq_qual_combined)
207 std::ranges::copy(qview |
views::char_to<
typename std::ranges::range_value_t<qual_type>::quality_alphabet_type>,
208 begin(qualities) + sequence_size_before);
210 else if constexpr (!detail::decays_to_ignore_v<qual_type>)
212 if constexpr (!detail::decays_to_ignore_v<qual_type>)
215 std::ranges::copy(qview |
views::char_to<std::ranges::range_value_t<qual_type>>,
216 std::cpp20::back_inserter(qualities));
220 detail::consume(qview);
225 template <
typename stream_type,
233 qual_type && qualities)
235 seqan3::detail::fast_ostreambuf_iterator stream_it{*stream.rdbuf()};
238 if constexpr (detail::decays_to_ignore_v<id_type>)
240 throw std::logic_error{
"The ID field may not be set to ignore when writing FASTQ files."};
244 if (std::ranges::empty(
id))
248 stream_it.write_range(
id);
253 if constexpr (detail::decays_to_ignore_v<seq_type>)
255 throw std::logic_error{
"The SEQ and SEQ_QUAL fields may not both be set to ignore when writing FASTQ files."};
267 if constexpr (!detail::decays_to_ignore_v<id_type>)
272 stream_it.write_range(
id);
278 if constexpr (detail::decays_to_ignore_v<qual_type>)
280 throw std::logic_error{
"The QUAL and SEQ_QUAL fields may not both be set to ignore when writing FASTQ files."};
284 if (std::ranges::empty(qualities))
287 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.
Core alphabet concept and free function/type trait wrappers.
Provides seqan3::views::char_to.
Provides seqan3::views::to_char.
Provides alphabet adaptations for standard char types.
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.
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
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:471
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:151
auto const to_char
A view that calls seqan3::to_char() on each element in the input range.
Definition: to_char.hpp:68
auto const char_to
A view over an alphabet, given a range of characters.
Definition: char_to.hpp:72
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.
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_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.
[DEPRECATED] Provides seqan3::views::take.
Provides traits to inspect some information of a type, for example its name.
Provides character predicates for tokenisation.