SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
header.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 <deque>
16 #include <unordered_map>
17 #include <vector>
18 
22 #include <seqan3/range/hash.hpp>
24 #include <seqan3/std/ranges>
25 
26 namespace seqan3
27 {
28 
31 template <std::ranges::forward_range ref_ids_type = std::deque<std::string>>
33 {
34 public:
38  alignment_file_header() = default;
49  ~alignment_file_header() = default;
50 
54  alignment_file_header(ref_ids_type & ref_ids) :
55  ref_ids_ptr{&ref_ids, ref_ids_deleter_noop}
56  {}
57 
61  alignment_file_header(ref_ids_type && ref_ids) :
62  ref_ids_ptr{new ref_ids_type{std::move(ref_ids)}, ref_ids_deleter_default}
63  {}
65 
68  {
75  };
76 
81 
83 
85 
86 private:
88  using ref_ids_ptr_t = std::unique_ptr<ref_ids_type, std::function<void(ref_ids_type*)>>;
90  static void ref_ids_deleter_noop(ref_ids_type *) {}
92  static void ref_ids_deleter_default(ref_ids_type * ptr) { delete ptr; }
96  type_reduce_view<reference_t<ref_ids_type>>>;
98  ref_ids_ptr_t ref_ids_ptr{new ref_ids_type{}, ref_ids_deleter_default};
99 
100 public:
119  ref_ids_type & ref_ids()
120  {
121  return *ref_ids_ptr;
122  }
123 
162 
165 
206 };
207 
208 } // namespace seqan3
seqan3::alignment_file_header::program_info_t::name
std::string name
The official name.
Definition: header.hpp:70
seqan3::alignment_file_header::format_version
std::string format_version
The file format version. Note: this is overwritten by our formats on output.
Definition: header.hpp:77
std::span
pre.hpp
Provides various transformation trait base templates and shortcuts.
std::string
seqan3::alignment_file_header::program_info_t::command_line_call
std::string command_line_call
The command line call that produces the file.
Definition: header.hpp:71
seqan3::alignment_file_header::program_info_t::id
std::string id
A unique (file scope) id.
Definition: header.hpp:69
seqan3::alignment_file_header::read_groups
std::vector< std::pair< std::string, std::string > > read_groups
The Read Group Dictionary (used by the SAM/BAM format).
Definition: header.hpp:205
vector
seqan3::alignment_file_header::operator=
alignment_file_header & operator=(alignment_file_header const &)=default
Copy assignment is defaulted.
seqan3::alignment_file_header::program_info_t::previous
std::string previous
The id of the previous program if program calls were chained.
Definition: header.hpp:72
seqan3::views::move
const auto move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:68
std::function
seqan3::alignment_file_header::ref_ids
ref_ids_type & ref_ids()
The range of reference ids.
Definition: header.hpp:119
seqan3::alignment_file_header::alignment_file_header
alignment_file_header(ref_ids_type &&ref_ids)
Construct from a rvalue range of reference ids which is moved into the ref_ids_ptr (owning).
Definition: header.hpp:61
seqan3::alignment_file_header::~alignment_file_header
~alignment_file_header()=default
Destructor is defaulted.
seqan3::alignment_file_header::program_info_t
Stores information of the program/tool that was used to create the file.
Definition: header.hpp:67
seqan3::alignment_file_header::comments
std::vector< std::string > comments
The list of comments.
Definition: header.hpp:84
seqan3::alignment_file_header
Stores the header information of alignment files.
Definition: header.hpp:32
type_reduce.hpp
Provides seqan3::views::type_reduce.
seqan3::alignment_file_header::ref_dict
std::unordered_map< key_type, int32_t, std::hash< key_type >, detail::view_equality_fn > ref_dict
The mapping of reference id to position in the ref_ids() range and the ref_id_info range.
Definition: header.hpp:164
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
seqan3::alignment_file_header::alignment_file_header
alignment_file_header(ref_ids_type &ref_ids)
Construct from a range of reference ids which redirects the ref_ids_ptr member (non-owning).
Definition: header.hpp:54
seqan3::alignment_file_header::sorting
std::string sorting
The sorting of the file. SAM: [unknown, unsorted, queryname, coordinate].
Definition: header.hpp:78
seqan3::alignment_file_header::program_info_t::description
std::string description
A description of the program and/or program call.
Definition: header.hpp:73
seqan3::alignment_file_header::alignment_file_header
alignment_file_header()=default
Default constructor is defaulted.
deque
detail.hpp
Auxiliary functions for the alignment IO.
ranges
Adaptations of concepts from the Ranges TS.
seqan3::alignment_file_header::ref_id_info
std::vector< std::tuple< int32_t, std::string > > ref_id_info
The reference information. (used by the SAM/BAM format)
Definition: header.hpp:161
seqan3::alignment_file_header::subsorting
std::string subsorting
The sub-sorting of the file. SAM: [unknown, unsorted, queryname, coordinate](:[A-Za-z0-9_-]+)+.
Definition: header.hpp:79
seqan3::alignment_file_header::grouping
std::string grouping
The grouping of the file. SAM: [none, query, reference].
Definition: header.hpp:80
hash.hpp
Provides overloads for std::hash.
seqan3::alignment_file_header::program_info_t::version
std::string version
The program/tool version.
Definition: header.hpp:74
std::conditional_t
std::unique_ptr< ref_ids_type, std::function< void(ref_ids_type *)> >
unordered_map
seqan3::alignment_file_header::program_infos
std::vector< program_info_t > program_infos
The list of program information.
Definition: header.hpp:82
concept.hpp
Core alphabet concept and free function/type trait wrappers.