From cc8dfec39b44268b6a3ce92d9cfa8b4328beead2 Mon Sep 17 00:00:00 2001 From: Loic <loic.busson@student-cs.fr> Date: Tue, 28 Jan 2020 14:28:22 +0100 Subject: [PATCH] rottable lien --- RotTable.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/RotTable.py b/RotTable.py index 37762b4..0930820 100644 --- a/RotTable.py +++ b/RotTable.py @@ -40,9 +40,21 @@ class RotTable: "TA": "TA",\ "TC": "GA",\ "TG": "CA",\ - "TT": "AA",\ + "TT": "AA"\ } + __SOUS_CORRESPONDANCE = {\ + "AA": "TT",\ + "AC": "GT",\ + "AG": "CT",\ + "AT": "AT",\ + "CA": "TG",\ + "CC": "GG",\ + "CG": "CG",\ + "GA": "TC",\ + "GC": "GC",\ + "TA": "TA"\ + } # get the angles in each axis (x, y, z), considering the deviation def __init__(self): self.rot_table = {} @@ -53,9 +65,11 @@ class RotTable: # get a random deviation, considering the "limits" given in the last 3 columns # of __ORIGINAL_ROT_TABLE def alea(self): - for dinucleotide in RotTable.__ORIGINAL_ROT_TABLE: + for dinucleotide in RotTable.__SOUS_CORRESPONDANCE: for i in range(2): - self.rot_table[dinucleotide][i] += numpy.random.uniform(low = -RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][i+3], high= RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][i+3]) + delta = numpy.random.uniform(low = -RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][i+3], high= RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][i+3]) + self.rot_table[dinucleotide][i] += delta + self.rot_table[RotTable.__SOUS_CORRESPONDANCE[dinucleotide]][i] += delta # return __ORIGINAL_ROT_TABLE def orta(self): @@ -86,6 +100,5 @@ class RotTable: ################### table1 = RotTable() -print(table1.orta()) -print(table1.rot_table["AA"]) +print(table1.rot_table) -- GitLab