A library for working with phylogenetic data.
v0.25.0
GenomeRegionList Class Reference

#include <genesis/population/genome_region.hpp>

Detailed Description

A sorted list of genome regions.

This list keeps GenomeRegions and sorts them by chromosome and interval. It (currently) does not allow overlapping/nested regions. This list can be used either as simply a set of regions to process, or, using find() and is_covered() to query whether certain positions on a chromosome are part of any of the regions stored in the list.

Definition at line 79 of file genome_region.hpp.

Public Member Functions

 GenomeRegionList ()
 
 GenomeRegionList (GenomeRegionList &&)=default
 
 GenomeRegionList (GenomeRegionList const &)=default
 
 ~GenomeRegionList ()=default
 
void add (GenomeRegion const &region)
 Add a GenomeRegion to the list. More...
 
void add (std::string const &chromosome, size_t start=0, size_t end=0)
 Add a GenomeRegion to the list, given its chromosome, and start and end positions. More...
 
const_reference at (size_t i) const
 
const_iterator begin () const
 
bool empty () const
 
const_iterator end () const
 
const_iterator find (std::string const &chromosome, size_t position) const
 Return an iterator to the GenomeRegion that covers the given position on the chromosome, or an end iterator if there is no region that covers the position. More...
 
bool is_covered (std::string const &chromosome, size_t position) const
 Return whether a given position on a chromosome is part of any of the regions stored. More...
 
GenomeRegionListoperator= (GenomeRegionList &&)=default
 
GenomeRegionListoperator= (GenomeRegionList const &)=default
 
const_reference operator[] (size_t i) const
 
size_t size () const
 

Public Types

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::vector< GenomeRegion >
 
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 = GenomeRegionList
 
using size_type = typename container::size_type
 
using value_type = GenomeRegion
 

Constructor & Destructor Documentation

◆ GenomeRegionList() [1/3]

GenomeRegionList ( )
inline

Definition at line 106 of file genome_region.hpp.

◆ ~GenomeRegionList()

~GenomeRegionList ( )
default

◆ GenomeRegionList() [2/3]

GenomeRegionList ( GenomeRegionList const &  )
default

◆ GenomeRegionList() [3/3]

Member Function Documentation

◆ add() [1/2]

void add ( GenomeRegion const &  region)

Add a GenomeRegion to the list.

This function ensures that regions are valid (start < end), and keeps the list sorted.

Definition at line 45 of file genome_region.cpp.

◆ add() [2/2]

void add ( std::string const &  chromosome,
size_t  start = 0,
size_t  end = 0 
)

Add a GenomeRegion to the list, given its chromosome, and start and end positions.

Definition at line 115 of file genome_region.cpp.

◆ at()

const_reference at ( size_t  i) const
inline

Definition at line 168 of file genome_region.hpp.

◆ begin()

const_iterator begin ( ) const
inline

Definition at line 182 of file genome_region.hpp.

◆ empty()

bool empty ( ) const
inline

Definition at line 158 of file genome_region.hpp.

◆ end()

const_iterator end ( ) const
inline

Definition at line 192 of file genome_region.hpp.

◆ find()

GenomeRegionList::const_iterator find ( std::string const &  chromosome,
size_t  position 
) const

Return an iterator to the GenomeRegion that covers the given position on the chromosome, or an end iterator if there is no region that covers the position.

Definition at line 125 of file genome_region.cpp.

◆ is_covered()

bool is_covered ( std::string const &  chromosome,
size_t  position 
) const

Return whether a given position on a chromosome is part of any of the regions stored.

Definition at line 120 of file genome_region.cpp.

◆ operator=() [1/2]

GenomeRegionList& operator= ( GenomeRegionList &&  )
default

◆ operator=() [2/2]

GenomeRegionList& operator= ( GenomeRegionList const &  )
default

◆ operator[]()

const_reference operator[] ( size_t  i) const
inline

Definition at line 163 of file genome_region.hpp.

◆ size()

size_t size ( ) const
inline

Definition at line 153 of file genome_region.hpp.

Member Typedef Documentation

◆ const_iterator

using const_iterator = typename container::const_iterator

Definition at line 95 of file genome_region.hpp.

◆ const_reference

using const_reference = value_type const&

Definition at line 92 of file genome_region.hpp.

◆ const_reverse_iterator

using const_reverse_iterator = typename container::const_reverse_iterator

Definition at line 97 of file genome_region.hpp.

◆ container

using container = std::vector<GenomeRegion>

Definition at line 88 of file genome_region.hpp.

◆ difference_type

using difference_type = typename container::difference_type

Definition at line 99 of file genome_region.hpp.

◆ iterator

using iterator = typename container::iterator

Definition at line 94 of file genome_region.hpp.

◆ reference

Definition at line 91 of file genome_region.hpp.

◆ reverse_iterator

using reverse_iterator = typename container::reverse_iterator

Definition at line 96 of file genome_region.hpp.

◆ self_type

Definition at line 87 of file genome_region.hpp.

◆ size_type

using size_type = typename container::size_type

Definition at line 100 of file genome_region.hpp.

◆ value_type

Definition at line 90 of file genome_region.hpp.


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