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";
size_t size() const
Return the size of the SampleSet, i.e., the number of Samples.
void add(Tree const &tree, std::string const &name="")
Add a Tree with a name to the TreeSet.
Data class for PlacementTreeEdges. Stores the branch length of the edge, and the edge_num, as defined in the jplace standard.
void copy_pqueries(Sample const &source, Sample &target)
Copy all Pqueries from the source Sample (left parameter) to the target Sample (right parameter)...
Provides functions for working with Placements and Pqueries.
Sample merge_all(SampleSet const &sample_set)
Returns a Sample where all Samples of a SampleSet have been merged into.
TreeNode & secondary_node()
Return the TreeNode of this TreeEdge that points away from the root.
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
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...
TreeNode & primary_node()
Return the TreeNode of this TreeEdge that points towards the root.
tree::TreeSet tree_set(SampleSet const &sample_set)
Return a TreeSet containing all the trees of the SampleSet.
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.
BaseEdgeData * data_ptr()
Return a pointer to the data.
Class for representing phylogenetic trees.
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...
bool all_identical_trees(SampleSet const &sample_set)
Returns true iff all Trees of the Samples in the set are identical.
Store a set of Samples with associated names.
std::string const & name_at(size_t index) const
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...
size_t total_pquery_count(SampleSet const &sample_set)
Return the total number of Pqueries in the Samples of the SampleSet.
Data class for PlacementTreeNodes. Stores a node name.
Manage a set of Pqueries along with the PlacementTree where the PqueryPlacements are placed on...
std::shared_ptr< BaseOutputTarget > to_string(std::string &target_string)
Obtain an output target for writing to a string.
size_t index() const
Return the index of this Node.
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...
BaseNodeData * data_ptr()
Return a pointer to the data.
std::ostream & operator<<(std::ostream &out, Sample const &smp)
Print a table of all Pqueries with their Placements and Names to the stream.