A library for working with phylogenetic and population genetic data.
v0.27.0
SlidingIntervalWindowIterator< ForwardIterator, DataType > Class Template Referencefinal

#include <genesis/population/window/sliding_interval_window_iterator.hpp>

Inherits BaseWindowIterator< ForwardIterator, typename ForwardIterator::value_type >.

Detailed Description

template<class ForwardIterator, class DataType = typename ForwardIterator::value_type>
class genesis::population::SlidingIntervalWindowIterator< ForwardIterator, DataType >

Iterator for sliding Windows of fixed sized intervals over the chromosomes of a genome.

The three functors

have to be set in the class prior to starting the iteration, as well as the width(). All other settings are optional and/or defaulted to reasonable values.

See BaseWindowIterator for more details on the three functors, the template parameters, and general usage examples of the class.

Definition at line 66 of file sliding_interval_window_iterator.hpp.

Public Member Functions

 SlidingIntervalWindowIterator (ForwardIterator begin, ForwardIterator end)
 
 SlidingIntervalWindowIterator (SlidingIntervalWindowIterator &&)=default
 
 SlidingIntervalWindowIterator (SlidingIntervalWindowIterator const &)=default
 
 ~SlidingIntervalWindowIterator ()=default
 
bool emit_leading_empty_windows () const
 
self_typeemit_leading_empty_windows (bool value)
 Select whether the iterator produces empty windows in the beginning of each chromosome, before the first actual position that is reported by the underlying data. More...
 
SlidingIntervalWindowIteratoroperator= (SlidingIntervalWindowIterator &&)=default
 
SlidingIntervalWindowIteratoroperator= (SlidingIntervalWindowIterator const &)=default
 
size_t stride () const
 
self_typestride (size_t value)
 Stride of the Window, that is, how many positions to move forward with each iteration. More...
 
size_t width () const
 
self_typewidth (size_t value)
 Width of the Window, that is, the fixed length along the chromosome. More...
 
- Public Member Functions inherited from BaseWindowIterator< ForwardIterator, typename ForwardIterator::value_type >
 BaseWindowIterator (BaseWindowIterator &&)=default
 
 BaseWindowIterator (BaseWindowIterator const &)=default
 
 BaseWindowIterator (ForwardIterator begin, ForwardIterator end)
 
 ~BaseWindowIterator ()=default
 
Iterator begin ()
 
Iterator end ()
 
BaseWindowIteratoroperator= (BaseWindowIterator &&)=default
 
BaseWindowIteratoroperator= (BaseWindowIterator const &)=default
 

Public Types

using base_type = BaseWindowIterator< ForwardIterator, DataType >
 
using const_reference = value_type const &
 
using Entry = typename Window::Entry
 
using InputType = typename ForwardIterator::value_type
 
using iterator_category = std::input_iterator_tag
 
using pointer = value_type *
 
using reference = value_type &
 
using self_type = SlidingIntervalWindowIterator< ForwardIterator, DataType >
 
using value_type = Window
 
using Window = ::genesis::population::Window< DataType >
 
- Public Types inherited from BaseWindowIterator< ForwardIterator, typename ForwardIterator::value_type >
using const_reference = value_type const &
 
using Entry = typename Window::Entry
 
using InputType = typename ForwardIterator::value_type
 
using iterator_category = std::input_iterator_tag
 
using pointer = value_type *
 
using reference = value_type &
 
using self_type = BaseWindowIterator< ForwardIterator, typename ForwardIterator::value_type >
 
using value_type = Window
 
using Window = ::genesis::population::Window< typename ForwardIterator::value_type >
 

Public Attributes

friend DerivedIterator
 
- Public Attributes inherited from BaseWindowIterator< ForwardIterator, typename ForwardIterator::value_type >
std::function< std::string(InputType const &)> chromosome_function
 Functor that yields the current chromosome, given the input iterator data. More...
 
std::function< typename ForwardIterator::value_type(InputType const &)> entry_input_function
 Functor to convert from the underlying input iterator 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 iterator data. More...
 

Classes

class  DerivedIterator
 Internal iterator that produces Windows. More...
 

Protected Member Functions

std::unique_ptr< typename BaseWindowIterator< ForwardIterator, DataType >::BaseIterator > get_begin_iterator_ () override final
 
std::unique_ptr< typename BaseWindowIterator< ForwardIterator, DataType >::BaseIterator > get_end_iterator_ () override final
 

Constructor & Destructor Documentation

◆ SlidingIntervalWindowIterator() [1/3]

SlidingIntervalWindowIterator ( ForwardIterator  begin,
ForwardIterator  end 
)
inline

Definition at line 344 of file sliding_interval_window_iterator.hpp.

◆ ~SlidingIntervalWindowIterator()

◆ SlidingIntervalWindowIterator() [2/3]

SlidingIntervalWindowIterator ( SlidingIntervalWindowIterator< ForwardIterator, DataType > const &  )
default

◆ SlidingIntervalWindowIterator() [3/3]

SlidingIntervalWindowIterator ( SlidingIntervalWindowIterator< ForwardIterator, DataType > &&  )
default

Member Function Documentation

◆ emit_leading_empty_windows() [1/2]

bool emit_leading_empty_windows ( ) const
inline

Definition at line 415 of file sliding_interval_window_iterator.hpp.

◆ emit_leading_empty_windows() [2/2]

self_type& emit_leading_empty_windows ( bool  value)
inline

Select whether the iterator produces empty windows in the beginning of each chromosome, before the first actual position that is reported by the underlying data.

Say the underlying iterator has the first Variant (or whatever datatype it iterates over) at position 1020 for a chromosome, and we use a window size of 100. If this setting is set to true, the iterator will emit 10 empty windows before reaching this position. If set to false, it will skip these, and start at position 1001, which is the first one that would have been reached by striding along the chromosome.

Definition at line 409 of file sliding_interval_window_iterator.hpp.

◆ get_begin_iterator_()

std::unique_ptr<typename BaseWindowIterator<ForwardIterator, DataType>::BaseIterator> get_begin_iterator_ ( )
inlinefinaloverrideprotectedvirtual

◆ get_end_iterator_()

std::unique_ptr<typename BaseWindowIterator<ForwardIterator, DataType>::BaseIterator> get_end_iterator_ ( )
inlinefinaloverrideprotectedvirtual

◆ operator=() [1/2]

SlidingIntervalWindowIterator& operator= ( SlidingIntervalWindowIterator< ForwardIterator, DataType > &&  )
default

◆ operator=() [2/2]

SlidingIntervalWindowIterator& operator= ( SlidingIntervalWindowIterator< ForwardIterator, DataType > const &  )
default

◆ stride() [1/2]

size_t stride ( ) const
inline

Definition at line 394 of file sliding_interval_window_iterator.hpp.

◆ stride() [2/2]

self_type& stride ( size_t  value)
inline

Stride of the Window, that is, how many positions to move forward with each iteration.

The stride his is the shift towards the next interval, determining how the first and last position in each Window change. It has to be <= width. If stride is set to 0 (default), it is set automatically to the width when starting the iteration.

Definition at line 388 of file sliding_interval_window_iterator.hpp.

◆ width() [1/2]

size_t width ( ) const
inline

Definition at line 376 of file sliding_interval_window_iterator.hpp.

◆ width() [2/2]

self_type& width ( size_t  value)
inline

Width of the Window, that is, the fixed length along the chromosome.

The width has to be > 0. This is the length of the interval, determining the first and last position in each Window.

Definition at line 370 of file sliding_interval_window_iterator.hpp.

Member Typedef Documentation

◆ base_type

using base_type = BaseWindowIterator<ForwardIterator, DataType>

Definition at line 75 of file sliding_interval_window_iterator.hpp.

◆ const_reference

using const_reference = value_type const&

Definition at line 85 of file sliding_interval_window_iterator.hpp.

◆ Entry

using Entry = typename Window::Entry

Definition at line 78 of file sliding_interval_window_iterator.hpp.

◆ InputType

using InputType = typename ForwardIterator::value_type

Definition at line 79 of file sliding_interval_window_iterator.hpp.

◆ iterator_category

using iterator_category = std::input_iterator_tag

Definition at line 81 of file sliding_interval_window_iterator.hpp.

◆ pointer

using pointer = value_type*

Definition at line 83 of file sliding_interval_window_iterator.hpp.

◆ reference

Definition at line 84 of file sliding_interval_window_iterator.hpp.

◆ self_type

using self_type = SlidingIntervalWindowIterator<ForwardIterator, DataType>

Definition at line 74 of file sliding_interval_window_iterator.hpp.

◆ value_type

using value_type = Window

Definition at line 82 of file sliding_interval_window_iterator.hpp.

◆ Window

using Window = ::genesis::population::Window<DataType>

Definition at line 77 of file sliding_interval_window_iterator.hpp.

Member Data Documentation

◆ DerivedIterator

Definition at line 358 of file sliding_interval_window_iterator.hpp.


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