FFPopSim  2.0
Library for Population Genetics
 All Classes Files Functions Variables Macros Pages
hivpopulation.h
Go to the documentation of this file.
1 
25 #ifndef HIVPOPULATION_H_
26 #define HIVPOPULATION_H_
27 
28 #include <string>
29 #include <fstream>
30 #include <sstream>
31 #include <iomanip>
32 #include <boost/algorithm/string.hpp>
33 
34 #include "ffpopsim_highd.h"
35 
36 #define HIVPOP_VERBOSE 0
37 #define HIVPOP_BADARG -1354341
38 #define NOTHING 1e-10
39 #define HIVGENOME 10000
40 
41 // HIV genes
42 #define ENV_START 7000
43 #define ENV_END 8000
44 
45 
53 struct hivgene {
54  unsigned int start;
55  unsigned int end;
56  hivgene(unsigned int start_in=0, unsigned int end_in=HIVGENOME);
57 };
58 
75 class hivpopulation : public haploid_highd {
76 public:
77  // constructors/destructors
78  hivpopulation(int N=0, int rng_seed=0, double mutation_rate=3e-5, double coinfection_rate=1e-2, double crossover_rate=1e-3);
79  virtual ~hivpopulation();
80 
81  // genes
83 
84  // treatment (set/get)
85  void set_treatment(double t){treatment=t; update_traits(); update_fitness();}
86  double get_treatment() {return treatment;}
87 
88  // stream I/O
89  int read_replication_coefficients(istream &model);
90  int read_resistance_coefficients(istream &model);
91  int write_genotypes(ostream &out_genotypes, int sample_size, string gt_label="", int start=0, int length=0);
92 
93 protected:
94  // fitness landscape
95  virtual void calc_individual_fitness_from_traits(clone_t *tempgt);
96 
97 private:
98  //random number generator
99  double treatment;
100  gsl_rng* rng;
101  int seed;
102 
103 };
104 
105 #endif /* HIVPOPULATION_H_ */