Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a sequence of DNA, it is necessary to examine all six reading frames of the DNA to find the coding regions the cell uses

Given a sequence of DNA, it is necessary to examine all six reading frames of the DNA to find the coding regions the cell uses to make proteins.

Very often we won't know where, in the DNA we are studying, the cell begins translating DNA into protein. Since we don't know where the translation begins, we have to consider the six possible reading frames when looking for coding regions.

Your task is to write a program to translate a DNA sequence, given in a GenBank file format called sequence.gb, into all six reading frames as output.

def dna2rna(seq): ''' The dna2rna function converts a sequence of DNA, given as a parameter and returns an RNA sequence. ''' return '' codon2aa = {'aaa': 'K', 'aac': 'N', 'aag': 'K', 'aau': 'N', 'aca': 'T', 'acc': 'T', 'acg': 'T', 'acu': 'T', 'aga': 'R', 'agc': 'S', 'agg': 'R', 'agu': 'S', 'aua': 'I', 'auc': 'I', 'aug': 'M', 'auu': 'I', 'caa': 'Q', 'cac': 'H', 'cag': 'Q', 'cau': 'H', 'cca': 'P', 'ccc': 'P', 'ccg': 'P', 'ccu': 'P', 'cga': 'R', 'cgc': 'R', 'cgg': 'R', 'cgu': 'R', 'cua': 'L', 'cuc': 'L', 'cug': 'L', 'cuu': 'L', 'gaa': 'E', 'gac': 'D', 'gag': 'E', 'gau': 'D', 'gca': 'A', 'gcc': 'A', 'gcg': 'A', 'gcu': 'A', 'gga': 'G', 'ggc': 'G', 'ggg': 'G', 'ggu': 'G', 'gua': 'V', 'guc': 'V', 'gug': 'V', 'guu': 'V', 'uaa': '_', 'uac': 'Y', 'uag': '_', 'uau': 'Y', 'uca': 'S', 'ucc': 'S', 'ucg': 'S', 'ucu': 'S', 'uga': '_', 'ugc': 'C', 'ugg': 'W', 'ugu': 'C', 'uua': 'L', 'uuc': 'F', 'uug': 'L', 'uuu': 'F'} if __name__ == '__main__': with urlopen('http://web.njit.edu/~kapleau/teach/current/bnfo135/sequence.gb') as conn: data = conn.readlines() lines = [line.strip() for line in [datum.decode() for datum in data]] flag = False dna = '' for line in lines: ## if the flag is 'True', append the line to 'dna'. ## if the word "ORIGIN" is in the line, set 'flag' to 'True' pass ## gets rid of any non-dna character. dna = dna.translate(str.maketrans('acgt', 'acgt', '0123456789 /')) ## calls the dna2rna function rna = dna2rna(dna) ## process the first 3 reading frames for i in range(3): ## create a variable 'seq' and assign it the rna to process seq = '' amino = '' while len(seq) >= 3: ## use the codon2aa table to append an amino acid to 'amino' ## update 'seq' to the next codon pass print('--- Reading Frame %i ---' % (i+1), amino, sep=' ') ## compute the reverse complement of 'rna' and assign the result ## back into the 'rna' variable ## process the next 3 reading frames. hint: just like the first 3 for i in range(3): ## same as the first 3 print('--- Reading Frame %i ---' % (i+4), amino, sep=' ')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions