|
SeqAn3 3.4.2-rc.1
The Modern C++ library for sequence analysis.
|
The alignment base format. More...
#include <seqan3/io/sam_file/detail/format_sam_base.hpp>
Inheritance diagram for seqan3::detail::format_sam_base:Protected Member Functions | |
| template<typename ref_id_type , typename ref_id_tmp_type , typename header_type , typename ref_seqs_type > | |
| void | check_and_assign_ref_id (ref_id_type &ref_id, ref_id_tmp_type &ref_id_tmp, header_type &header, ref_seqs_type &) |
Checks for known reference ids or adds a new reference is and assigns a reference id to ref_id. | |
| template<arithmetic arithmetic_target_type> | |
| void | read_arithmetic_field (std::string_view const &str, arithmetic_target_type &arithmetic_target) |
| Reads arithmetic fields using std::from_chars. | |
| template<std::ranges::forward_range target_range_type> | |
| void | read_forward_range_field (std::string_view const str, target_range_type &target) |
Reads from str to target, converting values with seqan3::views::char_to. | |
| template<typename stream_view_type , std::ranges::forward_range target_range_type> | |
| void | read_forward_range_field (stream_view_type &&stream_view, target_range_type &target) |
| Reads a range by copying from stream_view to target, converting values with seqan3::views::char_to. | |
| template<typename stream_view_type , typename ref_ids_type , typename ref_seqs_type > | |
| void | read_header (stream_view_type &&stream_view, sam_file_header< ref_ids_type > &hdr, ref_seqs_type &) |
| Reads the SAM header. | |
| int32_t | soft_clipping_at_front (std::vector< cigar > const &cigar_vector) const |
Returns the soft clipping value at the front of the cigar_vector or 0 if none present. | |
| template<typename stream_t , typename header_type > | |
| void | write_header (stream_t &stream, sam_file_output_options const &options, header_type &header) |
| Writes the SAM header. | |
Constructors, destructor and assignment | |
| format_sam_base ()=default | |
| Defaulted. | |
| format_sam_base (format_sam_base const &)=default | |
| Defaulted. | |
| format_sam_base & | operator= (format_sam_base const &)=default |
| Defaulted. | |
| format_sam_base (format_sam_base &&)=default | |
| Defaulted. | |
| format_sam_base & | operator= (format_sam_base &&)=default |
| Defaulted. | |
| ~format_sam_base ()=default | |
| Defaulted. | |
Protected Attributes | |
| std::array< char, 316 > | arithmetic_buffer {} |
| A buffer used when parsing arithmetic values with std::from_chars. | |
| bool | header_was_written {false} |
| A variable that tracks whether the content of header has been written or not. | |
| bool | ref_info_present_in_header {false} |
| Tracks whether reference information (@SQ tag) were found in the SAM header. | |
Static Protected Attributes | |
| static constexpr std::array | format_version {'1', '.', '6'} |
| The format version string. | |
The alignment base format.
Since the SAM and BAM format share a lot of functionality, this abstract base class defines common member variables and functions that are used in both formats.
|
inlineprotected |
Checks for known reference ids or adds a new reference is and assigns a reference id to ref_id.
| ref_id_type | The type of the reference id (usually a views::type_reduce over ref_id_tmp_type). |
| ref_id_tmp_type | The type of the temporary parsed id (same_as type as reference ids in header). |
| header_type | The type of the alignment header. |
| ref_seqs_type | A tag whether the reference information were given or not (std::ignore or not). |
| [out] | ref_id | The reference id to be filled. |
| [in] | ref_id_tmp | The temporary of the parsed reference id. |
| [in,out] | header | The header object that stores the reference id information. |
|
inlineprotected |
Reads arithmetic fields using std::from_chars.
| arithmetic_target_type | The type of value to parse from input; must model seqan3::arithmetic. |
| [in,out] | str | The string_view to parse. |
| [out] | arithmetic_target | The arithmetic value object to store the parsed value. |
| seqan3::format_error | if the character sequence in str cannot be successfully converted to a value of type arithmetic_target_type. |
|
inlineprotected |
Reads from str to target, converting values with seqan3::views::char_to.
| target_range_type | The type of range to parse from input; must model std::ranges::forward_range. |
| [in,out] | str | The string_view to parse. |
| [out] | target | The range to store the parsed sequence. |
|
inlineprotected |
Reads a range by copying from stream_view to target, converting values with seqan3::views::char_to.
| stream_view_type | The type of the stream as a view. |
| target_range_type | The type of range to parse from input; must model std::ranges::forward_range. |
| [in,out] | stream_view | The stream view to iterate over. |
| [out] | target | The range to store the parsed sequence. |
|
inlineprotected |
Reads the SAM header.
| stream_view_type | The type of the stream as a view. |
| [in,out] | stream_view | The stream view to iterate over. |
| [in,out] | hdr | The header (as a pointer) to store the parsed values. |
| seqan3::format_error | if any unexpected character or format is encountered. |
Reading the header format is done according to the official SAM format specifications.
The function throws a seqan3::format_error if the format is not in a correct state (e.g. required fields are not given), but throwing might occur downstream of the actual error.
Any user-defined tags are not checked for correctness ([TAG]:[VALUE]) and are stored as strings:
|
inlineprotected |
Returns the soft clipping value at the front of the cigar_vector or 0 if none present.
| [in] | cigar_vector | The cigar information to parse for soft-clipping. |
|
inlineprotected |
Writes the SAM header.
| stream_t | The stream type. |
| [in,out] | stream | The stream to print to. |
| [in] | options | The options to alter printing. |
| [in] | header | The header to print. |
| seqan3::format_error | if the header object contains the wrong information or the contents are ill-formed. |
Before writing the header, the contents are checked for correctness according to the rules of the official SAM format specifications.