Helper class to iterate over Variants and process pairs of FST between their samples (SampleCounts), using a set of BaseFstPoolCalculator.
Definition at line 67 of file fst_pool_processor.hpp.
|
| FstPoolProcessor (FstPoolProcessor &&)=default |
|
| FstPoolProcessor (FstPoolProcessor const &)=default |
|
| FstPoolProcessor (std::shared_ptr< utils::ThreadPool > thread_pool=nullptr, size_t threading_threshold=4096) |
| Construct a processor. More...
|
|
| ~FstPoolProcessor ()=default |
|
void | add_calculator (size_t index_p1, size_t index_p2, std::unique_ptr< BaseFstPoolCalculator > calculator) |
| Add a calculator, that is, an instance to compute FST for a pair of samples. More...
|
|
std::vector< std::unique_ptr< BaseFstPoolCalculator > > const & | calculators () const |
|
VariantFilterStats | get_filter_stats () const |
| Get the sum of filter statistics of all Variants processed here. More...
|
|
PiVectorTuple const & | get_pi_vectors () const |
| Get lists of all the three intermediate pi values (within, between, total) that are part of our unbiased estimators. More...
|
|
template<class D > |
PiVectorTuple const & | get_pi_vectors (BaseWindow< D > const &window, std::shared_ptr< GenomeLocusSet > provided_loci) const |
| Get lists of all the three intermediate pi values (within, between, total) that are part of our unbiased estimators. More...
|
|
std::vector< double > const & | get_result () const |
| Get a list of all resulting FST values for all pairs of samples. More...
|
|
template<class D > |
std::vector< double > const & | get_result (BaseWindow< D > const &window, std::shared_ptr< GenomeLocusSet > provided_loci) const |
| Get a list of all resulting FST values for all pairs of samples. More...
|
|
FstPoolProcessor & | operator= (FstPoolProcessor &&)=default |
|
FstPoolProcessor & | operator= (FstPoolProcessor const &)=default |
|
void | process (Variant const &variant) |
|
void | reset () |
|
std::vector< std::pair< size_t, size_t > > const & | sample_pairs () const |
|
size_t | size () const |
| Get the total number of calculates, i.e., the number of pairs of samples for which we comute FST here. More...
|
|
std::shared_ptr< utils::ThreadPool > | thread_pool () const |
| Get the thread pool used for processing, if enough sample pairs are being processed. More...
|
|
FstPoolProcessor & | thread_pool (std::shared_ptr< utils::ThreadPool > value) |
| Set the thread pool used for processing, if enough sample pairs are being processed. More...
|
|
size_t | threading_threshold () const |
|
FstPoolProcessor & | threading_threshold (size_t value) |
| Set the threshold of calculators after which the processing is done in threads. More...
|
|
Get lists of all the three intermediate pi values (within, between, total) that are part of our unbiased estimators.
This computes the window-average-corrected values for pi within, pi between, and pi total (in that order in the tuple), for each sample pair (order in the three vectors). This uses the same window averaging policy as the get_result() function.
This only works when all calculators are of type FstPoolCalculatorUnbiased, and throws an exception otherwise. It is merely meant as a convenience function for that particular case.
Definition at line 317 of file fst_pool_processor.hpp.
std::vector<double> const& get_result |
( |
BaseWindow< D > const & |
window, |
|
|
std::shared_ptr< GenomeLocusSet > |
provided_loci |
|
) |
| const |
|
inline |
Get a list of all resulting FST values for all pairs of samples.
This always takes the window
and provided_loci
as input, which are components needed for some of the window averaging policies, even if the WindowAveragePolicy does not require it. This is meant to make sure that we at least keep track of the right things when doing any computations, and cannot forget about this. There is an overload of this function which does not need this, and always returns the sum.
Definition at line 266 of file fst_pool_processor.hpp.
Set the threshold of calculators after which the processing is done in threads.
For small numbers of processors (small number of sample pairs), starting threads for each call of process() is more expensive than just doing the computation directly in the main thread. Hence, we only want to use the thread pool if the overhead is justified.
With this setting the number of sample pairs can be set after which we use the thread pool.
Definition at line 144 of file fst_pool_processor.hpp.