Skip to content
Snippets Groups Projects
Commit 52376378 authored by Joan Hérisson's avatar Joan Hérisson
Browse files

refactor

parent 7e3489c4
Branches
No related tags found
No related merge requests found
from copy import deepcopy
from json import load as json_load
from os import path as os_path
here = os_path.abspath(os_path.dirname(__file__))
class RotTable:
"""Represents the rotation table"""
"""Represents a rotation table"""
# 3 first values: 3 angle values
# 3 last values: SD values
__ORIGINAL_ROT_TABLE = json_load(
open(os_path.join(here, 'table.json'))
)
def __init__(self):
self.__Rot_Table = deepcopy(RotTable.__ORIGINAL_ROT_TABLE)
def __init__(self, filename: str = None):
if filename is None:
filename = os_path.join(here, 'table.json')
self.rot_table = json_load(open(filename))
###################
# WRITING METHODS #
###################
def setTwist(self, dinucleotide: str, value: float):
self.rot_table[dinucleotide][0] = value
def setWedge(self, dinucleotide: str, value: float):
self.rot_table[dinucleotide][1] = value
def setDirection(self, dinucleotide: str, value: float):
self.rot_table[dinucleotide][2] = value
###################
# READING METHODS #
###################
def getTwist(self, dinucleotide: str):
return self.getTable()[dinucleotide][0]
def getTwist(self, dinucleotide):
return self.__Rot_Table[dinucleotide][0]
def getWedge(self, dinucleotide: str):
return self.getTable()[dinucleotide][1]
def getWedge(self, dinucleotide):
return self.__Rot_Table[dinucleotide][1]
def getDirection(self, dinucleotide: str):
return self.getTable()[dinucleotide][2]
def getDirection(self, dinucleotide):
return self.__Rot_Table[dinucleotide][2]
def getTable(self):
return self.rot_table
###################
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment