From 76f8aab64d9a74abf4004e4ed965e5ab25e62e5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Chlo=C3=A9=20Muller?= <chloe.muller@student-cs.fr>
Date: Wed, 29 Jan 2020 09:02:03 +0100
Subject: [PATCH] =?UTF-8?q?je=20sais=20pas=20ce=20qu'il=20s'est=20pass?=
 =?UTF-8?q?=C3=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .DS_Store                                 | Bin 6148 -> 6148 bytes
 RotTable.py                               |  54 +++++++++++---
 Traj3D.py                                 |   6 ++
 __pycache__/Initialisation.cpython-37.pyc | Bin 1840 -> 0 bytes
 __pycache__/RotTable.cpython-36.pyc       | Bin 2085 -> 2132 bytes
 __pycache__/RotTable.cpython-37.pyc       | Bin 2086 -> 2577 bytes
 __pycache__/Traj3D.cpython-36.pyc         | Bin 1976 -> 1976 bytes
 __pycache__/Traj3D.cpython-37.pyc         | Bin 1958 -> 1931 bytes
 __pycache__/croisement.cpython-37.pyc     | Bin 0 -> 2386 bytes
 __pycache__/individu.cpython-37.pyc       | Bin 0 -> 1936 bytes
 __pycache__/population.cpython-37.pyc     | Bin 0 -> 6259 bytes
 algogenetique.py                          |  38 ++++++++++
 croisement.py                             |  61 +++++++++++++---
 first_plot.png                            | Bin 0 -> 2412 bytes
 individu.py                               |  55 ++++++++++-----
 inutile.py                                |   2 +-
 population.py                             |  82 +++++++++++++++-------
 selection_par_rang.py                     |  45 ------------
 18 files changed, 235 insertions(+), 108 deletions(-)
 delete mode 100644 __pycache__/Initialisation.cpython-37.pyc
 create mode 100644 __pycache__/croisement.cpython-37.pyc
 create mode 100644 __pycache__/individu.cpython-37.pyc
 create mode 100644 __pycache__/population.cpython-37.pyc
 create mode 100644 algogenetique.py
 create mode 100644 first_plot.png
 delete mode 100644 selection_par_rang.py

diff --git a/.DS_Store b/.DS_Store
index ce584036d310ff852c50dff6063d64ba8881c0a3..eb0f78382c04c8e58afb90d646790e2b7fb5c130 100644
GIT binary patch
delta 180
zcmZoMXfc=|#>CJ*u~2NHo;G(TLn1>CLncEpL*m3j^~nYzEZKq#o(y>mnG7WiNRnV)
zK0_XZ9zy{`rDslla#Buy5(5K+00RS4A_D`%jQ?Q300Qg`B@C$y#SA4_Ri8(w-mJ*{
ojAgR{vpUmeb`E|HCWiLSip<}cC-aLKGBQlI;gQ}PBeH@S0Lv^f!2kdN

delta 349
zcmZoMXfc=|#>B)qu~2NHo;G(bLn=caLkUB1Qu$^^#^sEY4MbS#IT=zI@)?pDN*R!(
ziwlx+@{<@C7)~Y?<YX3?7#Lh<WMXDvWn<^y;Nsxo<%$i?$S)5rNh~QXc1kRY2Jr$C
zOEQw6?2!EY95_2MDJ(O!JYGP=IX|x?F*7f<2&6nXGbJ@Cv8X;KJTosPzuYOmG%uwX
zY!Fn2gM*WUGhRTVy4uv#Tt~s!#IROJq1xQsKu5vE*sQjelS5q9(AF~{x3a3brnYV-
z0~jzef++?Dekcv2W-%}@VDT$YS#VKaPJUiG0|Nu&W=6($ESuRm_&J!EI5#sgerKM{
XFJdSFGO__A&%gj;GHebI*}@C}|AJV0

diff --git a/RotTable.py b/RotTable.py
index e3486c1..9f841ef 100644
--- a/RotTable.py
+++ b/RotTable.py
@@ -21,9 +21,40 @@ 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": "GT",\
+        "AG": "CT",\
+        "AT": "AT",\
+        "CA": "TG",\
+        "CC": "GG",\
+        "CG": "CG",\
+        "CT": "AG",\
+        "GA": "TC",\
+        "GC": "GC",\
+        "GG": "CC",\
+        "GT": "AC",\
+        "TA": "TA",\
+        "TC": "GA",\
+        "TG": "CA",\
+        "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 = {}
@@ -34,13 +65,18 @@ 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):
         return self.__ORIGINAL_ROT_TABLE
+    
+    def corr(self):
+        return self.__CORRESPONDANCE
 
     ###################
     # WRITING METHODS #
@@ -53,17 +89,17 @@ class RotTable:
     ###################
 
     def getTwist(self, dinucleotide):
-        return RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][0]
+        return self.rot_table[dinucleotide][0]
 
     def getWedge(self, dinucleotide):
-        return RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][1]
+        return self.rot_table[dinucleotide][1]
 
     def getDirection(self, dinucleotide):
-        return RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][2]
+        return self.rot_table[dinucleotide][2]
 
     ###################
 
-# table1 = RotTable()
-# print(table1.orta())
+#table1 = RotTable()
+#print(table1.orta())
 
-# print(table1.rot_table["AA"])
+# print(table1.rot_table)
diff --git a/Traj3D.py b/Traj3D.py
index eee7181..92cc972 100644
--- a/Traj3D.py
+++ b/Traj3D.py
@@ -65,3 +65,9 @@ class Traj3D:
         ax.plot(x,y,z)
         plt.show()
         plt.savefig(filename)
+
+# from RotTable import RotTable
+# table = RotTable()
+# test = Traj3D()
+# test.compute("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA", table)
+# test.draw("first_plot")
\ No newline at end of file
diff --git a/__pycache__/Initialisation.cpython-37.pyc b/__pycache__/Initialisation.cpython-37.pyc
deleted file mode 100644
index e986e03a10e3574402c013796cf8296d4a58eb32..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 1840
zcmZ?b<>g{vU|`UBtRMHBlY!wehy%l-3=9ko3=9m#YK#mFDGVu$ISf$@DNHHMDJ&_h
zDQqbW>1-+NDI6)BDO@SsU>;8jZwg-ue~JK@Czv9X!jQs|!UyIFr--D8rii78gLx7u
zk||Ot(kYT)o=l1?SS3H02QoztZi;-0LW*LFSc(!@PC11;MI}WwMGedYnW7Fi1>_bD
zxLY(+#K2}kYzLX51vdrc7Hzm&P<^B`M<9yPogqaxMX!Y+MX#ADipiZJML)%$g(1Zt
zm8qFIiaC|JnIVcLl{J+mi!H@ak|B$|nURqpg)x{x)958A^!(EM4}H~$Iq&F@e)bFq
z$T(!C{r~?zeTQ7@>%blB?9+|G;4zHh=#V~ZCJ21Af7#E#zyQ_u#r`ELhzC}@*&1e=
zg2PKDkTA$928JK@FPY)I278zy7Ke1Oyn`c@!NB8?c>v@Hh?Cyfzf=Ng`=$}of9R?M
zOdEqk=5dgsH-R9xZnTHG#1<wm<?!+!NFMB@VkZZvPedJFRxmIyykr9r8X#f|$Z)VK
z<Inc#X<+ch{-q@Y14Cxv|NsAAs(@G>AQmW*X$st8a&(Mha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m#KCE(+_pwQOlrUs5)-Xykq%cY{1T$zd`4urTFfeE`6)}O-
zf=t$ADuNq_X4Wl^^wg4&^338Aqsa@{BqrOj$+LhAoSeueY)FC;;i)O<siu<`u$lXS
zw4=I*jRg1bq^Fj+WEQ0+mt^MWSxlB=cVpz5oXW1}4Dv{k6v#^;?-$8|SPCFQ5k!Ck
z2SI>?3FLoPP!iB#U|`^2WMQ8CkX>T(dv>-m5oQi{4gn5k4rWLo34k2P9>tlPSdvj%
zl9^L{iv`3ik^vbFGA4?xBrz!`)$kT;K~ZL2Ns%x}0%0AP1+w!NhfQvNN@-529ViZp
Qxxf~4Fmf>QS+Fqz0Amh+1ONa4

diff --git a/__pycache__/RotTable.cpython-37.pyc b/__pycache__/RotTable.cpython-37.pyc
index 306bef3707a8dfe8d997aa52208ffe660f6a4161..34a0caf41c6c790ba653935d986362949db3c6b6 100644
GIT binary patch
delta 1463
zcmZ1`Fj0ihiI<m)fq{Wx!E}STTig@*Bp9_Os%x^PFa|SdvP{g9Va%J@{;Xa%g*AmO
zg*}}uMQ@Hk6ibSJib0BDicyMjib;xTidl+zibaZLidBkricN}biXB)LE1D{h8tWAM
zIb2a}DGn))EeuiYDNZTQEeuf{DK06lEeuhdDQ+q5EeugyDIO`FEeuiIDPAewEeugS
zd?`LDzAX$<yeWRc44VF%S1~3q*1w#^z`&p>aEr;&@fMS#^DQPv_ghSkA-9;E9d9u?
zJKth*cE82s9CC}v-SHNayYnq3clTRN?jg6BLL6@~g*e}03UR;16cSRTz`(#zBm*KO
zK!ga0kOvXcAVM5O2!jYY5FrI3#6X0P5Qvlo5t1N66hsJuoWxZGqKd%sV4Ywi!SZ08
zU?ahLz@~wWnC!#6hE0uuf#H|?WJVTI_VT=({KS;v$u=w!a=N*R#U-gl`a$_6A&E&j
zsd@#Kw>aYCGxIV_;^VC+XS3+kvoJ6)urn|)I5RLX6t^)jFjO>@Fk~^hFvOPCGFB9n
zFr_dygLo;mOeM@&ELp523|VY7jFJpBOesv_43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Z|FMWMN>3JL)v0G@U|;}+movz_
zX$%Yu6$vE_S&S|Wv0=506#*qoDU8h^o=YuL4MP@l4WlGO4HGMaBtr>H7Hbw8NG(Jx
zg-M)2l7X86T_lCMm&u%gnZbskP%NCGkRzNSg&~+hlf|!ym4Sg_@&i`(`Y7g{{PHN4
zjLh^5P4*%t1_p*AAqED9TdYNidFiP|f?#%DX>LJf6kAbZUP^v$6nkl2W?Ftxt|oJl
z2uM9B#%?iY7J)(tLWqNeg&7zalt4aX14S((4<jFA6>m^}Nl0Q+PO4sFPHJK@6T{?(
z?BX6UXQwbqf}F?XSH#G`z@W*5aE>Mu!YYUrV9P-E+~P=2EeR>lEG{vce30E7)3BGM
z8Wx_KlAdZh`5?Q*<X{eYA57PQ0*_eN@ua7gxMUWkCYNO9=UGhN$)U{1HTf=wo((9J
zizHwHRU`vq$$<!Y5CQfcf&h6G92y|2i*+VPbE=gxbFgy=a4>T)gC&XtKtaYH#hIH}
zl2KZcnNxg=1;i|p0vQL2*C@6UP{<qJVl61j%qsy$EmBy5Ed$wei^C>2KczG$)eaPJ
S#h?Vr!N|eL!Nh05#s~nh5Y4Ip

diff --git a/__pycache__/Traj3D.cpython-36.pyc b/__pycache__/Traj3D.cpython-36.pyc
index ecd80201694553fe02c71577fca8c84a37602d91..b5c1da4e7f16d56be5828446b2f8423d03027c1c 100644
GIT binary patch
delta 18
ZcmdnNzk{FCn3tDplbb=@(~X?#*#R@T1<C*b

delta 18
ZcmdnNzk{FCn3tC;;l5s+$VSff>;N%*1wH@(

diff --git a/__pycache__/Traj3D.cpython-37.pyc b/__pycache__/Traj3D.cpython-37.pyc
index 9089d353fd2661eb0e1c444fe75a6b707a6ecd10..868cf3c5285c75f887b4c574b83184755ea94f88 100644
GIT binary patch
delta 278
zcmZ3+-_6hK#LLUYz`($;V7fuv(~Z34jJCgA^+StOi;DG=Gjj4%b4zn_Qj7Fm^2_sb
z@)J{v^;0u-vr<bdbW_Xnb4p7x^Yii&GmBD-b#oJoOHzwA-(gf`^1j6umYQ6WUsS}(
zz`$^ewJ0$!J@poIPHNsQj-dRKM3AmqEV+p#8MoMr5>ql0^NMeAq^FjIlxG%~+~P@3
zEpf>#N=*hUo9x4q$#`q?HWpV###@vBu&OfNnykdut$d3+q$n}3I0tN4kqiR^LlGy4
z0C}cJ5yaA)e1XkQR~+nuywco)$|7YDTQE1Vq#!51BquXTub>jdy2S>ei&Q6Dvu6VU
Da%W;S

delta 285
zcmeC?U&hbt#LLUYz`($udPgr#WFv1mW5m~31_lQG(BjmhV*TWdocz?>(wv;sB7K+q
z<kH;Kypm#l*W~=1RD~4v%)Io}GmUwfsij5wrV6?W!68QauAcg-nYvl2r4_oVW%)U!
zC7Jnod5M`tsl}TQGO993MX`mYCYR(F6|pifFx+A-O3X`7y~Ui9nin;RMM5%)BR#bw
zq&%~@B#I|JwZtW}C^Z>mLeykKmQ2Q|&9hlt85yG{KV(&9jGD~O)~y`H9a5B-SDcdw
zQdK0*z`#(%2_is#Dv}1V)Fy9bv(ps?+m=_FTTodf%fP@8C77F7Qjn8hl9QRFS5OIJ
OMX^EXBKgS*?AZXTWm$Ou

diff --git a/__pycache__/croisement.cpython-37.pyc b/__pycache__/croisement.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ecad689e2e6d0e89bac238cab0e024e5e204b30d
GIT binary patch
literal 2386
zcmZ?b<>g{vU|?7<-5_qIAOpi=5C?`u85kHG7#J9er5G6)QW#Pga~PsPG*b>^E@KoU
zBZ$qM!<5S$#mvZ%!ji(8!j{6G!jZy|&X&TN!j;0E!jr-a=JBQQrwF77rU-#~!YLvt
z3@KbG0$`qKidc$xibRSem?xDYog$MWn<5S7$)(7HRSJT6AX60JrYNQ;r6{LJq^N-9
zR8x3U)Kb(_G{8KNDVlIoKyJ~3yG1)i0&FJ4c91DLa8p2T(S^GO)kk`B1fp0{^ivF4
z7@}BH3{#9+7^2ux7=sx!jbDO7%ukc?7DrHiNl0Q+PAZ7)nU|7TmYGtT-hb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~Eur)JfGZe?wu#~Vvc`QYLY8bLOvN%CmqlO8>0%sSF
z1zZamK%%uAP!*so08s%-WKfnQLkcrEL$Sa!6wEYcxM|E;2-7%g7{TJ4;0y&)%L&d<
zU>3S*;0y(l0VQyVjgZWYFb|YLK`MxI9m21;TnAABG7X{vkLzk!Qdq$m$_6Pzu|YCa
zks>TF6@kk4B4q{!22E~6UMd2WyG5!XMQR{Ioq>Vj7ISW9-Yw?b#EK$N*<GXwlF$Na
z<SNnzv2{R%E{M<r5&8@a3{gDb<Oj(lhA2FvA_I^rLl9vEB0%{7oEeHh3H6p3QZi0S
zEv<kg<YH@3c@0v}fRvK?7-a~hV@4jvA`6gX*&%)dmlzzG(5e{XbC55=i5;vG;ubVl
iaoFVMr<CTT+JQ=+Vo*46F!C_+FoW_FZY;vWp#%WEPg8CH

literal 0
HcmV?d00001

diff --git a/__pycache__/individu.cpython-37.pyc b/__pycache__/individu.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..37d35b2ce8c0d3c05331c63b2112883e7ee05733
GIT binary patch
literal 1936
zcmZ?b<>g{vU|?7<-5{=tmx19ihy%mS3=9ko3=9m#K@1EGDGVu$ISjcBQ4EYAHd78`
zE@KoUn9ZES6vdpvkiwF~lFJ&!n#&f&1{P<{Vb5icVrOJXVT<B$XGmdB;b>t<;b>-x
z;!I%<X3*q(39?C(@fJr=eo07TQckKS<1Mz3qQop?7e7s=TP($eMJ2bGGxO3w;zfyh
zDfzkSJLFnl2kz*zPX_6QVYo{*7#J8*8KM|d7^0X`7*m*97^0X{m{V9<7@}BGS<@I(
zSX0<q7^B!y*n=4~Ic{-y=A~qoWu}xSGeM04(IC^DLH-tFU|^_WtYL^}s9{*Zn8LUa
z#AZri2xib^@{0;{baZrgcMNe30U>us5YssX0-QtKo!y<?LmWZU?jWACBZ%kd?CuB#
z&d%=6&LQsZ?(UB6?#}M+At51-?jayqP3BvyC7{5##gST;m{Xcql6s4^I61#46&xg~
zIcY^43=9k_8H#uq7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X)ublpeR2nF^V6oF}^6j
zBoS1|6i2bA<d-Jpq?Sang40tJb4g}V6bDq$2ok%X;;RT0#kV+eOCcI{K}C-UIG#Be
zxfuBv*%&z(6Bzjz1sKJckzy96-cOSqRBq)Z=BCES-{Ojo&&^LM%>l7_;^PZT6LTOk
zMSLL7fD+OzrU1htMGy~cJAweYqX?8fK&pyCp66iVVBwGhi)nHdfig2V``%*BE6pva
zECL4&OKxIGMiHp2ECLmTMIe1esvzS*Mj?3<Y!S$gTO2kJH`;-Ugkq354<ipF2crNZ
I4-*R$06sa{TmS$7

literal 0
HcmV?d00001

diff --git a/__pycache__/population.cpython-37.pyc b/__pycache__/population.cpython-37.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0a6a330d28c49e773950856fc4d57e01af3ba167
GIT binary patch
literal 6259
zcmZ?b<>g{vU|?7<-5`!zih<!Vhy%mS3=9ko3=9m#Q49<WDGVu$ISe5nnkk1dmnn*g
z5yWQBVa{caVg|EWa#(U%qgZp<qS(NE)*SXIc6WvpwiNajh7|T@rYMdSjug%ohA7Sy
zt`zPThA6HS)?fxro|hmSH5qR)YH2dw;_%E%$t=rEDFv~E@=HPzlX6lunQjRu7v*Ob
zr{<>SmBg3k#TVpf=9SzMLlR6$Ev<kE7yBiHOoU+;m_HI27#LC+q8L*cqL@+`Q<z#9
zqL@>dQ&?IUqF7Rd!0u#>VoebSyOJ@AEky+EPR1zq6wwr(6y6rbD2^1d6uuPx7RD&f
z6xI~hRIU`(G?o;B6u}n8C~mNC#BXs0<QJ6YB$j06=Or^i9RZ?2;pq$tPdQL{g6%J1
zs9|hobYW;_tYL^}tO1csDGb33n#_L5j7VBRUI+$h6=PsvNN1>Fh~=wgEMX{NY-VU?
zoXAwj63noYL6fNnWJM83u_n_kCOv~&jM+sT3=9ll;+Lm>XmM&$v3_z!PJU``X--aR
zk-kfQd0tL_VoI@oYNl>hYH5XTYFU0xDah@4iJ3*I#k#qP#U-gl`UP-5=@nG|;<Cxf
zEG|jT&n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git a/algogenetique.py b/algogenetique.py
new file mode 100644
index 0000000..8a1874e
--- /dev/null
+++ b/algogenetique.py
@@ -0,0 +1,38 @@
+import mathutils
+import math
+import numpy
+import RotTable
+from individu import Individu
+from population import Population, afficher
+import croisement
+from Traj3D import *
+from random import random
+import matplotlib.pyplot as plt
+
+
+
+def main(N,tmax,pmutation, proportion,brin="plasmid_8k.fasta"):
+    '''lineList = [line.rstrip('\n') for line in open(brin)]
+	brin = ''.join(lineList[1:])'''
+    L=[]
+    People=Population(N)
+    for i in range(tmax):
+        print(i)
+        max=0
+        best=None
+        People.reproduction(p = proportion, proba_mutation= pmutation)
+        for individu in People.indiv:
+            if individu.score>max:
+                best=individu
+                max=individu.score
+        L.append(max)
+
+    plt.plot([i for i in range(tmax)], L)
+    plt.show()
+    return(best)
+
+
+main(100,100,0,50)
+
+
+
diff --git a/croisement.py b/croisement.py
index 48a399f..96f85a8 100644
--- a/croisement.py
+++ b/croisement.py
@@ -26,30 +26,71 @@ def croisement_un_point(parent1, parent2):
     enfant1 = Individu(RotTable())
     enfant2 = Individu(RotTable())
     comp = 0
-    point_crois= numpy.random.random_integers(0,16)
+    point_crois= numpy.random.random_integers(0,8)
     for doublet in ROT_TABLE:
+        if doublet == "GA":
+            break
         if comp < point_crois:
             enfant1.table.rot_table[doublet] = parent1.table.rot_table[doublet]
+            correspondent_doublet1 = enfant1.table.corr()[doublet]
+            enfant1.table.rot_table[correspondent_doublet1] = parent1.table.rot_table[correspondent_doublet1]
+            enfant1.table.rot_table[correspondent_doublet1][2] *= -1
+
             enfant2.table.rot_table[doublet] = parent2.table.rot_table[doublet]
+            correspondent_doublet2 = enfant2.table.corr()[doublet]
+            enfant2.table.rot_table[correspondent_doublet2] = parent2.table.rot_table[correspondent_doublet2]
+            enfant2.table.rot_table[correspondent_doublet2][2] *= -1
+        
         else :
             enfant1.table.rot_table[doublet] = parent2.table.rot_table[doublet]
+            correspondent_doublet1 = enfant1.table.corr()[doublet]
+            enfant1.table.rot_table[correspondent_doublet1] = parent2.table.rot_table[correspondent_doublet1]
+            enfant1.table.rot_table[correspondent_doublet1][2] *= -1
+
             enfant2.table.rot_table[doublet] = parent1.table.rot_table[doublet]
+            correspondent_doublet2 = enfant2.table.corr()[doublet]
+            enfant2.table.rot_table[correspondent_doublet2] = parent1.table.rot_table[correspondent_doublet1]
+            enfant2.table.rot_table[correspondent_doublet2][2] *= -1
+
         comp += 1
     return enfant1, enfant2
 
 
 def croisement_deux_points(parent1, parent2):
-    enfant1 = RotTable()
-    enfant2 = RotTable()
+    enfant1 = Individu(RotTable())
+    enfant2 = Individu(RotTable())
     comp = 0
-    point_crois1= numpy.random.random_integers(0,16)
-    point_crois2= numpy.random.random_integers(0,16)
+    point_crois1= numpy.random.random_integers(0,8)
+    point_crois2= numpy.random.random_integers(0,8)
     for doublet in ROT_TABLE:
         if comp < min(point_crois1,point_crois2) or comp > max(point_crois1,point_crois2):
-            enfant1.rot_table[doublet] = parent1.rot_table[doublet]
-            enfant2.rot_table[doublet] = parent2.rot_table[doublet]
+            enfant1.table.rot_table[doublet] = parent1.table.rot_table[doublet]
+            correspondent_doublet1 = enfant1.table.corr()[doublet]
+            enfant1.table.rot_table[correspondent_doublet1] = parent1.table.rot_table[correspondent_doublet1]
+            enfant1.table.rot_table[correspondent_doublet1][2] *= -1
+
+            enfant2.table.rot_table[doublet] = parent2.table.rot_table[doublet]
+            correspondent_doublet2 = enfant2.table.corr()[doublet]
+            enfant2.table.rot_table[correspondent_doublet2] = parent2.table.rot_table[correspondent_doublet2]
+            enfant2.table.rot_table[correspondent_doublet2][2] *= -1
+        
         else :
-            enfant1.rot_table[doublet] = parent2.rot_table[doublet]
-            enfant2.rot_table[doublet] = parent1.rot_table[doublet]
+            enfant1.table.rot_table[doublet] = parent2.table.rot_table[doublet]
+            correspondent_doublet1 = enfant1.table.corr()[doublet]
+            enfant1.table.rot_table[correspondent_doublet1] = parent2.table.rot_table[correspondent_doublet1]
+            enfant1.table.rot_table[correspondent_doublet1][2] *= -1
+
+            enfant2.table.rot_table[doublet] = parent1.table.rot_table[doublet]
+            correspondent_doublet2 = enfant2.table.corr()[doublet]
+            enfant2.table.rot_table[correspondent_doublet2] = parent1.table.rot_table[correspondent_doublet1]
+            enfant2.table.rot_table[correspondent_doublet2][2] *= -1
         comp += 1
-    return enfant1, enfant2
\ No newline at end of file
+    return enfant1, enfant2
+
+# parent1 = Individu(RotTable())
+# parent2 = Individu(RotTable())
+# print("parent1: ", parent1.table.rot_table)
+# print("parent2: ", parent2.table.rot_table)
+# enfant1, enfant2 = croisement_un_point(parent1, parent2)
+# print("enfant1: ", enfant1.table.rot_table)
+# print("enfant2: ", enfant2.table.rot_table)
\ No newline at end of file
diff --git a/first_plot.png b/first_plot.png
new file mode 100644
index 0000000000000000000000000000000000000000..0e536fb530ea40bc82a9395940755ad27a030609
GIT binary patch
literal 2412
zcmeAS@N?(olHy`uVBq!ia0y~yU}|7sV0^&A#=yW}dhyN^1_lO}VkgfK4h{~E8jh3>
z1_lPs0*}aI1_u5_5N2FqzdVzHfx)uGHKHUqKdq!Zu_%=xH?gE3C%+^oGfAN=wWv5V
zKTp9(&rr`uM<Ju6q`*pFAE7`mzbIYbl>6ri1_q9ko-U3d6?5KRGh}2?;5lG$VE^-n
zOnquxRb}VT=rAxCoqNx~z;Mr~fq}u0O@Kk+7y}c-5eWx|1_@>k27zP-MusFF1qO#6
zMizz+!%;<}K`@#MMl-@_Suk20j@AgHl_Fi+1$t_g?0c3k-;~6_z`)??>gTe~DWM4f
DIVz$A

literal 0
HcmV?d00001

diff --git a/individu.py b/individu.py
index 0bc68e4..2419381 100644
--- a/individu.py
+++ b/individu.py
@@ -1,7 +1,7 @@
 from RotTable import RotTable
-from Traj3D import *
+from Traj3D import Traj3D
 import numpy as np
-from math import sqrt
+from math import sqrt, inf
 from random import random
 
 P1 = 0.015
@@ -10,27 +10,36 @@ class Individu():
 
     def __init__(self, table):
         self.table = table
-        self.score = None
+        self.score = self.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
     
     def evaluate(self, brin):
         traj = Traj3D()
-        traj.compute(brin, self.table)
+
+        numb_ajout = 3
+
+        fisrt_seq = brin[0:numb_ajout]
+        last_seq = brin[-numb_ajout:]
+
+        traj.compute(last_seq + brin + fisrt_seq, self.table)
         traj_array = np.array(traj.getTraj())
+        list_distance = []
+
+        for i in range(numb_ajout):
+                first_nuc_coordonate = traj_array[numb_ajout+i, 0:3]
+                first_nuc_coordonate_compute = traj_array[-(numb_ajout-i), 0:3]
+                
+                last_nuc_coordonate = traj_array[-(2*numb_ajout-i), 0:3]
+                last_nuc_coordonate_compute = traj_array[i, 0:3]
 
-        first_nucleotide = traj_array[0, 0:3]
-        last_nucleotide = traj_array[-1, 0:3]
-        distance = sqrt(sum((first_nucleotide - last_nucleotide) ** 2))
+                distance_first_nuc = np.linalg.norm(first_nuc_coordonate - first_nuc_coordonate_compute, ord=2)
+                distance_last_nuc = np.linalg.norm(last_nuc_coordonate - last_nuc_coordonate_compute, ord=2)
 
-        first_name = brin[0]
-        last_name = brin[-1]
+                list_distance += [distance_first_nuc, distance_last_nuc]
 
-        rot_computed = self.table.rot_table[last_name+first_name]
-        rot_traj = first_nucleotide - last_nucleotide
-        # print(rot_traj)
-        # print(rot_computed)
-        diff_angle = sum(abs(rot_computed - rot_traj))
 
-        self.score = 1/(distance + diff_angle)
+        self.score = 1/max(list_distance)
+
+        return 1/max(list_distance)
 
 
     def mutation(self, proba = P1):
@@ -39,10 +48,14 @@ 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)
@@ -52,3 +65,9 @@ class Individu():
 # test = Individu(table)
 # test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
 # print(test.score)
+
+
+# qqun=Individu(RotTable())
+# qqun.table.rot_table={'AA': [35.576558502141, 7.433901511509349, -154], 'AC': [33.22048222654215, 5.25191751302917, 143], 'AG': [26.446029097301288, 6.052240462237622, -2], 'AT': [30.47045254036881, 1.333716025628036, 0], 'CA': [34.00734209585039, 33.70710613604862, -64], 'CC': [33.61019622767888, 3.713127032109607, -57], 'CG': [29.664061041382677, 6.725155507162601, 0], 'CT': [26.446029097301288, 6.052240462237622, 2], 'GA': [36.655773481637176, 10.45337581740701, 120], 'GC': [42.26984493493484, 3.5310453395352823, 180], 'GG': [33.61019622767888, 3.713127032109607, -57], 'GT': [33.22048222654215, 5.25191751302917, 143], 'TA': [36.951508786388914, -2.5174751178033303, 0], 'TC': [36.655773481637176, 10.45337581740701, -120], 'TG': [34.00734209585039, 33.70710613604862, -64], 'TT': [35.576558502141, 7.433901511509349, -154]}
+# qqun.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
+# print(qqun.score)
diff --git a/inutile.py b/inutile.py
index 1a2947e..420a646 100644
--- a/inutile.py
+++ b/inutile.py
@@ -31,7 +31,7 @@ class table_rotation(rotation):
         self.dict = {doublet : rotation(doublet) for doublet in ORIGINAL_ROT_TABLE}
 
 table1 = table_rotation()
-print(table1.dict["AA"].x)
+# 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)
diff --git a/population.py b/population.py
index fdcb337..828caac 100644
--- a/population.py
+++ b/population.py
@@ -1,8 +1,9 @@
-import random
-from random import random, randint, randrange
+
+from random import *
 from individu import Individu
 from RotTable import RotTable
-from croisement import * 
+from croisement import croisement_un_point, croisement_deux_points
+import copy
 
 class Population:
     def __init__(self,n):
@@ -13,8 +14,30 @@ class Population:
         """Fonction qui renvoie une nouvelle instance de population a partir d'une liste d'individus"""
         self.n = len(liste_individus)
         self.indiv = liste_individus
+        for i in range(0,self.n):
+            self.indiv[i].evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
+
         return self
 
+    def selection_p_best(self,p=None):
+        if p==None:
+            p=(self.n)//2
+            
+        def tri_rapide_aux(tableau,debut,fin):
+            if debut < fin-1:
+                positionPivot=partitionner(tableau,debut,fin)
+                tri_rapide_aux(tableau,debut,positionPivot)
+                tri_rapide_aux(tableau,positionPivot+1,fin)
+            
+        def tri_rapide(tableau):
+            tri_rapide_aux(tableau,0,len(tableau))
+        
+        liste_individus=self.indiv
+        tri_rapide(liste_individus)
+        individus_selectionnes = [element for element in liste_individus[:p]]
+        self = self.modifier_population(individus_selectionnes)
+
+
     def selection_duel_pondere(self,p=None): 
         if p == None :
             p = (self.n)//2
@@ -31,7 +54,7 @@ class Population:
             y=self.indiv[t]
             vu.add(t)
             vu.add(m)
-            p=random(0,1)
+            p=random()
             if p>x.score/(x.score+y.score):
                 newself.append(y)
             else:
@@ -42,25 +65,32 @@ class Population:
     def selection_duel(self,p=None):
         if p == None :
             p = (self.n)//2
-        newself=[]
+        meilleur = self.indiv[0]
+        for individu in self.indiv :
+            if meilleur.score < individu.score:
+                print("meilleur, individu: ", meilleur.score, individu.score)
+                meilleur = individu
+        newself = [meilleur]
         vu=set()                        
         t=randrange(0,self.n)
-        m=randrange(0,self.n)             
+        m=randrange(0,self.n)
+        non_vu = [i for i in range(0, self.n)]          
         while len(newself)<p:
-            while m in vu:
-                m=randrange(0,self.n)
-            while t in vu:
-                t=randrange(0,self.n)
+            m = choice(non_vu)
+            non_vu.remove(m)
+            t = choice(non_vu)
+            non_vu.remove(t)
+            
             x=self.indiv[m]
             y=self.indiv[t]
-            vu.add(t)
-            vu.add(m)
-            if x.score<=y.score:
+            if x.score>=y.score:
                 newself.append(x)
             else:
                 newself.append(y)
         self = self.modifier_population(newself)
 
+
+
     def selection_par_rang(self,p = None):
         if p == None :
             p = (self.n)//2
@@ -115,33 +145,40 @@ class Population:
         while len(newself)<p:
             m=m=randrange(0, self.n)
             x=self.indiv[m]
-            p=random(0,1)
+            p=random()
             if p<=x.score/somme:
                 newself.append(x)
         self = self.modifier_population(newself)
 
-    def reproduction(self,selection=None,enfant=croisement_un_point, p = None):
+    def reproduction(self,proba_mutation = None, selection=None,enfant=croisement_un_point, p = None):
+        if proba_mutation == None :
+            proba_mutation = 0.001
         if selection == None :
             selection = self.selection_duel
         if p == None :
             p = (self.n)//2
         vieille_taille = self.n
         selection(p)
-        newself = list(self.indiv)
+        newself = [element for element in self.indiv]       
         while len(newself)<vieille_taille:
             m=randrange(0,self.n)
             t=randrange(0,self.n)
-            x=newself[m]
-            y=newself[t]
+            x=copy.deepcopy(newself[m])
+            y=copy.deepcopy(newself[t])
             couple_enfant = enfant(x,y)
+            for child in couple_enfant :
+                child.mutation(proba_mutation)
+                child.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
             newself.append(couple_enfant[0])
             newself.append(couple_enfant[1])
         self = self.modifier_population(newself)
 
+
 def afficher(popu):
     for individu in popu.indiv :
         print("\n individu \n")
         print(individu.table.rot_table)
+        print ("score", individu.score)
     
 def test():
     popu = Population(4)
@@ -149,16 +186,11 @@ def test():
     for individu in popu.indiv :
         individu.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
     afficher(popu)
-    # popu.selection_par_rang()
-    # print("\n SELECTION PAR RANG \n")
-    # afficher(popu)
-    popu.reproduction()
+    popu.reproduction(selection = popu.selection_duel)
     print("\n REPRODUCTION \n")
     afficher(popu)
 
-test()
-
-
+#test()
 
     
 
diff --git a/selection_par_rang.py b/selection_par_rang.py
deleted file mode 100644
index ded5567..0000000
--- a/selection_par_rang.py
+++ /dev/null
@@ -1,45 +0,0 @@
-from random import random
-
-def creer_population(self, liste_individus):
-    self.n = len(liste_individus)
-    self.indiv = set(liste_individus)
-    return self
-
-def selection_par_rang(self, p = n//2):
-    set_individus = self.indiv
-    n = self.n
-
-    def partitionner(tableau,debut,fin):
-        echanger(tableau,debut,random.randint(debut,fin-1)) 
-        partition=debut
-        for i in range(debut+1,fin):
-            if tableau[i].score<tableau[debut].score: 
-                partition+=1 
-                echanger(tableau,i,partition) 
-        echanger(tableau,debut,partition) 
-        return partition
-
-    def tri_rapide_aux(tableau,debut,fin):
-        if debut < fin-1:
-            positionPivot=partitionner(tableau,debut,fin)
-          tri_rapide_aux(tableau,debut,positionPivot)
-          tri_rapide_aux(tableau,positionPivot+1,fin)
-    
-    def tri_rapide(tableau):
-        tri_rapide_aux(tableau,0,len(tableau))
-
-    liste = list(set_individus)
-    tri_rapide(liste)
-    individus_selectionnes = []
-
-    for _ in range(p):
-        curseur = random()*n*(n+1)/2
-        j = 1
-        while j*(j+1)/2 < curseur :
-            j+=1 
-        #on doit prendre l'individu avec le jème score 
-        individus_selectionnes.append(liste[j])
-    self = creer_population(self, liste_individus)
-
-
-    
\ No newline at end of file
-- 
GitLab