From 214c5ed9eee9e71938a92ddc192f96642b8b3eaa Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 15:01:42 -0500 Subject: [PATCH 01/35] actualizando encabezado --- src/rich_at.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rich_at.py b/src/rich_at.py index e381036..57a5486 100644 --- a/src/rich_at.py +++ b/src/rich_at.py @@ -5,7 +5,7 @@ 1.0 Author - Lopez Angeles Brenda E. + Lopez Angeles Brenda Elizabeth. Descripcion Programa que busca regiones ricas en AT From 22e67c4c1408768d4bddc1d49dc4acf049c60ee7 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 15:12:41 -0500 Subject: [PATCH 02/35] agregando comentarios --- src/rich_at.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/rich_at.py b/src/rich_at.py index 57a5486..71f8865 100644 --- a/src/rich_at.py +++ b/src/rich_at.py @@ -25,10 +25,11 @@ See also None ''' - +# Importamos librerias import argparse import re +# Paso de argumentos mediante argparse arg_parser = argparse.ArgumentParser(description="Search AT rich regions") arg_parser.add_argument("-f", "--file", metavar="path/to/file", @@ -42,10 +43,19 @@ args = arg_parser.parse_args() +# Abrimos el archivo y extraemos su contenido with open(args.file, "r") as seq_file: dna = seq_file.read().upper() - + def evaluate(dna): + ''' + Evalua si el archivo contienealgun caracter diferente a los permitidos [ATGC]. + Parameters: + dna (str): secuencia de ADN a procesar. + Returns: + 0 (int): si encuentra caracteres no validos. + 1 (int): si no encuentra caracteres validos. + ''' not_dna = re.finditer("[^ATGC]+", dna) matches = len([*re.finditer("[^ATGC]+", dna)]) if matches: @@ -56,6 +66,14 @@ def evaluate(dna): return(1) def find_regions(dna, at=2): + ''' + Evalua la existencia de regiones ricas en AT en una cadena de ADN. + Parameters: + dna (str): secuencia de ADN a procesar. + at (int): tamaño minimo de las regiones ricas en AT a buscar, por default 2. + Returns: + 0 (int): Termina la evaluacion de la secuencia. + ''' at_rich = re.finditer("A+|T+",dna) matches = len([*re.finditer("A+|T+", dna)]) if matches: @@ -66,6 +84,7 @@ def find_regions(dna, at=2): print("No se encontraron regiones ricas en AT") return(0) +# Llamamos a nuestras funciones. if evaluate(dna): if args.search: ans = find_regions(dna,args.search) From 1db3e8ae5d37ef01a7dfaaa68c09347c85d5807b Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 15:14:21 -0500 Subject: [PATCH 03/35] agregando comentarios --- src/rich_at.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rich_at.py b/src/rich_at.py index 71f8865..f640b01 100644 --- a/src/rich_at.py +++ b/src/rich_at.py @@ -53,8 +53,8 @@ def evaluate(dna): Parameters: dna (str): secuencia de ADN a procesar. Returns: - 0 (int): si encuentra caracteres no validos. - 1 (int): si no encuentra caracteres validos. + 0 (int): si encuentra caracteres invalidos. + 1 (int): si no encuentra caracteres invalidos. ''' not_dna = re.finditer("[^ATGC]+", dna) matches = len([*re.finditer("[^ATGC]+", dna)]) From db95b2182d041425b2318bacc47dd2a3d4caa7e5 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 15:14:43 -0500 Subject: [PATCH 04/35] ACTUALIZANDO secuencia --- data/ADN_at.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/ADN_at.txt b/data/ADN_at.txt index 2bc758d..168e3fa 100644 --- a/data/ADN_at.txt +++ b/data/ADN_at.txt @@ -1 +1 @@ -gggggggggggggggg \ No newline at end of file +ggggggggggggggggaatt \ No newline at end of file From a8cefd0ccf59dcba485fa7491aa0cb12558f4033 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 15:18:11 -0500 Subject: [PATCH 05/35] agregando comentarios --- src/rich_at.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rich_at.py b/src/rich_at.py index f640b01..f6e736c 100644 --- a/src/rich_at.py +++ b/src/rich_at.py @@ -49,7 +49,7 @@ def evaluate(dna): ''' - Evalua si el archivo contienealgun caracter diferente a los permitidos [ATGC]. + Evalua si el archivo contiene algun caracter diferente a los permitidos [ATGC]. Parameters: dna (str): secuencia de ADN a procesar. Returns: From 2f8b61735e14c4276ec83ed48ea01fb6e6c06c40 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 15:45:32 -0500 Subject: [PATCH 06/35] agregando comentarios --- src/rich_at.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rich_at.py b/src/rich_at.py index f6e736c..716ce4e 100644 --- a/src/rich_at.py +++ b/src/rich_at.py @@ -60,7 +60,7 @@ def evaluate(dna): matches = len([*re.finditer("[^ATGC]+", dna)]) if matches: for invalid in not_dna: - print(f"Existen caracteres invalidos en tu archivo: {invalid.group()} en las coordenadas: {invalid.span()}") + print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") return(0) else: return(1) @@ -74,12 +74,16 @@ def find_regions(dna, at=2): Returns: 0 (int): Termina la evaluacion de la secuencia. ''' - at_rich = re.finditer("A+|T+",dna) + at_rich = re.finditer("[AT]+",dna) matches = len([*re.finditer("A+|T+", dna)]) if matches: + count_at = 0 for islas in at_rich: if len(islas.group()) >= at: + count_at += 1 print(f"Se encontro esta region rica en AT: {islas.group()} en la posicion {islas.span()}") + if not count_at: + print(f"No se encontraron regiones ricas en AT = {at}") else: print("No se encontraron regiones ricas en AT") return(0) From 768646f1e7451d83f4623a801d824e60793f4dc0 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 21:09:31 -0500 Subject: [PATCH 07/35] ACTUALIZANDO secuencia --- data/ADN_at.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/ADN_at.txt b/data/ADN_at.txt index 168e3fa..b428f39 100644 --- a/data/ADN_at.txt +++ b/data/ADN_at.txt @@ -1 +1 @@ -ggggggggggggggggaatt \ No newline at end of file +aatgggatcccaacca \ No newline at end of file From e2b8a0033f8b6485c6211b2c74a8f592acf6d3fa Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 21:22:21 -0500 Subject: [PATCH 08/35] Actualizando informacion del encabezado --- src/rich_at.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rich_at.py b/src/rich_at.py index 716ce4e..5faf74d 100644 --- a/src/rich_at.py +++ b/src/rich_at.py @@ -14,13 +14,15 @@ DNA sequence Usage - Python rich_at.py -f path/to/file [-s ] - py .\src\rich_at.py -f data/ADN_at.txt -s 4 + Python .\src\rich_at.py [-h] -f path/to/file [-s SEARCH] + python .\src\rich_at.py -f data/ADN_at.txt -s 4 Arguments - -h --help - -f --file - -s --search + -h, --help + -f --file, --file path/to/file + Archivo con secuencia de ADN + -s SEARCH, --search SEARCH + Tamaño minimo de las regiones de AT See also None @@ -37,7 +39,7 @@ required=True) arg_parser.add_argument("-s", "--search", - help="cantidad minima de AT a buscar", + help="Tamaño minimo de las regiones de AT", type=int, required=False) From 636c0bd12dd9d296f4045e7371e5191e3c7eac09 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 26 Aug 2022 21:22:47 -0500 Subject: [PATCH 09/35] Actualizando secuencia --- data/ADN_at.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/ADN_at.txt b/data/ADN_at.txt index b428f39..bf04ed6 100644 --- a/data/ADN_at.txt +++ b/data/ADN_at.txt @@ -1 +1 @@ -aatgggatcccaacca \ No newline at end of file +aaaccctttaattaggc \ No newline at end of file From 65c082bf3005039dcec44b55b2c41c5178a14578 Mon Sep 17 00:00:00 2001 From: Brenda Date: Tue, 30 Aug 2022 12:26:34 -0500 Subject: [PATCH 10/35] agregando archivo --- src/diccionario.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/diccionario.py diff --git a/src/diccionario.py b/src/diccionario.py new file mode 100644 index 0000000..fb2768c --- /dev/null +++ b/src/diccionario.py @@ -0,0 +1,19 @@ +# Diccionarios + +cadena=[] +cadena= input("Introduce el texto que desees, no mas de 10000 letras \n") + +lista=cadena.split(' ') +diccionario={} +sinEspacios= cadena.replace(" ","") + +if len(sinEspacios) <= 10000: + for word in lista: + cuenta= lista.count(word) + diccionario[word]= cuenta + + for word, valor in diccionario.items(): + print(word, end=' '), + print(valor) +else: + print("El texto no debe contener más de 10000 letras") \ No newline at end of file From efd081ec776ee304148fc1471d134f275c28f33e Mon Sep 17 00:00:00 2001 From: Brenda Date: Tue, 30 Aug 2022 12:28:03 -0500 Subject: [PATCH 11/35] modificando --- data/ADN_at.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/ADN_at.txt b/data/ADN_at.txt index bf04ed6..ab16b85 100644 --- a/data/ADN_at.txt +++ b/data/ADN_at.txt @@ -1 +1 @@ -aaaccctttaattaggc \ No newline at end of file +aaacccttjtaattiagogc \ No newline at end of file From 9c576e8504dac6ddb7526cf9ab1ce6e37784144f Mon Sep 17 00:00:00 2001 From: Brenda Date: Tue, 30 Aug 2022 13:42:36 -0500 Subject: [PATCH 12/35] =?UTF-8?q?a=C3=B1adiendo=20archivos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/file1.txt | 23 +++++++++++++++++++++++ data/file2.txt | 22 ++++++++++++++++++++++ src/ejercicio.py | 5 +++++ 3 files changed, 50 insertions(+) create mode 100644 data/file1.txt create mode 100644 data/file2.txt create mode 100644 src/ejercicio.py diff --git a/data/file1.txt b/data/file1.txt new file mode 100644 index 0000000..2c57307 --- /dev/null +++ b/data/file1.txt @@ -0,0 +1,23 @@ +#PDB id UniProt entry +3kip Q59Z17 +1n4w P12676 +6nms P78324 +3og2 Q70SY0 +1c17 P68699 +1otg Q05354 +1fjc P08199 +1mvf P0AE72 +5mvi Q8Z903 +4k7x B3D6W2 +1vb7 Q8R1G6 +1uhg P01012 +2nr4 Q8PVV4 +6av8 B3FIS6 +6nuc Q08209 +6vgo Q9H4B8 +2yrz P16144 +3plz O00482 +1tdz P42371 +3v9o Q2T1V0 +6liv P54769 + diff --git a/data/file2.txt b/data/file2.txt new file mode 100644 index 0000000..2dbdaa5 --- /dev/null +++ b/data/file2.txt @@ -0,0 +1,22 @@ +#Uniprot entry ENA id +Q59Z17 CP017624 +P12676 M31939 +P78324 D86043 +Q70SY0 AJ549427 +P68699 J01594 +Q05354 X53666 +P08199 M15825 +P0AE72 D16450 +Q8Z903 AL513382 +B3D6W2 CP000869 +Q8R1G6 BC024556 +P01012 V00383 +Q8PVV4 AE008384 +B3FIS6 EU195270 +Q08209 L14778 +Q9H4B8 AJ291679 +P16144 X51841 +O00482 U80251 +P42371 X74298 +Q2T1V0 CP000086 +P54769 U08598 diff --git a/src/ejercicio.py b/src/ejercicio.py new file mode 100644 index 0000000..f40c2f0 --- /dev/null +++ b/src/ejercicio.py @@ -0,0 +1,5 @@ +file1 = 'data/file1' +file2 = 'data/file2' +with open(file1, "r") as fistfile: + list = fistfile.read().upper() +print(list) \ No newline at end of file From 74e89cf0d52bebee2f82f998833830132de2ceef Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 15:46:11 -0500 Subject: [PATCH 13/35] =?UTF-8?q?a=C3=B1adiendo=20archivos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Diccionarios.md | 60 ++++++++++++++++++++++++++++++++++++++++++ src/ADN_to_ARN_to_P.py | 44 +++++++++++++++++++++++++++++++ src/ejercicio.py | 16 ++++++++--- 3 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 docs/Diccionarios.md create mode 100644 src/ADN_to_ARN_to_P.py diff --git a/docs/Diccionarios.md b/docs/Diccionarios.md new file mode 100644 index 0000000..0391b1f --- /dev/null +++ b/docs/Diccionarios.md @@ -0,0 +1,60 @@ +# Diccionarios + +Para crear un diccionario en python: + +- Se crea por medio de llaves, declarando cuales serán las llaves (keys) las cuales deben de ser únicas. + + ``` + enzymes = { + 'EcoRI': r'GAATT', + 'AvaII': r'GGCC' + } + + Enzymes={} + + # Métodos + + #Elimina un elemento de un diccionario + enzymes.pop('EcoRI') + + # Obtener elementos dentro de un diccionario: + all_counts["key"] + # Si esperamos que el elemento no se encuentra en el diccionario, entonces, podemos hacer que nos devuelva un 0. + all_counts.get('TC',0) + + # Para obtener las llaves + all_counts.keys() + + # Función sort + sort(variable) + + # Metodo items: regresa tuplas, las llaves y el valor + all_counts.items() + + # Ya que genera tuplas, entonces podemos iterar sobre ambos elementos. + for key, item in all_counts.items: + Print(key) + print(item) + + # fromkeys: inicializar un diccionario con valores e iterables: listas, tuplas, etc. + llaves = [a,b,c,d] + diccionario = dict.fromkeys(llaves,[]) + {'a':[],'b':[],...} + + # Por el contrario: + llaves = [a,b,c,d] + valores =[1,2,3] + diccionario = dict.fromkeys(llaves,valores) + {'a':[1,2,3],'b':[1,2,3],...} + + # Popitem: borra el ultimo par clave-valor insertado. + diccionario.popitem() + + # setdefault: inserta un elemento al final del diccionario si es que este no fue encontrado y se asigna un valor "none" + diccionario.setdefault("peso") + + # Values + Accede a los valores + ``` + + \ No newline at end of file diff --git a/src/ADN_to_ARN_to_P.py b/src/ADN_to_ARN_to_P.py new file mode 100644 index 0000000..f3b9a1a --- /dev/null +++ b/src/ADN_to_ARN_to_P.py @@ -0,0 +1,44 @@ +''' Name + search AT rich regions + +Version + 1.0 + +Author + Lopez Angeles Brenda Elizabeth. + +Descripcion + Programa que busca regiones ricas en AT + +Category + DNA sequence + +Usage + Python .\src\rich_at.py [-h] -f path/to/file [-s SEARCH] + python .\src\rich_at.py -f data/ADN_at.txt -s 4 + +Arguments + -h, --help + -f --file, --file path/to/file + Archivo con secuencia de ADN + -s SEARCH, --search SEARCH + Tamaño minimo de las regiones de AT + +See also + None +''' + +gencode = { + 'ATA':'I', 'ATC':'I', 'ATT':'I', 'ATG':'M', 'ACA':'T', + 'ACC':'T', 'ACG':'T', 'ACT':'T', 'AAC':'N', 'AAT':'N', + 'AAA':'K', 'AAG':'K', 'AGC':'S', 'AGT':'S', 'AGA':'R', + 'AGG':'R', 'CTA':'L', 'CTC':'L', 'CTG':'L', 'CTT':'L', + 'CCA':'P', 'CCC':'P', 'CCG':'P', 'CCT':'P', 'CAC':'H', + 'CAT':'H', 'CAA':'Q', 'CAG':'Q', 'CGA':'R', 'CGC':'R', + 'CGG':'R', 'CGT':'R', 'GTA':'V', 'GTC':'V', 'GTG':'V', + 'GTT':'V', 'GCA':'A', 'GCC':'A', 'GCG':'A', 'GCT':'A', + 'GAC':'D', 'GAT':'D', 'GAA':'E', 'GAG':'E', 'GGA':'G', + 'GGC':'G', 'GGG':'G', 'GGT':'G', 'TCA':'S', 'TCC':'S', + 'TCG':'S', 'TCT':'S', 'TTC':'F', 'TTT':'F', 'TTA':'L', + 'TTG':'L', 'TAC':'Y', 'TAT':'Y', 'TAA':'_', 'TAG':'_', + 'TGC':'C', 'TGT':'C', 'TGA':'_', 'TGG':'W'} \ No newline at end of file diff --git a/src/ejercicio.py b/src/ejercicio.py index f40c2f0..acc5e97 100644 --- a/src/ejercicio.py +++ b/src/ejercicio.py @@ -1,5 +1,13 @@ -file1 = 'data/file1' -file2 = 'data/file2' +file1 = 'data/file1.txt' +file2 = 'data/file2.txt' with open(file1, "r") as fistfile: - list = fistfile.read().upper() -print(list) \ No newline at end of file + content = fistfile.read().split('\n') + +fisrtfile_list = [elements.split('\t') for elements in content] + +with open(file2, "r") as secondfile: + content = secondfile.read().replace(' ','\t').split('\n') +#print(content) +secondfile_list = [elements.split('\t') for elements in content] + +print(secondfile_list) From c7e0e0202ad07445b0a012b1faf552291e306524 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 15:48:29 -0500 Subject: [PATCH 14/35] =?UTF-8?q?a=C3=B1adiendo=20archivos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/{ADN_to_ARN_to_P.py => ARN_toPro.py} | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) rename src/{ADN_to_ARN_to_P.py => ARN_toPro.py} (89%) diff --git a/src/ADN_to_ARN_to_P.py b/src/ARN_toPro.py similarity index 89% rename from src/ADN_to_ARN_to_P.py rename to src/ARN_toPro.py index f3b9a1a..ca9c933 100644 --- a/src/ADN_to_ARN_to_P.py +++ b/src/ARN_toPro.py @@ -1,5 +1,5 @@ ''' Name - search AT rich regions + Version 1.0 @@ -14,8 +14,7 @@ DNA sequence Usage - Python .\src\rich_at.py [-h] -f path/to/file [-s SEARCH] - python .\src\rich_at.py -f data/ADN_at.txt -s 4 + Arguments -h, --help From c06fcb67ff2dd6ffb000b681035846a0dd63b336 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 15:54:30 -0500 Subject: [PATCH 15/35] cambios menores --- src/ARN_toPro.py | 12 ++++++------ src/aminoacids_module.py | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/ARN_toPro.py b/src/ARN_toPro.py index ca9c933..7660595 100644 --- a/src/ARN_toPro.py +++ b/src/ARN_toPro.py @@ -1,5 +1,5 @@ ''' Name - + ARN to protein Version 1.0 @@ -11,7 +11,7 @@ Programa que busca regiones ricas en AT Category - DNA sequence + Aminoacid sequence Usage @@ -19,9 +19,7 @@ Arguments -h, --help -f --file, --file path/to/file - Archivo con secuencia de ADN - -s SEARCH, --search SEARCH - Tamaño minimo de las regiones de AT + See also None @@ -40,4 +38,6 @@ 'GGC':'G', 'GGG':'G', 'GGT':'G', 'TCA':'S', 'TCC':'S', 'TCG':'S', 'TCT':'S', 'TTC':'F', 'TTT':'F', 'TTA':'L', 'TTG':'L', 'TAC':'Y', 'TAT':'Y', 'TAA':'_', 'TAG':'_', - 'TGC':'C', 'TGT':'C', 'TGA':'_', 'TGG':'W'} \ No newline at end of file + 'TGC':'C', 'TGT':'C', 'TGA':'_', 'TGG':'W'} + +ARN = 'AACCTTGGGGG' \ No newline at end of file diff --git a/src/aminoacids_module.py b/src/aminoacids_module.py index 92a899c..d884be6 100644 --- a/src/aminoacids_module.py +++ b/src/aminoacids_module.py @@ -16,7 +16,7 @@ aminoacid_per ''' - +import re def aminoacid_per(aminoacid_sequence, aminoacid_list = ['A','I','L','M','F','W','Y','V']): ''' Calcula el porcentaje de aminoacidos en una seuencia @@ -111,4 +111,22 @@ def traducction(secuencia): # STOP if codon == 'UAA' or codon == 'UGA' or codon == 'UAG': peptid.append('-STOP-') - return("".join(peptid)) \ No newline at end of file + return("".join(peptid)) + +def evaluate(rna): + ''' + Evalua si el archivo contiene algun caracter diferente a los permitidos [ATGC]. + Parameters: + dna (str): secuencia de ADN a procesar. + Returns: + 0 (int): si encuentra caracteres invalidos. + 1 (int): si no encuentra caracteres invalidos. + ''' + not_dna = re.finditer("[^AUGC]+", rna) + matches = len([*re.finditer("[^AUGC]+", rna)]) + if matches: + for invalid in not_dna: + print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") + return(0) + else: + return(1) \ No newline at end of file From 0ca5647c1133d3ee3d349ee678c47c57f4cdb348 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 17:42:58 -0500 Subject: [PATCH 16/35] actualizando archivo de prueba --- data/ARN_protein.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 data/ARN_protein.txt diff --git a/data/ARN_protein.txt b/data/ARN_protein.txt new file mode 100644 index 0000000..7e46b1f --- /dev/null +++ b/data/ARN_protein.txt @@ -0,0 +1 @@ +AAAAAAUUAAGGG \ No newline at end of file From b815342f1cfde26d1721235f1e8f4c210da6b958 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 17:44:06 -0500 Subject: [PATCH 17/35] corrigiendo condiciones de funcion evaluate --- src/aminoacids_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aminoacids_module.py b/src/aminoacids_module.py index d884be6..1995594 100644 --- a/src/aminoacids_module.py +++ b/src/aminoacids_module.py @@ -115,9 +115,9 @@ def traducction(secuencia): def evaluate(rna): ''' - Evalua si el archivo contiene algun caracter diferente a los permitidos [ATGC]. + Evalua si el archivo contiene algun caracter diferente a los permitidos [AUGC]. Parameters: - dna (str): secuencia de ADN a procesar. + dna (str): secuencia de ARN a procesar. Returns: 0 (int): si encuentra caracteres invalidos. 1 (int): si no encuentra caracteres invalidos. From aad68914ccc05cb88476deab943b875144fe16e2 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 17:45:07 -0500 Subject: [PATCH 18/35] agregando funcion evaluate_dna --- src/aminoacids_module.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/aminoacids_module.py b/src/aminoacids_module.py index 1995594..1b76484 100644 --- a/src/aminoacids_module.py +++ b/src/aminoacids_module.py @@ -113,7 +113,7 @@ def traducction(secuencia): peptid.append('-STOP-') return("".join(peptid)) -def evaluate(rna): +def evaluate_rna(rna): ''' Evalua si el archivo contiene algun caracter diferente a los permitidos [AUGC]. Parameters: @@ -124,6 +124,24 @@ def evaluate(rna): ''' not_dna = re.finditer("[^AUGC]+", rna) matches = len([*re.finditer("[^AUGC]+", rna)]) + if matches: + for invalid in not_dna: + print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") + return(0) + else: + return(1) + +def evaluate_dna(dna): + ''' + Evalua si el archivo contiene algun caracter diferente a los permitidos [ATGC]. + Parameters: + dna (str): secuencia de ADN a procesar. + Returns: + 0 (int): si encuentra caracteres invalidos. + 1 (int): si no encuentra caracteres invalidos. + ''' + not_dna = re.finditer("[^ATGC]+", dna) + matches = len([*re.finditer("[^ATGC]+", dna)]) if matches: for invalid in not_dna: print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") From cebfe8602da3cfc5b032d175a74dc0c7359e578e Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 17:45:33 -0500 Subject: [PATCH 19/35] =?UTF-8?q?a=C3=B1adiendo=20argumentos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ARN_toPro.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/ARN_toPro.py b/src/ARN_toPro.py index 7660595..6799960 100644 --- a/src/ARN_toPro.py +++ b/src/ARN_toPro.py @@ -24,7 +24,34 @@ See also None ''' +# Importamos librerias +import argparse +from posixpath import split +import re +from aminoacids_module import evaluate +# Paso de argumentos mediante argparse +arg_parser = argparse.ArgumentParser(description="Translating ARN to protein") +arg_parser.add_argument("-f", "--FILE", + metavar="path/to/file", + help="Archivo con secuencia de ARN", + required=True) + +arg_parser.add_argument("-o", "--OUTPUT", + help="Archivo de salida", + type=int, + required=False) + +arg_parser.add_argument("-p","--PRINT", + help = "Imprimir a pantalla", + required= False) + +args = arg_parser.parse_args() + +# Abrimos el archivo y extraemos su contenido +with open(args.FILE, "r") as seq_file: + ARN = seq_file.read().upper() + gencode = { 'ATA':'I', 'ATC':'I', 'ATT':'I', 'ATG':'M', 'ACA':'T', 'ACC':'T', 'ACG':'T', 'ACT':'T', 'AAC':'N', 'AAT':'N', @@ -39,5 +66,10 @@ 'TCG':'S', 'TCT':'S', 'TTC':'F', 'TTT':'F', 'TTA':'L', 'TTG':'L', 'TAC':'Y', 'TAT':'Y', 'TAA':'_', 'TAG':'_', 'TGC':'C', 'TGT':'C', 'TGA':'_', 'TGG':'W'} - -ARN = 'AACCTTGGGGG' \ No newline at end of file + +def codon_format(ARN): + codon_seq = [ARN[i:i+3] for i in range(0,len(ARN),3)] + return(codon_seq) + +if evaluate(ARN): + print() From 289b01b18e793f29529cb0931bae2f4dee1b6bed Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 17:46:17 -0500 Subject: [PATCH 20/35] =?UTF-8?q?a=C3=B1adiendo=20argumentos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ARN_toPro.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ARN_toPro.py b/src/ARN_toPro.py index 6799960..fe990cf 100644 --- a/src/ARN_toPro.py +++ b/src/ARN_toPro.py @@ -28,7 +28,7 @@ import argparse from posixpath import split import re -from aminoacids_module import evaluate +from aminoacids_module import evaluate_rna # Paso de argumentos mediante argparse arg_parser = argparse.ArgumentParser(description="Translating ARN to protein") @@ -71,5 +71,5 @@ def codon_format(ARN): codon_seq = [ARN[i:i+3] for i in range(0,len(ARN),3)] return(codon_seq) -if evaluate(ARN): +if evaluate_rna(ARN): print() From 8eca8bd7c11a8289b1247869764701719330c123 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 18:27:04 -0500 Subject: [PATCH 21/35] actualizando archivo de prueba --- data/ARN_protein.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/ARN_protein.txt b/data/ARN_protein.txt index 7e46b1f..b5e8c83 100644 --- a/data/ARN_protein.txt +++ b/data/ARN_protein.txt @@ -1 +1 @@ -AAAAAAUUAAGGG \ No newline at end of file +AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA \ No newline at end of file From 1d471ff968998e76474d29fa55b83fba2a75fd48 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 18:27:31 -0500 Subject: [PATCH 22/35] agregando funcion codon_format --- src/aminoacids_module.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/aminoacids_module.py b/src/aminoacids_module.py index 1b76484..e0c55b8 100644 --- a/src/aminoacids_module.py +++ b/src/aminoacids_module.py @@ -147,4 +147,8 @@ def evaluate_dna(dna): print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") return(0) else: - return(1) \ No newline at end of file + return(1) + +def codon_format(ARN): + codon_seq = [ARN[i:i+3] for i in range(0,len(ARN),3)] + return(codon_seq) \ No newline at end of file From 60ee38e25bada81b9d1fc2039851b3f6dd462cdb Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 18:28:05 -0500 Subject: [PATCH 23/35] =?UTF-8?q?a=C3=B1adiendo=20archivos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/output_peptid.txt | 1 + src/ARN_toPro.py | 64 +++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 data/output_peptid.txt diff --git a/data/output_peptid.txt b/data/output_peptid.txt new file mode 100644 index 0000000..e64662f --- /dev/null +++ b/data/output_peptid.txt @@ -0,0 +1 @@ +MAMAPRTEINSTRING_ \ No newline at end of file diff --git a/src/ARN_toPro.py b/src/ARN_toPro.py index fe990cf..e339b89 100644 --- a/src/ARN_toPro.py +++ b/src/ARN_toPro.py @@ -35,11 +35,15 @@ arg_parser.add_argument("-f", "--FILE", metavar="path/to/file", help="Archivo con secuencia de ARN", - required=True) + required=False) + +arg_parser.add_argument("-s", "--SEQUENCE", + help="Secuencia de ARN", + type=str, + required=False) arg_parser.add_argument("-o", "--OUTPUT", help="Archivo de salida", - type=int, required=False) arg_parser.add_argument("-p","--PRINT", @@ -49,27 +53,41 @@ args = arg_parser.parse_args() # Abrimos el archivo y extraemos su contenido -with open(args.FILE, "r") as seq_file: - ARN = seq_file.read().upper() - -gencode = { - 'ATA':'I', 'ATC':'I', 'ATT':'I', 'ATG':'M', 'ACA':'T', - 'ACC':'T', 'ACG':'T', 'ACT':'T', 'AAC':'N', 'AAT':'N', - 'AAA':'K', 'AAG':'K', 'AGC':'S', 'AGT':'S', 'AGA':'R', - 'AGG':'R', 'CTA':'L', 'CTC':'L', 'CTG':'L', 'CTT':'L', - 'CCA':'P', 'CCC':'P', 'CCG':'P', 'CCT':'P', 'CAC':'H', - 'CAT':'H', 'CAA':'Q', 'CAG':'Q', 'CGA':'R', 'CGC':'R', - 'CGG':'R', 'CGT':'R', 'GTA':'V', 'GTC':'V', 'GTG':'V', - 'GTT':'V', 'GCA':'A', 'GCC':'A', 'GCG':'A', 'GCT':'A', - 'GAC':'D', 'GAT':'D', 'GAA':'E', 'GAG':'E', 'GGA':'G', - 'GGC':'G', 'GGG':'G', 'GGT':'G', 'TCA':'S', 'TCC':'S', - 'TCG':'S', 'TCT':'S', 'TTC':'F', 'TTT':'F', 'TTA':'L', - 'TTG':'L', 'TAC':'Y', 'TAT':'Y', 'TAA':'_', 'TAG':'_', - 'TGC':'C', 'TGT':'C', 'TGA':'_', 'TGG':'W'} +if args.FILE: + with open(args.FILE, "r") as seq_file: + ARN = seq_file.read().upper() + +if args.SEQUENCE: + ARN = args.SEQUENCE -def codon_format(ARN): - codon_seq = [ARN[i:i+3] for i in range(0,len(ARN),3)] - return(codon_seq) +def arn_to_peptid(ARN): + gencode = { + 'AUA':'I', 'AUC':'I', 'AUU':'I', 'AUG':'M', 'ACA':'T', + 'ACC':'T', 'ACG':'T', 'ACU':'T', 'AAC':'N', 'AAU':'N', + 'AAA':'K', 'AAG':'K', 'AGC':'S', 'AGU':'S', 'AGA':'R', + 'AGG':'R', 'CUA':'L', 'CUC':'L', 'CUG':'L', 'CUU':'L', + 'CCA':'P', 'CCC':'P', 'CCG':'P', 'CCU':'P', 'CAC':'H', + 'CAU':'H', 'CAA':'Q', 'CAG':'Q', 'CGA':'R', 'CGC':'R', + 'CGG':'R', 'CGU':'R', 'GUA':'V', 'GUC':'V', 'GUG':'V', + 'GUU':'V', 'GCA':'A', 'GCC':'A', 'GCG':'A', 'GCU':'A', + 'GAC':'D', 'GAU':'D', 'GAA':'E', 'GAG':'E', 'GGA':'G', + 'GGC':'G', 'GGG':'G', 'GGU':'G', 'UCA':'S', 'UCC':'S', + 'UCG':'S', 'UCU':'S', 'UUC':'F', 'UUU':'F', 'UUA':'L', + 'UUG':'L', 'UAC':'Y', 'UAU':'Y', 'UAA':'_', 'UAG':'_', + 'UGC':'C', 'UGU':'C', 'UGA':'_', 'UGG':'W'} + + codon_sequence = [ARN[i:i+3] for i in range(0,len(ARN),3)] + peptid = [gencode.get(codon, "*") for codon in codon_sequence] + return(peptid) if evaluate_rna(ARN): - print() + peptid = arn_to_peptid(ARN) + if args.OUTPUT: + output_file = open(args.OUTPUT,'w') + output_file.write("".join(peptid)) + + + + + + From 9df6ab6f9970b4f1e1e6f2c3a0796a2c71534446 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 19:09:13 -0500 Subject: [PATCH 24/35] agregando translate_dna --- src/aminoacids_module.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/aminoacids_module.py b/src/aminoacids_module.py index e0c55b8..121cdea 100644 --- a/src/aminoacids_module.py +++ b/src/aminoacids_module.py @@ -149,6 +149,25 @@ def evaluate_dna(dna): else: return(1) -def codon_format(ARN): +def codon_format(ARN): + ''' + Da formato de codones a una secuencia de ARN. + Parameters: + ARN (str): secuencia de ARN a formatear. + Returns: + codon_seq (list): lista con los codones de la secuencia. + ''' codon_seq = [ARN[i:i+3] for i in range(0,len(ARN),3)] - return(codon_seq) \ No newline at end of file + return(codon_seq) + +def translate_dna(ADN): + ''' + Convierte una secuencia de ADN a ARN. + Parameters: + ADN (str): secuencia de ADN a traducir. + Returns: + ARN_seq (str): secuencia de ARN. + ''' + ARN_dic = {'A' : 'U','T' : 'A','C' : 'G','G' : 'C'} + ARN_seq = [ARN_dic.get(nucleotide) for nucleotide in ADN] + return(''.join(ARN_seq)) \ No newline at end of file From 9cb9b4d00a3588dd2caba0cf5fd25d96f14178ab Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 19:11:20 -0500 Subject: [PATCH 25/35] cambiando salida, prueba --- data/output_peptid.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/data/output_peptid.txt b/data/output_peptid.txt index e64662f..d63c607 100644 --- a/data/output_peptid.txt +++ b/data/output_peptid.txt @@ -1 +1,2 @@ +La secuencia proteica obtenida fue: MAMAPRTEINSTRING_ \ No newline at end of file From e6e9af17623a59a1a240108ad19570f4ee9da81b Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 19:12:22 -0500 Subject: [PATCH 26/35] =?UTF-8?q?a=C3=B1adiendo=20nuevas=20opciones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ARN_toPro.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ARN_toPro.py b/src/ARN_toPro.py index e339b89..e71592e 100644 --- a/src/ARN_toPro.py +++ b/src/ARN_toPro.py @@ -47,7 +47,7 @@ required=False) arg_parser.add_argument("-p","--PRINT", - help = "Imprimir a pantalla", + help = "Imprimir a pantalla la secuencia peptidica", required= False) args = arg_parser.parse_args() @@ -84,7 +84,12 @@ def arn_to_peptid(ARN): peptid = arn_to_peptid(ARN) if args.OUTPUT: output_file = open(args.OUTPUT,'w') - output_file.write("".join(peptid)) + output_file.write(f"La secuencia proteica obtenida fue:\n{''.join(peptid)}") + output_file.close() + + if args.PRINT: + print(f"La secuencia proteica obtenida fue:\n{''.join(peptid)}") + From 89e11ed0f27f1f6fed5c5245f5d47dc6c0a878b9 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 23:25:34 -0500 Subject: [PATCH 27/35] cambiando salida, prueba --- data/output_peptid.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/output_peptid.txt b/data/output_peptid.txt index d63c607..ffe6bb0 100644 --- a/data/output_peptid.txt +++ b/data/output_peptid.txt @@ -1,2 +1,2 @@ La secuencia proteica obtenida fue: -MAMAPRTEINSTRING_ \ No newline at end of file +M \ No newline at end of file From e5367226ffa018498908e9bfd8ba88ae8e497d76 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 23:26:20 -0500 Subject: [PATCH 28/35] eliminando translate_dna --- src/aminoacids_module.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/aminoacids_module.py b/src/aminoacids_module.py index 121cdea..5c784f0 100644 --- a/src/aminoacids_module.py +++ b/src/aminoacids_module.py @@ -131,24 +131,6 @@ def evaluate_rna(rna): else: return(1) -def evaluate_dna(dna): - ''' - Evalua si el archivo contiene algun caracter diferente a los permitidos [ATGC]. - Parameters: - dna (str): secuencia de ADN a procesar. - Returns: - 0 (int): si encuentra caracteres invalidos. - 1 (int): si no encuentra caracteres invalidos. - ''' - not_dna = re.finditer("[^ATGC]+", dna) - matches = len([*re.finditer("[^ATGC]+", dna)]) - if matches: - for invalid in not_dna: - print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") - return(0) - else: - return(1) - def codon_format(ARN): ''' Da formato de codones a una secuencia de ARN. From 312cb67e371117f6c29ad4ff09854e8769579138 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 23:27:06 -0500 Subject: [PATCH 29/35] agregando translate_dna --- src/ADN_module.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/ADN_module.py b/src/ADN_module.py index 5b2fba2..81cd178 100644 --- a/src/ADN_module.py +++ b/src/ADN_module.py @@ -21,7 +21,7 @@ nucleotide_percentage ''' - +import re def count_dna(dna): ''' Regresa el conteo de nucleotidos en una secuencia de ADN @@ -145,4 +145,21 @@ def fasta_files(filepath_in, filepath_out = "data/fasta_file.fasta"): my_file.close() return(filepath_out) - \ No newline at end of file + +def evaluate_dna(dna): + ''' + Evalua si el archivo contiene algun caracter diferente a los permitidos [ATGC]. + Parameters: + dna (str): secuencia de ADN a procesar. + Returns: + 0 (int): si encuentra caracteres invalidos. + 1 (int): si no encuentra caracteres invalidos. + ''' + not_dna = re.finditer("[^ATGC]+", dna) + matches = len([*re.finditer("[^ATGC]+", dna)]) + if matches: + for invalid in not_dna: + print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") + return(0) + else: + return(1) \ No newline at end of file From 2efce35871b464b1824f1be7acf461d28c990dd9 Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 23:27:47 -0500 Subject: [PATCH 30/35] actualizando archivo de prueba --- data/ARN_protein.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/ARN_protein.txt b/data/ARN_protein.txt index b5e8c83..ccd7acb 100644 --- a/data/ARN_protein.txt +++ b/data/ARN_protein.txt @@ -1 +1 @@ -AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA \ No newline at end of file +TAC \ No newline at end of file From d8710844ba9025576b24f70c184eb8f8b2b6988a Mon Sep 17 00:00:00 2001 From: Brenda Date: Fri, 2 Sep 2022 23:28:16 -0500 Subject: [PATCH 31/35] actualizando condiciones de cadenas de ADN --- src/ARN_toPro.py | 66 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/src/ARN_toPro.py b/src/ARN_toPro.py index e71592e..f378990 100644 --- a/src/ARN_toPro.py +++ b/src/ARN_toPro.py @@ -1,5 +1,5 @@ ''' Name - ARN to protein + ADN/ARN to protein Version 1.0 @@ -8,37 +8,41 @@ Lopez Angeles Brenda Elizabeth. Descripcion - Programa que busca regiones ricas en AT + Programa que convierte una secuencia de ADN o ARN en una secuencia peptidica. + Por default, el programa convierte secuencias de ARN. Category Aminoacid sequence Usage - + Python ARN_toPro.py [-h] [-f path/to/file] [-s SEQUENCE] [-o OUTPUT] [-p PRINT] [-c CHANGETODNA] Arguments -h, --help -f --file, --file path/to/file - + -s SEQUENCE, --SEQUENCE + -o OUTPUT, --OUTPUT + -p PRINT, --PRINT + -c CHANCETODNA, --CHANGETODNA See also None ''' # Importamos librerias import argparse -from posixpath import split -import re from aminoacids_module import evaluate_rna +from aminoacids_module import translate_dna +from ADN_module import evaluate_dna # Paso de argumentos mediante argparse arg_parser = argparse.ArgumentParser(description="Translating ARN to protein") arg_parser.add_argument("-f", "--FILE", metavar="path/to/file", - help="Archivo con secuencia de ARN", + help="Archivo con la secuencia de ARN o ADN", required=False) arg_parser.add_argument("-s", "--SEQUENCE", - help="Secuencia de ARN", + help="Secuencia de ARN o ADN", type=str, required=False) @@ -50,17 +54,42 @@ help = "Imprimir a pantalla la secuencia peptidica", required= False) +arg_parser.add_argument("-c","--CHANGEtoDNA", + help = "Si la secuencia es de ADN", + required= False) + args = arg_parser.parse_args() -# Abrimos el archivo y extraemos su contenido +# Abrimos el archivo y extraemos su contenido. +# Si el usuario ingresa una secuencia de ADN, la convertimos a ARN llamando a la funcion del modulo creado. + if args.FILE: with open(args.FILE, "r") as seq_file: - ARN = seq_file.read().upper() - + if args.CHANGEtoDNA: + ADN = seq_file.read().upper() + if evaluate_dna(ADN): + ARN = translate_dna(ADN) + else: + ARN = seq_file.read().upper() + +# Si el usurio ingresa una secuencia por teclado +# Si el usuario ingresa una secuencia de ADN, llamamos a la funcion translate_dna + if args.SEQUENCE: - ARN = args.SEQUENCE + if args.CHANGEtoDNA: + ADN = args.SEQUENCE + ARN = translate_dna(ADN) + else: + ARN = args.SEQUENCE def arn_to_peptid(ARN): + ''' + Funcion que convierte una secuencia de ARN a proteina. + Parameters: + ARN (str): secuencia de ARN a procesar. + Returns: + peptide (str): secuencia peptidica generada. + ''' gencode = { 'AUA':'I', 'AUC':'I', 'AUU':'I', 'AUG':'M', 'ACA':'T', 'ACC':'T', 'ACG':'T', 'ACU':'T', 'AAC':'N', 'AAU':'N', @@ -80,6 +109,10 @@ def arn_to_peptid(ARN): peptid = [gencode.get(codon, "*") for codon in codon_sequence] return(peptid) +# Evaluamos si la secuencia contiene algun caracter incorrecto. +# Si el usuario quiere un archivo como formato de salida. +# Si el usurio quiere imprimir la secuencia a pantalla. + if evaluate_rna(ARN): peptid = arn_to_peptid(ARN) if args.OUTPUT: @@ -88,11 +121,4 @@ def arn_to_peptid(ARN): output_file.close() if args.PRINT: - print(f"La secuencia proteica obtenida fue:\n{''.join(peptid)}") - - - - - - - + print(f"La secuencia proteica obtenida fue:\n{''.join(peptid)}") \ No newline at end of file From 71417107c96de0818be210bf9f47b66fa39e3289 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sat, 3 Sep 2022 14:20:57 -0500 Subject: [PATCH 32/35] actualizando mensajes --- data/ARN_protein.txt | 2 +- src/ADN_module.py | 2 +- src/ARN_toPro.py | 8 ++++++-- src/aminoacids_module.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/data/ARN_protein.txt b/data/ARN_protein.txt index ccd7acb..52cb74d 100644 --- a/data/ARN_protein.txt +++ b/data/ARN_protein.txt @@ -1 +1 @@ -TAC \ No newline at end of file +aug \ No newline at end of file diff --git a/src/ADN_module.py b/src/ADN_module.py index 81cd178..193b277 100644 --- a/src/ADN_module.py +++ b/src/ADN_module.py @@ -159,7 +159,7 @@ def evaluate_dna(dna): matches = len([*re.finditer("[^ATGC]+", dna)]) if matches: for invalid in not_dna: - print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") + print(f"Existen caracteres invalidos: {invalid.group()} en las coordenadas: {invalid.span()}") return(0) else: return(1) \ No newline at end of file diff --git a/src/ARN_toPro.py b/src/ARN_toPro.py index f378990..19cff0c 100644 --- a/src/ARN_toPro.py +++ b/src/ARN_toPro.py @@ -30,6 +30,7 @@ ''' # Importamos librerias import argparse +from sys import flags from aminoacids_module import evaluate_rna from aminoacids_module import translate_dna from ADN_module import evaluate_dna @@ -52,10 +53,12 @@ arg_parser.add_argument("-p","--PRINT", help = "Imprimir a pantalla la secuencia peptidica", + action = 'store_true', required= False) arg_parser.add_argument("-c","--CHANGEtoDNA", help = "Si la secuencia es de ADN", + action = 'store_true', required= False) args = arg_parser.parse_args() @@ -77,14 +80,15 @@ if args.SEQUENCE: if args.CHANGEtoDNA: - ADN = args.SEQUENCE + ADN = args.SEQUENCE.upper() ARN = translate_dna(ADN) else: - ARN = args.SEQUENCE + ARN = args.SEQUENCE.upper() def arn_to_peptid(ARN): ''' Funcion que convierte una secuencia de ARN a proteina. + Si encuentra una secuencia con un codon incompleto, agregara un "*" Parameters: ARN (str): secuencia de ARN a procesar. Returns: diff --git a/src/aminoacids_module.py b/src/aminoacids_module.py index 5c784f0..bed4382 100644 --- a/src/aminoacids_module.py +++ b/src/aminoacids_module.py @@ -126,7 +126,7 @@ def evaluate_rna(rna): matches = len([*re.finditer("[^AUGC]+", rna)]) if matches: for invalid in not_dna: - print(f"Existen caracteres invalidos en el archivo: {invalid.group()} en las coordenadas: {invalid.span()}") + print(f"Existen caracteres invalidos: {invalid.group()} en las coordenadas: {invalid.span()}") return(0) else: return(1) From 184c7cc8bf16eb2dd3fbedbdb5160b3b667946a6 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 4 Sep 2022 14:04:43 -0500 Subject: [PATCH 33/35] Actualizando version, convertiendo de ADN a proteina --- src/ARN_toPro.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ARN_toPro.py b/src/ARN_toPro.py index 19cff0c..4cec412 100644 --- a/src/ARN_toPro.py +++ b/src/ARN_toPro.py @@ -2,7 +2,7 @@ ADN/ARN to protein Version - 1.0 + 1.5 Author Lopez Angeles Brenda Elizabeth. @@ -16,6 +16,7 @@ Usage Python ARN_toPro.py [-h] [-f path/to/file] [-s SEQUENCE] [-o OUTPUT] [-p PRINT] [-c CHANGETODNA] + Python ARN_toPro.py -f data/ARN_protein.txt -o sata/output_peptid.txt -p Arguments -h, --help From 44cfbd9fd9585ff8507eb3766ceed2954e720ae8 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 4 Sep 2022 14:05:24 -0500 Subject: [PATCH 34/35] archivos de entrada y salida, haciendo pruebas --- data/ARN_protein.txt | 2 +- data/output_peptid.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/ARN_protein.txt b/data/ARN_protein.txt index 52cb74d..b5e8c83 100644 --- a/data/ARN_protein.txt +++ b/data/ARN_protein.txt @@ -1 +1 @@ -aug \ No newline at end of file +AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA \ No newline at end of file diff --git a/data/output_peptid.txt b/data/output_peptid.txt index ffe6bb0..d63c607 100644 --- a/data/output_peptid.txt +++ b/data/output_peptid.txt @@ -1,2 +1,2 @@ La secuencia proteica obtenida fue: -M \ No newline at end of file +MAMAPRTEINSTRING_ \ No newline at end of file From 057e2cef6115cb1400e4a181f8e2f2ab7481d8e9 Mon Sep 17 00:00:00 2001 From: Brenda Date: Sun, 4 Sep 2022 14:16:40 -0500 Subject: [PATCH 35/35] archivo de salida, convirtiendo de ADN/ARN a proteina --- results/output_peptid.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 results/output_peptid.txt diff --git a/results/output_peptid.txt b/results/output_peptid.txt new file mode 100644 index 0000000..d63c607 --- /dev/null +++ b/results/output_peptid.txt @@ -0,0 +1,2 @@ +La secuencia proteica obtenida fue: +MAMAPRTEINSTRING_ \ No newline at end of file