31#include <seqan3/io/detail/record.hpp>
152 requires std::is_floating_point_v<typename t::bpp_prob>;
169 requires std::is_same_v<typename t::structure_alphabet, dssp9>
176 typename t::template structured_seq_alphabet<typename t::seq_alphabet, typename t::structure_alphabet>,
177 typename t::seq_alphabet,
178 typename t::structure_alphabet>,
179 typename t::template structured_seq_alphabet<typename t::seq_alphabet, typename t::structure_alphabet>>;
186 requires std::is_floating_point_v<typename t::energy_type::value_type>;
189 requires std::is_floating_point_v<typename t::react_type>;
234 template <
typename _seq_alphabet>
243 template <
typename _
id_alphabet>
255 template <
typename _bpp_prob,
typename _bpp_partner>
259 template <
typename _bpp_item>
263 template <
typename _bpp_queue>
272 template <
typename _structure_alphabet>
278 template <
typename _seq_alphabet,
typename _structure_alphabet>
282 template <
typename _structured_seq_alphabet>
296 template <
typename _react_type>
305 template <
typename _comment_alphabet>
331 template <
typename _seq_alphabet,
typename _structure_alphabet>
391 for (
field f : selected_field_ids::as_array)
392 if (!field_ids::contains(f))
396 "You selected a field that is not valid for structure files, please refer to the documentation "
397 "of structure_file_input::field_ids for the accepted values.");
405 "You may not select field::structured_seq and either of field::seq and field::structure "
406 "at the same time.");
414 using seq_type =
typename traits_type::template seq_container<typename traits_type::seq_alphabet>;
416 using id_type =
typename traits_type::template id_container<typename traits_type::id_alphabet>;
418 using bpp_type =
typename traits_type::template bpp_container<
typename traits_type::template bpp_queue<
419 typename traits_type::template bpp_item<typename traits_type::bpp_prob, typename traits_type::bpp_partner>>>;
421 using structure_type =
typename traits_type::template structure_container<typename traits_type::structure_alphabet>;
424 typename traits_type::template structured_seq_alphabet<
typename traits_type::seq_alphabet,
425 typename traits_type::structure_alphabet>>;
429 using react_type =
typename traits_type::template react_container<typename traits_type::react_type>;
431 using comment_type =
typename traits_type::template comment_container<typename traits_type::comment_alphabet>;
467 using iterator = detail::in_file_iterator<structure_file_input>;
508 primary_stream{new
std::ifstream{}, stream_deleter_default}
510 primary_stream->rdbuf()->pubsetbuf(stream_buffer.
data(), stream_buffer.
size());
512 ->open(filename, std::ios_base::in | std::ios::binary);
514 if (!primary_stream->good())
518 secondary_stream = detail::make_secondary_istream(*primary_stream, filename);
521 detail::set_format(format, filename);
539 template <input_stream stream_t, structure_file_input_format file_format>
540 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
char>
542 file_format
const & SEQAN3_DOXYGEN_ONLY(format_tag),
544 primary_stream{&stream, stream_deleter_noop},
545 format{detail::structure_file_input_format_exposer<file_format>{}}
547 static_assert(list_traits::contains<file_format, valid_formats>,
548 "You selected a format that is not in the valid_formats of this file.");
551 secondary_stream = detail::make_secondary_istream(*primary_stream);
555 template <input_stream stream_t, structure_file_input_format file_format>
556 requires std::same_as<typename std::remove_reference_t<stream_t>::char_type,
char>
558 file_format
const & SEQAN3_DOXYGEN_ONLY(format_tag),
560 primary_stream{new stream_t{
std::move(stream)}, stream_deleter_default},
561 format{detail::structure_file_input_format_exposer<file_format>{}}
563 static_assert(list_traits::contains<file_format, valid_formats>,
564 "You selected a format that is not in the valid_formats of this file.");
567 secondary_stream = detail::make_secondary_istream(*primary_stream);
592 if (!first_record_was_read)
595 first_record_was_read =
true;
650 selected_field_ids::contains(field::structured_seq)>
682 stream_ptr_t primary_stream{
nullptr, stream_deleter_noop};
684 stream_ptr_t secondary_stream{
nullptr, stream_deleter_noop};
687 bool first_record_was_read{
false};
693 typename detail::variant_from_tags<valid_formats, detail::structure_file_input_format_exposer>::type;
699 void read_next_record()
702 record_buffer.
clear();
705 position_buffer = secondary_stream->tellg();
715 assert(!
format.valueless_by_exception());
720 if constexpr (selected_field_ids::contains(field::structured_seq))
722 static_assert(!selected_field_ids::contains(field::structure),
723 "You may not select field::structured_seq and field::structure at the same time.");
724 static_assert(!selected_field_ids::contains(field::seq),
725 "You may not select field::structured_seq and field::seq at the same time.");
726 f.read_structure_record(*secondary_stream,
728 detail::get_or_ignore<field::structured_seq>(record_buffer),
729 detail::get_or_ignore<field::id>(record_buffer),
730 detail::get_or_ignore<field::bpp>(record_buffer),
731 detail::get_or_ignore<field::structured_seq>(record_buffer),
732 detail::get_or_ignore<field::energy>(record_buffer),
733 detail::get_or_ignore<field::react>(record_buffer),
734 detail::get_or_ignore<field::react_err>(record_buffer),
735 detail::get_or_ignore<field::comment>(record_buffer),
736 detail::get_or_ignore<field::offset>(record_buffer));
740 f.read_structure_record(*secondary_stream,
742 detail::get_or_ignore<field::seq>(record_buffer),
743 detail::get_or_ignore<field::id>(record_buffer),
744 detail::get_or_ignore<field::bpp>(record_buffer),
745 detail::get_or_ignore<field::structure>(record_buffer),
746 detail::get_or_ignore<field::energy>(record_buffer),
747 detail::get_or_ignore<field::react>(record_buffer),
748 detail::get_or_ignore<field::react_err>(record_buffer),
749 detail::get_or_ignore<field::comment>(record_buffer),
750 detail::get_or_ignore<field::offset>(record_buffer));
766template <input_stream stream_type,
767 structure_file_input_format file_format,
768 detail::fields_specialisation selected_field_ids>
775template <input_stream stream_type,
Provides seqan3::aa27, container aliases and string literals.
Provides alphabet adaptations for standard char types.
The twenty-seven letter amino acid alphabet.
Definition aa27.hpp:43
The protein structure alphabet of the characters "HGIEBTSCX".
Definition dssp9.hpp:59
The 15 letter RNA alphabet, containing all IUPAC smybols minus the gap.
Definition rna15.hpp:48
The five letter RNA alphabet of A,C,G,U and the unknown character N.
Definition rna5.hpp:46
A seqan3::alphabet_tuple_base that joins an aminoacid alphabet with a protein structure alphabet.
Definition structured_aa.hpp:52
A seqan3::alphabet_tuple_base that joins a nucleotide alphabet with an RNA structure alphabet.
Definition structured_rna.hpp:53
Provides the dssp format for protein structure.
field
An enumerator for the fields used in file formats.
Definition record.hpp:60
@ energy
Energy of a folded sequence, represented by one float number.
@ comment
Comment field of arbitrary content, usually a string.
@ structure
Fixed interactions, usually a string of structure alphabet characters.
@ bpp
Base pair probability matrix of interactions, usually a matrix of float numbers.
@ react
Reactivity values of the sequence characters given in a vector of float numbers.
@ react_err
Reactivity error values given in a vector corresponding to seqan3::field::react.
@ offset
Sequence (seqan3::field::seq) relative start position (0-based), unsigned value.
@ structured_seq
Sequence and fixed interactions combined in one range.
@ id
The identifier, usually a string.
@ seq
The "sequence", usually a range of nucleotides or amino acids.
Provides the seqan3::detail::in_file_iterator class template.
Checks whether from can be explicitly converted to to.
A concept that indicates whether an alphabet represents RNA structure.
A more refined container concept than seqan3::container.
Refines seqan3::alphabet and adds assignability.
Provides exceptions used in the I/O module.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
SeqAn specific customisations in the standard namespace.
Provides seqan3::rna15, container aliases and string literals.
Provides seqan3::rna5, container aliases and string literals.
A class template that holds a choice of seqan3::field.
Definition record.hpp:125
Thrown if there is an unspecified filesystem or stream error while opening, e.g. permission problem.
Definition io/exception.hpp:36
void clear() noexcept(noexcept(std::apply(expander, std::declval< record & >().as_base())))
Clears containers that provide .clear() and (re-)initialises all other elements with = {}.
Definition record.hpp:242
Type that contains multiple types.
Definition type_list.hpp:26
Provides seqan3::structure_record.
Provides the composite of aminoacid with structure alphabets.
Provides traits for seqan3::type_list.
Adaptations of concepts from the standard library.