diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ce584036d310ff852c50dff6063d64ba8881c0a3 Binary files /dev/null and b/.DS_Store differ diff --git a/__pycache__/RotTable.cpython-36.pyc b/__pycache__/RotTable.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dbb2e4134f6503a6df95598a7c5505e659fc5c85 Binary files /dev/null and b/__pycache__/RotTable.cpython-36.pyc differ diff --git a/__pycache__/Traj3D.cpython-36.pyc b/__pycache__/Traj3D.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ecd80201694553fe02c71577fca8c84a37602d91 Binary files /dev/null and b/__pycache__/Traj3D.cpython-36.pyc differ diff --git a/individu.py b/individu.py index 02c676cb171bfb49572264d1c6d4f55371c35ec2..d01e39b7818e6f09edc0766db823cb1798909f5b 100644 --- a/individu.py +++ b/individu.py @@ -1,33 +1,40 @@ -from table_rotation import table_rotation -from traj3D import * +from RotTable import RotTable +from Traj3D import * import numpy as np from math import sqrt class Individu(): - def __init__(self, rot_table): - self.rot_table = rot_table + def __init__(self, table): + self.table = table self.score = None def evaluate(self, brin): traj = Traj3D() - traj.compute(brin, self.rot_table) + traj.compute(brin, self.table) traj_array = np.array(traj.getTraj()) - first_nucleotide = traj_array[0, :] - last_nucleotide = traj_array[-1, :] - distance = sqrt(sum((last_nucleotide - last_nucleotide) ** 2)) + first_nucleotide = traj_array[0, 0:3] + last_nucleotide = traj_array[-1, 0:3] + distance = sqrt(sum((first_nucleotide - last_nucleotide) ** 2)) first_name = brin[0] last_name = brin[-1] - rot_computed = rot_table[last_name+first_name] - rot_traj = first_name - last_name + 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): - + mutation = 0 return mutation + +table = RotTable() +test = Individu(table) +test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA") +print(test.score)