A toolkit for working with phylogenetic data.
v0.24.0
Dataframe Class Reference

#include <genesis/utils/containers/dataframe.hpp>

Detailed Description

Definition at line 59 of file containers/dataframe.hpp.

Public Member Functions

 Dataframe ()=default
 
 Dataframe (Dataframe const &other)
 
 Dataframe (Dataframe &&)=default
 
 ~Dataframe ()=default
 
template<class T >
Column< T > & add_col (std::string const &name)
 
template<class T >
Column< T > & add_col (std::string const &name, T const &init)
 
template<class T >
Column< T > & add_col (std::string const &name, std::vector< T > const &init)
 
template<class T >
Column< T > & add_col (std::string const &name, std::vector< T > &&init)
 
self_typeadd_row (std::string const &name)
 
template<class T >
Column< T > & add_unnamed_col ()
 
template<class T >
Column< T > & add_unnamed_col (T const &init)
 
template<class T >
Column< T > & add_unnamed_col (std::vector< T > const &init)
 
template<class T >
Column< T > & add_unnamed_col (std::vector< T > &&init)
 
self_typeadd_unnamed_row ()
 
reference at (size_type col_index)
 
const_reference at (size_type col_index) const
 
reference at (std::string const &col_name)
 
const_reference at (std::string const &col_name) const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin ()
 
const_iterator cend ()
 
self_typeclear ()
 
self_typeclear_cols ()
 
self_typeclear_rows ()
 
size_t col_index (std::string const &col_name) const
 
std::string const & col_name (size_type col_index) const
 
self_typecol_name (size_type col_index, std::string const &value)
 
std::vector< std::string > const & col_names () const
 
size_type cols () const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
bool has_col_name (std::string const &col_name) const
 
bool has_row_name (std::string const &row_name) const
 
bool has_unnamed_cols () const
 
bool has_unnamed_rows () const
 
Dataframeoperator= (Dataframe const &other)
 
Dataframeoperator= (Dataframe &&)=default
 
reference operator[] (size_type col_index)
 
const_reference operator[] (size_type col_index) const
 
reference operator[] (std::string const &col_name)
 
const_reference operator[] (std::string const &col_name) const
 
self_typeremove_col (size_type col_index)
 
self_typeremove_col (std::string const &col_name)
 
self_typeremove_row (size_type row_index)
 
self_typeremove_row (std::string const &row_name)
 
template<class T >
Column< T > & replace_col (size_type at_index)
 
template<class T >
Column< T > & replace_col (size_type at_index, T const &init)
 
template<class T >
Column< T > & replace_col (size_type at_index, std::vector< T > const &init)
 
template<class T >
Column< T > & replace_col (size_type at_index, std::vector< T > &&init)
 
template<class T >
Column< T > & replace_col (std::string const &at_name)
 
template<class T >
Column< T > & replace_col (std::string const &at_name, T const &init)
 
template<class T >
Column< T > & replace_col (std::string const &at_name, std::vector< T > const &init)
 
template<class T >
Column< T > & replace_col (std::string const &at_name, std::vector< T > &&init)
 
size_t row_index (std::string const &row_name) const
 
std::string const & row_name (size_type row_index) const
 
self_typerow_name (size_type row_index, std::string const &value)
 
std::vector< std::string > const & row_names () const
 
size_type rows () const
 

Public Types

using const_iterator = utils::DereferenceIterator< container_type::const_iterator >
 
using const_pointer = value_type const *
 
using const_reference = value_type const &
 
using container_type = std::vector< std::unique_ptr< value_type > >
 
using iterator = utils::DereferenceIterator< container_type::iterator >
 
using pointer = value_type *
 
using reference = value_type &
 
using self_type = Dataframe
 
using size_type = size_t
 
using value_type = ColumnBase
 

Classes

class  Column
 
class  ColumnBase
 

Friends

void swap (self_type &lhs, self_type &rhs)
 
bool validate (Dataframe const &)
 Helper function to validate internal invariants. More...
 

Constructor & Destructor Documentation

◆ Dataframe() [1/3]

Dataframe ( )
default

◆ ~Dataframe()

~Dataframe ( )
default

◆ Dataframe() [2/3]

Dataframe ( Dataframe const &  other)
inline

Definition at line 514 of file containers/dataframe.hpp.

◆ Dataframe() [3/3]

Dataframe ( Dataframe &&  )
default

Member Function Documentation

◆ add_col() [1/4]

Column<T>& add_col ( std::string const &  name)
inline

Definition at line 809 of file containers/dataframe.hpp.

◆ add_col() [2/4]

Column<T>& add_col ( std::string const &  name,
T const &  init 
)
inline

Definition at line 831 of file containers/dataframe.hpp.

◆ add_col() [3/4]

