How can I return the list in alphabets?
I have sequence translator, and a python code that reads both dna and protein sequence. The code reads the dna sequence and translate it to protein sequence, reads the protein sequence, compares it with the translated protein sequence and prints out a list of the protein sequence that exist in the read protein sequence. How can I print a list of the protein that exist in both of them?
def translate_codon(cod):
"""Translates a codon into an aminoacid using an internal dictionary with the standard genetic code."""
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 cod in tc:
return tc[cod]
else:
return '-1'
def seq_prot(dna_seq, ab):
seqm = dna_seq.upper()
prot = ab.upper()
seq_aa = ''
for pos in range(0, len(seqm)-2,3):
cod = seqm[pos:pos+3]
seq_aa += translate_codon(cod)
for p in seq_aa:
if p in prot:
seq_aa[p] += 1
else:
seq_aa = p
return seq_aa
dna_seq = "ACCCCTGTGACATACCTTTATGTTGCCTCGGCGGATCAGCCCGCGCCCC"
ab = 'TLYPAP'
print("The protein sequence are :",seq_prot(dna_seq, ab))
The protein sequence are : TYPP
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)