SeqAn3
seqan3::sequence_file_format_fastq Class Reference

The FastQ format. More...

#include <seqan3/io/sequence_file/format_fastq.hpp>

Inheritance diagram for seqan3::sequence_file_format_fastq:
[legend]

Public Member Functions

template<typename stream_type , typename seq_legal_alph_type , bool seq_qual_combined, typename seq_type , typename id_type , typename qual_type >
void read (stream_type &stream, sequence_file_input_options< seq_legal_alph_type, seq_qual_combined > const &options, seq_type &sequence, id_type &id, qual_type &qualities)
 Read from the specified stream and back-insert into the given field buffers. More...
 
template<typename stream_type , typename seq_type , typename id_type , typename qual_type >
void write (stream_type &stream, sequence_file_output_options const &options, seq_type &&sequence, id_type &&id, qual_type &&qualities)
 Write the given fields to the specified stream. More...
 
Constructors, destructor and assignment

Rule of five explicitly defaulted.

 sequence_file_format_fastq ()=default
 
 sequence_file_format_fastq (sequence_file_format_fastq const &)=delete
 
sequence_file_format_fastqoperator= (sequence_file_format_fastq const &)=delete
 
 sequence_file_format_fastq (sequence_file_format_fastq &&)=default
 
sequence_file_format_fastqoperator= (sequence_file_format_fastq &&)=default
 

Static Public Attributes

static std::vector< std::string > file_extensions
 The valid file extensions for this format; note that you can modify this value. More...
 

Detailed Description

The FastQ format.

Introduction

FastQ is the de-facto-standard for storing sequences together with quality information. See the article on wikipedia for a an in-depth description of the format.

Fields

The FastQ format provides the fields seqan3::field::SEQ, seqan3::field::ID and seqan3::field::QUAL; or alternatively provides seqan3::field::SEQ_QUAL as a single field of sequence and quality. All three fields (or ID + SEQ_QUAL) are required when writing and the sequence and qualities are required to be of the same length.

Encodings

All documented encodings for the quality string are supported (see the article above), but they are not detected from the file. Instead, when reading the file, you have to set the respective alphabet via a traits type (see seqan3::sequence_file_input_traits_concept and the quality submodule

Todo:
link).

Implementation notes

This implementation supports the following optional features of the format:

  • line breaks and/or other whitespace characters in any part of the sequence and/or qualities (only when reading!)
  • writing the ID to the +-line also (line is always ignored when reading)

Member Function Documentation

◆ read()

template<typename stream_type , typename seq_legal_alph_type , bool seq_qual_combined, typename seq_type , typename id_type , typename qual_type >
void seqan3::sequence_file_format_fastq::read ( stream_type &  stream,
sequence_file_input_options< seq_legal_alph_type, seq_qual_combined > const &  options,
seq_type &  sequence,
id_type &  id,
qual_type &  qualities 
)
inline

Read from the specified stream and back-insert into the given field buffers.

Template Parameters
stream_typeInput stream, must satisfy seqan3::istream_concept with char.
seq_typeType of the seqan3::field::SEQ input; must satisfy std::ranges::OutputRange over a seqan3::alphabet_concept.
id_typeType of the seqan3::field::ID input; must satisfy std::ranges::OutputRange over a seqan3::alphabet_concept.
qual_typeType of the seqan3::field::QUAL input; must satisfy std::ranges::OutputRange over a seqan3::quality_concept.
Parameters
[in,out]streamThe input stream to read from.
[in]optionsFile specific options passed to the format.
[out]sequenceThe buffer for seqan3::field::SEQ input, i.e. the "sequence".
[out]idThe buffer for seqan3::field::ID input, e.g. the header line in FastA.
[out]qualitiesThe buffer for seqan3::field::QUAL input.

Additional requirements

◆ write()

template<typename stream_type , typename seq_type , typename id_type , typename qual_type >
void seqan3::sequence_file_format_fastq::write ( stream_type &  stream,
sequence_file_output_options const &  options,
seq_type &&  sequence,
id_type &&  id,
qual_type &&  qualities 
)
inline

Write the given fields to the specified stream.

Template Parameters
stream_typeOutput stream, must satisfy seqan3::ostream_concept with char.
seq_typeType of the seqan3::field::SEQ output; must satisfy std::ranges::OutputRange over a seqan3::alphabet_concept.
id_typeType of the seqan3::field::ID output; must satisfy std::ranges::OutputRange over a seqan3::alphabet_concept.
qual_typeType of the seqan3::field::QUAL output; must satisfy std::ranges::OutputRange over a seqan3::quality_concept.
Parameters
[in,out]streamThe output stream to write into.
[in]optionsFile specific options passed to the format.
[in]sequenceThe data for seqan3::field::SEQ, i.e. the "sequence".
[in]idThe data for seqan3::field::ID, e.g. the header line in FastA.
[in]qualitiesThe data for seqan3::field::QUAL.

Additional requirements

  • The format must also accept std::ignore as parameter for any of the fields, however it shall throw an exception if one of the fields required for writing the format is marked as such. [this shall be checked inside the function]
  • The format does not handle seqan3::field::SEQ_QUAL, instead seqan3::sequence_file_output splits it into two views and passes it to the format as if they were separate.

Member Data Documentation

◆ file_extensions

std::vector<std::string> seqan3::sequence_file_format_fastq::file_extensions
inlinestatic
Initial value:
{
{ "fastq" },
{ "fq" }
}

The valid file extensions for this format; note that you can modify this value.


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