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
|
DNA Crawler::MutateDNA(){
Molekule mol;
DNA tmp;
float mutationRate = readSettings("MutationRate");
tmp = readDNAFile(*this);
for (unsigned int i = 0; i < tmp.getChromosomes().size(); i++){
for (unsigned int a = 0; a < tmp.getChromosomes()[i].getGenes().size(); a++){
for (unsigned int b = 0; b < tmp.getChromosomes()[i].getGenes()[a].getPairs().size(); b++){
for (int c = 0; c < 2; c++){
srand(time(NULL));
int x = (rand() % 100) + 1;
if (x <= mutationRate){
int x = rand() % 14;
tmp.getChromosomes()[i].getGenes()[a].getPairs()[b].getMolekules()[c] = mol.getMolekuleList()[x];
}
}
}
}
}
return tmp;
}
vector <Molekule> Molekule::getMolekuleList(){
vector <Molekule> molList;
Molekule a("Adenine", "A", "");
Molekule c("Cytosine", "C", "");
Molekule t("Adenine", "T", "");
Molekule g("Adenine", "G", "");
Molekule h("Adenine", "H", "");
Molekule i("Adenine", "I", "");
Molekule j("Adenine", "J", "");
Molekule p("Adenine", "P", "");
Molekule q("Adenine", "Q", "");
Molekule r("Adenine", "R", "");
Molekule s("Adenine", "S", "");
Molekule y("Adenine", "Y", "");
Molekule u("Adenine", "U", "");
Molekule x("Adenine", "X", "");
molList.push_back(a);
molList.push_back(c);
molList.push_back(t);
molList.push_back(g);
molList.push_back(h);
molList.push_back(i);
molList.push_back(j);
molList.push_back(p);
molList.push_back(q);
molList.push_back(r);
molList.push_back(s);
molList.push_back(y);
molList.push_back(u);
molList.push_back(x);
return molList;
}
|