#include <genesis/population/window/base_window.hpp>
Inherited by Window< D, A >, WindowView< D >, and Window< D, EmptyAccumulator >.
Base class for Window and WindowView, to share common functionality.
See Window for usage and details on the functions offered here.
The class also adds a special case for when we are streaming over a whole genome. In that case, we cannot use our usual notation of first and last positions on a chromosome, as we are using the whole genome instead. As the notation is however useful in all other cases, we want to keep it. A cleaner approach from a software design perspective would be to have base classes for both cases, but that would lead to having incompatible types of WindowStream classes, which would add too much complexity for the current use case.
Definition at line 60 of file base_window.hpp.
Public Member Functions | |
BaseWindow ()=default | |
BaseWindow (BaseWindow &&)=default | |
BaseWindow (BaseWindow const &)=default | |
virtual | ~BaseWindow ()=default |
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... | |
std::unordered_map< std::string, size_t > & | chromosomes () |
Get the list of all chromosomes along the genome, with their length. More... | |
std::unordered_map< std::string, size_t > const & | chromosomes () const |
Get the list of all chromosomes along the genome, with their length. More... | |
void | clear () |
Clear all data from 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... | |
GenomeRegion | genome_region () const |
Return the genome region that this Windows is defined over. More... | |
bool | is_whole_genome () const |
Return if this instance is intended to be used for a whole genome stream. More... | |
void | is_whole_genome (bool value) |
Set whether this instance is intended to be used for a whole genome stream. More... | |
size_t | last_position () const |
Get the last position in the chromosome of the Window, that is, where the Window ends. More... | |
void | last_position (size_t value) |
Set the last position in the chromosome of the Window, that is, where the Window ends. More... | |
BaseWindow & | operator= (BaseWindow &&)=default |
BaseWindow & | operator= (BaseWindow const &)=default |
size_t | width () const |
Get the width of the Window. More... | |
Public Types | |
using | Data = D |
Protected Member Functions | |
virtual void | clear_ () |
Virtual clear function for derived classes to clear their data. More... | |
|
default |
|
virtualdefault |
|
default |
|
default |
|
inline |
Get the chromosome name that this Window belongs to.
Definition at line 90 of file base_window.hpp.
|
inline |
Set the chromosome name that this Window belongs to.
Definition at line 98 of file base_window.hpp.
|
inline |
Get the list of all chromosomes along the genome, with their length.
Definition at line 222 of file base_window.hpp.
|
inline |
Get the list of all chromosomes along the genome, with their length.
This is based on the chromsomoes and their lengths as encountered in the input data, or on the sequence dictionary if provided to the GenomeWindowStream.
Usage of this member is only valid if is_whole_genome() is set.
Definition at line 214 of file base_window.hpp.
|
inline |
Clear all data from the Window.
Definition at line 234 of file base_window.hpp.
|
inlineprotectedvirtual |
Virtual clear function for derived classes to clear their data.
Definition at line 253 of file base_window.hpp.
|
inline |
Get the first position in the chromosome of the Window, that is, where the Window starts.
The first and last position in the Window are determined for example by the sliding window width and stride, or by a genomic region that the window represents. They are hence independent of the actual data entries stored in the window, but obviously should be covering their positions. See the Window class documentation for an example.
We use 1-based coordinates and closed intervals, where both the first and the last position are inclusive.
Definition at line 114 of file base_window.hpp.
|
inline |
Set the first position in the chromosome of the Window, that is, where the Window starts.
The first and last position in the Window are determined for example by the sliding window width and stride, or by a genomic region that the window represents. They are hence independent of the actual data entries stored in the window, but obviously should be covering their positions. See the Window class documentation for an example.
We use 1-based coordinates and closed intervals, where both the first and the last position are inclusive.
Definition at line 124 of file base_window.hpp.
|
inline |
Return the genome region that this Windows is defined over.
This is a convenience function that gives the chromosome(), as well as first_position() and last_position(), combined into a GenomeRegion object, for ease of use.
Definition at line 155 of file base_window.hpp.
|
inline |
Return if this instance is intended to be used for a whole genome stream.
Definition at line 192 of file base_window.hpp.
|
inline |
Set whether this instance is intended to be used for a whole genome stream.
Definition at line 201 of file base_window.hpp.
|
inline |
Get the last position in the chromosome of the Window, that is, where the Window ends.
The first and last position in the Window are determined for example by the sliding window width and stride, or by a genomic region that the window represents. They are hence independent of the actual data entries stored in the window, but obviously should be covering their positions. See the Window class documentation for an example.
We use 1-based coordinates and closed intervals, where both the first and the last position are inclusive.
Definition at line 134 of file base_window.hpp.
|
inline |
Set the last position in the chromosome of the Window, that is, where the Window ends.
The first and last position in the Window are determined for example by the sliding window width and stride, or by a genomic region that the window represents. They are hence independent of the actual data entries stored in the window, but obviously should be covering their positions. See the Window class documentation for an example.
We use 1-based coordinates and closed intervals, where both the first and the last position are inclusive.
Definition at line 144 of file base_window.hpp.
|
default |
|
default |
|
inline |
Get the width of the Window.
This is the distance between first_position() and last_position(), i.e., the distance between the start of the Window and its end as denoted by these positions, plus one, as we are using closed intervals where both positions are included.
See Window::span() for a function that computes the distance between the positions of the first and last entry in the window instead, which might be smaller than the width, if there are no entries in the beginning or end of the window.
See the Window class documentation for an example of the difference between the two functions.
Definition at line 173 of file base_window.hpp.
using Data = D |
Definition at line 68 of file base_window.hpp.