From 9ea436a85aa4b4cf8b6ef3496c8eda4333923397 Mon Sep 17 00:00:00 2001 From: Leche Quemada Date: Sun, 25 Mar 2018 21:46:34 -0600 Subject: [PATCH] Lots of bugs fixed, GUI added, now importable module --- Genes_v1.1.0.py | 183 ----------------------- README.es.md | 16 -- README.md | 16 -- __pycache__/dnatoprotein.cpython-35.pyc | Bin 0 -> 5371 bytes dnatoprotein.py | 191 ++++++++++++++++++++++++ gui.py | 163 ++++++++++++++++++++ locale/en/LC_MESSAGES/en.mo | Bin 0 -> 1291 bytes locale/en/LC_MESSAGES/en.po | 53 +++++++ locale/en/LC_MESSAGES/gui_en.mo | Bin 0 -> 1117 bytes locale/en/LC_MESSAGES/gui_en.po | 84 +++++++++++ locale/en/LC_MESSAGES/translate.mo | Bin 1942 -> 0 bytes locale/en/LC_MESSAGES/translate.po | 79 ---------- translate.pot | 66 -------- translategui.pot | 72 +++++++++ translation.pot | 41 +++++ 15 files changed, 604 insertions(+), 360 deletions(-) delete mode 100755 Genes_v1.1.0.py delete mode 100644 README.es.md delete mode 100644 README.md create mode 100644 __pycache__/dnatoprotein.cpython-35.pyc create mode 100755 dnatoprotein.py create mode 100755 gui.py create mode 100644 locale/en/LC_MESSAGES/en.mo create mode 100644 locale/en/LC_MESSAGES/en.po create mode 100644 locale/en/LC_MESSAGES/gui_en.mo create mode 100644 locale/en/LC_MESSAGES/gui_en.po delete mode 100644 locale/en/LC_MESSAGES/translate.mo delete mode 100644 locale/en/LC_MESSAGES/translate.po delete mode 100644 translate.pot create mode 100644 translategui.pot create mode 100644 translation.pot diff --git a/Genes_v1.1.0.py b/Genes_v1.1.0.py deleted file mode 100755 index 696c3d5..0000000 --- a/Genes_v1.1.0.py +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -#Paso 0. Dependencias y variables: -import re -import sys -import gettext -import locale - -lugar = locale.getdefaultlocale() - -continuar = True -liGEN=[] -does_ends="" - -en = gettext.translation('translate', localedir='locale', languages=['en']) - - -if len(sys.argv) > 1: - if sys.argv[1] == "es": - _ = lambda s: s - if sys.argv[1] == "en": - en.install() -else: - if "es" in lugar[0]: - _ = lambda s: s - else: - en.install() - -#Paso 1. Input de la cadena: -cadena0 = input(_("Escribe la cadena a transcribir: ")) -cadenat = input(_("¿Cadena molde [escriba 't'] (3'5) o complementaria [escriba 'n'] (5'3)? ")) -intrones = input(_("Escribe los intrones ARN o ADN a usar separados por un espacio (e.g. GGG AAT TTA UUA): ")) -intronet = input(_("¿Intrones tipo ARN [escriba 'R'] o ADN [escriba 'D']? (ARN por defecto) ")) -if intronet == "D": - intrones = intrones.replace("G", "P").replace("C", "G").replace("P", "C") - intrones = intrones.replace("A", "H").replace("T", "A").replace("H", "U") -intrones = intrones.split(" ") - - - -print("\n") - -#Define funcion TRANSCRIPCION -def transcripcion( gen,tipo ): - sinicio = ['TAC'] - salto = ['ATC','ACT','ATT'] - global cadena0 - global cadenat - global continuar - global liGEN - global does_ends - - - #Crear cadena molde - if tipo == "n": - #Reemplazar C's por G's y G's por C's de forma astuta - gen = gen.replace("G", "P").replace("C", "G").replace("P", "C") - #Reemplazar A's por T's y T's por A's de forma astuta - gen = gen.replace("A", "H").replace("T", "A").replace("H", "T") - - print(_("Se usará la cadena {} como molde").format(gen)) - #No crear cadena molde - elif tipo == "t": - print(_("Se usará la cadena {} como molde").format(gen)) - - else: - print(_("Escriba el tipo de cadena correctamente")) - quit() - - #Verificar señal de inicio - if sinicio[0] in gen: - #Partir desde señal de inicio - liCAD = gen.split(sinicio[0], 1) - preINI = liCAD[0] - posINI = liCAD[1] - #Crear lista de tripletes - liPOS_INI = re.findall('..?.?', posINI) - #Buscar s-alto en liPOS_INI - if any(x in salto for x in liPOS_INI): - #Hacer lista de s-altos encontrados - salto_s = [i for i in liPOS_INI if i in salto] - indSALTO = liPOS_INI.index(salto_s[0]) - liGEN = liPOS_INI[0:indSALTO] - cadena0 = ''.join(liPOS_INI[indSALTO+1:]) - #Imprimir gen dividido - print(_("Se encontró el gen {} {} {} {} {}").format(preINI, sinicio[0], ' '.join(liGEN), salto_s[0], cadena0)) - liGEN.append(salto_s[0]) - - - else: - liGEN = liPOS_INI - #Imprimir gen incompleto - does_ends = "..." - print(_("Se encontró el gen {} {} {}{}").format(preINI, sinicio[0], ' '.join(liGEN), does_ends)) - cadena0 = "" - - #Aunar a lista el inicio - liGEN.insert(0, sinicio[0]) - - #Reemplazar de forma astuta - liGEN = [i2.replace("G", "P").replace("C", "G").replace("P", "C") for i2 in liGEN] - liGEN = [i3.replace("A", "H").replace("T", "A").replace("H", "U") for i3 in liGEN] - - print(_("El ARN Inmaduro es: {}{}").format(' '.join(liGEN), does_ends)) - - #Remover intrones - for i4 in intrones: - liGEN[:] = [i5 for i5 in liGEN if i5 != i4] - - print(_("El ARN Maduro es: GTP + {}{} + PoliA").format(' '.join(liGEN), does_ends)) - - if sinicio[0] in cadena0: - continuar = True - cadenat = "t" - else: - continuar = False - - - - - - - - - - else: - print(_("La cadena molde no contiene un gen, revise la misma y su tipo")) - quit() - - -def traduccion( arn ): - #Tuples Definidas - Met = ["AUG"] - Ile = ["AUA", "AUC", "AUU"] - Arg = ["AGG", "AGA", "CGG", "CGA", "CGC", "CGU"] - Ser = ["AGC", "AGU", "UCG", "UCA", "UCC", "UCU"] - Thr = ["ACG", "ACA", "ACC", "ACU"] - Lys = ["AAG", "AAA"] - Asn = ["AAC", "AAU"] - Leu = ["UUG", "UUA", "CTG", "CTA", "CTC", "CTU"] - Phe = ["UUC", "UUU"] - Trp = ["UGG"] - STP = ["UGA", "UAG", "UAA"] - Cys = ["UGC", "UGU"] - Tyr = ["UAC", "UAU"] - Val = ["GUG", "GUA", "GUC", "GUU"] - Gly = ["GGG", "GGA", "GGC", "GGU"] - Ala = ["GCG", "GCA", "GCC", "GCU"] - Glu = ["GAA", "GAG"] - Asp = ["GAU", "GAC"] - Pro = ["CCG", "CCA", "CCC", "CCU"] - Gln = ["CAA", "CAG"] - His = ["CAU", "CAC"] - - #Proteinas enlistadas - aminoacids = [Met,Ile,Arg,Ser,Thr,Lys,Asn,Leu,Phe,Trp,STP,Cys,Tyr,Val,Gly,Ala,Glu,Asp,Pro,Gln,His] - aminocopy = ["Met","Ile","Arg","Ser","Thr","Lys","Asn","Leu","Phe","Trp","STP","Cys","Tyr","Val","Gly","Ala","Glu","Asp","Pro","Gln","His"] - - protein = "" - - for triplete in arn: - for amino in aminoacids: - for value in amino: - if value == triplete: - theindex = aminoacids.index(amino) - amcopy = aminocopy[theindex] - protein += amcopy + " - " - - - protein = protein.rstrip("- STP") - print(_("La proteína es: {}{} \n").format(protein, does_ends)) - return - - - - - -while continuar: - transcripcion(cadena0, cadenat) - traduccion(liGEN) - - diff --git a/README.es.md b/README.es.md deleted file mode 100644 index 5c3f2e9..0000000 --- a/README.es.md +++ /dev/null @@ -1,16 +0,0 @@ -# Proteína a ADN -Programa en Python para ayudar al usuario en la transcripción y traducción de una cadena de ADN a un gen ARN y a continuación a una cadena de aminoácidos, es decir, una proteína. Para ejecutar, escribir en una terminal: - -```shell -$ ./Genes_v1.1.0.py -``` - -Siempre que Python 3 se use para ejecutarlo, correrá sin problemas. -Traducción al Inglés y Español basado en el locale del sistema, o pasando un argumento de lenguaje: - -```shell -$ ./Genes_v1.1.0.py [es/en] -``` - -To read this in [English, click here.](README.md) -Para leer esto en [Inglés, click aquí](README.md) diff --git a/README.md b/README.md deleted file mode 100644 index 2b1c129..0000000 --- a/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# DNA to Protein -Simple Python script to aid the user at transcribing and translating an DNA chain to an RNA gene and subsequently to a chain of aminoacids, that is, a protein. To execute type on a terminal: - -```shell -$ ./Genes_v1.1.0.py -``` - -As long as python3 is used to execute it, it will run properly, thus a GUI will work just as well. -English and Spanish translations based on the locale of the system, or selected by passing an argument at execution: - -```shell -$ ./Genes_v1.1.0.py [es/en] -``` - -To read this in [Spanish, click here.](README.es.md) -Para leer esto en [Español, click aquí](README.es.md) diff --git a/__pycache__/dnatoprotein.cpython-35.pyc b/__pycache__/dnatoprotein.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bae7dcac186ab373d5523b0ab6d760fda1c603ac GIT binary patch literal 5371 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 literal 0 HcmV?d00001 diff --git a/dnatoprotein.py b/dnatoprotein.py new file mode 100755 index 0000000..983c64d --- /dev/null +++ b/dnatoprotein.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +#Dependencias y variables: +import re +import sys +import gettext +import locale + +lugar = locale.getdefaultlocale() + +en = gettext.translation('en', localedir='locale', languages=['en']) + + +if len(sys.argv) > 1: + if sys.argv[1] == "es": + _ = lambda s: s + if sys.argv[1] == "en": + en.install() +else: + if "es" in lugar[0]: + _ = lambda s: s + else: + en.install() + +def main(): + #Paso 1. Input de la cadena: + cadena = input(_("Escriba la cadena de ADN a convertir: ")) + tipo_c = input(_("¿La cadena es molde [escriba 't'] (3'5) o complementaria [escriba 'n'] (5'3)? ")) + intrones = input(_("Escriba los intrones ARN o ADN a usar separados por un espacio (e.g. TCA AAC CGC GAT): ")) + tipo_i = input(_("¿Intrones tipo ARN [escriba 'R'] o ADN [escriba 'D']? (ARN por defecto) ")) + print("\n") + + try: + paso_uno = preconversion(cadena, tipo_c, intrones, tipo_i) + #Imprimir cadena molde + print(paso_uno[0]) + + paso_dos = transcripcion(paso_uno[0], paso_uno[1]) + #Cadena dividida en inicio, tripletes, final + print(paso_dos[0][0] + ' '.join(paso_dos[0][1]) + paso_dos[0][2] + "\n") + #ARN Inmaduro y Maduro + print(' '.join(paso_dos[1]) + "\n" + ' '.join(paso_dos[2]) + "\n") + + paso_tres = traduccion(paso_dos[2]) + #Imprimir lista de proteínas + print(' '.join(paso_tres) + "\n") + + try: + while True: + paso_dos = transcripcion(paso_dos[0][2], paso_uno[1]) + #Cadena dividida en inicio, tripletes, final + print(paso_dos[0][0] + ' '.join(paso_dos[0][1]) + paso_dos[0][2] + "\n") + #ARN Inmaduro y Maduro + print(' '.join(paso_dos[1]) + "\n" + ' '.join(paso_dos[2]) + "\n") + + paso_tres = traduccion(paso_dos[2]) + #Imprimir lista de proteínas + print(' '.join(paso_tres) + "\n") + + except ValueError: + print (_("Conversión completa")) + + + except ValueError as ve: + print (ve) + + + +def preconversion(gen, gtipo, intrones, itipo): + #Primera función, toma una cadena de ADN, su tipo (Molde [t] o Complementaria [n]) + #una cadena de intrones separados por un espacio, su tipo (ADN [D] o ARN [R]) + #Convertir Intrones ADN -> ARN + if itipo == "D": + intrones = intrones.replace("G", "P").replace("C", "G").replace("P", "C") + intrones = intrones.replace("A", "H").replace("T", "A").replace("H", "U") + #Hacer lista de intrones + intrones = intrones.split(" ") + + #Crear cadena molde a partir de la complementaria + if gtipo == "n": + #Reemplazar C's por G's y G's por C's de forma astuta + gen = gen.replace("G", "P").replace("C", "G").replace("P", "C") + #Reemplazar A's por T's y T's por A's de forma astuta + gen = gen.replace("A", "H").replace("T", "A").replace("H", "T") + + #La función regresa la cadena molde y los intrones en el lenguaje correcto {Tupla(Str, Lista)} + return (gen,intrones) + +def transcripcion(gen, intrones): + #Segunda función, toma una cadena molde de ADN e intrones en una lista + #en ARN, lo convierte a un ARN Maduro, con pasos intermedios + #con propósito de comprensión del proceso, devuelve en total Tupla(Str, Lista, Tupla(Str, Str), Lista, Lista) + + + #Definimos la señal de inicio y las de alto + s_inicio = ['TAC'] + s_alto = ['ATC','ACT','ATT'] + + #Si la cadena contiene la señal de inicio... + if s_inicio[0] in gen: + #Partir desde señal de inicio + val_uno = gen.split(s_inicio[0], 1) + #Crear lista de tripletes + tripletes_uno = re.findall('..?.?', val_uno[1]) + + #Buscar señal de alto en tripletes + if any(triplete in s_alto for triplete in tripletes_uno): + #Hacer lista de señales de alto encontradas + altos_uno = [triplete for triplete in tripletes_uno if triplete in s_alto] + #Buscar el índice de la primera en tripletes + s_alto_uno = tripletes_uno.index(altos_uno[0]) + #Crear tripletes dos hasta la señal de alto + tripletes_dos = tripletes_uno[0:s_alto_uno] + gen_2 = ''.join(tripletes_uno[s_alto_uno+1:]) + final_cadena = (altos_uno[0], gen_2) + #val_uno[0] + tripletes_dos + final_cadena[n] + + else: + tripletes_dos = tripletes_uno + final_cadena = ("...", "") + + #Aunar a lista el inicio + tripletes_dos.insert(0, s_inicio[0]) + #Aunar a lista el final + tripletes_dos.append(final_cadena[0]) + #Crear tupla con información del gen final + cadena_des = (val_uno[0], tripletes_dos, final_cadena[1]) + #Reemplazar de forma astuta, se obtiene ADN Inmaduro + tripletes_tres = [triplete.replace("G", "P").replace("C", "G").replace("P", "C") for triplete in tripletes_dos] + tripletes_tres = [triplete.replace("A", "H").replace("T", "A").replace("H", "U") for triplete in tripletes_tres] + #Remover intrones, se obtiene ADN Maduro + tripletes_cuatro = [x for x in tripletes_tres if x not in intrones] + #Regresamos la cadena partida en inicio, gen, final {Tupla(Str, Lista, Str)} + # ARN Inmaduro {Lista} + # ARN Maduro {Lista} + # {Tupla(Tupla(Str, Lista, Tupla(Str, Str)), Lista, Lista))} + return (cadena_des, tripletes_tres, tripletes_cuatro) + + #Si la señal no contiene la señal de inicio... + else: + raise ValueError(_("La cadena proporcionada no contiene un gen.")) + + +def traduccion(arn): + #Tercera función, toma una cadena de ADN Maduro en forma de lista + #Regresa una tupla con las abreviaturas de las proteínas en ella + #Tuplas Definidas + Met = ("AUG",) + Ile = ("AUA", "AUC", "AUU") + Arg = ("AGG", "AGA", "CGG", "CGA", "CGC", "CGU") + Ser = ("AGC", "AGU", "UCG", "UCA", "UCC", "UCU") + Thr = ("ACG", "ACA", "ACC", "ACU") + Lys = ("AAG", "AAA") + Asn = ("AAC", "AAU") + Leu = ("UUG", "UUA", "CUG", "CUA", "CUC", "CUU") + Phe = ("UUC", "UUU") + Trp = ("UGG",) + STP = ("UGA", "UAG", "UAA") + Cys = ("UGC", "UGU") + Tyr = ("UAC", "UAU") + Val = ("GUG", "GUA", "GUC", "GUU") + Gly = ("GGG", "GGA", "GGC", "GGU") + Ala = ("GCG", "GCA", "GCC", "GCU") + Glu = ("GAA", "GAG") + Asp = ("GAU", "GAC") + Pro = ("CCG", "CCA", "CCC", "CCU") + Gln = ("CAA", "CAG") + His = ("CAU", "CAC") + + #Proteinas enlistadas + aminoacids = (Met,Ile,Arg,Ser,Thr,Lys,Asn,Leu,Phe,Trp,STP,Cys,Tyr,Val,Gly,Ala,Glu,Asp,Pro,Gln,His) + aminocopy = ("Met","Ile","Arg","Ser","Thr","Lys","Asn","Leu","Phe","Trp","STP","Cys","Tyr","Val","Gly","Ala","Glu","Asp","Pro","Gln","His") + + protein = [] + for triplete in arn: + for amino, amcopy in zip(aminoacids, aminocopy): + for value in amino: + if value == triplete: + protein.append(amcopy) + #Regresa lista + return protein + +if __name__ == "__main__": + main() + + + + + + diff --git a/gui.py b/gui.py new file mode 100755 index 0000000..9244939 --- /dev/null +++ b/gui.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +#Paquetes y Variables Necesarias +from dnatoprotein import * +import gettext +import locale +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk + +lugar = locale.getdefaultlocale() + +en = gettext.translation('gui_en', localedir='locale', languages=['en']) + + +if len(sys.argv) > 1: + if sys.argv[1] == "es": + _ = lambda s: s + if sys.argv[1] == "en": + en.install() +else: + if "es" in lugar[0]: + _ = lambda s: s + else: + en.install() + +#Se crea la Ventana +class ADNaProteina(Gtk.Window): + + #Auto Función + def __init__(self): + #Título de la Ventana + Gtk.Window.__init__(self, title=_("ADN a Proteína")) + #Borde de la Ventana + self.set_border_width(20) + #Caja Maestra + box_outer = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=50) + #Añadiendo Caja Maestra + self.add(box_outer) + #Creando ListBox, modo de selección y añadiéndola + listbox = Gtk.ListBox() + listbox.set_selection_mode(Gtk.SelectionMode.NONE) + box_outer.pack_start(listbox, True, True, 0) + + ##########Empieza Primer Fila########## + #Declaramos Fila + row_one = Gtk.ListBoxRow() + #Declaramos 1ra caja vertical, la añadimos + vbox_one = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8) + row_one.add(vbox_one) + #Declaramos 1ra caja horizontal, la añadimos a caja v. + hbox_one = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5) + vbox_one.pack_start(hbox_one, True, True, 0) + #Ventana -> Caja Maestra -> ListBox -> 1ra Fila -> Caja V -> Caja H + #Creamos entrada uno, con placeholder, y preferentemente mayusculas + entry1 = Gtk.Entry() + entry1.set_placeholder_text(_("Ingrese la cadena y seleccione tipo")) + hint = Gtk.InputHints(16) + entry1.set_input_hints(hint) + #Creamos lista de opciones para tipos de cadena e intrones + chtipos=[_("Molde (3'5)"), _("Complementaria (5'3)")] + acids=["ARN", "ADN"] + #Creamos primer combo, añadimos opciones + acid_combo = Gtk.ComboBoxText() + for chtipo in chtipos: + acid_combo.append_text(chtipo) + #Por defecto seleccionamos ADN + acid_combo.set_active(0) + #Añadimos a la caja la entrada y el combo + hbox_one.pack_start(entry1, True, True, 0) + hbox_one.pack_start(acid_combo, False, True, 0) + #Declaramos la 2nda caja horizontal, la añadimos a caja v. + hbox_two = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5) + vbox_one.pack_start(hbox_two, True, True, 0) + #Declaramos 2nda entrada, con placeholder y hints + entry2 = Gtk.Entry() + entry2.set_placeholder_text(_("Ingrese los intrones separados por un espacio")) + entry1.set_input_hints(hint) + #Creamos segundo combo, añadimos opciones + intron_combo = Gtk.ComboBoxText() + for acid in acids: + intron_combo.append_text(acid) + #Por defecto seleccionamos ADN + intron_combo.set_active(0) + #Añadimos a la caja el combo y la entrada + hbox_two.pack_start(entry2, True, True, 0) + hbox_two.pack_start(intron_combo, False, True, 0) + #Declaramos el botón principal + button_one = Gtk.Button.new_with_mnemonic(_("_Convert")) + #Declaramos texto final por llamado a función + label = Gtk.Label() + #Al presionar, función luego descrita + button_one.connect("clicked", self.on_button_clicked, entry1, entry2, acid_combo, intron_combo, label) + #Añadir botón a la caja vertical + vbox_one.pack_start(button_one, True, True, 0) + #Añadir fila a ListBox + listbox.add(row_one) + ##########Termina Primer Fila########## + + ##########Empieza Segunda Fila########## + #Creamos segunda fila + row_two = Gtk.ListBoxRow() + #Y creamos caja vertical dos, ponemos borde + vbox_two = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10, border_width=15) + #Añadimos a la fila la caja v.2 + row_two.add(vbox_two) + #Ponemos placeholder + label.set_text(_("Aquí se mostrarán los resultados")) + #Lo hacemos seleccionable, con line-wrap + label.set_selectable(True) + #label.set_line_wrap(True) + #Añadimos el texto a la caja v.2 + vbox_two.pack_start(label, True, True, 0) + #Añadimos la fila a ListBox + listbox.add(row_two) + + #Función usada al presionar botón + def on_button_clicked(self, button, entry1, entry2, combo1, combo2, label): + label.set_text(_("Empezando conversión")) + if combo1.get_active() == 0: + tipo_c = "t" + else: + tipo_c = "n" + cadena = entry1.get_text() + intrones = entry2.get_text() + if combo2.get_active() == 0: + tipo_i = "R" + else: + tipo_i = "N" + + try: + paso_uno = preconversion(cadena, tipo_c, intrones, tipo_i) + paso_dos = transcripcion(paso_uno[0], paso_uno[1]) + paso_tres = traduccion(paso_dos[2]) + #Imprimir + chain = (paso_dos[0][0] + " " + ' '.join(paso_dos[0][1]) + " " + paso_dos[0][2]) + label.set_text(_("{}\n{}\n{}\n{}\n{}").format(paso_uno[0], chain, ' '.join(paso_dos[1]), ' '.join(paso_dos[2]), ' '.join(paso_tres))) + + + try: + while True: + paso_dos = transcripcion(paso_dos[0][2], paso_uno[1]) + paso_tres = traduccion(paso_dos[2]) + #Imprimir + label.set_text(_("{}\n{}\n{}\n{}\n{}\n{}").format(label.get_text(), paso_uno[0], chain, ' '.join(paso_dos[1]), ' '.join(paso_dos[2]), ' '.join(paso_tres))) + + + except ValueError: + print (_("Conversión completa")) + + + except ValueError as ve: + label.set_text(_("")) + + + + +win = ADNaProteina() +win.connect("delete-event", Gtk.main_quit) +win.resize(1200, 300) +win.show_all() +Gtk.main() diff --git a/locale/en/LC_MESSAGES/en.mo b/locale/en/LC_MESSAGES/en.mo new file mode 100644 index 0000000000000000000000000000000000000000..71e035ecb5f7779251fac765ad7ad6f961d80c02 GIT binary patch literal 1291 zcmaJ=O>Yx15M7{v6mAGOaTrcXM7<=bipo}16_U29)Q_kH3PL@&*=cH&*ely9L|ovA z#FhWRoeP|hKwS9={0z=K?`|7Fh?OQ2d*94^<9+^db?#k+=Q83ZqK~+Oc#85calD~m;04-J*>Z=%| zXU#M87MrPf6b{+wgetw=zUWw%9!t@co)c;{noFXwAXyCb$@O%F_}^e~~NL**+QICl%hsklE)D4P!1hh}j$rDnWXc`QnRfjfGJQ{|}@ zH{!dH=)fMjj-(H7E4|Ug%8^(%cI*<;S-x~Dtz|0yuGBQ$TA^lr`E0&~SXZJ`!y1i2 z>{#ibC)&5lGx=kt?oK;QrSRI&A@%}mursF#MY&bd$)La%o(=o(NZMS{bd_)- zxtQnqMDXu?5R?lmx4P9hM<_=VSIC2h=ejswemJWmo=NjTPy g=OI;#;$zpTB=RM9cr~kpx#w{>dC^}5x(Wrq00}H~2><{9 literal 0 HcmV?d00001 diff --git a/locale/en/LC_MESSAGES/en.po b/locale/en/LC_MESSAGES/en.po new file mode 100644 index 0000000..0d65ee7 --- /dev/null +++ b/locale/en/LC_MESSAGES/en.po @@ -0,0 +1,53 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: 2018-03-25 21:09-0600\n" +"PO-Revision-Date: 2018-03-25 21:18-0600\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" +"X-Generator: Poedit 2.0.6\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: en\n" + +#: dnatoprotein.py:30 +msgid "Escriba la cadena de ADN a convertir: " +msgstr "Write the DNA chain to be transcribed: " + +#: dnatoprotein.py:31 +msgid "" +"¿La cadena es molde [escriba 't'] (3'5) o complementaria [escriba 'n'] " +"(5'3)? " +msgstr "" +"What type of chain is it? For template (3'5, anti-sense, non-coding) write " +"'t', for non-template (5'3, sense, coding) write 'n': " + +#: dnatoprotein.py:32 +msgid "" +"Escriba los intrones ARN o ADN a usar separados por un espacio (e.g. TCA AAC " +"CGC GAT): " +msgstr "" +"Introduce the introns in RNA or DNA format separated by a space (e.g. TCA " +"AAC CGC GAT): " + +#: dnatoprotein.py:33 +msgid "" +"¿Intrones tipo ARN [escriba 'R'] o ADN [escriba 'D']? (ARN por defecto) " +msgstr "" +"What type of introns are they? For RNA write 'R', for DNA write 'D'. RNA is " +"used by default: " + +#: dnatoprotein.py:64 +msgid "Conversión completa" +msgstr "Conversion terminated" + +#: dnatoprotein.py:144 +msgid "La cadena proporcionada no contiene un gen." +msgstr "The given chain does not contain a gene." diff --git a/locale/en/LC_MESSAGES/gui_en.mo b/locale/en/LC_MESSAGES/gui_en.mo new file mode 100644 index 0000000000000000000000000000000000000000..4675ff0159a089d9e9024111112ac25315e0ea49 GIT binary patch literal 1117 zcmb7?OHWfl6vs!!*VSl5-4SyTBe1x&kCc#$T_6-C0ya{OJ2Uhi%Qd$%*O@6;pI<_^ zCVl`G#*O>N4`E_l`T^V;6aUj&feCB^)+Zhwa?Q%758r0IWDlxjbU&PL^_qm6Ils zG*z9fOyi^4Vq=s3XGN_+fRm!$$@qm-vBsy}W3jB-sK%5^YRQeN1#j_>MCNJNhFC?oyJU4mC5R~c$`n-#LL&gzTW{CM*^3A$}JZz z$KgXix>gYdjeE^-!LW32!$s*hqH?h`8x|{Jxk}|y*o(DpZ3<;V?j(h#H#X#8J6WEX)Ke z(xSVsno8$SgGSmlG7Xos>DY)=HgIjNJV*JqHl=91My2UFB, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: 2018-03-25 21:18-0600\n" +"PO-Revision-Date: 2018-03-25 21:23-0600\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" +"X-Generator: Poedit 2.0.6\n" +"Last-Translator: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: en\n" + +#: gui.py:23 +msgid "ADN a Proteína" +msgstr "DNA to Protein" + +#: gui.py:47 +msgid "Ingrese la cadena y seleccione tipo" +msgstr "Enter the chain and select its type" + +#: gui.py:51 +msgid "Complementaria (5'3)" +msgstr "Non-template (5'3)" + +#: gui.py:51 +msgid "Molde (3'5)" +msgstr "Template (3'5)" + +#: gui.py:67 +msgid "Ingrese los intrones separados por un espacio" +msgstr "Enter the introns separated by a space" + +#: gui.py:79 +msgid "_Convert" +msgstr "_Convert" + +#: gui.py:98 +msgid "Aquí se mostrarán los resultados" +msgstr "Here the results will be shown" + +#: gui.py:109 +msgid "Empezando conversión" +msgstr "Starting conversion" + +#: gui.py:127 +msgid "" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}" +msgstr "" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}" + +#: gui.py:135 +msgid "" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}" +msgstr "" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}" + +#: gui.py:139 +msgid "Conversión completa" +msgstr "Conversion complete" diff --git a/locale/en/LC_MESSAGES/translate.mo b/locale/en/LC_MESSAGES/translate.mo deleted file mode 100644 index 99563fb074fc1b5fbee9bb62dccc316155aa3cb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1942 zcmaJ>&u<$=6ds`bGE@jS&;vrRh~ijyjqM~Qauh`-NuyLva9sx~q8ui>FV4VvW;HuY zFjWsoaO1!QapsITA#vbRsX24(l`{wa2)>zJ$Dx9*cKmtgy?H;r_ul;Z+NB=^p37Ko zVts@4D%Rgv{%JoY#1&u%_zv(Uunsi9w}C$b?*e}Zt^r?vT8KA*w}D=+fNuf616~FG z47>^a1Godc@{ADQ;_MOdU3~v_Nr-E}SDr0#8R*X+06ztO1v~&g0ur$ET!}-Vk3R=q z1AY(u8u%OV5V-QZ5O5;^Ay;gRm$Behz@>Nr%RewHYFG#_JTFz~;YI(ml~RAWM>~2V zlfoL}yhr!$-@88(?9R8hM+15<2mu3=s=nCDW2=rNaY{~Qh7zV&CafjJ##)Y@oUnFW z=`p1clyXVVN*#_X+asE*n4FY$)@aT{XomWmdnBpIrKOxRX=MVP%vdTk;>~2N3@vbL z+@kI6ZR+<&G#d43f4|@GhHstwoR|~=YJ=dkQ>@t=7_)AY>g z{D3RA>#lxC3ybyT2KihjS<0SfX_ch8lJ-i=^~J_INO<^QXU1tLl&|?*bqLjx=K0=c z{cxQYyq;$|;bT~Zb(!-;a#Mb6g|Vh-=#YAT(V)&^-| zWg6Wuc7n;$S@_J?x~o+FU0cv}b&WcW)${y%=q&gs4M%rOVPoDX8#F{IRG4A(Vo=)+l5@d-Oz|LPiS9qO$}u@u23shj1BU-mq&VB2zDqz>gTM;+!$1~H8_(GPa% zROSf3(22huFTPJus0vWBiBqR4P3g#wJyM6gSx(}U6R;BKHpf+h3f#GMLf@RLg^~BU zI2Glrb8g};(^1*EjjDXO8=9WyAeuP{_dpZ8heMAY&~;SrUlGiT=XpXqOv^BQXO%5d aA67nmO{=ZVdaG)&GCfolcZLM7u>KE>yfP*L diff --git a/locale/en/LC_MESSAGES/translate.po b/locale/en/LC_MESSAGES/translate.po deleted file mode 100644 index 6356fbe..0000000 --- a/locale/en/LC_MESSAGES/translate.po +++ /dev/null @@ -1,79 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: DNA to Protein 1.0.2\n" -"POT-Creation-Date: 2018-02-25 17:43-0600\n" -"PO-Revision-Date: 2018-03-04 18:48-0600\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: pygettext.py 1.5\n" -"X-Generator: Poedit 2.0.6\n" -"Last-Translator: \n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Language: en\n" -"X-Poedit-SourceCharset: UTF-8\n" - -#: Genes_v1.0.0.py:11 -msgid "Escribe la cadena a transcribir: " -msgstr "Type the chain to transcribe: " - -#: Genes_v1.0.0.py:12 -msgid "" -"¿Cadena molde [escriba 't'] (3'5) o complementaria [escriba 'n'] (5'3)? " -msgstr "" -"What type of chain is it? For template (3'5, anti-sense, non-coding) write " -"'t', for non-template (5'3, sense, coding) write 'n': " - -#: Genes_v1.0.0.py:13 -msgid "" -"Escribe los intrones ARN o ADN a usar separados por un espacio (e.g. GGG AAT " -"TTA UUA): " -msgstr "" -"Introduce the introns in RNA or DNA format separated by a space (e.g. GGG " -"AAT TTA UUA): " - -#: Genes_v1.0.0.py:14 -msgid "" -"¿Intrones tipo ARN [escriba 'R'] o ADN [escriba 'D']? (ARN por defecto) " -msgstr "" -"What type of introns are they? For RNA write 'R', for DNA write 'D'. RNA is " -"used by default: " - -#: Genes_v1.0.0.py:41 Genes_v1.0.0.py:44 -msgid "Se usará la cadena {} como molde" -msgstr "The chain {} will be used as template" - -#: Genes_v1.0.0.py:47 -msgid "Escriba el tipo de cadena correctamente" -msgstr "Please write the chain type correctly" - -#: Genes_v1.0.0.py:66 -msgid "Se encontró el gen {} {} {} {} {}" -msgstr "A gene was found: {} {} {} {} {}" - -#: Genes_v1.0.0.py:75 -msgid "Se encontró el gen {} {} {}{}" -msgstr "A gene was found: {} {} {}{}" - -#: Genes_v1.0.0.py:85 -msgid "El ARN Inmaduro es: {}{}" -msgstr "The Precursor (Inmature) RNA is: {} {}" - -#: Genes_v1.0.0.py:91 -msgid "El ARN Maduro es: GTP + {}{} + PoliA" -msgstr "The Mature RNA is: GTP + {}{} + PoliA" - -#: Genes_v1.0.0.py:108 -msgid "La cadena molde no contiene un gen, revise la misma y su tipo" -msgstr "" -"The template chain doesn't contain any genes, please check if it, and its " -"type, are correct" - -#: Genes_v1.0.0.py:148 -msgid "La proteína es: {}{} \n" -msgstr "The resulting protein is: {}{} \n" diff --git a/translate.pot b/translate.pot deleted file mode 100644 index 78d4e98..0000000 --- a/translate.pot +++ /dev/null @@ -1,66 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2018-02-25 17:43-0600\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: pygettext.py 1.5\n" - - -#: Genes_v1.0.0.py:11 -msgid "Escribe la cadena a transcribir: " -msgstr "" - -#: Genes_v1.0.0.py:12 -msgid "¿Cadena molde [escriba 't'] (3'5) o complementaria [escriba 'n'] (5'3)? " -msgstr "" - -#: Genes_v1.0.0.py:13 -msgid "Escribe los intrones ARN o ADN a usar separados por un espacio (e.g. GGG AAT TTA UUA): " -msgstr "" - -#: Genes_v1.0.0.py:14 -msgid "¿Intrones tipo ARN [escriba 'R'] o ADN [escriba 'D']? (ARN por defecto) " -msgstr "" - -#: Genes_v1.0.0.py:41 Genes_v1.0.0.py:44 -msgid "Se usará la cadena {} como molde" -msgstr "" - -#: Genes_v1.0.0.py:47 -msgid "Escriba el tipo de cadena correctamente" -msgstr "" - -#: Genes_v1.0.0.py:66 -msgid "Se encontró el gen {} {} {} {} {}" -msgstr "" - -#: Genes_v1.0.0.py:75 -msgid "Se encontró el gen {} {} {}{}" -msgstr "" - -#: Genes_v1.0.0.py:85 -msgid "El ARN Inmaduro es: {}{}" -msgstr "" - -#: Genes_v1.0.0.py:91 -msgid "El ARN Maduro es: GTP + {}{} + PoliA" -msgstr "" - -#: Genes_v1.0.0.py:108 -msgid "La cadena molde no contiene un gen, revise la misma y su tipo" -msgstr "" - -#: Genes_v1.0.0.py:148 -msgid "" -"La proteína es: {}{} \n" -msgstr "" - diff --git a/translategui.pot b/translategui.pot new file mode 100644 index 0000000..2167693 --- /dev/null +++ b/translategui.pot @@ -0,0 +1,72 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2018-03-25 21:18-0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" + + +#: gui.py:23 +msgid "ADN a Proteína" +msgstr "" + +#: gui.py:47 +msgid "Ingrese la cadena y seleccione tipo" +msgstr "" + +#: gui.py:51 +msgid "Complementaria (5'3)" +msgstr "" + +#: gui.py:51 +msgid "Molde (3'5)" +msgstr "" + +#: gui.py:67 +msgid "Ingrese los intrones separados por un espacio" +msgstr "" + +#: gui.py:79 +msgid "_Convert" +msgstr "" + +#: gui.py:98 +msgid "Aquí se mostrarán los resultados" +msgstr "" + +#: gui.py:109 +msgid "Empezando conversión" +msgstr "" + +#: gui.py:127 +msgid "" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}" +msgstr "" + +#: gui.py:135 +msgid "" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}\n" +"{}" +msgstr "" + +#: gui.py:139 +msgid "Conversión completa" +msgstr "" + diff --git a/translation.pot b/translation.pot new file mode 100644 index 0000000..a20c8a3 --- /dev/null +++ b/translation.pot @@ -0,0 +1,41 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2018-03-25 21:09-0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: pygettext.py 1.5\n" + + +#: dnatoprotein.py:30 +msgid "Escriba la cadena de ADN a convertir: " +msgstr "" + +#: dnatoprotein.py:31 +msgid "¿La cadena es molde [escriba 't'] (3'5) o complementaria [escriba 'n'] (5'3)? " +msgstr "" + +#: dnatoprotein.py:32 +msgid "Escriba los intrones ARN o ADN a usar separados por un espacio (e.g. TCA AAC CGC GAT): " +msgstr "" + +#: dnatoprotein.py:33 +msgid "¿Intrones tipo ARN [escriba 'R'] o ADN [escriba 'D']? (ARN por defecto) " +msgstr "" + +#: dnatoprotein.py:64 +msgid "Conversión completa" +msgstr "" + +#: dnatoprotein.py:144 +msgid "La cadena proporcionada no contiene un gen." +msgstr "" +