Loading...
Searching...
No Matches
seqan3::fields< fs > Struct Template Reference
IO

A class template that holds a choice of seqan3::field. More...

`#include <seqan3/io/record.hpp>`

Inheritance diagram for seqan3::fields< fs >:
[legend]

## Detailed Description

template<field... fs>
struct seqan3::fields< fs >

A class template that holds a choice of seqan3::field.

Template Parameters

  fs | The fields you wish to be present in the seqan3::record returned by your file.

See also
  seqan3::record

This class acts as a compile time list of seqan3::field elements. It is used in specialising file classes to determine the elements in a seqan3::record.

### Example

// 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/core/debug_stream.hpp>
#include <seqan3/io/record.hpp>
#include <seqan3/io/sequence_file/input.hpp>
#include <seqan3/io/sequence_file/output.hpp>
auto input = R"(> TEST1
ACGT
> Test2
AGGCTGA
> Test3
GGAGTATAATATATATATATATAT)";
int main()
{
// specify custom field combination/order to file:
seqan3::sequence_file_input fin{std::istringstream{input},
seqan3::format_fasta{},
seqan3::fields<seqan3::field::id, seqan3::field::seq>{}};
auto record = fin.front(); // get current record, in this case the first
auto & id = record.id();
seqan3::debug_stream << id << '\n'; // TEST1
auto & seq = record.sequence();
seqan3::debug_stream << seq << '\n'; // ACGT
}
std::istringstream
seqan3::format_fasta
The FASTA format.
Definition format_fasta.hpp:77
seqan3::sequence_file_input
A class for reading sequence files, e.g. FASTA, FASTQ ...
Definition sequence_file/input.hpp:206
seqan3::sequence_file_input::front
reference front() noexcept
Return the record we are currently at in the file.
Definition sequence_file/input.hpp:463
seqan3::sequence_record::id
decltype(auto) id() &&
The identifier, usually a string.
Definition sequence_file/record.hpp:55
debug_stream.hpp
Provides seqan3::debug_stream and related types.
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:38
seqan3::field::seq
@ seq
The "sequence", usually a range of nucleotides or amino acids.
Definition record.hpp:62
output.hpp
Provides seqan3::sequence_file_output and corresponding traits classes.
record.hpp
Provides the seqan3::record template and the seqan3::field enum.
input.hpp
Provides seqan3::sequence_file_input and corresponding traits classes.
sstream
seqan3::fields
A class template that holds a choice of seqan3::field.
Definition record.hpp:125

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

- record.hpp

Hide me