Column<T>& add_col ( std::string const &  name,
std::vector< T > const &  init 
)
inline

Definition at line 841 of file containers/dataframe.hpp.

◆ add_col() [4/4]

Column<T>& add_col ( std::string const &  name,
std::vector< T > &&  init 
)
inline

Definition at line 848 of file containers/dataframe.hpp.

◆ add_row()

self_type& add_row ( std::string const &  name)
inline

Definition at line 878 of file containers/dataframe.hpp.

◆ add_unnamed_col() [1/4]

Column<T>& add_unnamed_col ( )
inline

Definition at line 763 of file containers/dataframe.hpp.

◆ add_unnamed_col() [2/4]

Column<T>& add_unnamed_col ( T const &  init)
inline

Definition at line 774 of file containers/dataframe.hpp.

◆ add_unnamed_col() [3/4]

Column<T>& add_unnamed_col ( std::vector< T > const &  init)
inline

Definition at line 784 of file containers/dataframe.hpp.

◆ add_unnamed_col() [4/4]

Column<T>& add_unnamed_col ( std::vector< T > &&  init)
inline

Definition at line 791 of file containers/dataframe.hpp.

◆ add_unnamed_row()

self_type& add_unnamed_row ( )
inline

Definition at line 866 of file containers/dataframe.hpp.

◆ at() [1/4]

reference at ( size_type  col_index)
inline

Definition at line 652 of file containers/dataframe.hpp.

◆ at() [2/4]

const_reference at ( size_type  col_index) const
inline

Definition at line 657 of file containers/dataframe.hpp.

◆ at() [3/4]

reference at ( std::string const &  col_name)
inline

Definition at line 662 of file containers/dataframe.hpp.

◆ at() [4/4]

const_reference at ( std::string const &  col_name) const
inline

Definition at line 667 of file containers/dataframe.hpp.

◆ begin() [1/2]

iterator begin ( )
inline

Definition at line 578 of file containers/dataframe.hpp.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Definition at line 583 of file containers/dataframe.hpp.

◆ cbegin()

const_iterator cbegin ( )
inline

Definition at line 598 of file containers/dataframe.hpp.

◆ cend()

const_iterator cend ( )
inline

Definition at line 603 of file containers/dataframe.hpp.

◆ clear()

self_type& clear ( )
inline

Definition at line 1012 of file containers/dataframe.hpp.

◆ clear_cols()

self_type& clear_cols ( )
inline

Definition at line 1032 of file containers/dataframe.hpp.

◆ clear_rows()

self_type& clear_rows ( )
inline

Definition at line 1022 of file containers/dataframe.hpp.

◆ col_index()

size_t col_index ( std::string const &  col_name) const
inline

Definition at line 730 of file containers/dataframe.hpp.

◆ col_name() [1/2]

std::string const& col_name ( size_type  col_index) const
inline

Definition at line 738 of file containers/dataframe.hpp.

◆ col_name() [2/2]

self_type& col_name ( size_type  col_index,
std::string const &  value 
)
inline

Definition at line 743 of file containers/dataframe.hpp.

◆ col_names()

std::vector<std::string> const& col_names ( ) const
inline

Definition at line 753 of file containers/dataframe.hpp.

◆ cols()

size_type cols ( ) const
inline

Definition at line 617 of file containers/dataframe.hpp.

◆ empty()

bool empty ( ) const
inline

Definition at line 623 of file containers/dataframe.hpp.

◆ end() [1/2]

iterator end ( )
inline

Definition at line 588 of file containers/dataframe.hpp.

◆ end() [2/2]

const_iterator end ( ) const
inline

Definition at line 593 of file containers/dataframe.hpp.

◆ has_col_name()

bool has_col_name ( std::string const &  col_name) const
inline

Definition at line 717 of file containers/dataframe.hpp.

◆ has_row_name()

bool has_row_name ( std::string const &  row_name) const
inline

Definition at line 676 of file containers/dataframe.hpp.

◆ has_unnamed_cols()

bool has_unnamed_cols ( ) const
inline

Definition at line 725 of file containers/dataframe.hpp.

◆ has_unnamed_rows()

bool has_unnamed_rows ( ) const
inline

Definition at line 684 of file containers/dataframe.hpp.

◆ operator=() [1/2]

Dataframe& operator= ( Dataframe const &  other)
inline

Definition at line 531 of file containers/dataframe.hpp.

◆ operator=() [2/2]

Dataframe& operator= ( Dataframe &&  )
default

◆ operator[]() [1/4]

reference operator[] ( size_type  col_index)
inline

Definition at line 632 of file containers/dataframe.hpp.

◆ operator[]() [2/4]

const_reference operator[] ( size_type  col_index) const
inline

Definition at line 637 of file containers/dataframe.hpp.

