SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
output.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <cassert>
16 #include <fstream>
17 #include <string>
18 #include <string_view>
19 #include <variant>
20 #include <vector>
21 
32 #include <seqan3/io/detail/record.hpp>
33 #include <seqan3/io/exception.hpp>
34 #include <seqan3/std/filesystem>
35 #include <seqan3/io/record.hpp>
37 #include <seqan3/std/ranges>
38 
39 namespace seqan3
40 {
41 
42 // ----------------------------------------------------------------------------
43 // alignment_file_output
44 // ----------------------------------------------------------------------------
45 
143 template <detail::fields_specialisation selected_field_ids_ =
144  fields<field::seq,
145  field::id,
147  field::ref_seq,
148  field::ref_id,
149  field::ref_offset,
151  field::cigar,
152  field::mapq,
153  field::qual,
154  field::flag,
155  field::mate,
156  field::tags,
157  field::evalue,
158  field::bit_score,
160  detail::type_list_of_alignment_file_output_formats valid_formats_ = type_list<format_sam, format_bam>,
161  typename ref_ids_type = ref_info_not_given>
163 {
164 public:
169  using selected_field_ids = selected_field_ids_;
172  using valid_formats = valid_formats_;
174  using stream_char_type = char;
176 
179  field::seq,
180  field::id,
182  field::ref_seq,
183  field::ref_id,
184  field::ref_offset,
186  field::cigar,
187  field::mapq,
188  field::flag,
189  field::qual,
190  field::mate,
191  field::tags,
192  field::evalue,
193  field::bit_score>;
194 
195  static_assert([] () constexpr
196  {
197  for (field f : selected_field_ids::as_array)
198  if (!field_ids::contains(f))
199  return false;
200  return true;
201  }(),
202  "You selected a field that is not valid for alignment files, "
203  "please refer to the documentation of "
204  "seqan3::alignment_file_output::field_ids for the accepted values.");
205 
211  using value_type = void;
214  using reference = void;
216  using const_reference = void;
218  using size_type = void;
222  using iterator = detail::out_file_iterator<alignment_file_output>;
224  using const_iterator = void;
226  using sentinel = std::default_sentinel_t;
228 
232  alignment_file_output() = delete;
244 
271  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
272  primary_stream{new std::ofstream{}, stream_deleter_default}
273  {
274  primary_stream->rdbuf()->pubsetbuf(stream_buffer.data(), stream_buffer.size());
275  static_cast<std::basic_ofstream<char> *>(primary_stream.get())->open(filename,
276  std::ios_base::out | std::ios::binary);
277 
278  // open stream
279  if (!primary_stream->good())
280  throw file_open_error{"Could not open file " + filename.string() + " for writing."};
281 
282  // possibly add intermediate compression stream
283  secondary_stream = detail::make_secondary_ostream(*primary_stream, filename);
284 
285  // initialise format handler or throw if format is not found
286  detail::set_format(format, filename);
287  }
288 
305  template <output_stream stream_type, alignment_file_output_format file_format>
307  requires std::same_as<typename std::remove_reference_t<stream_type>::char_type, stream_char_type>
309  alignment_file_output(stream_type & stream,
310  file_format const & SEQAN3_DOXYGEN_ONLY(format_tag),
311  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
312  primary_stream{&stream, stream_deleter_noop},
313  secondary_stream{&stream, stream_deleter_noop},
314  format{detail::alignment_file_output_format_exposer<file_format>{}}
315  {
316  static_assert(list_traits::contains<file_format, valid_formats>,
317  "You selected a format that is not in the valid_formats of this file.");
318  }
319 
321  template <output_stream stream_type, alignment_file_output_format file_format>
323  requires std::same_as<typename std::remove_reference_t<stream_type>::char_type, stream_char_type>
325  alignment_file_output(stream_type && stream,
326  file_format const & SEQAN3_DOXYGEN_ONLY(format_tag),
327  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
328  primary_stream{new stream_type{std::move(stream)}, stream_deleter_default},
329  secondary_stream{&*primary_stream, stream_deleter_noop},
330  format{detail::alignment_file_output_format_exposer<file_format>{}}
331  {
332  static_assert(list_traits::contains<file_format, valid_formats>,
333  "You selected a format that is not in the valid_formats of this file.");
334  }
335 
366  template <typename ref_ids_type_, std::ranges::forward_range ref_lengths_type>
368  requires std::same_as<std::remove_reference_t<ref_ids_type_>, ref_ids_type>
371  ref_ids_type_ && ref_ids,
372  ref_lengths_type && ref_lengths,
373  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
375 
376  {
377  initialise_header_information(ref_ids, ref_lengths);
378  }
379 
401  template <output_stream stream_type,
402  alignment_file_output_format file_format,
403  typename ref_ids_type_, // generic type to capture lvalue references
404  std::ranges::forward_range ref_lengths_type>
406  requires std::same_as<std::remove_reference_t<ref_ids_type_>, ref_ids_type>
408  alignment_file_output(stream_type && stream,
409  ref_ids_type_ && ref_ids,
410  ref_lengths_type && ref_lengths,
411  file_format const & SEQAN3_DOXYGEN_ONLY(format_tag),
412  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
413  alignment_file_output{std::forward<stream_type>(stream), file_format{}, selected_field_ids{}}
414  {
415  initialise_header_information(ref_ids, ref_lengths);
416  }
418 
440  iterator begin() noexcept
441  {
442  return {*this};
443  }
444 
459  sentinel end() noexcept
460  {
461  return {};
462  }
463 
482  template <typename record_t>
483  void push_back(record_t && r)
485  requires tuple_like<record_t> &&
486  requires { requires detail::is_type_specialisation_of_v<std::remove_cvref_t<record_t>, record>; }
488  {
489  using default_align_t = std::pair<std::span<gapped<char>>, std::span<gapped<char>>>;
490  using default_mate_t = std::tuple<std::string_view, std::optional<int32_t>, int32_t>;
491 
492  write_record(detail::get_or<field::header_ptr>(r, nullptr),
493  detail::get_or<field::seq>(r, std::string_view{}),
494  detail::get_or<field::qual>(r, std::string_view{}),
495  detail::get_or<field::id>(r, std::string_view{}),
496  detail::get_or<field::offset>(r, 0u),
497  detail::get_or<field::ref_seq>(r, std::string_view{}),
498  detail::get_or<field::ref_id>(r, std::ignore),
499  detail::get_or<field::ref_offset>(r, std::optional<int32_t>{}),
500  detail::get_or<field::alignment>(r, default_align_t{}),
501  detail::get_or<field::cigar>(r, std::vector<cigar>{}),
502  detail::get_or<field::flag>(r, sam_flag::none),
503  detail::get_or<field::mapq>(r, 0u),
504  detail::get_or<field::mate>(r, default_mate_t{}),
505  detail::get_or<field::tags>(r, sam_tag_dictionary{}),
506  detail::get_or<field::evalue>(r, 0u),
507  detail::get_or<field::bit_score>(r, 0u));
508  }
509 
531  template <typename tuple_t>
532  void push_back(tuple_t && t)
534  requires tuple_like<tuple_t>
536  {
537  using default_align_t = std::pair<std::span<gapped<char>>, std::span<gapped<char>>>;
538  using default_mate_t = std::tuple<std::string_view, std::optional<int32_t>, int32_t>;
539 
540  // index_of might return npos, but this will be handled well by get_or_ignore (and just return ignore)
541  write_record(detail::get_or<selected_field_ids::index_of(field::header_ptr)>(t, nullptr),
542  detail::get_or<selected_field_ids::index_of(field::seq)>(t, std::string_view{}),
543  detail::get_or<selected_field_ids::index_of(field::qual)>(t, std::string_view{}),
544  detail::get_or<selected_field_ids::index_of(field::id)>(t, std::string_view{}),
545  detail::get_or<selected_field_ids::index_of(field::offset)>(t, 0u),
546  detail::get_or<selected_field_ids::index_of(field::ref_seq)>(t, std::string_view{}),
547  detail::get_or<selected_field_ids::index_of(field::ref_id)>(t, std::ignore),
548  detail::get_or<selected_field_ids::index_of(field::ref_offset)>(t, std::optional<int32_t>{}),
549  detail::get_or<selected_field_ids::index_of(field::alignment)>(t, default_align_t{}),
550  detail::get_or<selected_field_ids::index_of(field::cigar)>(t, std::vector<cigar>{}),
551  detail::get_or<selected_field_ids::index_of(field::flag)>(t, sam_flag::none),
552  detail::get_or<selected_field_ids::index_of(field::mapq)>(t, 0u),
553  detail::get_or<selected_field_ids::index_of(field::mate)>(t, default_mate_t{}),
554  detail::get_or<selected_field_ids::index_of(field::tags)>(t, sam_tag_dictionary{}),
555  detail::get_or<selected_field_ids::index_of(field::evalue)>(t, 0u),
556  detail::get_or<selected_field_ids::index_of(field::bit_score)>(t, 0u));
557  }
558 
582  template <typename arg_t, typename ...arg_types>
583  void emplace_back(arg_t && arg, arg_types && ... args)
584  {
585  push_back(std::tie(arg, args...));
586  }
587 
609  template <typename rng_t>
612  requires std::ranges::input_range<rng_t> && tuple_like<std::ranges::range_reference_t<rng_t>>
614  {
615  for (auto && record : range)
616  push_back(std::forward<decltype(record)>(record));
617  return *this;
618  }
619 
648  template <typename rng_t>
651  requires std::ranges::input_range<rng_t> && tuple_like<std::ranges::range_reference_t<rng_t>>
653  {
654  f = range;
655  return f;
656  }
657 
659  template <typename rng_t>
662  requires std::ranges::input_range<rng_t> && tuple_like<std::ranges::range_reference_t<rng_t>>
664  {
665  f = range;
666  return std::move(f);
667  }
669 
672 
677  {
678  return *secondary_stream;
679  }
681 
692  auto & header()
693  {
694  if constexpr (std::same_as<ref_ids_type, ref_info_not_given>)
695  throw std::logic_error{"Please construct your file with reference id and length information in order "
696  "to properly initialise the header before accessing it."};
697 
698  return *header_ptr;
699  }
700 
701 protected:
704  std::vector<char> stream_buffer{std::vector<char>(1'000'000)};
705 
713  static void stream_deleter_noop(std::basic_ostream<stream_char_type> *) {}
715  static void stream_deleter_default(std::basic_ostream<stream_char_type> * ptr) { delete ptr; }
716 
718  stream_ptr_t primary_stream{nullptr, stream_deleter_noop};
720  stream_ptr_t secondary_stream{nullptr, stream_deleter_noop};
721 
723  using format_type = typename detail::variant_from_tags<valid_formats,
724  detail::alignment_file_output_format_exposer>::type;
725 
727  format_type format;
729 
731  using header_type = alignment_file_header<std::conditional_t<std::same_as<ref_ids_type, ref_info_not_given>,
733  ref_ids_type>>;
734 
736  std::unique_ptr<header_type> header_ptr;
737 
739  template <typename ref_ids_type_, typename ref_lengths_type>
740  void initialise_header_information(ref_ids_type_ && ref_ids, ref_lengths_type && ref_lengths)
741  {
742  assert(std::ranges::size(ref_ids) == std::ranges::size(ref_lengths));
743 
744  header_ptr = std::make_unique<alignment_file_header<ref_ids_type>>(std::forward<ref_ids_type_>(ref_ids));
745 
746  for (int32_t idx = 0; idx < std::ranges::distance(ref_ids); ++idx)
747  {
748  header_ptr->ref_id_info.emplace_back(ref_lengths[idx], "");
749 
750  if constexpr (std::ranges::contiguous_range<std::ranges::range_reference_t<ref_ids_type_>> &&
751  std::ranges::sized_range<std::ranges::range_reference_t<ref_ids_type_>> &&
752  std::ranges::borrowed_range<std::ranges::range_reference_t<ref_ids_type_>>)
753  {
754  auto && id = header_ptr->ref_ids()[idx];
755  header_ptr->ref_dict[std::span{std::ranges::data(id), std::ranges::size(id)}] = idx;
756  }
757  else
758  {
759  header_ptr->ref_dict[header_ptr->ref_ids()[idx]] = idx;
760  }
761  }
762  }
763 
765  template <typename record_header_ptr_t, typename ...pack_type>
766  void write_record(record_header_ptr_t && record_header_ptr, pack_type && ...remainder)
767  {
768  static_assert((sizeof...(pack_type) == 15), "Wrong parameter list passed to write_record.");
769 
770  assert(!format.valueless_by_exception());
771 
772  std::visit([&] (auto & f)
773  {
774  // use header from record if explicitly given, e.g. file_output = file_input
775  if constexpr (!std::same_as<record_header_ptr_t, std::nullptr_t>)
776  {
777  f.write_alignment_record(*secondary_stream,
778  options,
779  *record_header_ptr,
780  std::forward<pack_type>(remainder)...);
781  }
782  else if constexpr (std::same_as<ref_ids_type, ref_info_not_given>)
783  {
784  f.write_alignment_record(*secondary_stream,
785  options,
786  std::ignore,
787  std::forward<pack_type>(remainder)...);
788  }
789  else
790  {
791  f.write_alignment_record(*secondary_stream,
792  options,
793  *header_ptr,
794  std::forward<pack_type>(remainder)...);
795  }
796  }, format);
797  }
798 
800  friend iterator;
801 };
802 
811 template <detail::fields_specialisation selected_field_ids>
816 
820 template <output_stream stream_type,
821  alignment_file_output_format file_format,
822  detail::fields_specialisation selected_field_ids>
823 alignment_file_output(stream_type &&, file_format const &, selected_field_ids const &)
827 
831 template <output_stream stream_type,
832  alignment_file_output_format file_format,
833  detail::fields_specialisation selected_field_ids>
834 alignment_file_output(stream_type &, file_format const &, selected_field_ids const &)
838 
842 template <output_stream stream_type,
843  alignment_file_output_format file_format>
844 alignment_file_output(stream_type &&, file_format const &)
848 
852 template <output_stream stream_type,
853  alignment_file_output_format file_format>
854 alignment_file_output(stream_type &, file_format const &)
858 
860 template <detail::fields_specialisation selected_field_ids,
861  std::ranges::forward_range ref_ids_type,
862  std::ranges::forward_range ref_lengths_type>
864  ref_ids_type &&,
865  ref_lengths_type &&,
866  selected_field_ids const &)
870 
872 template <std::ranges::forward_range ref_ids_type,
873  std::ranges::forward_range ref_lengths_type>
875  ref_ids_type &&,
876  ref_lengths_type &&)
880 
882 template <output_stream stream_type,
883  std::ranges::forward_range ref_ids_type,
884  std::ranges::forward_range ref_lengths_type,
885  alignment_file_output_format file_format,
886  detail::fields_specialisation selected_field_ids>
887 alignment_file_output(stream_type &&,
888  ref_ids_type &&,
889  ref_lengths_type &&,
890  file_format const &,
891  selected_field_ids const &)
895 
897 template <output_stream stream_type,
898  std::ranges::forward_range ref_ids_type,
899  std::ranges::forward_range ref_lengths_type,
900  alignment_file_output_format file_format,
901  detail::fields_specialisation selected_field_ids>
902 alignment_file_output(stream_type &,
903  ref_ids_type &&,
904  ref_lengths_type &&,
905  file_format const &,
906  selected_field_ids const &)
910 
912 template <output_stream stream_type,
913  std::ranges::forward_range ref_ids_type,
914  std::ranges::forward_range ref_lengths_type,
915  alignment_file_output_format file_format>
916 alignment_file_output(stream_type &&,
917  ref_ids_type &&,
918  ref_lengths_type &&,
919  file_format const &)
923 
925 template <output_stream stream_type,
926  std::ranges::forward_range ref_ids_type,
927  std::ranges::forward_range ref_lengths_type,
928  alignment_file_output_format file_format>
929 alignment_file_output(stream_type &,
930  ref_ids_type &&,
931  ref_lengths_type &&,
932  file_format const &)
937 
938 } // namespace seqan3
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &, file_format const &, selected_field_ids const &) -> alignment_file_output< selected_field_ids, type_list< file_format >, ref_info_not_given >
Deduces selected_field_ids, and the valid format from input and sets alignment_file_output::ref_ids_t...
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &, file_format const &) -> alignment_file_output< typename alignment_file_output<>::selected_field_ids, type_list< file_format >, ref_info_not_given >
Deduces the valid format from input and sets alignment_file_output::ref_ids_type to seqan3::detail::r...
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(std::filesystem::path, selected_field_ids const &) -> alignment_file_output< selected_field_ids, typename alignment_file_output<>::valid_formats, ref_info_not_given >
Deduces selected_field_ids from input and sets alignment_file_output::ref_ids_type to seqan3::detail:...
seqan3::alignment_file_output_options
The options type defines various option members that influence the behavior of all or some formats.
Definition: output_options.hpp:23
misc.hpp
Provides helper data structures for the seqan3::alignment_file_output.
seqan3::alignment_file_output::size_type
void size_type
The size type (void).
Definition: output.hpp:218
std::span
fstream
misc_output.hpp
Provides various utility functions required only for output.
seqan3::alignment_file_output::options
alignment_file_output_options options
The options are public and its members can be set directly.
Definition: output.hpp:671
std::string_view
seqan3::type_list
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
tuple.hpp
Provides seqan3::tuple_like.
seqan3::field::offset
@ offset
Sequence (SEQ) relative start position (0-based), unsigned value.
concept.hpp
Stream concepts.
seqan3::alignment_file_output::const_reference
void const_reference
The const reference type (void).
Definition: output.hpp:216
seqan3::alignment_file_output::~alignment_file_output
~alignment_file_output()=default
Destructor is defaulted.
std::pair
vector
std::vector::size
T size(T... args)
seqan3::alignment_file_output::end
sentinel end() noexcept
Returns a sentinel for comparison with iterator.
Definition: output.hpp:459
seqan3::field::id
@ id
The identifier, usually a string.
std::unique_ptr::get
T get(T... args)
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &&, ref_ids_type &&, ref_lengths_type &&, file_format const &, selected_field_ids const &) -> alignment_file_output< selected_field_ids, type_list< file_format >, std::remove_reference_t< ref_ids_type >>
Deduces selected_field_ids, the valid format, and the ref_ids_type from input.
format_sam.hpp
Provides the seqan3::format_sam.
seqan3::alignment_file_output
A class for writing alignment files, e.g. SAM, BAL, BLAST, ...
Definition: output.hpp:163
std::tuple
record.hpp
Provides the seqan3::record template and the seqan3::field enum.
std::function
filesystem
This header includes C++17 filesystem support and imports it into namespace std::filesystem (independ...
seqan3::alignment_file_output::stream_char_type
char stream_char_type
Character type of the stream(s).
Definition: output.hpp:174
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &&, file_format const &, selected_field_ids const &) -> alignment_file_output< selected_field_ids, type_list< file_format >, ref_info_not_given >
Deduces selected_field_ids, and the valid format from input and sets alignment_file_output::ref_ids_t...
std::filesystem::path
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &stream, file_format const &format_tag, selected_field_ids const &fields_tag=selected_field_ids{})
Construct from an existing stream and with specified format.
Definition: output.hpp:309
seqan3::fields
A class template that holds a choice of seqan3::field.
Definition: record.hpp:166
std::tie
T tie(T... args)
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &, ref_ids_type &&, ref_lengths_type &&, file_format const &, selected_field_ids const &) -> alignment_file_output< selected_field_ids, type_list< file_format >, std::remove_reference_t< ref_ids_type >>
Deduces selected_field_ids, the valid format, and the ref_ids_type from input.
seqan3::seq
constexpr sequenced_policy seq
Global execution policy object for sequenced execution policy.
Definition: execution.hpp:54
seqan3::alignment_file_output::push_back
void push_back(record_t &&r)
Write a seqan3::record to the file.
Definition: output.hpp:483
seqan3::value_type
Exposes the value_type of another type.
Definition: pre.hpp:58
seqan3::alignment_file_output::header
auto & header()
Access the file's header.
Definition: output.hpp:692
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &&stream, file_format const &format_tag, selected_field_ids const &fields_tag=selected_field_ids{})
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: output.hpp:325
seqan3::field::cigar
@ cigar
The cigar vector (std::vector<seqan3::cigar>) representing the alignment in SAM/BAM format.
seqan3::alignment_file_output::operator=
alignment_file_output & operator=(alignment_file_output const &)=delete
Copy assignment is explicitly deleted, because you can't have multiple access to the same file.
seqan3::views::move
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:68
seqan3::sam_flag::none
@ none
None of the flags below are set.
std::basic_ostream
std::forward
T forward(T... args)
seqan3::alignment_file_output::push_back
void push_back(tuple_t &&t)
Write a record in form of a std::tuple to the file.
Definition: output.hpp:532
std::ofstream
seqan3::field::mapq
@ mapq
The mapping quality of the SEQ alignment, usually a ohred-scaled score.
seqan3::alignment_file_output::valid_formats
valid_formats_ valid_formats
A seqan3::type_list with the possible formats.
Definition: output.hpp:172
exception.hpp
Provides exceptions used in the I/O module.
header.hpp
Provides the seqan3::alignment_file_header class.
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
alignment_file_output_format
The generic concept for alignment file out formats.
std::logic_error
seqan3::alignment_file_output::operator=
alignment_file_output & operator=(rng_t &&range)
Write a range of records (or tuples) to the file.
Definition: output.hpp:610
seqan3::alignment_file_output::emplace_back
void emplace_back(arg_t &&arg, arg_types &&... args)
Write a record to the file by passing individual fields.
Definition: output.hpp:583
output_options.hpp
Provides seqan3::alignment_file_output_options.
std::format
T format(T... args)
seqan3::pack_traits::size
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:116
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(std::filesystem::path filename, selected_field_ids const &fields_tag=selected_field_ids{})
Construct from filename.
Definition: output.hpp:270
tuple_like
Whether a type behaves like a tuple.
seqan3::alignment_file_output::const_iterator
void const_iterator
The const iterator type is void, because files are not const-iterable.
Definition: output.hpp:224
ranges
Adaptations of concepts from the Ranges TS.
seqan3::sam_tag_dictionary
The SAM tag dictionary class that stores all optional SAM fields.
Definition: sam_tag_dictionary.hpp:325
format_bam.hpp
Provides the seqan3::format_bam.
std::remove_reference_t
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &, ref_ids_type &&, ref_lengths_type &&, file_format const &) -> alignment_file_output< typename alignment_file_output<>::selected_field_ids, type_list< file_format >, std::remove_reference_t< ref_ids_type >>
Deduces the valid format, and the ref_ids_type from input. selected_field_ids is defaulted.
seqan3::ref_info_not_given
Type tag which indicates that no reference information has been passed to the alignment file on const...
Definition: misc.hpp:23
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &&, ref_ids_type &&, ref_lengths_type &&, file_format const &) -> alignment_file_output< typename alignment_file_output<>::selected_field_ids, type_list< file_format >, std::remove_reference_t< ref_ids_type >>
Deduces the valid format, and the ref_ids_type from input. selected_field_ids is defaulted.
seqan3::alignment_file_output::reference
void reference
The reference type (void).
Definition: output.hpp:214
seqan3::alignment_file_output::sentinel
std::default_sentinel_t sentinel
The type returned by end().
Definition: output.hpp:226
cassert
seqan3::field
field
An enumerator for the fields used in file formats.
Definition: record.hpp:65
seqan3::alignment_file_output::selected_field_ids
selected_field_ids_ selected_field_ids
A seqan3::fields list with the fields selected for the record.
Definition: output.hpp:170
seqan3::record
The class template that file records are based on; behaves like an std::tuple.
Definition: record.hpp:226
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(std::filesystem::path const &, ref_ids_type &&, ref_lengths_type &&, selected_field_ids const &) -> alignment_file_output< selected_field_ids, typename alignment_file_output<>::valid_formats, std::remove_reference_t< ref_ids_type >>
Deduces selected_field_ids and ref_ids_type from input. valid_formats is defaulted.
std::ptrdiff_t
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &&, file_format const &) -> alignment_file_output< typename alignment_file_output<>::selected_field_ids, type_list< file_format >, ref_info_not_given >
Deduces the valid format from input and sets alignment_file_output::ref_ids_type to seqan3::detail::r...
std::visit
T visit(T... args)
output_format_concept.hpp
Provides seqan3::alignment_file_output_format and auxiliary classes.
seqan3::alignment_file_output::operator|
friend alignment_file_output & operator|(rng_t &&range, alignment_file_output &f)
Write a range of records (or tuples) to the file.
Definition: output.hpp:649
std::optional
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(alignment_file_output &&)=default
Move construction is defaulted.
out_file_iterator.hpp
Provides the seqan3::detail::out_file_iterator class template.
seqan3::alignment_file_output::begin
iterator begin() noexcept
Returns an iterator to current position in the file.
Definition: output.hpp:440
seqan3::alignment_file_output::operator=
alignment_file_output & operator=(alignment_file_output &&)=default
Move assignment is defaulted.
seqan3::field::flag
@ flag
The alignment flag (bit information), uint16_t value.
seqan3::alignment_file_output::operator|
friend alignment_file_output operator|(rng_t &&range, alignment_file_output &&f)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: output.hpp:660
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(stream_type &&stream, ref_ids_type_ &&ref_ids, ref_lengths_type &&ref_lengths, file_format const &format_tag, selected_field_ids const &fields_tag=selected_field_ids{})
Construct from an existing stream and with specified format.
Definition: output.hpp:408
seqan3::alignment_file_output::iterator
detail::out_file_iterator< alignment_file_output > iterator
The iterator type of this view (an output iterator).
Definition: output.hpp:222
seqan3::alignment_file_output::alignment_file_output
alignment_file_output()=delete
Default constructor is explicitly deleted, you need to give a stream or file name.
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(alignment_file_output const &)=delete
Copy construction is explicitly deleted, because you can't have multiple access to the same file.
traits.hpp
Provides traits for seqan3::type_list.
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(std::filesystem::path const &, ref_ids_type &&, ref_lengths_type &&) -> alignment_file_output< typename alignment_file_output<>::selected_field_ids, typename alignment_file_output<>::valid_formats, std::remove_reference_t< ref_ids_type >>
Deduces ref_ids_type from input. Valid formats, and selected_field_ids are defaulted.
std::unique_ptr
seqan3::alignment_file_output::alignment_file_output
alignment_file_output(std::filesystem::path const &filename, ref_ids_type_ &&ref_ids, ref_lengths_type &&ref_lengths, selected_field_ids const &fields_tag=selected_field_ids{})
Construct from filename.
Definition: output.hpp:370
string_view
std::vector::data
T data(T... args)
seqan3::field::header_ptr
@ header_ptr
A pointer to the seqan3::alignment_file_header object storing header information.
seqan3::field::alignment
@ alignment
The (pairwise) alignment stored in an seqan3::alignment object.
variant
string