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

debug evaluation

parents ea5818bc 9a9e512e
No related branches found
No related tags found
No related merge requests found
.DS_Store 0 → 100644
File added
File added
File added
from Initialisation import table_rotation from RotTable import RotTable
from Traj3D import * from Traj3D import *
import numpy as np import numpy as np
from math import sqrt from math import sqrt
class Individu(): class Individu():
def __init__(self, rot_table): def __init__(self, table):
self.rot_table = rot_table self.table = table
self.score = None self.score = None
def evaluate(self, brin): def evaluate(self, brin):
traj = Traj3D() traj = Traj3D()
traj.compute(brin, self.rot_table) traj.compute(brin, self.table)
traj_array = np.array(traj.getTraj()) traj_array = np.array(traj.getTraj())
first_nucleotide = traj_array[0, :] first_nucleotide = traj_array[0, 0:3]
last_nucleotide = traj_array[-1, :] last_nucleotide = traj_array[-1, 0:3]
distance = sqrt(sum((first_nucleotide - last_nucleotide) ** 2)) distance = sqrt(sum((first_nucleotide - last_nucleotide) ** 2))
first_name = brin[0] first_name = brin[0]
last_name = brin[-1] last_name = brin[-1]
rot_computed = self.rot_table[last_name+first_name] rot_computed = self.table.Rot_Table[last_name+first_name]
rot_traj = first_name - last_name rot_traj = first_nucleotide - last_nucleotide
print(rot_traj)
print(rot_computed)
diff_angle = sum(abs(rot_computed - rot_traj)) diff_angle = sum(abs(rot_computed - rot_traj))
self.score = 1/(distance + diff_angle) self.score = 1/(distance + diff_angle)
# def mutation(self): def mutation(self):
mutation = 0
# return mutation return mutation
individu1 = Individu(table_rotation()) table = RotTable()
print(individu1.rot_table.dict["AA"].x) test = Individu(table)
\ No newline at end of file test.evaluate("AAAGGATCTTCTTGAGATCCTTTTTTTCTGCGCGTAATCTGCTGCCAGTAAACGAAAAAACCGCCTGGGGAGGCGGTTTAGTCGAA")
print(test.score)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment