#include <genesis/sequence/formats/fastx_input_stream.hpp>
Stream through an input source and parse it as Fasta or Fastq sequences.
This class allows to iterate over an input source, interpreting it as Fasta or Fastq sequences, and yielding one such sequence per iteration step. This is useful for processing large files without having to keep them fully in memory.
Example:
for( auto const& s : FastaInputStream( from_file( "/path/to/large_file.fastq" ))) { std::cout << s.length() << "\n"; }
Use functions such as utils::from_file() and utils::from_string() to conveniently get an input source that can be used here.
See FastaReader and FastqReader for a description of the expected formats. In order to change the reading behaviour, a reader object can be handed over from which the settings are copied. The reader instance can also be modified before starting the iteration, if needed.
Thread safety: No thread safety. The common use case for this iterator is to loop over a file. Thus, guarding induces unnecessary overhead. If multiple threads read from this iterator, both dereferencing and incrementing need to be guarded.
Definition at line 55 of file fastx_input_stream.hpp.
Public Member Functions | |
FastxInputStream () | |
Create a default instance, with no input. More... | |
FastxInputStream (self_type &&)=default | |
FastxInputStream (self_type const &)=default | |
FastxInputStream (std::shared_ptr< utils::BaseInputSource > source) | |
Create an instance that reads from an input source, using a default FastaReader or FastqReader. More... | |
FastxInputStream (std::shared_ptr< utils::BaseInputSource > source, Reader const &reader) | |
Create an instance that reads from an input source, using the settings of a given FastaReader oder FastqReader. More... | |
~FastxInputStream ()=default | |
Iterator | begin () const |
Iterator | end () const |
std::shared_ptr< utils::BaseInputSource > | input_source () const |
self_type & | operator= (self_type &&)=default |
self_type & | operator= (self_type const &)=default |
Reader & | reader () |
Reader const & | reader () const |
Public Types | |
using | difference_type = std::ptrdiff_t |
using | iterator_category = std::input_iterator_tag |
using | pointer = value_type * |
using | reference = value_type & |
using | self_type = FastxInputStream |
using | value_type = Sequence |
Classes | |
class | Iterator |
Internal iterator over the sequences. More... | |
|
inline |
Create a default instance, with no input.
Definition at line 279 of file fastx_input_stream.hpp.
|
inlineexplicit |
Create an instance that reads from an input source, using a default FastaReader or FastqReader.
Definition at line 288 of file fastx_input_stream.hpp.
|
inline |
Create an instance that reads from an input source, using the settings of a given FastaReader oder FastqReader.
Definition at line 299 of file fastx_input_stream.hpp.
|
default |
|
default |
|
default |
|
inline |
Definition at line 319 of file fastx_input_stream.hpp.
|
inline |
Definition at line 324 of file fastx_input_stream.hpp.
|
inline |
Definition at line 333 of file fastx_input_stream.hpp.
|
inline |
Definition at line 338 of file fastx_input_stream.hpp.
|
inline |
Definition at line 343 of file fastx_input_stream.hpp.
using difference_type = std::ptrdiff_t |
Definition at line 101 of file fastx_input_stream.hpp.
using iterator_category = std::input_iterator_tag |
Definition at line 102 of file fastx_input_stream.hpp.
using pointer = value_type* |
Definition at line 99 of file fastx_input_stream.hpp.
using reference = value_type& |
Definition at line 100 of file fastx_input_stream.hpp.
using self_type = FastxInputStream |
Definition at line 97 of file fastx_input_stream.hpp.
using value_type = Sequence |
Definition at line 98 of file fastx_input_stream.hpp.