Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your code cannot contain any import statements. It should also not contain print statements. The functions use the return statement to return the result of

Your code cannot contain any import statements. It should also not contain print statements. The functions use the return statement to return the result of the function call, so print statements should not occur in your solution.

image text in transcribedimage text in transcribed

Question #3 A DNA molecule can be specified using a string of the characters C' , G 'A,, T'. Each of these characters represents one of the four nucleobases Cytosine, Guanine, Adenine, and Thymine. Consult the wikipedia page on DNA for more details. If the string sequence contains a character that is not equal to one of C' , 'G' , 'A, , T, then that character is said to be a bad base and the string sequence is said to be a bad sequence For example the string CGTTTCAAACCGGT, has no bad bases and so is not a bad sequence, while the string (CGTAacTTG#OGG has four bad bases and so is a bad sequence. Write a function bad sequence.counter that has one argument file_name that is a string. The function should return the tuple (n, m) where n is the number of bad sequences and bad bases that the file named file name con tains The file named file.name should be present in the same directory (folder) that contains your python homework3 project/files line of the file is a sequence that needs to be evaluated The function should open the file and then process it to count the . You can assume that this file is a plain text file and that each individual number of bad bases and bad sequences that it contains Once the file has been processed the function should close the file before returning the results. An empty line in the file does not count as a bad sequence, just ignore it. Also do not count any spaces that occur at the beginning or the end of a line. Do not count the end of line character, n, that occurs at the end of each line of the file as a bad base . You can use the file https: //ms.master. ca/~matt/1mp3/homework/ sequences.txt to test your code and to see what a typical file to be processed looks like. This particular file has 10 bad bases and 4 bad sequences and so bad sequence.counter('sequences.txt should return the tuple (4, 10)

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_2

Step: 3

blur-text-image_3

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 Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions