-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathparms.h
179 lines (164 loc) · 5.21 KB
/
parms.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
//
// parms.h
// frequencyDependentSimulation
//
// Created by Nicholas Croucher on 28/09/2015.
// Copyright (c) 2015 Imperial College. All rights reserved.
//
#ifndef frequencyDependentSimulation_parms_h
#define frequencyDependentSimulation_parms_h
#include <iostream>
#include <string>
#include <fstream>
#include <getopt.h>
#include <string.h>
#include <vector>
// structure for storing parameters
struct parms {
std::string programme;
double fSelection;
double vSelection;
double immigrationRate;
int immigrationType;
double upperLimit;
double lowerLimit;
double selectedProp;
double lowerSelection;
double higherSelection;
double transformationProportion;
double transformationRate;
double transformationAsymmetryLoci;
double transformationAsymmetryMarker;
int popSize;
int numGen;
int genotypeSampleSize;
double decayRate;
std::string het_mode;
int densdepMode;
};
// structure for isolate objects
struct isolate {
std::string id;
int year;
int sc;
std::string serotype;
bool vt;
bool latent_vt;
std::vector<bool> genotype;
std::vector<bool> markers;
double fitness;
// new constructor for struct 'isolate'
// isolate(std::string init_id, int init_year, int init_sc, std::string init_serotype, bool init_vt, bool second_vt, std::vector<bool> *init_genotype, std::vector<bool> *init_markers) : id(init_id),year(init_year),sc(init_sc),serotype(init_serotype),vt(init_vt),latent_vt(second_vt),genotype(*init_genotype),markers(*init_markers) {}
// constructor for struct 'isolate'
isolate(std::string init_id, int init_year, int init_sc, std::string init_serotype, bool init_vt, bool second_vt, std::vector<bool> *init_genotype, std::vector<bool> *init_markers, double init_fitness) {
id = init_id;
year = init_year;
sc = init_sc;
serotype = init_serotype;
vt = init_vt;
latent_vt = second_vt;
genotype = (*init_genotype);
markers = (*init_markers);
fitness = init_fitness;
};
// destructor for struct 'isolate'
// ~isolate() {
// genotype.clear();
// genotype.shrink_to_fit();
// markers.clear();
// markers.shrink_to_fit();
// }
//
// // copy constructor for struct 'isolate'
// isolate(const isolate& other): id(other.id),year(other.year),sc(other.sc),serotype(other.serotype),vt(other.vt),latent_vt(other.latent_vt),genotype(other.genotype),markers(other.markers) {}
//
// // copy assignment operator
// isolate& operator=(const isolate& other) {
// // check for self-assignment
// if (&other != this) {
// id = other.id;
// year = other.year;
// sc = other.sc;
// serotype = other.serotype;
// vt = other.vt;
// latent_vt = other.latent_vt;
// genotype = other.genotype;
// markers = other.markers;
// }
// return *this;
// }
//
// // move constructor
// isolate(isolate&& other) {
//
// id = other.id;
// other.id = nullptr;
// year = other.year;
// other.year = nullptr;
// sc = other.sc;
// other.sc = nullptr;
// serotype = other.serotype;
// other.serotype = nullptr;
// vt = other.vt;
// other.vt = nullptr;
// latent_vt = other.latent_vt;
// other.latent_vt = nullptr;
// genotype = other.genotype;
// other.genotype = nullptr;
// markers = other.markers;
// other.markers = nullptr;
//
// }
// move assignment operator
// isolate& operator=(isolate&& other) {
// if (&other != this) {
// delete p;
// p = other.p;
// other.p = nullptr;
//
// }
// return *this;
// }
};
// constructor
//isolate::isolate(std::string init_id, int init_year, int init_sc, std::string init_serotype, bool init_vt, bool second_vt, std::vector<bool> *init_genotype, std::vector<bool> *init_markers) {
// id = init_id;
// year = init_year;
// sc = init_sc;
// serotype = init_serotype;
// vt = init_vt;
// latent_vt = second_vt;
// genotype = (*init_genotype);
// markers = (*init_markers);
//}
// destructor
//isolate::~isolate() {
//// delete[] genotype;
// genotype = nullptr;
//// delete[] markers;
// markers = nullptr;
//}
// structure for COG objects
struct cog {
std::string id;
bool vt;
double weight;
double currentFreq;
double eqFreq;
std::vector<double> actualFreq;
std::vector<double> simFreq;
// constructor for struct 'cog'
cog(std::string init_id, int init_vt, double init_weight, double init_eqFreq, std::vector<double> *init_actualFreq) {
id = init_id;
vt = init_vt;
weight = init_weight;
currentFreq = 0.0;
eqFreq = init_eqFreq;
actualFreq = (*init_actualFreq);
std::vector<double> tmpSimFreq(actualFreq.size(),0.0);
simFreq = tmpSimFreq;
};
// copy constructor for struct 'cog'
cog(const cog& other): id(other.id),vt(other.vt),weight(other.weight),currentFreq(other.currentFreq),actualFreq(other.actualFreq),simFreq(other.simFreq) {}
};
#endif