|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_PLACEMENT_FUNCTION_FUNCTIONS_H_
2 #define GENESIS_PLACEMENT_FUNCTION_FUNCTIONS_H_
39 #include <unordered_map>
40 #include <unordered_set>
54 bool has_name( Pquery
const& pquery, std::string
const& name );
60 bool has_name( Sample
const& smp, std::string
const& name );
65 Pquery
const*
find_pquery( Sample
const& smp, std::string
const& name );
70 Pquery*
find_pquery( Sample& smp, std::string
const& name );
238 std::string
const& regex,
250 std::unordered_set<std::string>
const& keep_list,
262 std::string
const& regex,
274 std::unordered_set<std::string>
const& remove_list,
476 Sample
const& smp,
const double min,
const double max,
const int bins = 10
510 Sample
const& smp,
double& min,
double& max,
const int bins = 10
516 #endif // include guard
void filter_pqueries_keeping_names(Sample &smp, std::string const ®ex, bool remove_empty_pqueries)
Remove all PqueryNames which do not match the given regex.
void copy_pqueries(Sample const &source, Sample &target)
Copy all Pqueries from the source Sample (left parameter) to the target Sample (right parameter).
void filter_pqueries_removing_names(Sample &smp, std::string const ®ex, bool remove_empty_pqueries)
Remove all PqueryNames which match the given regex.
std::pair< PlacementTreeEdge const *, size_t > placement_count_max_edge(Sample const &smp)
Get the number of placements on the edge with the most placements, and a pointer to this edge.
size_t total_name_count(Sample const &smp)
Get the total number of PqueryNames in all Pqueries of the given Sample.
Pquery const * find_pquery(Sample const &smp, std::string const &name)
Return the first Pquery that has a particular name, or nullptr of none has.
void filter_min_weight_threshold(Pquery &pquery, double threshold)
Remove all PqueryPlacements that have a like_weight_ratio below the given threshold.
bool has_name(Pquery const &pquery, std::string const &name)
Return true iff the given Pquery contains a particular name.
std::pair< PlacementTreeEdge const *, double > placement_mass_max_edge(Sample const &smp)
Get the summed mass of the placements on the heaviest edge, measured by their like_weight_ratio,...
void filter_max_pendant_length(Pquery &pquery, double threshold)
Remove all PqueryPlacements that have a pendant_length above the given threshold.
void filter_pqueries_differing_names(Sample &sample_1, Sample &sample_2, bool remove_empty_pqueries)
Remove all PqueryNames from the two Samples that occur in both of them.
std::vector< int > closest_leaf_distance_histogram_auto(Sample const &smp, double &min, double &max, const int bins)
Returns the same type of histogram as closest_leaf_distance_histogram(), but automatically determines...
void sort_placements_by_weight(Pquery &pquery)
Sort the PqueryPlacements of a Pquery by their like_weight_ratio, in descending order (most likely fi...
void filter_pqueries_intersecting_names(Sample &sample_1, Sample &sample_2, bool remove_empty_pqueries)
Remove all PqueryNames from the two Samples that are unique to each of them.
void scale_all_branch_lengths(Sample &smp, double factor)
Scale all branch lengths of the Tree and the position of the PqueryPlacements by a given factor.
void merge_duplicate_placements(Pquery &pquery)
Merge all PqueryPlacements of a Pquery that are on the same TreeEdge into one averaged PqueryPlacemen...
std::unordered_set< std::string > all_pquery_names(Sample const &sample)
Return a set of all unique PqueryNames of the Pqueries of the given sample.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
void merge_duplicates(Sample &smp)
Look for Pqueries with the same name and merge them.
void normalize_weight_ratios(Pquery &pquery)
Recalculate the like_weight_ratio of the PqueryPlacement&s of a Pquery, so that their sum is 1....
size_t remove_empty_name_pqueries(Sample &sample)
Remove all Pqueries from the Sample that have no PqueryNames.
std::vector< int > closest_leaf_depth_histogram(Sample const &smp)
Return a histogram representing how many placements have which depth with respect to their closest le...
std::vector< double > closest_leaf_weight_distribution(Sample const &sample)
void collect_duplicate_pqueries(Sample &smp)
Find all Pqueries that share a common name and combine them into a single Pquery containing all thei...
void merge_duplicate_names(Pquery &pquery)
Merge all PqueryNames that have the same name property into one, while adding up their multiplicity.
size_t total_placement_count(Sample const &smp)
Get the total number of PqueryPlacements in all Pqueries of the given Sample.
void filter_min_accumulated_weight(Pquery &pquery, double threshold)
Remove the PqueryPlacements with the lowest like_weight_ratio, while keeping the accumulated weight (...
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.
std::vector< int > closest_leaf_distance_histogram(Sample const &smp, const double min, const double max, const int bins)
Returns a histogram counting the number of placements that have a certain distance to their closest l...
void filter_n_max_weight_placements(Pquery &pquery, size_t n)
Remove all PqueryPlacements but the n most likely ones from the Pquery.
size_t remove_empty_placement_pqueries(Sample &sample)
Remove all Pqueries from the Sample that have no PqueryPlacements.
void filter_min_pendant_length(Pquery &pquery, double threshold)
Remove all PqueryPlacements that have a pendant_length below the given threshold.