def exec_tout(self, brin): adn = bio.DNA(brin) left, center, right = adn.display_translated(return_lines=True) # add directions start = f'{adn.strand2.start}{_s*3}{adn.strand1.start}{_s*3}{adn.strand2.start}{_s*3}{adn.strand1.start}' end = f'{adn.strand2.end}{_s*3}{adn.strand1.end}{_s*3}{adn.strand2.end}{_s*3}{adn.strand1.end}' start = bio.get_c(start, "grey") end = bio.get_c(end, "grey") center.insert(0, start) center.append(end) # add padding lines to left & right left = [''] + left + [''] right = [''] + right + [''] left = self._format_lines(lines=left) center = self._format_lines(lines=center) right = self._format_lines(lines=right) self.text_left.setText(left) self.text_center.setText(center) self.text_right.setText(right)
def exec_transcription(self, brin): brin = brin.transcribe() lines = list(str(brin)) # add directions start = bio.get_c(brin.start, "grey") end = bio.get_c(brin.end, "grey") lines = [start] + lines + [end] lines = self._format_lines(lines=lines) self.text_center.setText(lines)
def exec_double_brins(self, brin): adn = bio.DNA(brin) lines = adn.__str__(get_lines=True) # add directions start = f'{adn.strand1.start}{_s*3}{adn.strand2.start}' end = f'{adn.strand1.end}{_s*3}{adn.strand2.end}' start = bio.get_c(start, "grey") end = bio.get_c(end, "grey") lines.insert(0, start) lines.append(end) string = self._format_lines(lines=lines) self.text_center.setText(string)
def exec_traduction(self, brin): ribose = bio.Ribose(brin.transcribe()) # sep acid names and genome names, arn = [], [] for line in ribose.__str__(side='left', get_lines=True): line = line.split(' ') names.append(' '.join(line[:-2])) arn.append(' '.join(line[-2:])) # add directions start = bio.get_c(ribose.start, "grey") end = bio.get_c(ribose.end, "grey") arn = [start] + arn + [end] names = [''] + names + [''] names = self._format_lines(lines=names) arn = self._format_lines(lines=arn) self.text_left.setText(names) self.text_center.setText(arn)
def display_error(self, msg): self.reset() self.text_left.setText(bio.get_c(msg, "red"))