|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_POPULATION_WINDOW_BASE_WINDOW_H_
2 #define GENESIS_POPULATION_WINDOW_BASE_WINDOW_H_
36 #include <unordered_map>
41 namespace population {
116 return first_position_;
126 first_position_ = value;
136 return last_position_;
146 last_position_ = value;
157 return { chromosome_, first_position_, last_position_ };
176 if( first_position_ > last_position_ ) {
177 throw std::runtime_error(
178 "Invalidly set first and last position in the Window, with " +
182 return last_position_ - first_position_ + 1;
194 return is_whole_genome_;
203 is_whole_genome_ = value;
214 std::unordered_map<std::string, size_t>
const&
chromosomes()
const
239 is_whole_genome_ =
false;
240 chromosomes_.clear();
265 std::string chromosome_;
266 size_t first_position_ = 0;
267 size_t last_position_ = 0;
270 bool is_whole_genome_ =
false;
271 std::unordered_map<std::string, size_t> chromosomes_;
278 #endif // include guard
virtual ~BaseWindow()=default
void is_whole_genome(bool value)
Set whether this instance is intended to be used for a whole genome stream.
void chromosome(std::string const &value)
Set the chromosome name that this Window belongs to.
std::unordered_map< std::string, size_t > const & chromosomes() const
Get the list of all chromosomes along the genome, with their length.
std::string to_string(GenomeLocus const &locus)
void first_position(size_t value)
Set the first position in the chromosome of the Window, that is, where the Window starts.
size_t width() const
Get the width of the Window.
std::string const & chromosome() const
Get the chromosome name that this Window belongs to.
bool is_whole_genome() const
Return if this instance is intended to be used for a whole genome stream.
std::unordered_map< std::string, size_t > & chromosomes()
Get the list of all chromosomes along the genome, with their length.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
void last_position(size_t value)
Set the last position in the chromosome of the Window, that is, where the Window ends.
void clear()
Clear all data from the Window.
BaseWindow & operator=(BaseWindow const &)=default
virtual void clear_()
Virtual clear function for derived classes to clear their data.
A region (between two positions) on a chromosome.
GenomeRegion genome_region() const
Return the genome region that this Windows is defined over.
size_t first_position() const
Get the first position in the chromosome of the Window, that is, where the Window starts.
size_t last_position() const
Get the last position in the chromosome of the Window, that is, where the Window ends.
Base class for Window and WindowView, to share common functionality.