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

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

Detailed Description

template<class ForwardIterator, class InputType, class DataType = InputType>
class genesis::population::RegionWindowIterator< ForwardIterator, InputType, DataType >

Iterator for Windows representing regions of a genome.

This class allows to iterate a set of regions, each in a window.

The template parameters are:

  • ForwardIterator: The underlying data iterator.
  • InputType: The input data type that the basis iterator provided (that is, the input iterator from which the region window takes its data),
  • DataType: The data type of the Window::Data that is stored in Window::Entry. The functor entry_input_function needs to be provided to convert from InputType to this DataType.

The three functors

  • entry_input_function,
  • chromosome_function, and
  • position_function

have to be set prior to the iteration. All other settings are option and/or defaulted to reasonable values.

The class streams through both the input data and the region list in a single pass. This makes it algorithmically complex, but is a good compromise between the memory footprint needed for storing data of multiple windows at the same time and processing speed for only having to read the input once.

Definition at line 84 of file region_window_iterator.hpp.

Public Member Functions

 RegionWindowIterator (ForwardIterator begin, ForwardIterator end)
 
 RegionWindowIterator (RegionWindowIterator &&)=default
 
 RegionWindowIterator (RegionWindowIterator const &)=default
 
 ~RegionWindowIterator ()=default
 
RegionWindowIteratoroperator= (RegionWindowIterator &&)=default
 
RegionWindowIteratoroperator= (RegionWindowIterator const &)=default
 

Public Types

using const_reference = value_type const &
 
using Entry = typename Window::Entry
 
using iterator_category = std::input_iterator_tag
 
using reference = value_type &
 
using self_type = RegionWindowIterator< ForwardIterator, InputType, DataType >
 
using settings_type = RegionWindowIteratorSettings< InputType, DataType >
 
using value_type = Window
 
using Window = ::genesis::population::Window< DataType >
 

Public Attributes

std::function< std::string(InputType const &)> chromosome_function
 Functor that yields the current chromosome, given the input iterator data. More...
 
std::function< DataType(InputType const &)> entry_input_function
 Functor to convert from the underlying input iterator that provides the data for the region window to the data that is stored per window. More...
 
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  Iterator
 Internal iterator over the data. More...
 

Constructor & Destructor Documentation

◆ RegionWindowIterator() [1/3]

RegionWindowIterator ( ForwardIterator  begin,
ForwardIterator  end 
)
inline

Definition at line 409 of file region_window_iterator.hpp.

◆ ~RegionWindowIterator()

~RegionWindowIterator ( )
default

◆ RegionWindowIterator() [2/3]

RegionWindowIterator ( RegionWindowIterator< ForwardIterator, InputType, DataType > const &  )
default

◆ RegionWindowIterator() [3/3]

RegionWindowIterator ( RegionWindowIterator< ForwardIterator, InputType, DataType > &&  )
default

Member Function Documentation

◆ operator=() [1/2]

RegionWindowIterator& operator= ( RegionWindowIterator< ForwardIterator, InputType, DataType > &&  )
default

◆ operator=() [2/2]

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

Member Typedef Documentation

◆ const_reference

using const_reference = value_type const&

Definition at line 102 of file region_window_iterator.hpp.

◆ Entry

using Entry = typename Window::Entry

Definition at line 96 of file region_window_iterator.hpp.

◆ iterator_category

using iterator_category = std::input_iterator_tag

Definition at line 106 of file region_window_iterator.hpp.

◆ reference

Definition at line 101 of file region_window_iterator.hpp.

◆ self_type

using self_type = RegionWindowIterator<ForwardIterator, InputType, DataType>

Definition at line 99 of file region_window_iterator.hpp.

◆ settings_type

using settings_type = RegionWindowIteratorSettings<InputType, DataType>

Definition at line 98 of file region_window_iterator.hpp.

◆ value_type

using value_type = Window

Definition at line 100 of file region_window_iterator.hpp.

◆ Window

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

Definition at line 95 of file region_window_iterator.hpp.

Member Data Documentation

◆ chromosome_function

std::function<std::string( InputType const& )> chromosome_function

Functor that yields the current chromosome, given the input iterator data.

Definition at line 439 of file region_window_iterator.hpp.

◆ entry_input_function

std::function<DataType( InputType const& )> entry_input_function

Functor to convert from the underlying input iterator that provides the data for the region window to the data that is stored per window.

Definition at line 434 of file region_window_iterator.hpp.

◆ position_function

std::function<size_t( InputType const& )> position_function

Functor that yields the current position on the chromosome, given the input iterator data.

Definition at line 445 of file region_window_iterator.hpp.


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