104 template <
typename stream_type,
105 typename legal_alph_type,
106 typename stream_pos_type,
112 stream_pos_type & position_buffer,
115 qual_type & SEQAN3_DOXYGEN_ONLY(qualities))
120 position_buffer = stream.tellg();
125 read_id(stream_view, options,
id);
132 template <
typename stream_type,
140 qual_type && SEQAN3_DOXYGEN_ONLY(qualities))
145 if constexpr (detail::decays_to_ignore_v<id_type>)
147 throw std::logic_error{
"The ID field may not be set to ignore when writing FASTA files."};
151 if (std::ranges::empty(
id))
158 if constexpr (detail::decays_to_ignore_v<seq_type>)
161 "The SEQ and SEQ_QUAL fields may not both be set to ignore when writing FASTA files."};
175 template <
typename stream_view_t,
typename seq_legal_alph_type,
typename id_type>
181 if (!is_id(*begin(stream_view)))
185 if constexpr (detail::decays_to_ignore_v<id_type>)
193#if SEQAN3_WORKAROUND_VIEW_PERFORMANCE
194 auto it = stream_view.begin();
195 auto e = stream_view.end();
200 for (; (it != e) && (
is_blank)(*it); ++it)
204 bool at_delimiter =
false;
205 for (; it != e; ++it)
212 id.push_back(
assign_char_to(*it, std::ranges::range_value_t<id_type>{}));
218 for (; (it != e) && ((!
is_char<
'\n'>)(*it)); ++it)
225 stream_view | std::views::drop(1)
234 stream_view | std::views::drop(1)
246#if SEQAN3_WORKAROUND_VIEW_PERFORMANCE
247 auto it = stream_view.begin();
248 auto e = stream_view.end();
253 for (; (it != e) && (
is_blank)(*it); ++it)
257 bool at_delimiter =
false;
258 for (; it != e; ++it)
265 id.push_back(
assign_char_to(*it, std::ranges::range_value_t<id_type>{}));
275 | std::views::drop(1)
283 | std::views::drop(1)
293 template <
typename stream_view_t,
typename seq_legal_alph_type,
typename seq_type>
298 if constexpr (!detail::decays_to_ignore_v<seq_type>)
300 constexpr auto is_legal_alph = char_is_valid_for<seq_legal_alph_type>;
302#if SEQAN3_WORKAROUND_VIEW_PERFORMANCE
303 auto it = stream_view.begin();
304 auto e = stream_view.end();
309 for (; (it != e) && ((!is_id)(*it)); ++it)
315 else if (is_legal_alph(*it))
323 + detail::type_name_as_string<seq_legal_alph_type>
336 | std::views::transform(
337 [is_legal_alph](
char const c)
339 if (!is_legal_alph(c))
342 +
"char_is_valid_for<"
343 + detail::type_name_as_string<seq_legal_alph_type>
359 template <
typename stream_it_t,
typename id_type>
370 stream_it.write_range(
id);
375 template <
typename stream_it_t,
typename seq_type>
384 auto end = std::ranges::end(char_sequence);
389 auto current_end = it;
391 using subrange_t = std::ranges::subrange<
decltype(it),
decltype(it), std::ranges::subrange_kind::sized>;
398 stream_it.write_range(char_sequence);
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.
Functionally the same as std::ostreambuf_iterator, but offers writing a range more efficiently.
Definition fast_ostreambuf_iterator.hpp:37
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:60
auto const char_to
A view over an alphabet, given a range of characters.
Definition char_to.hpp:64
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition alphabet/concept.hpp:521
constexpr void consume(rng_t &&rng)
Iterate over a range.
Definition core/range/detail/misc.hpp:28
constexpr auto take_until
A view adaptor that returns elements from the underlying range until the functor evaluates to true (o...
Definition take_until_view.hpp:557
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_view.hpp:571
constexpr auto istreambuf
A view factory that returns a view over the stream buffer of an input stream.
Definition istreambuf_view.hpp:104
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_view.hpp:82
@ seq
The "sequence", usually a range of nucleotides or amino acids.
constexpr auto is_blank
Checks whether c is a blank character.
Definition predicate.hpp:139
constexpr auto is_digit
Checks whether c is a digital character.
Definition predicate.hpp:259
std::string make_printable(char const c)
Returns a printable value for the given character c.
Definition pretty_print.hpp:45
constexpr auto is_char
Checks whether a given letter is the same as the template non-type argument.
Definition predicate.hpp:60
constexpr auto is_space
Checks whether c is a space character.
Definition predicate.hpp:122
constexpr auto is_cntrl
Checks whether c is a control character.
Definition predicate.hpp:87
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:26
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 io/exception.hpp:45
The options type defines various option members that influence the behaviour of all or some formats.
Definition sequence_file/output_options.hpp:23
uint32_t fasta_letters_per_line
Inserts linebreaks after every n-th letter in the sequence; 0 means no linebreaks.
Definition sequence_file/output_options.hpp:29
bool fasta_legacy_id_marker
Begin the ID line with ";" instead of ">" (not recommended).
Definition sequence_file/output_options.hpp:25
bool add_carriage_return
The default plain text line-ending is "\n", but on Windows an additional carriage return is recommend...
Definition sequence_file/output_options.hpp:39
bool fasta_blank_before_id
Insert a single space after ">" (or ";") before the actual ID.
Definition sequence_file/output_options.hpp:27
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.