From 514105dac64334baeebafdebdc2fd2a4a2f47ba9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Chlo=C3=A9=20Muller?= <chloe.muller@student-cs.fr>
Date: Tue, 28 Jan 2020 13:33:02 +0100
Subject: [PATCH] Rajout de la correspondance entre les nucleotides opposes
 dans RotTable et application de cette correspondance pour mutation dans
 individu.py

---
 RotTable.py | 24 +++++++++++++++++++++++-
 individu.py | 13 +++++++++----
 2 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/RotTable.py b/RotTable.py
index e3486c1..ae2a83b 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 0bc68e4..a239cf4 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)
-- 
GitLab