From e2fd5d8e83762ecc3d550b92cf75b59995a70913 Mon Sep 17 00:00:00 2001 From: Loic <loic.busson@student-cs.fr> Date: Mon, 27 Jan 2020 16:38:38 +0100 Subject: [PATCH] test --- .vscode/settings.json | 3 +++ Initialisation.py | 11 +++++++++++ RotTable.py | 13 ++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..395ba2d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "D:\\Programmes\\Anaconda3\\python.exe" +} \ No newline at end of file diff --git a/Initialisation.py b/Initialisation.py index bd09059..1a2947e 100644 --- a/Initialisation.py +++ b/Initialisation.py @@ -25,3 +25,14 @@ class rotation: self.y = numpy.random.uniform(low = ORIGINAL_ROT_TABLE[doublet][1] - ORIGINAL_ROT_TABLE[doublet][4], high = ORIGINAL_ROT_TABLE[doublet][1] + ORIGINAL_ROT_TABLE[doublet][4]) self.z = ORIGINAL_ROT_TABLE[doublet][2] self.doublet = doublet + +class table_rotation(rotation): + def __init__(self): + self.dict = {doublet : rotation(doublet) for doublet in ORIGINAL_ROT_TABLE} + +table1 = table_rotation() +print(table1.dict["AA"].x) + +#table1.dict --> {'AA': <__main__.rotation object at 0x000001A722E1BAC8>, 'AC': <__main__.rotation object at 0x000001A722E1BB00>, 'AG': <__main__.rotation object at 0x000001A729A66A58>, 'AT': <__main__.rotation object at 0x000001A729A66A20>, 'CA': <__main__.rotation object at 0x000001A729A669E8>, 'CC': <__main__.rotation object at 0x000001A729A66A90>, 'CG': <__main__.rotation object at 0x000001A729A66B00>, 'CT': <__main__.rotation object at 0x000001A729A66B70>, 'GA': <__main__.rotation object at 0x000001A729B88D68>, 'GC': <__main__.rotation object at 0x000001A729B88DA0>, 'GG': <__main__.rotation object at 0x000001A729B88DD8>, 'GT': <__main__.rotation object at 0x000001A729B88E10>, 'TA': <__main__.rotation object at 0x000001A729B88E48>, 'TC': <__main__.rotation object at 0x000001A729B88E80>, 'TG': <__main__.rotation object at 0x000001A729B88EB8>, 'TT': <__main__.rotation object at 0x000001A729B88EF0>} +#table1.dict["AA"] ---> <__main__.rotation object at 0x000001A722E1BAC8> (qui est l'object rotation) +#table1.dict["AA"].x ---> 35.67097790545279 (rotation selon x de AA) \ No newline at end of file diff --git a/RotTable.py b/RotTable.py index ca025dc..ede2d0b 100644 --- a/RotTable.py +++ b/RotTable.py @@ -27,13 +27,21 @@ class RotTable: self.__Rot_Table = {} for dinucleotide in RotTable.__ORIGINAL_ROT_TABLE: self.__Rot_Table[dinucleotide] = RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][:3] + self.alea() + + + def alea(self): + for dinucleotide in RotTable.__ORIGINAL_ROT_TABLE: + 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]) ################### # WRITING METHODS # ################### - +#table = RotTable() +#table.__Rot_Table["AA"] --> [35.62, 7.2, -154] ################### # READING METHODS # @@ -49,3 +57,6 @@ class RotTable: return RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][2] ################### + + table1 = RotTable() + print(table1.__Rot_Table["AA"]) -- GitLab