A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Pquery Class Reference

#include <genesis/placement/pquery.hpp>

Detailed Description

A pquery holds a set of PqueryPlacements and a set of PqueryNames.

According to the jplace standard, a pquery is a container object that represents the possible phylogenetic placement positions of a sequence (or set of sequences). Each such position is stored as a PqueryPlacement and can be accessed via the functions of this class.

Furthermore, it might be useful to combine the placement positions of several sequences into one object. This is for example the case if there are replicate sequences. Thus, a Pquery supports to store multiple PqueryNames, each of them containing an identifying name string and a so called multiplicity, which can be used as e.g., an abundance count for the associated name, and is used as a factor for the weights of the placements in some calculations.

Definition at line 82 of file pquery.hpp.

Public Member Functions

 Pquery ()=default
 
 Pquery (Pquery const &)=default
 
 Pquery (Pquery &&)=default
 
 ~Pquery ()=default
 
PqueryNameadd_name (std::string name="", double multiplicity=1.0)
 Create a new PqueryName using the provided parameters, add it to the Pquery and return it. More...
 
PqueryNameadd_name (PqueryName const &other)
 Create a new PqueryName as a copy of the provided one, add it to the Pquery and return it. More...
 
PqueryPlacementadd_placement (PlacementTreeEdge &edge)
 Create a new PqueryPlacement at a given PlacementTreeEdge, add it to the Pquery and return it. More...
 
PqueryPlacementadd_placement (PqueryPlacement const &val)
 Create a new PqueryPlacement as a copy of the provided one, add it to the Pquery and return it. More...
 
PqueryPlacementadd_placement (PlacementTreeEdge &edge, PqueryPlacement const &val)
 Create a new PqueryPlacement at a given PlacementTreeEdge, add it to the Pquery and return it. The property values of the provided PqueryPlacement are copied. More...
 
iterator_names begin_names ()
 
const_iterator_names begin_names () const
 
iterator_placements begin_placements ()
 
const_iterator_placements begin_placements () const
 
void clear ()
 Clear all data stored in this Pquery, i.e., clear all PqueryNames and all PqueryPlacements. More...
 
void clear_names ()
 Delete all PqueryNames of this Pquery. More...
 
void clear_placements ()
 Delete all PqueryPlacements of this Pquery. More...
 
iterator_names end_names ()
 
const_iterator_names end_names () const
 
iterator_placements end_placements ()
 
const_iterator_placements end_placements () const
 
std::vector< PqueryName > & expose_names ()
 
std::vector< PqueryPlacement > & expose_placements ()
 
PqueryNamename_at (size_t index)
 Return the PqueryName at a certain index. More...
 
PqueryName const & name_at (size_t index) const
 Return the PqueryName at a certain index. More...
 
size_t name_size () const
 Return the number of PqueryNames stored in this Pquery. More...
 
utils::Range< iterator_namesnames ()
 Return a Range iterator to the PqueryNames. More...
 
utils::Range
< const_iterator_names
names () const
 Return a const Range iterator to the PqueryNames. More...
 
Pqueryoperator= (Pquery const &)=default
 
Pqueryoperator= (Pquery &&)=default
 
PqueryPlacementplacement_at (size_t index)
 Return the PqueryPlacement at a certain index. More...
 
PqueryPlacement const & placement_at (size_t index) const
 Return the PqueryPlacement at a certain index. More...
 
size_t placement_size () const
 Return the number of PqueryPlacements stored in this Pquery. More...
 
utils::Range< iterator_placementsplacements ()
 Return a Range iterator to the PqueryPlacements. More...
 
utils::Range
< const_iterator_placements
placements () const
 Return a const Range iterator to the PqueryPlacements. More...
 
void remove_name_at (size_t index)
 Remove the PqueryName at a certain index position within this Pquery. More...
 
void remove_placement_at (size_t index)
 Remove the PqueryPlacement at a certain index position within this Pquery. More...
 

Public Types

typedef std::vector
< PqueryName >::const_iterator 
const_iterator_names
 
typedef std::vector
< PqueryPlacement >
::const_iterator 
const_iterator_placements
 
typedef std::vector
< PqueryName >::iterator 
iterator_names
 
typedef std::vector
< PqueryPlacement >::iterator 
iterator_placements
 
typedef std::vector< PqueryNamePqueryNames
 
typedef std::vector
< PqueryPlacement
PqueryPlacements
 

Constructor & Destructor Documentation

Pquery ( )
default
~Pquery ( )
default
Pquery ( Pquery const &  )
default
Pquery ( Pquery &&  )
default

Member Function Documentation

PqueryName & add_name ( std::string  name = "",
double  multiplicity = 1.0 
)

Create a new PqueryName using the provided parameters, add it to the Pquery and return it.

As this function might reallocate the memory where names are stored, all iterators and pointer to PqueryNamess are considered to be invalidated.

Definition at line 181 of file pquery.cpp.

PqueryName & add_name ( PqueryName const &  other)

Create a new PqueryName as a copy of the provided one, add it to the Pquery and return it.

As this function might reallocate the memory where names are stored, all iterators and pointer to PqueryNamess are considered to be invalidated.

Definition at line 187 of file pquery.cpp.

PqueryPlacement & add_placement ( PlacementTreeEdge edge)

Create a new PqueryPlacement at a given PlacementTreeEdge, add it to the Pquery and return it.

The values of the placement can then be adjusted using the returned object reference.

It is important that the provided edge belongs to the same PlacementTree as the Pquery and its containing Sample do. This is up to the user and not checked.

As this function might reallocate the memory where placements are stored, all iterators and pointer to PqueryPlacements are invalidated.

Definition at line 92 of file pquery.cpp.

PqueryPlacement & add_placement ( PqueryPlacement const &  val)

Create a new PqueryPlacement as a copy of the provided one, add it to the Pquery and return it.

As this function might reallocate the memory where placements are stored, all iterators and pointer to PqueryPlacements are considered to be invalidated.

Definition at line 98 of file pquery.cpp.

PqueryPlacement & add_placement ( PlacementTreeEdge edge,
PqueryPlacement const &  val 
)

Create a new PqueryPlacement at a given PlacementTreeEdge, add it to the Pquery and return it. The property values of the provided PqueryPlacement are copied.

It is important that the provided edge belongs to the same PlacementTree as the Pquery and its containing Sample do. This is up to the user and not checked.

As this function might reallocate the memory where placements are stored, all iterators and pointer to PqueryPlacements are considered to be invalidated.

Definition at line 104 of file pquery.cpp.

Pquery::iterator_names begin_names ( )

Definition at line 142 of file pquery.cpp.

Pquery::const_iterator_names begin_names ( ) const

Definition at line 152 of file pquery.cpp.

Pquery::iterator_placements begin_placements ( )

Definition at line 53 of file pquery.cpp.

Pquery::const_iterator_placements begin_placements ( ) const

Definition at line 63 of file pquery.cpp.

void clear ( )

Clear all data stored in this Pquery, i.e., clear all PqueryNames and all PqueryPlacements.

Definition at line 43 of file pquery.cpp.

void clear_names ( )

Delete all PqueryNames of this Pquery.

Definition at line 213 of file pquery.cpp.

void clear_placements ( )

Delete all PqueryPlacements of this Pquery.

Definition at line 133 of file pquery.cpp.

Pquery::iterator_names end_names ( )

Definition at line 147 of file pquery.cpp.

Pquery::const_iterator_names end_names ( ) const

Definition at line 157 of file pquery.cpp.

Pquery::iterator_placements end_placements ( )

Definition at line 58 of file pquery.cpp.

Pquery::const_iterator_placements end_placements ( ) const

Definition at line 68 of file pquery.cpp.

std::vector< PqueryName > & expose_names ( )

Definition at line 172 of file pquery.cpp.

std::vector< PqueryPlacement > & expose_placements ( )

Definition at line 83 of file pquery.cpp.

PqueryName & name_at ( size_t  index)

Return the PqueryName at a certain index.

The index must be smaller than name_size(), otherwise this functions throws an exception.

Definition at line 198 of file pquery.cpp.

PqueryName const & name_at ( size_t  index) const

Return the PqueryName at a certain index.

The index must be smaller than name_size(), otherwise this functions throws an exception.

Definition at line 203 of file pquery.cpp.

size_t name_size ( ) const

Return the number of PqueryNames stored in this Pquery.

Definition at line 193 of file pquery.cpp.

Return a Range iterator to the PqueryNames.

This makes iterating placements via a range based for loop easy.

Definition at line 162 of file pquery.cpp.

Return a const Range iterator to the PqueryNames.

This makes iterating placements via a range based for loop easy.

Definition at line 167 of file pquery.cpp.

Pquery& operator= ( Pquery const &  )
default
Pquery& operator= ( Pquery &&  )
default
PqueryPlacement & placement_at ( size_t  index)

Return the PqueryPlacement at a certain index.

The index must be smaller than placement_size(), otherwise this functions throws an exception.

Definition at line 118 of file pquery.cpp.

PqueryPlacement const & placement_at ( size_t  index) const

Return the PqueryPlacement at a certain index.

The index must be smaller than placement_size(), otherwise this functions throws an exception.

Definition at line 123 of file pquery.cpp.

size_t placement_size ( ) const

Return the number of PqueryPlacements stored in this Pquery.

Definition at line 113 of file pquery.cpp.

Return a Range iterator to the PqueryPlacements.

This makes iterating placements via a range based for loop easy.

Definition at line 73 of file pquery.cpp.

Return a const Range iterator to the PqueryPlacements.

This makes iterating placements via a range based for loop easy.

Definition at line 78 of file pquery.cpp.

void remove_name_at ( size_t  index)

Remove the PqueryName at a certain index position within this Pquery.

As this function moves names in the container, all iterators and pointer to PqueryNamess are considered to be invalidated.

Definition at line 208 of file pquery.cpp.

void remove_placement_at ( size_t  index)

Remove the PqueryPlacement at a certain index position within this Pquery.

As this function moves placements in the container, all iterators and pointer to PqueryPlacements are considered to be invalidated.

Definition at line 128 of file pquery.cpp.

Member Typedef Documentation

typedef std::vector<PqueryName>::const_iterator const_iterator_names

Definition at line 97 of file pquery.hpp.

typedef std::vector<PqueryPlacement>::const_iterator const_iterator_placements

Definition at line 94 of file pquery.hpp.

typedef std::vector<PqueryName>::iterator iterator_names

Definition at line 96 of file pquery.hpp.

typedef std::vector<PqueryPlacement>::iterator iterator_placements

Definition at line 93 of file pquery.hpp.

typedef std::vector<PqueryName> PqueryNames

Definition at line 91 of file pquery.hpp.

typedef std::vector<PqueryPlacement> PqueryPlacements

Definition at line 90 of file pquery.hpp.


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