◆ operator[]() [3/4]

reference operator[] ( std::string const &  col_name)
inline

Definition at line 642 of file containers/dataframe.hpp.

◆ operator[]() [4/4]

const_reference operator[] ( std::string const &  col_name) const
inline

Definition at line 647 of file containers/dataframe.hpp.

◆ remove_col() [1/2]

self_type& remove_col ( size_type  col_index)
inline

Definition at line 1040 of file containers/dataframe.hpp.

◆ remove_col() [2/2]

self_type& remove_col ( std::string const &  col_name)
inline

Definition at line 1072 of file containers/dataframe.hpp.

◆ remove_row() [1/2]

self_type& remove_row ( size_type  row_index)
inline

Definition at line 1080 of file containers/dataframe.hpp.

◆ remove_row() [2/2]

self_type& remove_row ( std::string const &  row_name)
inline

Definition at line 1107 of file containers/dataframe.hpp.

◆ replace_col() [1/8]

Column<T>& replace_col ( size_type  at_index)
inline

Definition at line 907 of file containers/dataframe.hpp.

◆ replace_col() [2/8]

Column<T>& replace_col ( size_type  at_index,
T const &  init 
)
inline

Definition at line 922 of file containers/dataframe.hpp.

◆ replace_col() [3/8]

Column<T>& replace_col ( size_type  at_index,
std::vector< T > const &  init 
)
inline

Definition at line 932 of file containers/dataframe.hpp.

◆ replace_col() [4/8]

Column<T>& replace_col ( size_type  at_index,
std::vector< T > &&  init 
)
inline

Definition at line 939 of file containers/dataframe.hpp.

◆ replace_col() [5/8]

Column<T>& replace_col ( std::string const &  at_name)
inline

Definition at line 957 of file containers/dataframe.hpp.

◆ replace_col() [6/8]

Column<T>& replace_col ( std::string const &  at_name,
T const &  init 
)
inline

Definition at line 974 of file containers/dataframe.hpp.

◆ replace_col() [7/8]

Column<T>& replace_col ( std::string const &  at_name,
std::vector< T > const &  init 
)
inline

Definition at line 984 of file containers/dataframe.hpp.

◆ replace_col() [8/8]

Column<T>& replace_col ( std::string const &  at_name,
std::vector< T > &&  init 
)
inline

Definition at line 991 of file containers/dataframe.hpp.

◆ row_index()

size_t row_index ( std::string const &  row_name) const
inline

Definition at line 689 of file containers/dataframe.hpp.

◆ row_name() [1/2]

std::string const& row_name ( size_type  row_index) const
inline

Definition at line 697 of file containers/dataframe.hpp.

◆ row_name() [2/2]

self_type& row_name ( size_type  row_index,
std::string const &  value 
)
inline

Definition at line 702 of file containers/dataframe.hpp.

◆ row_names()

std::vector<std::string> const& row_names ( ) const
inline

Definition at line 712 of file containers/dataframe.hpp.

◆ rows()

size_type rows ( ) const
inline

Definition at line 612 of file containers/dataframe.hpp.

Friends And Related Function Documentation

◆ swap

void swap ( self_type lhs,
self_type rhs 
)
friend

Definition at line 549 of file containers/dataframe.hpp.

◆ validate

bool validate ( Dataframe const &  )
friend

Helper function to validate internal invariants.

Located in genesis/utils/containers/dataframe/operators.hpp

The appendix needs to contain at least all the rows (by name) of the target. This necessiates that all rows in target need to be named (no empty names). Also, the column names need to be distinct.

Definition at line 404 of file utils/containers/dataframe/operators.cpp.

Member Typedef Documentation

◆ const_iterator

using const_iterator = utils::DereferenceIterator< container_type::const_iterator >

Definition at line 503 of file containers/dataframe.hpp.

◆ const_pointer

using const_pointer = value_type const*

Definition at line 500 of file containers/dataframe.hpp.

◆ const_reference

using const_reference = value_type const&

Definition at line 498 of file containers/dataframe.hpp.

◆ container_type

using container_type = std::vector< std::unique_ptr< value_type > >

Definition at line 495 of file containers/dataframe.hpp.

◆ iterator

using iterator = utils::DereferenceIterator< container_type::iterator >

Definition at line 502 of file containers/dataframe.hpp.

◆ pointer

using pointer = value_type*

Definition at line 499 of file containers/dataframe.hpp.

◆ reference

Definition at line 497 of file containers/dataframe.hpp.

◆ self_type

Definition at line 493 of file containers/dataframe.hpp.

◆ size_type

using size_type = size_t

Definition at line 505 of file containers/dataframe.hpp.

◆ value_type

Definition at line 494 of file containers/dataframe.hpp.


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