SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
output_format_concept.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 <fstream>
16 #include <string>
17 #include <vector>
18 
29 
30 namespace seqan3::detail
31 {
32 
43 template <typename format_type>
44 struct alignment_file_output_format_exposer : public format_type
45 {
46 public:
47  // Can't use `using format_type::write_alignment_record` as it produces a hard failure in the format concept check
48  // for types that do not model the format concept, i.e. don't offer the proper write_alignment_record interface.
50  template <typename ...ts>
51  void write_alignment_record(ts && ...args)
52  {
53  format_type::write_alignment_record(std::forward<ts>(args)...);
54  }
55 };
56 
57 } // namespace seqan3::detail
58 
59 namespace seqan3
60 {
61 
73 template <typename t>
75 SEQAN3_CONCEPT alignment_file_output_format =
76  requires (detail::alignment_file_output_format_exposer<t> & v,
77  std::ofstream & stream,
78  alignment_file_output_options & options,
79  alignment_file_header<> & header,
80  dna5_vector & seq,
81  std::vector<phred42> & qual,
82  std::string & id,
83  int32_t & offset,
84  dna5_vector & ref_seq,
85  std::optional<int32_t> & ref_id,
86  std::optional<int32_t> & ref_offset,
87  std::pair<std::vector<gapped<dna4>>, std::vector<gapped<dna4>>> & align,
88  std::vector<cigar> & cigar,
89  sam_flag & flag,
90  uint8_t & mapq,
92  sam_tag_dictionary & tag_dict,
93  double & e_value,
94  double & bit_score)
95 {
96  t::file_extensions;
97 
98  { v.write_alignment_record(stream,
99  options,
100  header,
101  seq,
102  qual,
103  id,
104  offset,
105  ref_seq,
106  ref_id,
107  ref_offset,
108  align,
109  cigar,
110  flag,
111  mapq,
112  mate,
113  tag_dict,
114  e_value,
115  bit_score
116  ) } -> void;
117 };
119 
185 
187 } // namespace seqan3
188 
189 namespace seqan3::detail
190 {
191 
197 template <typename t>
198 constexpr bool is_type_list_of_alignment_file_output_formats_v = false;
199 
205 template <typename ...ts>
206 constexpr bool is_type_list_of_alignment_file_output_formats_v<type_list<ts...>>
208 
214 template <typename t>
215 SEQAN3_CONCEPT type_list_of_alignment_file_output_formats = is_type_list_of_alignment_file_output_formats_v<t>;
216 } // namespace seqan3::detail
misc.hpp
Provides helper data structures for the seqan3::alignment_file_output.
fstream
std::string
seqan3::type_list
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
sam_tag_dictionary.hpp
Provides the seqan3::sam_tag_dictionary class and auxiliaries.
std::pair
vector
seqan3::sam_flag
sam_flag
An enum flag that describes the properties of an aligned read (given as a SAM record).
Definition: misc.hpp:70
std::tuple
seqan3::seq
constexpr sequenced_policy seq
Global execution policy object for sequenced execution policy.
Definition: execution.hpp:54
alignment_file_output_format::write_alignment_record
void write_alignment_record(stream_type &stream, alignment_file_output_options const &options, alignment_file_header<> &header, seq_type &&seq, qual_type &&qual, id_type &&id, offset_type &&offset, ref_seq_type &&ref_seq, ref_id_type &&ref_id, ref_offset_type &&ref_offset, align_type &&align, std::vector< cigar > &cigar_vector, flag_type &&flag, mapq_type &&mapq, mate_type &&mate, tag_dict_type &&tag_dict, e_value_type &&e_value, bit_score_type &&bit_score)
Write the given fields to the specified stream.
gapped.hpp
Provides seqan3::gapped.
std::ofstream
dna5.hpp
Provides seqan3::dna5, container aliases and string literals.
header.hpp
Provides the seqan3::alignment_file_header class.
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
alignment_file_output_format
The generic concept for alignment file out formats.
output_options.hpp
Provides seqan3::alignment_file_output_options.
cigar.hpp
Provides the seqan3::cigar alphabet.
aliases.hpp
Provides aliases for qualified.
std::optional
phred42.hpp
Provides seqan3::phred42 quality scores.
type_list.hpp
Provides seqan3::type_list.
string