A library for working with phylogenetic data. v0.25.0
SlidingWindowIteratorSettings< InputType, DataType > Struct Template Reference

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

## Detailed Description

### template<class InputType, class DataType = InputType> struct genesis::population::SlidingWindowIteratorSettings< InputType, DataType >

Settings for running a sliding window iteration.

The SlidingWindowIterator takes a lot of settings, and providing all of them in its constructor is cumbersome and error prone, so instead we offer this convenient settings class to all prepare them beforehand. This allows to set all values by their name, instead of just by their position in the constructor.

The template parameters are:

• InputType: The input data type that the basis iterator provided (that is, the input iterator from which the sliding 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 width, as well as the three functors have to be set in this settings class prior to using it to initialize a SlidingWindowIterator.

Definition at line 70 of file sliding_window_iterator.hpp.

## Public Attributes

WindowAnchorType anchor_type = WindowAnchorType::kIntervalBegin
The type of position that the Window outputs when using its Window::anchor_position() function. See there for details. More...

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 sliding 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...

size_t stride = 0
Stride of the Window, that is, how many positions or entries (depending on WindowType) to move forward with each iteration step. More...

size_t width = 0
Width of the Window, either in fixed length along the chromosome, or in number of variants/entries per Window, depending on the setting for WindowType. More...

WindowType window_type = WindowType::kInterval
Type of the Window, that is, whether to iterate over intervals of fixed length, or over a certain number of variants/entries per Window. More...

## ◆ anchor_type

 WindowAnchorType anchor_type = WindowAnchorType::kIntervalBegin

The type of position that the Window outputs when using its Window::anchor_position() function. See there for details.

Definition at line 82 of file sliding_window_iterator.hpp.

## ◆ chromosome_function

 std::function chromosome_function

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

Definition at line 131 of file sliding_window_iterator.hpp.

Definition at line 112 of file sliding_window_iterator.hpp.

## ◆ entry_input_function

 std::function entry_input_function

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

Definition at line 126 of file sliding_window_iterator.hpp.

## ◆ position_function

 std::function position_function

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

Definition at line 137 of file sliding_window_iterator.hpp.

## ◆ stride

 size_t stride = 0

Stride of the Window, that is, how many positions or entries (depending on WindowType) to move forward with each iteration step.

The stride has to be <= width. If stride is set to 0 (default here), it is set automatically to the width when constructing a SlidingWindowIterator with this settings object, which means, we create windows that do not overlap.

With WindowType::kInterval, this is the shift towards the next interval, determining how the first and last position in each Window change. With WindowType::kVariants instead, this is the number of variants (SNPs or VCF records/lines) per Window that we dequeue and enqueue.

Definition at line 107 of file sliding_window_iterator.hpp.

## ◆ width

 size_t width = 0

Width of the Window, either in fixed length along the chromosome, or in number of variants/entries per Window, depending on the setting for WindowType.

The width has to be > 0. With WindowType::kInterval, this is the length of the interval, determining the first and last position in each Window. With WindowType::kVariants instead, this is the number of variants (SNPs or VCF records/lines) per Window.

Definition at line 92 of file sliding_window_iterator.hpp.

## ◆ window_type

 WindowType window_type = WindowType::kInterval

Type of the Window, that is, whether to iterate over intervals of fixed length, or over a certain number of variants/entries per Window.

Definition at line 76 of file sliding_window_iterator.hpp.

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