diff --git a/RotTable.py b/RotTable.py index e3486c1b21452cfed789090694fdb3d372884c98..ae2a83b202eef1af57c50fe80c3c33243a82a4eb 100644 --- a/RotTable.py +++ b/RotTable.py @@ -21,7 +21,26 @@ class RotTable: "TA": [36, 0.9, 0, 1.1, 2, 0],\ "TC": [36.9, 5.3, -120, 0.9, 6, 0],\ "TG": [34.5, 3.5, 64, 0.9, 34, 0],\ - "TT": [35.62, 7.2, -154, 0.06, 0.6, 0]\ + "TT": [35.62, 7.2, 154, 0.06, 0.6, 0]\ + } + + __CORRESPONDANCE = {\ + "AA": "TT" + "AC": "TG" + "AG": "TC" + "AT": "TA" + "CA": "GT" + "CC": "GG" + "CG": "GC" + "CT": "GA" + "GA": "CT" + "GC": "CG" + "GG": "CC" + "GT": "CA" + "TA": "AT" + "TC": "AG" + "TG": "AC" + "TT": "AA" } # get the angles in each axis (x, y, z), considering the deviation @@ -41,6 +60,9 @@ class RotTable: # return __ORIGINAL_ROT_TABLE def orta(self): return self.__ORIGINAL_ROT_TABLE + + def corr(self): + return self.__CORRESPONDANCE ################### # WRITING METHODS # diff --git a/individu.py b/individu.py index 0bc68e4926298da3172bec0b670ea360435d13ca..a239cf486c1138982004f1a3cbced51211ce5b33 100644 --- a/individu.py +++ b/individu.py @@ -1,5 +1,5 @@ from RotTable import RotTable -from Traj3D import * +from Traj3D import Traj3D import numpy as np from math import sqrt from random import random @@ -8,6 +8,8 @@ P1 = 0.015 class Individu(): + + def __init__(self, table): self.table = table self.score = None @@ -39,10 +41,13 @@ class Individu(): for coord in range(3): tir = random() if tir < proba : - # print("mutation", doublet, coord) - # print("table", table_rotations[doublet][coord]) table_rotations[doublet][coord] =np.random.uniform(low = self.table.orta()[doublet][coord] - self.table.orta()[doublet][coord + 3], high = self.table.orta()[doublet][coord] + self.table.orta()[doublet][coord + 3]) - # print("table", table_rotations[doublet][coord]) + doublet2 = self.table.corr()[doublet] + if coord = 0 or coord = 1 : + table_rotations[doublet2][coord] = table_rotations[doublet][coord] + else : + #sur l'axe z il y a un moins + table_rotations[doublet2][coord] = - table_rotations[doublet][coord] # individu1 = Individu(RotTable()) # print(individu1.table.rot_table)