|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
50 for(
size_t i = 0; i < sample_set.
size(); ++i ) {
51 if( sample_set.
name_at(i) == name ) {
52 return &sample_set[i];
60 for(
size_t i = 0; i < sample_set.
size(); ++i ) {
61 if( sample_set.
name_at(i) == name ) {
62 return &sample_set[i];
76 if( sample_set.
size() == 0 ) {
87 for (
size_t i = 0; i < res.tree().
node_count(); ++i) {
91 for (
size_t i = 0; i < res.tree().edge_count(); ++i) {
100 for (
auto& smp : sample_set) {
110 for(
auto const& sample : sample_set ) {
127 auto node_comparator = [] (
133 if( l_ptr ==
nullptr || r_ptr ==
nullptr ) {
136 return (( l_ptr->name == r_ptr->name ) && ( node_l.
index() == node_r.index() ));
139 auto edge_comparator = [] (
145 if( l_ptr ==
nullptr || r_ptr ==
nullptr ) {
148 return ( l_ptr->edge_num() == r_ptr->edge_num() ) &&
153 return equal(
tree_set( sample_set ), node_comparator, edge_comparator );
159 for(
size_t i = 0; i < sample_set.
size(); ++i ) {
160 tset.
add( sample_set[i].tree(), sample_set.
name_at(i) );
167 for(
auto& smp : sample_set ) {
186 for(
size_t i = 0; i < sample_set.
size(); ++i ) {
189 out << sample_set[i] <<
"\n";
void add(Tree const &tree, std::string const &name="")
Add a Tree with a name to the TreeSet.
Store a set of Samples with associated names.
void copy_pqueries(Sample const &source, Sample &target)
Copy all Pqueries from the source Sample (left parameter) to the target Sample (right parameter).
Manage a set of Pqueries along with the PlacementTree where the PqueryPlacements are placed on.
tree::TreeSet tree_set(SampleSet const &sample_set)
Return a TreeSet containing all the trees of the SampleSet.
Provides functions for working with Placements and Pqueries.
bool equal(Tree const &lhs, Tree const &rhs, std::function< bool(TreeNode const &, TreeNode const &) > node_comparator, std::function< bool(TreeEdge const &, TreeEdge const &) > edge_comparator)
Compare two trees for equality given binary comparator functionals for their nodes and edges.
TreeNode & secondary_node()
Return the TreeNode of this TreeEdge that points away from the root.
std::string to_string(GenomeLocus const &locus)
Data class for PlacementTreeEdges. Stores the branch length of the edge, and the edge_num,...
Class for representing phylogenetic trees.
size_t node_count(Tree const &tree)
Return the number of Nodes of a Tree. Same as Tree::node_count().
Data class for PlacementTreeNodes. Stores a node name.
Sample * find_sample(SampleSet &sample_set, std::string const &name)
Get the first Sample in a SampleSet that has a given name, or nullptr if not found.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
TreeNode & primary_node()
Return the TreeNode of this TreeEdge that points towards the root.
Sample merge_all(SampleSet const &sample_set)
Returns a Sample where all Samples of a SampleSet have been merged into.
BaseEdgeData * data_ptr()
Return a pointer to the data.
size_t size() const
Return the size of the SampleSet, i.e., the number of Samples.
std::string const & name_at(size_t index) const
tree::Tree average_branch_length_tree(SampleSet const &sample_set)
Return the Tree that has edges with the average branch length of the respective edges of the Trees in...
size_t total_pquery_count(SampleSet const &sample_set)
Return the total number of Pqueries in the Samples of the SampleSet.
size_t index() const
Return the index of this Node.
void adjust_to_average_branch_lengths(SampleSet &sample_set)
Set the branch lengths of all Samples in the sample_set to the respecitve average branch length of th...
BaseNodeData * data_ptr()
Return a pointer to the data.
void adjust_branch_lengths(Sample &sample, tree::Tree const &source)
Take the branch lengths of the source Tree and use them as the new branch lengths of the sample.
bool all_identical_trees(SampleSet const &sample_set)
Returns true iff all Trees of the Samples in the set are identical.
std::ostream & operator<<(std::ostream &out, Sample const &smp)
Print a table of all Pqueries with their Placements and Names to the stream.