A library for working with phylogenetic data.
v0.25.0
Window< D, A > Class Template Reference

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

Detailed Description

template<class D, class A = EmptyAccumulator>
class genesis::population::Window< D, A >

Window over the chromosomes of a genome.

This class is a container for the Data that is produced when sliding over the chromosomes of a genome in windows. It is for example emitted by the WindowGenerator class.

The class is mostly meant to be used as a plain old data structure, where some data is filled in (e.g., via the WindowGenerator), and can then be processed to compute some values for the Window. That is, from the user side, the const access functions are mostly important, while the non-const modification functions are chiefly meant for the code that fills the Window in the first place.

Definition at line 108 of file window.hpp.

Public Member Functions

 Window ()=default
 
 Window (Window &&)=default
 
 Window (Window const &)=default
 
 ~Window ()=default
 
Accumulatoraccumulator ()
 Get the Accumulator data that can be used for speeding up certain window computations. More...
 
Accumulator const & accumulator () const
 Get the Accumulator data that can be used for speeding up certain window computations. More...
 
size_t anchor_position () const
 Get the position in the chromosome reported according to the currently set WindowAnchorType. More...
 
size_t anchor_position (WindowAnchorType anchor_type) const
 Get the position in the chromosome reported according to a specific WindowAnchorType. More...
 
WindowAnchorType anchor_type () const
 Get the WindowAnchorType that is currently set for using anchor_position(). More...
 
void anchor_type (WindowAnchorType value)
 Set the WindowAnchorType that is currently set for using anchor_position(). More...
 
reference at (size_t index)
 Return a reference to the element at specified location pos, with bounds checking. More...
 
const_reference at (size_t index) const
 Return a reference to the element at specified location pos, with bounds checking. More...
 
iterator begin ()
 Iterator to the begin of the Data Entries. More...
 
const_iterator begin () const
 Const iterator to the begin of the Data Entries. More...
 
std::string const & chromosome () const
 Get the chromosome name that this Window belongs to. More...
 
void chromosome (std::string const &value)
 Set the chromosome name that this Window belongs to. More...
 
void clear ()
 Clear all data from the Window. More...
 
bool empty () const
 Return whether the Window is empty, that is, if it does not contain any Entries. More...
 
iterator end ()
 Iterator to the end of the Data Entries. More...
 
const_iterator end () const
 Const iterator to the end of the Data Entries. More...
 
containerentries ()
 Immediate container access to the Data Entries. More...
 
container const & entries () const
 Immediate container access to the Data Entries. More...
 
size_t entry_count () const
 Get the number of D/Data Entries that are stored in the Window. More...
 
size_t first_position () const
 Get the first position in the chromosome of the Window, that is, where the Window starts. More...
 
void first_position (size_t value)
 Set the first position in the chromosome of the Window, that is, where the Window starts. More...
 
size_t last_position () const
 Get the last (past-the-end) position in the chromosome of the Window, that is, where the Window ends. More...
 
void last_position (size_t value)
 Set the last (past-the-end) position in the chromosome of the Window, that is, where the Window ends. More...
 
Windowoperator= (Window &&)=default
 
Windowoperator= (Window const &)=default
 
reference operator[] (size_t index)
 Return a reference to the element at specified location index. More...
 
const_reference operator[] (size_t index) const
 Return a reference to the element at specified location index. More...
 
double saturation () const
 Get the fraction of entries to window width. More...
 
size_t size () const
 Get the number of D/Data Entries that are stored in the Window. More...
 
size_t span () const
 Get the distance between the first and the last variant (entry) in the Window. More...
 
size_t width () const
 Get the width of the Window. More...
 

Public Types

using Accumulator = A
 
using const_iterator = typename container::const_iterator
 
using const_reference = value_type const &
 
using const_reverse_iterator = typename container::const_reverse_iterator
 
using container = std::deque< Entry >
 
using Data = D
 
using difference_type = typename container::difference_type
 
using iterator = typename container::iterator
 
using reference = value_type &
 
using reverse_iterator = typename container::reverse_iterator
 
using self_type = Window< Data, Accumulator >
 
using size_type = typename container::size_type
 
using value_type = Entry
 

Classes

struct  Entry
 Data that is stored per entry that was enqueued in a window. More...
 

Constructor & Destructor Documentation

◆ Window() [1/3]

Window ( )
default

◆ ~Window()

~Window ( )
default

◆ Window() [2/3]

Window ( Window< D, A > const &  )
default

◆ Window() [3/3]

Window ( Window< D, A > &&  )
default

Member Function Documentation

◆ accumulator() [1/2]

Accumulator& accumulator ( )
inline

Get the Accumulator data that can be used for speeding up certain window computations.

Definition at line 553 of file window.hpp.

◆ accumulator() [2/2]

Accumulator const& accumulator ( ) const
inline

Get the Accumulator data that can be used for speeding up certain window computations.

Definition at line 562 of file window.hpp.

◆ anchor_position() [1/2]

size_t anchor_position ( ) const
inline

Get the position in the chromosome reported according to the currently set WindowAnchorType.

See anchor_type( WindowAnchorType ) to change the type of position that is reported here, and see anchor_position( WindowAnchorType ) for an alternative that allows to freely pick the WindowAnchorType instead.

Definition at line 370 of file window.hpp.

◆ anchor_position() [2/2]

size_t anchor_position ( WindowAnchorType  anchor_type) const
inline

Get the position in the chromosome reported according to a specific WindowAnchorType.

Definition at line 378 of file window.hpp.

◆ anchor_type() [1/2]

WindowAnchorType anchor_type ( ) const
inline

Get the WindowAnchorType that is currently set for using anchor_position().

Definition at line 444 of file window.hpp.

◆ anchor_type() [2/2]

void anchor_type ( WindowAnchorType  value)
inline

Set the WindowAnchorType that is currently set for using anchor_position().

This function is mainly useful to set the WindowAnchorType once, and then use the variant of anchor_position() without any arguments to get the reported position.

Definition at line 455 of file window.hpp.

◆ at() [1/2]

reference at ( size_t  index)
inline

Return a reference to the element at specified location pos, with bounds checking.

Definition at line 489 of file window.hpp.

◆ at() [2/2]

const_reference at ( size_t  index) const
inline

Return a reference to the element at specified location pos, with bounds checking.

Definition at line 497 of file window.hpp.

◆ begin() [1/2]

iterator begin ( )
inline

Iterator to the begin of the Data Entries.

Definition at line 505 of file window.hpp.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Const iterator to the begin of the Data Entries.

Definition at line 513 of file window.hpp.

◆ chromosome() [1/2]

std::string const& chromosome ( ) const
inline

Get the chromosome name that this Window belongs to.

Definition at line 222 of file window.hpp.

◆ chromosome() [2/2]

void chromosome ( std::string const &  value)
inline

Set the chromosome name that this Window belongs to.

Definition at line 230 of file window.hpp.

◆ clear()

void clear ( )
inline

Clear all data from the Window.

Definition at line 574 of file window.hpp.

◆ empty()

bool empty ( ) const
inline

Return whether the Window is empty, that is, if it does not contain any Entries.

Definition at line 282 of file window.hpp.

◆ end() [1/2]

iterator end ( )
inline

Iterator to the end of the Data Entries.

Definition at line 521 of file window.hpp.

◆ end() [2/2]

const_iterator end ( ) const
inline

Const iterator to the end of the Data Entries.

Definition at line 529 of file window.hpp.

◆ entries() [1/2]

container& entries ( )
inline

Immediate container access to the Data Entries.

Definition at line 545 of file window.hpp.

◆ entries() [2/2]

container const& entries ( ) const
inline

Immediate container access to the Data Entries.

Definition at line 537 of file window.hpp.

◆ entry_count()

size_t entry_count ( ) const
inline

Get the number of D/Data Entries that are stored in the Window.

See also
size() for an alias.

Definition at line 263 of file window.hpp.

◆ first_position() [1/2]

size_t first_position ( ) const
inline

Get the first position in the chromosome of the Window, that is, where the Window starts.

We use half-open intervals; the first position is part of the Window, the last is not.

Definition at line 325 of file window.hpp.

◆ first_position() [2/2]

void first_position ( size_t  value)
inline

Set the first position in the chromosome of the Window, that is, where the Window starts.

We use half-open intervals; the first position is part of the Window, the last is not.

Definition at line 335 of file window.hpp.

◆ last_position() [1/2]

size_t last_position ( ) const
inline

Get the last (past-the-end) position in the chromosome of the Window, that is, where the Window ends.

We use half-open intervals; the first position is part of the Window, the last is not.

Definition at line 346 of file window.hpp.

◆ last_position() [2/2]

void last_position ( size_t  value)
inline

Set the last (past-the-end) position in the chromosome of the Window, that is, where the Window ends.

We use half-open intervals; the first position is part of the Window, the last is not.

Definition at line 357 of file window.hpp.

◆ operator=() [1/2]

Window& operator= ( Window< D, A > &&  )
default

◆ operator=() [2/2]

Window& operator= ( Window< D, A > const &  )
default

◆ operator[]() [1/2]

reference operator[] ( size_t  index)
inline

Return a reference to the element at specified location index.

No bounds checking is performed.

Definition at line 469 of file window.hpp.

◆ operator[]() [2/2]

const_reference operator[] ( size_t  index) const
inline

Return a reference to the element at specified location index.

No bounds checking is performed.

Definition at line 480 of file window.hpp.

◆ saturation()

double saturation ( ) const
inline

Get the fraction of entries to window width.

Definition at line 290 of file window.hpp.

◆ size()

size_t size ( ) const
inline

Get the number of D/Data Entries that are stored in the Window.

See also
entry_count() for an alias.

Definition at line 273 of file window.hpp.

◆ span()

size_t span ( ) const
inline

Get the distance between the first and the last variant (entry) in the Window.

The width() function returns a different distance depending on the WindowType used for the Window. However, sometimes it is useful to know the distance between the first and the last variant (entry) in a window, independently from whether that Window runs across intervals or variatns. This is what we here compute and call the span of the window.

Definition at line 308 of file window.hpp.

◆ width()

size_t width ( ) const
inline

Get the width of the Window.

This is the distance between first_position() and last_position(). That is, for Windows of type WindowType::kInterval, this is the distance between the start of the Window and its end. For WindowType::kVariants however, this is the distance between the positions of the first and the last variant (entry) in the Window.

See span() for a function that computes that latter distance for WindowType::kInterval windows as well.

Definition at line 246 of file window.hpp.

Member Typedef Documentation

◆ Accumulator

using Accumulator = A

Definition at line 117 of file window.hpp.

◆ const_iterator

using const_iterator = typename container::const_iterator

Definition at line 195 of file window.hpp.

◆ const_reference

using const_reference = value_type const&

Definition at line 192 of file window.hpp.

◆ const_reverse_iterator

using const_reverse_iterator = typename container::const_reverse_iterator

Definition at line 197 of file window.hpp.

◆ container

using container = std::deque<Entry>

Definition at line 188 of file window.hpp.

◆ Data

using Data = D

Definition at line 116 of file window.hpp.

◆ difference_type

using difference_type = typename container::difference_type

Definition at line 199 of file window.hpp.

◆ iterator

using iterator = typename container::iterator

Definition at line 194 of file window.hpp.

◆ reference

Definition at line 191 of file window.hpp.

◆ reverse_iterator

using reverse_iterator = typename container::reverse_iterator

Definition at line 196 of file window.hpp.

◆ self_type

Definition at line 187 of file window.hpp.

◆ size_type

using size_type = typename container::size_type

Definition at line 200 of file window.hpp.

◆ value_type

using value_type = Entry

Definition at line 190 of file window.hpp.


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