SeqAn3  3.0.3
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 <seqan3/std/filesystem>
17 #include <fstream>
18 #include <seqan3/std/ranges>
19 #include <string>
20 #include <string_view>
21 #include <variant>
22 #include <vector>
23 
26 #include <seqan3/io/detail/record.hpp>
28 #include <seqan3/io/exception.hpp>
29 #include <seqan3/io/record.hpp>
39 
40 namespace seqan3
41 {
42 
43 // ----------------------------------------------------------------------------
44 // sam_file_output
45 // ----------------------------------------------------------------------------
46 
144 template <detail::fields_specialisation selected_field_ids_ =
145  fields<field::seq,
146  field::id,
152  field::cigar,
153  field::mapq,
154  field::qual,
155  field::flag,
156  field::mate,
157  field::tags,
161  detail::type_list_of_sam_file_output_formats valid_formats_ = type_list<format_sam, format_bam>,
162  typename ref_ids_type = ref_info_not_given>
164 {
165 public:
171  using selected_field_ids = selected_field_ids_;
173  using valid_formats = valid_formats_;
174 #ifdef SEQAN3_DEPRECATED_310
177  using ref_ids_type_t = ref_ids_type;
179 #endif
181  using stream_char_type = char;
183 
186  field::seq,
187  field::id,
193  field::cigar,
194  field::mapq,
195  field::flag,
196  field::qual,
197  field::mate,
198  field::tags,
201 
202  static_assert([] () constexpr
203  {
204  for (field f : selected_field_ids::as_array)
205  if (!field_ids::contains(f))
206  return false;
207  return true;
208  }(),
209  "You selected a field that is not valid for alignment files, "
210  "please refer to the documentation of "
211  "seqan3::sam_file_output::field_ids for the accepted values.");
212 
219  using value_type = void;
221  using reference = void;
223  using const_reference = void;
225  using size_type = void;
229  using iterator = detail::out_file_iterator<sam_file_output>;
231  using const_iterator = void;
233  using sentinel = std::default_sentinel_t;
235 
240  sam_file_output() = delete;
242  sam_file_output(sam_file_output const &) = delete;
250  ~sam_file_output() = default;
251 
278  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
279  primary_stream{new std::ofstream{}, stream_deleter_default}
280  {
281  primary_stream->rdbuf()->pubsetbuf(stream_buffer.data(), stream_buffer.size());
282  static_cast<std::basic_ofstream<char> *>(primary_stream.get())->open(filename,
283  std::ios_base::out | std::ios::binary);
284 
285  // open stream
286  if (!primary_stream->good())
287  throw file_open_error{"Could not open file " + filename.string() + " for writing."};
288 
289  // possibly add intermediate compression stream
290  secondary_stream = detail::make_secondary_ostream(*primary_stream, filename);
291 
292  // initialise format handler or throw if format is not found
293  detail::set_format(format, filename);
294  }
295 
312  template <output_stream stream_type, sam_file_output_format file_format>
314  requires std::same_as<typename std::remove_reference_t<stream_type>::char_type, stream_char_type>
316  sam_file_output(stream_type & stream,
317  file_format const & SEQAN3_DOXYGEN_ONLY(format_tag),
318  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
319  primary_stream{&stream, stream_deleter_noop},
320  secondary_stream{&stream, stream_deleter_noop},
321  format{detail::sam_file_output_format_exposer<file_format>{}}
322  {
323  static_assert(list_traits::contains<file_format, valid_formats>,
324  "You selected a format that is not in the valid_formats of this file.");
325  }
326 
328  template <output_stream stream_type, sam_file_output_format file_format>
330  requires std::same_as<typename std::remove_reference_t<stream_type>::char_type, stream_char_type>
332  sam_file_output(stream_type && stream,
333  file_format const & SEQAN3_DOXYGEN_ONLY(format_tag),
334  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
335  primary_stream{new stream_type{std::move(stream)}, stream_deleter_default},
336  secondary_stream{&*primary_stream, stream_deleter_noop},
337  format{detail::sam_file_output_format_exposer<file_format>{}}
338  {
339  static_assert(list_traits::contains<file_format, valid_formats>,
340  "You selected a format that is not in the valid_formats of this file.");
341  }
342 
373  template <typename ref_ids_type_, std::ranges::forward_range ref_lengths_type>
375  requires std::same_as<std::remove_reference_t<ref_ids_type_>, ref_ids_type>
378  ref_ids_type_ && ref_ids,
379  ref_lengths_type && ref_lengths,
380  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
382 
383  {
384  initialise_header_information(ref_ids, ref_lengths);
385  }
386 
408  template <output_stream stream_type,
409  sam_file_output_format file_format,
410  typename ref_ids_type_, // generic type to capture lvalue references
411  std::ranges::forward_range ref_lengths_type>
413  requires std::same_as<std::remove_reference_t<ref_ids_type_>, ref_ids_type>
415  sam_file_output(stream_type && stream,
416  ref_ids_type_ && ref_ids,
417  ref_lengths_type && ref_lengths,
418  file_format const & SEQAN3_DOXYGEN_ONLY(format_tag),
419  selected_field_ids const & SEQAN3_DOXYGEN_ONLY(fields_tag) = selected_field_ids{}) :
420  sam_file_output{std::forward<stream_type>(stream), file_format{}, selected_field_ids{}}
421  {
422  initialise_header_information(ref_ids, ref_lengths);
423  }
425 
447  iterator begin() noexcept
448  {
449  return {*this};
450  }
451 
466  sentinel end() noexcept
467  {
468  return {};
469  }
470 
489  template <typename record_t>
490  void push_back(record_t && r)
492  requires detail::record_like<record_t>
494  {
495  using default_align_t = std::pair<std::span<gapped<char>>, std::span<gapped<char>>>;
496  using default_mate_t = std::tuple<std::string_view, std::optional<int32_t>, int32_t>;
497 
498  write_record(detail::get_or<field::header_ptr>(r, nullptr),
499  detail::get_or<field::seq>(r, std::string_view{}),
500  detail::get_or<field::qual>(r, std::string_view{}),
501  detail::get_or<field::id>(r, std::string_view{}),
502  detail::get_or<field::offset>(r, 0u),
503  detail::get_or<field::ref_seq>(r, std::string_view{}),
504  detail::get_or<field::ref_id>(r, std::ignore),
505  detail::get_or<field::ref_offset>(r, std::optional<int32_t>{}),
506  detail::get_or<field::alignment>(r, default_align_t{}),
507  detail::get_or<field::cigar>(r, std::vector<cigar>{}),
508  detail::get_or<field::flag>(r, sam_flag::none),
509  detail::get_or<field::mapq>(r, 0u),
510  detail::get_or<field::mate>(r, default_mate_t{}),
511  detail::get_or<field::tags>(r, sam_tag_dictionary{}),
512  detail::get_or<field::evalue>(r, 0u),
513  detail::get_or<field::bit_score>(r, 0u));
514  }
515 
537  template <typename tuple_t>
538  void push_back(tuple_t && t)
540  requires tuple_like<tuple_t> && (!detail::record_like<tuple_t>)
542  {
543  using default_align_t = std::pair<std::span<gapped<char>>, std::span<gapped<char>>>;
544  using default_mate_t = std::tuple<std::string_view, std::optional<int32_t>, int32_t>;
545 
546  // index_of might return npos, but this will be handled well by get_or_ignore (and just return ignore)
547  write_record(detail::get_or<selected_field_ids::index_of(field::header_ptr)>(t, nullptr),
548  detail::get_or<selected_field_ids::index_of(field::seq)>(t, std::string_view{}),
549  detail::get_or<selected_field_ids::index_of(field::qual)>(t, std::string_view{}),
550  detail::get_or<selected_field_ids::index_of(field::id)>(t, std::string_view{}),
551  detail::get_or<selected_field_ids::index_of(field::offset)>(t, 0u),
552  detail::get_or<selected_field_ids::index_of(field::ref_seq)>(t, std::string_view{}),
553  detail::get_or<selected_field_ids::index_of(field::ref_id)>(t, std::ignore),
554  detail::get_or<selected_field_ids::index_of(field::ref_offset)>(t, std::optional<int32_t>{}),
555  detail::get_or<selected_field_ids::index_of(field::alignment)>(t, default_align_t{}),
556  detail::get_or<selected_field_ids::index_of(field::cigar)>(t, std::vector<cigar>{}),
557  detail::get_or<selected_field_ids::index_of(field::flag)>(t, sam_flag::none),
558  detail::get_or<selected_field_ids::index_of(field::mapq)>(t, 0u),
559  detail::get_or<selected_field_ids::index_of(field::mate)>(t, default_mate_t{}),
560  detail::get_or<selected_field_ids::index_of(field::tags)>(t, sam_tag_dictionary{}),
561  detail::get_or<selected_field_ids::index_of(field::evalue)>(t, 0u),
562  detail::get_or<selected_field_ids::index_of(field::bit_score)>(t, 0u));
563  }
564 
588  template <typename arg_t, typename ...arg_types>
589  void emplace_back(arg_t && arg, arg_types && ... args)
590  {
591  push_back(std::tie(arg, args...));
592  }
593 
615  template <typename rng_t>
616  sam_file_output & operator=(rng_t && range)
618  requires std::ranges::input_range<rng_t> && tuple_like<std::ranges::range_reference_t<rng_t>>
620  {
621  for (auto && record : range)
622  push_back(std::forward<decltype(record)>(record));
623  return *this;
624  }
625 
654  template <typename rng_t>
655  friend sam_file_output & operator|(rng_t && range, sam_file_output & f)
657  requires std::ranges::input_range<rng_t> && tuple_like<std::ranges::range_reference_t<rng_t>>
659  {
660  f = range;
661  return f;
662  }
663 
665  template <typename rng_t>
666  friend sam_file_output operator|(rng_t && range, sam_file_output && f)
668  requires std::ranges::input_range<rng_t> && tuple_like<std::ranges::range_reference_t<rng_t>>
670  {
671  f = range;
672  return std::move(f);
673  }
675 
678 
683  {
684  return *secondary_stream;
685  }
687 
698  auto & header()
699  {
700  if constexpr (std::same_as<ref_ids_type, ref_info_not_given>)
701  throw std::logic_error{"Please construct your file with reference id and length information in order "
702  "to properly initialise the header before accessing it."};
703 
704  return *header_ptr;
705  }
706 
707 protected:
710  std::vector<char> stream_buffer{std::vector<char>(1'000'000)};
711 
719  static void stream_deleter_noop(std::basic_ostream<stream_char_type> *) {}
721  static void stream_deleter_default(std::basic_ostream<stream_char_type> * ptr) { delete ptr; }
722 
724  stream_ptr_t primary_stream{nullptr, stream_deleter_noop};
726  stream_ptr_t secondary_stream{nullptr, stream_deleter_noop};
727 
729  using format_type = typename detail::variant_from_tags<valid_formats,
730  detail::sam_file_output_format_exposer>::type;
731 
733  format_type format;
735 
737  using header_type = sam_file_header<std::conditional_t<std::same_as<ref_ids_type, ref_info_not_given>,
739  ref_ids_type>>;
740 
742  std::unique_ptr<header_type> header_ptr;
743 
745  template <typename ref_ids_type_, typename ref_lengths_type>
746  void initialise_header_information(ref_ids_type_ && ref_ids, ref_lengths_type && ref_lengths)
747  {
748  assert(std::ranges::size(ref_ids) == std::ranges::size(ref_lengths));
749 
750  header_ptr = std::make_unique<sam_file_header<ref_ids_type>>(std::forward<ref_ids_type_>(ref_ids));
751 
752  for (int32_t idx = 0; idx < std::ranges::distance(ref_ids); ++idx)
753  {
754  header_ptr->ref_id_info.emplace_back(ref_lengths[idx], "");
755 
756  if constexpr (std::ranges::contiguous_range<std::ranges::range_reference_t<ref_ids_type_>> &&
757  std::ranges::sized_range<std::ranges::range_reference_t<ref_ids_type_>> &&
758  std::ranges::borrowed_range<std::ranges::range_reference_t<ref_ids_type_>>)
759  {
760  auto && id = header_ptr->ref_ids()[idx];
761  header_ptr->ref_dict[std::span{std::ranges::data(id), std::ranges::size(id)}] = idx;
762  }
763  else
764  {
765  header_ptr->ref_dict[header_ptr->ref_ids()[idx]] = idx;
766  }
767  }
768  }
769 
771  template <typename record_header_ptr_t, typename ...pack_type>
772  void write_record(record_header_ptr_t && record_header_ptr, pack_type && ...remainder)
773  {
774  static_assert((sizeof...(pack_type) == 15), "Wrong parameter list passed to write_record.");
775 
776  assert(!format.valueless_by_exception());
777 
778  std::visit([&] (auto & f)
779  {
780  // use header from record if explicitly given, e.g. file_output = file_input
781  if constexpr (!std::same_as<record_header_ptr_t, std::nullptr_t>)
782  {
783  f.write_alignment_record(*secondary_stream,
784  options,
785  *record_header_ptr,
786  std::forward<pack_type>(remainder)...);
787  }
788  else if constexpr (std::same_as<ref_ids_type, ref_info_not_given>)
789  {
790  f.write_alignment_record(*secondary_stream,
791  options,
792  std::ignore,
793  std::forward<pack_type>(remainder)...);
794  }
795  else
796  {
797  f.write_alignment_record(*secondary_stream,
798  options,
799  *header_ptr,
800  std::forward<pack_type>(remainder)...);
801  }
802  }, format);
803  }
804 
806  friend iterator;
807 };
808 
817 template <detail::fields_specialisation selected_field_ids>
820 
824 template <output_stream stream_type,
825  sam_file_output_format file_format,
826  detail::fields_specialisation selected_field_ids>
827 sam_file_output(stream_type &&, file_format const &, selected_field_ids const &)
829 
833 template <output_stream stream_type,
834  sam_file_output_format file_format,
835  detail::fields_specialisation selected_field_ids>
836 sam_file_output(stream_type &, file_format const &, selected_field_ids const &)
838 
842 template <output_stream stream_type,
843  sam_file_output_format file_format>
844 sam_file_output(stream_type &&, file_format const &)
846 
850 template <output_stream stream_type,
851  sam_file_output_format file_format>
852 sam_file_output(stream_type &, file_format const &)
854 
856 template <detail::fields_specialisation selected_field_ids,
857  std::ranges::forward_range ref_ids_type,
858  std::ranges::forward_range ref_lengths_type>
859 sam_file_output(std::filesystem::path const &, ref_ids_type &&, ref_lengths_type &&, selected_field_ids const &)
863 
865 template <std::ranges::forward_range ref_ids_type,
866  std::ranges::forward_range ref_lengths_type>
867 sam_file_output(std::filesystem::path const &, ref_ids_type &&, ref_lengths_type &&)
871 
873 template <output_stream stream_type,
874  std::ranges::forward_range ref_ids_type,
875  std::ranges::forward_range ref_lengths_type,
876  sam_file_output_format file_format,
877  detail::fields_specialisation selected_field_ids>
878 sam_file_output(stream_type &&, ref_ids_type &&, ref_lengths_type &&, file_format const &, selected_field_ids const &)
880 
882 template <output_stream stream_type,
883  std::ranges::forward_range ref_ids_type,
884  std::ranges::forward_range ref_lengths_type,
885  sam_file_output_format file_format,
886  detail::fields_specialisation selected_field_ids>
887 sam_file_output(stream_type &, ref_ids_type &&, ref_lengths_type &&, file_format const &, selected_field_ids const &)
889 
891 template <output_stream stream_type,
892  std::ranges::forward_range ref_ids_type,
893  std::ranges::forward_range ref_lengths_type,
894  sam_file_output_format file_format>
895 sam_file_output(stream_type &&, ref_ids_type &&, ref_lengths_type &&, file_format const &)
899 
901 template <output_stream stream_type,
902  std::ranges::forward_range ref_ids_type,
903  std::ranges::forward_range ref_lengths_type,
904  sam_file_output_format file_format>
905 sam_file_output(stream_type &, ref_ids_type &&, ref_lengths_type &&, file_format const &)
910 
911 } // namespace seqan3
A class for writing alignment files, e.g. SAM, BAL, BLAST, ...
Definition: output.hpp:164
void const_reference
The const reference type (void).
Definition: output.hpp:223
sam_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:415
sam_file_output(stream_type &, ref_ids_type &&, ref_lengths_type &&, file_format const &, selected_field_ids const &) -> sam_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.
void size_type
The size type (void).
Definition: output.hpp:225
sam_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:332
sam_file_output(sam_file_output const &)=delete
Copy construction is explicitly deleted, because you can't have multiple access to the same file.
friend sam_file_output & operator|(rng_t &&range, sam_file_output &f)
Write a range of records (or tuples) to the file.
Definition: output.hpp:655
sam_file_output()=delete
Default constructor is explicitly deleted, you need to give a stream or file name.
detail::out_file_iterator< sam_file_output > iterator
The iterator type of this view (an output iterator).
Definition: output.hpp:229
sam_file_output & operator=(rng_t &&range)
Write a range of records (or tuples) to the file.
Definition: output.hpp:616
sam_file_output & operator=(sam_file_output const &)=delete
Copy assignment is explicitly deleted, because you can't have multiple access to the same file.
sam_file_output(std::filesystem::path const &, ref_ids_type &&, ref_lengths_type &&) -> sam_file_output< typename sam_file_output<>::selected_field_ids, typename sam_file_output<>::valid_formats, std::remove_reference_t< ref_ids_type >>
Deduces ref_ids_type from input. Valid formats, and selected_field_ids are set to the default.
auto & header()
Access the file's header.
Definition: output.hpp:698
std::default_sentinel_t sentinel
The type returned by end().
Definition: output.hpp:233
char stream_char_type
Character type of the stream(s).
Definition: output.hpp:181
sam_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:316
iterator begin() noexcept
Returns an iterator to current position in the file.
Definition: output.hpp:447
sam_file_output(std::filesystem::path const &, ref_ids_type &&, ref_lengths_type &&, selected_field_ids const &) -> sam_file_output< selected_field_ids, typename sam_file_output<>::valid_formats, std::remove_reference_t< ref_ids_type >>
Deduces selected_field_ids and ref_ids_type from input. valid_formats is set to the default.
sentinel end() noexcept
Returns a sentinel for comparison with iterator.
Definition: output.hpp:466
sam_file_output(std::filesystem::path, selected_field_ids const &) -> sam_file_output< selected_field_ids, typename sam_file_output<>::valid_formats, ref_info_not_given >
Deduces selected_field_ids from input and sets sam_file_output::ref_ids_type to seqan3::detail::ref_i...
void emplace_back(arg_t &&arg, arg_types &&... args)
Write a record to the file by passing individual fields.
Definition: output.hpp:589
void push_back(record_t &&r)
Write a seqan3::record to the file.
Definition: output.hpp:490
selected_field_ids_ selected_field_ids
A seqan3::fields list with the fields selected for the record.
Definition: output.hpp:171
sam_file_output & operator=(sam_file_output &&)=default
Move assignment is defaulted.
valid_formats_ valid_formats
A seqan3::type_list with the possible formats.
Definition: output.hpp:173
void reference
The reference type (void).
Definition: output.hpp:221
sam_file_output(stream_type &, ref_ids_type &&, ref_lengths_type &&, file_format const &) -> sam_file_output< typename sam_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 set to the default.
sam_file_output(stream_type &&, file_format const &) -> sam_file_output< typename sam_file_output<>::selected_field_ids, type_list< file_format >, ref_info_not_given >
Deduces the valid format from input and sets sam_file_output::ref_ids_type to seqan3::detail::ref_inf...
sam_file_output(std::filesystem::path filename, selected_field_ids const &fields_tag=selected_field_ids{})
Construct from filename.
Definition: output.hpp:277
sam_file_output(stream_type &&, ref_ids_type &&, ref_lengths_type &&, file_format const &) -> sam_file_output< typename sam_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 set to the default.
void push_back(tuple_t &&t)
Write a record in form of a std::tuple to the file.
Definition: output.hpp:538
void value_type
The value type (void).
Definition: output.hpp:219
~sam_file_output()=default
Destructor is defaulted.
sam_file_output_options options
The options are public and its members can be set directly.
Definition: output.hpp:677
sam_file_output(stream_type &&, ref_ids_type &&, ref_lengths_type &&, file_format const &, selected_field_ids const &) -> sam_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.
sam_file_output(sam_file_output &&)=default
Move construction is defaulted.
sam_file_output(stream_type &, file_format const &, selected_field_ids const &) -> sam_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 sam_file_output::ref_ids_type to...
sam_file_output(stream_type &&, file_format const &, selected_field_ids const &) -> sam_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 sam_file_output::ref_ids_type to...
sam_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:377
friend sam_file_output operator|(rng_t &&range, sam_file_output &&f)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: output.hpp:666
void const_iterator
The const iterator type is void, because files are not const-iterable.
Definition: output.hpp:231
sam_file_output(stream_type &, file_format const &) -> sam_file_output< typename sam_file_output<>::selected_field_ids, type_list< file_format >, ref_info_not_given >
Deduces the valid format from input and sets sam_file_output::ref_ids_type to seqan3::detail::ref_inf...
The SAM tag dictionary class that stores all optional SAM fields.
Definition: sam_tag_dictionary.hpp:332
T data(T... args)
This header includes C++17 filesystem support and imports it into namespace std::filesystem (independ...
T format(T... args)
T forward(T... args)
T get(T... args)
@ none
None of the flags below are set.
field
An enumerator for the fields used in file formats.
Definition: record.hpp:62
@ flag
The alignment flag (bit information), uint16_t value.
@ ref_offset
Sequence (seqan3::field::ref_seq) relative start position (0-based), unsigned value.
@ ref_seq
The (reference) "sequence" information, usually a range of nucleotides or amino acids.
@ alignment
The (pairwise) alignment stored in an object that models seqan3::detail::pairwise_alignment.
@ cigar
The cigar vector (std::vector<seqan3::cigar>) representing the alignment in SAM/BAM format.
@ mapq
The mapping quality of the seqan3::field::seq alignment, usually a Phred-scaled score.
@ bit_score
The bit score (statistical significance indicator), unsigned value.
@ offset
Sequence (seqan3::field::seq) relative start position (0-based), unsigned value.
@ mate
The mate pair information given as a std::tuple of reference name, offset and template length.
@ header_ptr
A pointer to the seqan3::sam_file_header object storing header information.
@ ref_id
The identifier of the (reference) sequence that seqan3::field::seq was aligned to.
@ evalue
The e-value (length normalized bit score), double value.
@ id
The identifier, usually a string.
@ tags
The optional tags in the SAM format, stored in a dictionary.
@ seq
The "sequence", usually a range of nucleotides or amino acids.
@ qual
The qualities, usually in Phred score notation.
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:150
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:70
The generic concept for alignment file out formats.
Whether a type behaves like a tuple.
Provides exceptions used in the I/O module.
Stream concepts.
Provides various utility functions required only for output.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides the seqan3::detail::out_file_iterator class template.
Adaptations of concepts from the Ranges TS.
Provides the seqan3::record template and the seqan3::field enum.
Provides seqan3::detail::record_like.
Provides the seqan3::format_bam.
Provides the seqan3::format_sam.
Provides the seqan3::sam_file_header class.
Provides seqan3::sam_file_output_format and auxiliary classes.
Provides seqan3::sam_file_output_options.
Provides helper data structures for the seqan3::sam_file_output.
T size(T... args)
A class template that holds a choice of seqan3::field.
Definition: record.hpp:167
The class template that file records are based on; behaves like an std::tuple.
Definition: record.hpp:227
Type tag which indicates that no reference information has been passed to the alignment file on const...
Definition: sam_flag.hpp:23
The options type defines various option members that influence the behavior of all or some formats.
Definition: output_options.hpp:23
T tie(T... args)
Provides seqan3::tuple_like.
Provides traits for seqan3::type_list.
T visit(T... args)