-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
65 lines (46 loc) · 1.74 KB
/
main.cpp
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
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <string>
#include "MoranConfig.h"
#include "/home/farid/Documents/git/MoranSimulator/utils/utils.h"
#include "/home/farid/Documents/git/MoranSimulator/MoranModel/MoranModel.h"
int main(int argc, char* argv[]){
std::cout << "VERSION " << MoranModel_VERSION_MAJOR << "."
<< MoranModel_VERSION_MINOR << std::endl;
if (argc != 4) {
std::cout << "Incorrect number of arguments\n";
std::cout << argc - 1 << " arguments given, 3 required.\n";
std::cout << "Usage: " << "./MoranSimulator population events runs\n";
return 1;
}
int runs = atoi(argv[3]);
int events = atoi(argv[2]);
int population = atoi(argv[1]);
// int runs = 100;
// int events = 20000;
// int population = 100;
printf("POPULATION = %i, ", population);
printf("EVENTS = %i, ", events);
printf("RUNS = %i \n", runs);
MoranProcess moran(population, events);
int average_quotient = 0;
int average_remainder = 0;
int seg_sites = 0;
std::vector< std::vector<int> > sample;
sample.reserve(10);
for (unsigned i = 0; i < runs; ++i){
sample = sampleWithoutReplacement(moran.getMutations(), 10);
// printVectorOfVectors(sample);
seg_sites = moran.calcualteSegregatingSites(sample);
average_quotient += seg_sites / runs;
average_remainder += seg_sites % runs;
moran.regeneratePath();
}
double average_mutations = average_quotient +
static_cast<double> (average_remainder) / runs;
std::cout << "<S> = " << average_mutations << std::endl;
// printVector(moran.calculateSiteFrequencySpectrum(sample));
return 0;
}