Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Texts in Computational Science and Engineering Editors Timothy J Barth Michael Griebel David E Keyes Risto M Nieminen Dirk Roose Tamar Schlick Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Hans Petter Langtangen A Primer on Scientific Programming with Python Third Edition Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 6.8 Exercises Exercise 6.31 Make a function more robust Consider the function get_base_counts(dna) (from Chapter 6.6.3), which counts how many times A, C, G, and T appears in the string dna: Unfortunately, this function crashes if other letters appear in dna Write an enhanced function get_base_counts2 which solves this problem Test it on a string like ’ADLSTTLLD’ Name of program file: get_base_counts2.py def get_base_counts(dna): counts = {’A’: 0, ’T’: 0, ’G’: 0, ’C’: 0} for base in dna: counts[base] += return counts Exercise 6.32 Find proportion of bases inside/outside exons Consider the lactase gene as described in Chapters 6.6.4 and 6.6.5 What is the proportion of base A inside and outside exons of the lactase gene? Write a function get_exons, which returns all the substrings of the exon regions concatenated, and a function get_introns, which returns all the substrings between the exon regions concatenated The function get_base_frequencies from Chapter 6.6.3 can then be used to analyze the frequencies of bases A, C, G, and T in the two strings Name of program file: prop_A_exons.py 339 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com ... and Split Unregistered Version - http://www.simpopdf.com Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Hans Petter Langtangen A Primer on Scientific Programming with Python...Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Texts... Programming with Python Third Edition Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 6.8 Exercises Exercise 6. 31 Make a function more robust Consider the function get_base_counts(dna)