Beispiel #1
0
 def translate(self):
     input_seq = self.ui.text_input.toPlainText()
     try:
         dna_instance = dna(seq=input_seq, type=self.type)
         self.ui.textEdit_console.clear()
         self.ui.textEdit_console.insertPlainText(
             dna_instance.translate_seq())
         self.ui.textEdit_console.moveCursor(qtg.QTextCursor.Start)
     except:
         self.invalid()
Beispiel #2
0
 def random_seq(self):
     dna_instance = dna()
     if self.ui.textEdit_length.text():
         length = int(self.ui.textEdit_length.text())
         dna_instance.generate_random(length=length,
                                      new_type=str(self.type))
     else:
         dna_instance.generate_random(new_type=self.type)
     self.ui.text_input.clear()
     self.ui.text_input.insertPlainText(dna_instance.seq)
     self.ui.text_input.moveCursor(qtg.QTextCursor.Start)
Beispiel #3
0
 def read_frames(self):
     input_seq = self.ui.text_input.toPlainText()
     try:
         dna_instance = dna(seq=input_seq, type=self.type)
         reading_frames = "[Open reading frames]:\n\n"
         for i, j in zip(dna_instance.open_reading_frames(), range(1, 7)):
             reading_frames += f"[{j}]: {i}\n\n"
         self.ui.textEdit_console.clear()
         self.ui.textEdit_console.insertPlainText(reading_frames)
         self.ui.textEdit_console.moveCursor(qtg.QTextCursor.Start)
     except:
         self.invalid()
Beispiel #4
0
 def seq_info(self):
     input_seq = self.ui.text_input.toPlainText()
     input_label = self.ui.textEdit_label.text()
     try:
         dna_instance = dna(seq=input_seq,
                            type=self.type,
                            label=input_label)
         self.ui.textEdit_console.clear()
         self.ui.textEdit_console.insertPlainText(
             dna_instance.get_info() + '\n[GC content]: ' +
             str(dna_instance.gc_content()) + '%')
         self.ui.textEdit_console.moveCursor(qtg.QTextCursor.Start)
     except:
         self.invalid()
Beispiel #5
0
 def proteinsORF(self):
     input_seq = self.ui.text_input.toPlainText()
     try:
         dna_instance = dna(seq=input_seq, type=self.type)
         proteins_found = dna_instance.proteins_rf()
         num_proteins = len(proteins_found)
         prots = f"[Proteins from all open reading frames]: Found {num_proteins} proteins\n\n"
         for i, j in zip(proteins_found, range(1, num_proteins + 1)):
             prots += f"[{j}]: {i}\n\n"
         self.ui.textEdit_console.clear()
         self.ui.textEdit_console.insertPlainText(prots)
         self.ui.textEdit_console.moveCursor(qtg.QTextCursor.Start)
     except:
         self.invalid()
Beispiel #6
0
#!/usr/bin/env python

from double_helix import double_helix as dna
from utilities import read_FASTA, read_textfile, write_textfile

test_seq = dna()
test_seq.generate_random(40, 'RNA')

for rf in test_seq.open_reading_frames():
    write_textfile('rfs.txt', rf, 'a')