Skip to content
Snippets Groups Projects
Commit f55549be authored by Gauthier Roy's avatar Gauthier Roy
Browse files

fix in the distance

parent 293c6eb1
Branches
No related tags found
No related merge requests found
{ {
"python.pythonPath": "D:\\Programmes\\Anaconda3\\python.exe" "python.pythonPath": "/Users/gauthierroy/anaconda3/bin/python"
} }
\ No newline at end of file
...@@ -53,16 +53,16 @@ class RotTable: ...@@ -53,16 +53,16 @@ class RotTable:
################### ###################
def getTwist(self, dinucleotide): def getTwist(self, dinucleotide):
return RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][0] return self.rot_table[dinucleotide][0]
def getWedge(self, dinucleotide): def getWedge(self, dinucleotide):
return RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][1] return self.rot_table[dinucleotide][1]
def getDirection(self, dinucleotide): def getDirection(self, dinucleotide):
return RotTable.__ORIGINAL_ROT_TABLE[dinucleotide][2] return self.rot_table[dinucleotide][2]
################### ###################
table1 = RotTable() #table1 = RotTable()
print(table1.orta()) #print(table1.orta())
...@@ -65,3 +65,9 @@ class Traj3D: ...@@ -65,3 +65,9 @@ class Traj3D:
ax.plot(x,y,z) ax.plot(x,y,z)
plt.show() plt.show()
plt.savefig(filename) 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
No preview for this file type
No preview for this file type
first_plot.png

2.36 KiB

...@@ -13,21 +13,15 @@ class Individu(): ...@@ -13,21 +13,15 @@ class Individu():
traj = Traj3D() traj = Traj3D()
traj.compute(brin, self.table) traj.compute(brin, self.table)
traj_array = np.array(traj.getTraj()) traj_array = np.array(traj.getTraj())
print(traj_array)
first_nucleotide = traj_array[0, 0:3] first_nucleotide = traj_array[0, 0:3]
last_nucleotide = traj_array[-1, 0:3] last_nucleotide = traj_array[-1, 0:3]
print(first_nucleotide)
print(last_nucleotide)
distance = sqrt(sum((first_nucleotide - last_nucleotide) ** 2)) distance = sqrt(sum((first_nucleotide - last_nucleotide) ** 2))
diff_ideal_distance = abs(3.38 - distance)
first_name = brin[0] self.score = 1/(diff_ideal_distance )
last_name = brin[-1]
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)
def mutation(self): def mutation(self):
...@@ -37,4 +31,5 @@ class Individu(): ...@@ -37,4 +31,5 @@ class Individu():
table = RotTable() table = RotTable()
test = Individu(table) test = Individu(table)
test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA") test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
print(table.rot_table)
print(test.score) print(test.score)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment