Loading...
Searching...
No Matches
seqan3::sam_file_input_default_traits< ref_sequences_t, ref_ids_t > Struct Template Reference
IO » SAM File

The default traits for seqan3::sam_file_input. More...

`#include <seqan3/io/sam_file/input.hpp>`

Inheritance diagram for seqan3::sam_file_input_default_traits< ref_sequences_t, ref_ids_t >:
[legend]

## Public Types

Member types
Definitions to model seqan3::sam_file_input_traits.
using | sequence_alphabet = dna5
| The sequence alphabet is seqan3::dna5.
using | sequence_legal_alphabet = dna15
| The legal sequence alphabet for parsing is seqan3::dna15.
template<typename _sequence_alphabet>
using | sequence_container = std::vector<_sequence_alphabet>
| The container for a sequence is std::vector.
template<typename _id_alphabet>
using | id_container = std::basic_string<_id_alphabet>
| The string type for an identifier is std::basic_string.
using | quality_alphabet = phred42
| The alphabet for a quality annotation is seqan3::phred42.
template<typename _quality_alphabet>
using | quality_container = std::vector<_quality_alphabet>
| The string type for a quality annotation is std::vector.
using | ref_sequences = ref_sequences_t
| The type of the reference sequences is deduced on construction.
using | ref_ids = ref_ids_t
| The type of the reference identifiers is deduced on construction.

## Additional Inherited Members

Related Symbols inherited from sam_file_input_traits
using | sequence_alphabet
| Alphabet of the characters for the seqan3::field::seq; must model seqan3::alphabet.
using | sequence_legal_alphabet
| Intermediate alphabet for seqan3::field::seq; must model seqan3::alphabet and be convertible to sequence_alphabet.
using | sequence_container
| Type template of the seqan3::field::seq, a container template over sequence_alphabet; must model seqan3::sequence_container.
using | id_container
| Type template of the seqan3::field::id, a container template over char; must model seqan3::sequence_container.
using | quality_alphabet
| Alphabet of the characters for the seqan3::field::qual; must model seqan3::writable_quality_alphabet.
using | quality_container
| Type template of the seqan3::field::qual, a container template over quality_alphabet; must model seqan3::sequence_container.
using | ref_sequences
| The type of range over reference sequences; must model std::ranges::forward_range, the value_type must also model std::ranges::forward_range, and the value type of the value type must model seqan3::alphabet (e.g. std::vector<std::vector<dna4>>).
using | ref_ids
| The type of range over reference sequences; must model std::ranges::forward_range, the value_type must also model std::ranges::forward_range, and the value type of the value type must model seqan3::alphabet (e.g. std::vector<string>).

## Detailed Description

template<typename ref_sequences_t = ref_info_not_given, typename ref_ids_t = std::deque<std::string>>
struct seqan3::sam_file_input_default_traits< ref_sequences_t, ref_ids_t >

The default traits for seqan3::sam_file_input.

Template Parameters

  ref_sequences_t | A range over reference sequences. This type is automatically deduced on construction.
  ref_ids_t | A range over reference ids. This type is automatically deduced on construction.

If you wish to change a single or a few types from the default, just inherit from this class and "overwrite" the respective type definitions.

This example will make the file read into a smaller alphabet and a compressed container:

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <sstream>
#include <seqan3/alphabet/container/bitpacked_sequence.hpp>
#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/io/sam_file/input.hpp>
#include <seqan3/utility/type_list/type_list.hpp>
struct my_traits : seqan3::sam_file_input_default_traits<>
{
using sequence_alphabet = seqan3::dna4; // instead of dna5
template <typename alph>
using sequence_container = seqan3::bitpacked_sequence<alph>; // must be defined as a template!
};
auto sam_file_raw = R"(@HD VN:1.6 SO:coordinate GO:none
@SQ SN:ref LN:45
r001 99 ref 7 30 8M2I4M1D3M = 37 39 TTAGATAAAGGATACTG *
r003 0 ref 29 30 5S6M * 0 0 GCCTAAGCTAA * SA:Z:ref,29,-,6H5M,17,0;
r003 2064 ref 29 17 6H5M * 0 0 TAGGC * SA:Z:ref,9,+,5S6M,30,1;
r001 147 ref 237 30 9M = 7 -39 CAGCGGCAT * NM:i:1
)";
// ... within main you can then use:
int main()
{
seqan3::sam_file_input<my_traits> fin{std::istringstream{sam_file_raw}, seqan3::format_sam{}};
}
std::istringstream
bitpacked_sequence.hpp
Provides seqan3::bitpacked_sequence.
seqan3::bitpacked_sequence
A space-optimised version of std::vector that compresses multiple letters into a single byte.
Definition bitpacked_sequence.hpp:62
seqan3::dna4
The four letter DNA alphabet of A,C,G,T.
Definition dna4.hpp:50
seqan3::format_sam
The SAM format (tag).
Definition format_sam.hpp:105
seqan3::sam_file_input
A class for reading SAM files, both SAM and its binary representation BAM are supported.
Definition sam_file/input.hpp:236
dna4.hpp
Provides seqan3::dna4, container aliases and string literals.
input.hpp
Provides seqan3::sam_file_input and corresponding traits classes.
sstream
seqan3::sam_file_input_default_traits
The default traits for seqan3::sam_file_input.
Definition sam_file/input.hpp:168
seqan3::sam_file_input_default_traits::sequence_alphabet
dna5 sequence_alphabet
The sequence alphabet is seqan3::dna5.
Definition sam_file/input.hpp:175
seqan3::sam_file_input_default_traits::sequence_container
std::vector< _sequence_alphabet > sequence_container
The container for a sequence is std::vector.
Definition sam_file/input.hpp:182
type_list.hpp
Provides seqan3::type_list.

The documentation for this struct was generated from the following file:

- sam_file/input.hpp

Hide me