UNIVERSIDAD ANDINA DEL CUSCO
FACULTAD DE INGENIERÍA Y ARQUITECTURA
ESCUELA PROFESIONAL DE INGENIERÍA DE SISTEMAS
Ejercicios:
“PYTHON”
ASIGNATURA: Fundamentos de bioinformática
DOCENTE: ING. GONZALES CONDORI, HARRY YEISON
ESTUDIANTES:
Coronado Miranda, Jeffry
Palomino Yabarrena, Lyndon
Castro Cana, Christopher
Jurado Jalisto, Kelvin
CUSCO – PERÚ
2020
1
1.
2.
3.
2
4.
5.
6.
3
7.
8.
1. Print (secuencia, ("ATATATACG")
2. Print(complemento inverso,("ATCGCGAT")
3. Print(totalduplest ("ATATATATACG")
4. print("el tamaño de la primera proteina codificada es: " )
print(proteinacodificada("GAT"))
5. print(puedeser("GAT"))
6. print(counter("AUGATATATATA"))
7. Print (impresion("ttccgatcaatg","tjs"))
4
8. print(Busqueda("aagctaaatgctaatcgtacaagc",4))
Proy 1.
class Myseq:
def __len__(self):
return len([Link])
def __getitem__(self, n):
return [Link][n]
def __getslice__(self, i, j):
return [Link][i:j]
def __str__(self):
return [Link]
def sacarSecuenciaBiotipo(self):
return self.seq_type
def muestraInfoSecuencia(self):
print("Secuencia: "+[Link]+" biotype "+self.seq_type)
def alfabeto (self):
if(self.seq_type == "ADN"):
return "ACGT"
elif (self.seq_type == "ARN"):
return "ACGU"
elif(self.seq_type == "PROTEIN"):
return "ACDEFGHIKLMNPQRSTVWY"
else:
None
def validar(self):
alp = [Link]()
res = True
i=0
while i < len([Link]) and res:
if [Link][i] not in alp:
res = False
else:
i+=1
return res
5
def transcripcion(self):
if(self.seq_type == "ADN"):
return Myseq([Link]("T","U"),"ARN")
else:
return None
def reverse_comp(self):
if(self.seq_type != "ADN"):
return None
comp = ""
for c in [Link]:
if(c == 'A'):
comp="T"+comp
elif(c == "T"):
comp="A"+comp
elif(c == "G"):
comp="C"+comp
elif(c == "C"):
comp="G"+comp
return Myseq(comp, "ADN")
def traducirCodon(cod,a):
tc = {"GCT":"A", "GCC":"A", "GCA":"A", "GCG":"A", "TGT":"C", "TGC":"C",
"GAT":"D", "GAC":"D", "GAA":"E", "GAG":"E", "TTT":"F", "TTC":"F",
"GGT":"G", "GGC":"G", "GGA":"G", "GGG":"G", "CAT":"H", "CAC":"H",
"ATA":"I", "ATT":"I", "ATC":"I", "AAA":"K","AAG":"K", "TTA":"L",
"TTG":"L", "CTT":"L","CTC":"L", "CTA":"L","CTG":"L", "ATG":"M",
"AAT":"N", "AAC":"N", "CCT":"P","CCC":"P", "CCA":"P","CCG":"P",
"CAA":"Q", "CAG":"Q", "CGT":"R","CGC":"R", "CGA":"R","CGG":"R",
"AGA":"R","AGG":"R", "TCT":"S","TCC":"S", "TCA":"S","TCG":"S",
"AGT":"S","AGC":"S", "ACT":"T","ACC":"T", "ACA":"T","ACG":"T",
"GTT":"V","GTC":"V", "GTA":"V","GTG":"V", "TGG":"W", "TAT":"Y",
"TAC":"Y", "TAA":"_", "TAG":"_", "TGA":"_"}
if a in tc:
return tc[a]
else:
return None
def traduccion(self,iniPos = 0):
if(self.seq_type != "ADN"):
6
return None
seq_aa=""
for pos in range(iniPos, len([Link])-2,3):
cod = [Link][pos:pos+3]
a = str(self.translate_codon(cod))
seq_aa=seq_aa+a
return Myseq(seq_aa, "PROTEIN")
class ADN(Myseq):
def __init__ (self, seq, seq_type = "ADN"):
[Link] = [Link]()
self.seq_type = seq_type
class ARN(Myseq):
def __init__ (self, seq, seq_type = "ARN"):
[Link] = [Link]()
self.seq_type = seq_type
class Proteina(Myseq):
def __init__ (self, seq, seq_type = "PROTEIN"):
[Link] = [Link]()
self.seq_type = seq_type
secuenciaA =
ADN("ATGTGATAAGAATAGAATGCTGAATAAATAGAATGACAT")
secuenciaB = ARN("MKVVLSVQERSVVSLL","PROTEIN")
print([Link](),[Link]())
print(secuenciaA)
7
Proy 2.
import random
def genADN():
DNA=['A','C','G','T']
tamaADN=len(DNA)
print(tamaADN)
for num in range(2):
ADN=[Link](DNA,k=50)
print("Primer ADN: ",ADN)
mutati=input("Desea Ingresar mutaciones?: ")
if mutati=="1":
mutaciones =int(input("Ingrese la cantidad de mutaciones: "))
for i in range(mutaciones):
nucleotidos=input("Ingrese el nucleotido: ")
[Link](nucleotidos)
print("El nuevo ADN es:",ADN)
elif mutati=="0":
boolremo=input("Desea remover un compuesto?: ")
if boolremo=="1":
remover=int(input("Ingrese la cantidad a remover: "))
for i in range(remover):
nucleoremove=input("Ingrese el nucleotido: ")
[Link](nucleoremove)
print("El nuevo ADN es:",ADN)
elif boolremo=="0":
replacesADN=input("Desea reemplazar algun compuesto: ")
if replacesADN=="1":
reemplace=int(input("Ingrese la cantidad a remover: "))
for i in range(reemplace):
valorre=input("Ingrese que compuesto reemplazar: ")
nucleoreplace=input("Ingrese el nucleotido: ")
for n,i in enumerate(ADN):
if i==valorre:
ADN[n]= nucleoreplace
else:
print("Valor no encontrado")
print("El nuevo ADN es:",ADN)
elif replacesADN=="0":
8
print("El ADN es: ",ADN)
print(genADN())