#include <genesis/population/window/genome_window_stream.hpp>
Stream for traversing the entire genome as a single window, with an inner WindowView iterator over the positions along the chromosomes.
The class produces exctly one window, which then traverses all positions of the whole underlying input data stream via an inner WindowView iterator. This class is merely meant as a simplification and wrapper, so that downstream statistics algorithms can just use a window as their input. This class contains a quite unfortunate amount of boiler plate, but hopefully makes downstream algorithms easier to write.
The three functors
have to be set in the class prior to starting the iteration for the iterator. In fact, only the first of them has to be set, as we internally do not need access to the chromosome and position information of the underlying data iterator. But to be conformant with the other window streams, it is better to be consistent here. See make_genome_window_stream() and make_default_genome_window_stream() for helper functions that take care of this for most of our data types.
See BaseWindowStream for more details on the three functors, the template parameters. This class here however does not derive from the BaseWindowStream over normal Windows, but behaves in a similar way - with the exception that it does not produce Windows in each step of the iteration, as we do not want to keep the positions of a whole genome in memory. Hence, instead, it yields a WindowView iterator, directly streaming over the positions of the chromosome, without keeping all data in memory.
Definition at line 87 of file genome_window_stream.hpp.
Public Member Functions | |
GenomeWindowStream (GenomeWindowStream &&)=default | |
GenomeWindowStream (GenomeWindowStream const &)=default | |
GenomeWindowStream (InputStreamIterator begin, InputStreamIterator end) | |
virtual | ~GenomeWindowStream () override=default |
GenomeWindowStream & | operator= (GenomeWindowStream &&)=default |
GenomeWindowStream & | operator= (GenomeWindowStream const &)=default |
std::shared_ptr< genesis::sequence::SequenceDict > | sequence_dict () const |
Get the currently set sequence dictionary used for the chromosome lengths. More... | |
self_type & | sequence_dict (std::shared_ptr< genesis::sequence::SequenceDict > value) |
Set a sequence dictionary to be used for the chromosome lengths. More... | |
Public Member Functions inherited from BaseWindowStream< InputStreamIterator, typename InputStreamIterator::value_type, ::genesis::population::WindowView< typename InputStreamIterator::value_type > > | |
BaseWindowStream (BaseWindowStream &&)=default | |
BaseWindowStream (BaseWindowStream const &)=default | |
BaseWindowStream (InputStreamIterator begin, InputStreamIterator end) | |
virtual | ~BaseWindowStream ()=default |
self_type & | add_begin_callback (std::function< void()> const &callback) |
Add a callback function that is executed when beginning the iteration. More... | |
self_type & | add_end_callback (std::function< void()> const &callback) |
Add a callback function that is executed when the end of the iteration is reached. More... | |
self_type & | add_on_enter_observer (std::function< void(::genesis::population::WindowView< typename InputStreamIterator::value_type > const &)> const &observer) |
Add a observer function that is executed once for each window during the iteration, when entering the window during the iteration. More... | |
self_type & | add_on_leave_observer (std::function< void(::genesis::population::WindowView< typename InputStreamIterator::value_type > const &)> const &observer) |
Add a observer function that is executed once for each window during the iteration, when leaving the window during the iteration. More... | |
Iterator | begin () |
self_type & | clear_callbacks () |
Clear all functions that have been added via add_begin_callback() and add_end_callback(). More... | |
self_type & | clear_observers () |
Clear all functions that are executed on incrementing to the next element. More... | |
Iterator | end () |
BaseWindowStream & | operator= (BaseWindowStream &&)=default |
BaseWindowStream & | operator= (BaseWindowStream const &)=default |
Public Attributes | |
friend | DerivedIterator |
Public Attributes inherited from BaseWindowStream< InputStreamIterator, typename InputStreamIterator::value_type, ::genesis::population::WindowView< typename InputStreamIterator::value_type > > | |
std::function< std::string(InputType const &)> | chromosome_function |
Functor that yields the current chromosome, given the input stream data. More... | |
std::function< DataType(InputType const &)> | entry_input_function |
Functor to convert from the underlying input stream that provides the data to fill the windows to the data that is stored per window. More... | |
friend | Iterator |
std::function< size_t(InputType const &)> | position_function |
Functor that yields the current position on the chromosome, given the input stream data. More... | |
Classes | |
class | DerivedIterator |
Internal iterator that produces WindowViews. More... | |
Protected Member Functions | |
std::unique_ptr< typename base_type::BaseIterator > | get_begin_iterator_ () override final |
Get the begin iterator. More... | |
std::unique_ptr< typename base_type::BaseIterator > | get_end_iterator_ () override final |
Get the end iterator. More... | |
Protected Member Functions inherited from BaseWindowStream< InputStreamIterator, typename InputStreamIterator::value_type, ::genesis::population::WindowView< typename InputStreamIterator::value_type > > | |
BaseWindowStream ()=default | |
|
inline |
Definition at line 352 of file genome_window_stream.hpp.
|
overridevirtualdefault |
|
default |
|
default |
|
inlinefinaloverrideprotectedvirtual |
Get the begin iterator.
Needs to be implemented by the derived class, to give the correct derived BaseIterator instance.
Definition at line 403 of file genome_window_stream.hpp.
|
inlinefinaloverrideprotectedvirtual |
Get the end iterator.
Needs to be implemented by the derived class, to give the correct derived BaseIterator instance.
Definition at line 412 of file genome_window_stream.hpp.
|
default |
|
default |
|
inline |
Get the currently set sequence dictionary used for the chromosome lengths.
Definition at line 375 of file genome_window_stream.hpp.
|
inline |
Set a sequence dictionary to be used for the chromosome lengths.
By default, we use the chromosome positions as given in the data to set the window positions. When setting a SequenceDict here, we use lengths as provided instead, throwing an exception should the dict not contain a chromosome of the input.
To un-set the dictionary, simply call this function with a nullptr
.
Definition at line 390 of file genome_window_stream.hpp.
using base_type = BaseWindowStream<InputStreamIterator, DataType, WindowViewType> |
Definition at line 99 of file genome_window_stream.hpp.
using const_reference = value_type const& |
Definition at line 111 of file genome_window_stream.hpp.
using InputType = typename InputStreamIterator::value_type |
Definition at line 102 of file genome_window_stream.hpp.
using iterator_category = std::input_iterator_tag |
Definition at line 107 of file genome_window_stream.hpp.
using pointer = value_type* |
Definition at line 109 of file genome_window_stream.hpp.
using reference = value_type& |
Definition at line 110 of file genome_window_stream.hpp.
using self_type = GenomeWindowStream<InputStreamIterator, DataType> |
Definition at line 98 of file genome_window_stream.hpp.
using value_type = WindowViewType |
Definition at line 108 of file genome_window_stream.hpp.
Definition at line 97 of file genome_window_stream.hpp.
friend DerivedIterator |
Definition at line 366 of file genome_window_stream.hpp.