libsequence  1.9.5
TreeOperations.hpp
Go to the documentation of this file.
1 
4 #ifndef __SEQUENCE_COALESCENT_TREE_OPERATIONS_HPP__
5 #define __SEQUENCE_COALESCENT_TREE_OPERATIONS_HPP__
6 
8 #include <vector>
9 #include <memory>
10 namespace Sequence
11 {
12  namespace coalsim {
13  double total_time( const marginal::const_iterator beg,
14  const int & nsam );
15 
16  int pick_branch( marginal::const_iterator beg,
17  const int & nsam,
18  const double & rtime);
19 
20  std::vector<int> get_all_descendants (marginal::const_iterator beg,
21  const int & nsam,
22  const int & branch);
23 
24  bool is_descendant( marginal::const_iterator beg,
25  const int & ind,
26  const int & branch );
27 
28  double total_time_on_arg( const Sequence::coalsim::arg & sample_history,
29  const int & total_number_of_sites );
30 
31  void minimize_arg( arg * sample_history );
32 
33  class sfs_times_impl;
34  class sfs_times
35  {
36  private:
37  std::unique_ptr<sfs_times_impl> impl;
38  public:
39  sfs_times();
40  sfs_times(arg::const_iterator sample_history_beg,
41  const arg::size_type & nsegs,
42  const int & total_nsites_simulated,
43  bool folded = false);
44  sfs_times(const sfs_times &);
45  ~sfs_times();
46 
47  double operator[]( std::vector<double>::size_type const & ) const;
48  sfs_times & operator=(const sfs_times &);
49  bool operator==(const sfs_times & rhs) const;
50  double ttime() const;
51  size_t size() const;
52  typedef std::vector<double>::const_iterator const_iterator;
53  const_iterator begin() const;
54  const_iterator end() const;
55  };
56  }
57 }
58 #endif
std::list< marginal > arg
Ancestral Recombination Graph.
Definition: SimTypes.hpp:217
int pick_branch(marginal::const_iterator beg, const int &nsam, const double &rtime)
pick a random branch of a marginal tree
void minimize_arg(arg *sample_history)
The namespace in which this library resides.
declaration of types for coalescent simulation
double total_time(const marginal::const_iterator beg, const int &nsam)
Calculate total time on a marginal tree.
double total_time_on_arg(const Sequence::coalsim::arg &sample_history, const int &total_number_of_sites)
Returns the total time on an ancestral recombination graph.
std::vector< int > get_all_descendants(marginal::const_iterator beg, const int &nsam, const int &branch)
Find all the descendants of a branch on a marginal tree.
bool is_descendant(marginal::const_iterator beg, const int &ind, const int &branch)
Ask if a tip of a tree is a descendant of a particular branch.