Question: CODE: import random from collections import Counter class Seq: def _ _ init _ _ ( self ) : self.translation _ dict = { '
CODE: import random
from collections import Counter
class Seq:
def initself:
self.translationdict ttt: Ftct: S 'tat': Ytgt: C
ttc: Ftcc: S 'tac': Ytgc: C
'tta': L 'tca': S 'taa': 'tga':
ttg: Ltcg: S 'tag': tgg: W
ctt: Lcct: P 'cat': Hcgt: R
ctc: Lccc: P 'cac': Hcgc: R
'cta': L 'cca': P 'caa': Q 'cga': R
ctg: Lccg: P 'cag': Qcgg: R
'att': I 'act': T 'aat': N 'agt': S
'atc': I 'acc': T 'aac': N 'agc': S
'ata': I 'aca': T 'aaa': K 'aga': R
'atg': M 'acg': T 'aag': K 'agg': R
gtt: Vgct: A 'gat': Dggt: G
gtc: Vgcc: A 'gac': Dggc: G
'gta': V 'gca': A 'gaa': E 'gga': G
gtg: Vgcg: A 'gag': Eggg: G
def probself:
proportion inputEnter the proportion of A to C eg: or ::
if proportion ::
self.probA
self.probC
elif proportion ::
self.probA
self.probC
else:
printInvalid proportion specified. Please use either : or :
def generaternasequenceself:
nucleotides acgu
sequencelength random.randint
sequence joinrandomchoicesnucleotides weightsselfprobA self.probC ksequencelength
#printsequence
return sequence
def translatesequenceself sequence, overlapbyoneFalse, overlapbytwoFalse:
if overlapbyone:
codons sequencei:i for i in range lensequence
elif overlapbytwo:
codons sequencei:i for i in range lensequence
else:
codons sequencei:i for i in range lensequence
aminoacids selftranslationdictcodon for codon in codons if lencodon
return aminoacids
def main:
s Seq
aminoacidcounts Counter
sprob
for in range:
rnasequence sgeneraternasequence
aminoacids stranslatesequencernasequence
aminoacidcounts.updateaminoacids
totalaminoacids sumaminoacidcounts.values
printAmino Acid Count Relative Frequency"
print
for aminoacid, count in aminoacidcounts.items:
frequency count totalaminoacids
fullname
if aminoacid N:
fullname 'Asparagine'
elif aminoacid Q:
fullname 'Glutamine'
elif aminoacid H:
fullname 'Histidine'
elif aminoacid K:
fullname 'Lysine'
elif aminoacid P:
fullname 'Proline'
elif aminoacid T:
fullname 'Threonine'
else:
fullname aminoacid
printffullname.ljuststrcountljustfrequency:f
if namemain:
main
Question: Are your results predictive with respect to the overlapping vs nonoverlapping possibilities for the code? To gain insight into this question, you can rewrite your translation method so that it accepts as an argument whether it should overlap by one, overlap by two, or not overlap when translating, and compare your earlier results!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
