Question: DNA Sequencing: The term DNA sequencingrefers to methods for determining the order of the nucleotide bases, adenine, thymine, cytosine, and guanine in a molecule of

DNA Sequencing: The term DNA sequencingrefers to methods for determining the order of the nucleotide bases, adenine, thymine, cytosine, and guanine in a molecule of DNA. The standard representation of the bases is to use their first letters, ATCG, so that DNA is represented as a string using only those four characters. However, DNA strings are millions of bases (characters) long. Substring matching is the process of determining whether a shorter string (the substring) is contained within a longer string. Substring matching plays important roles in the reconstruction of an unknown DNA string from pieces and in searching for interesting substrings within a known DNA string. Python provides a find(substring, start, end) string method that returns the lowest index (integer) where the substring is found in the index range start index < end. The start and end arguments are optional, but for this exercise we will make them required (you will learn later how to handle optional arguments). If the substring is not found, -1 is returned.

(a) Without using the find string method, write a function that behaves exactly like the find string method. As your function is not a string method, the string to search must be an argumentlets make it the first one. The resulting format of your function will be: find(some string, substring, start, end)

(b) Biology researchers frequently want to find all the locations where a substring is found, not simply the first one. Write a function named multi find (some string, substring, start, end) that, instead of returning one integer index, returns a string that contains zero or more indices separated by commas. In this case, the string will contain digits representing the integer indices. If the substring is not found, an empty string is returned. You may use the find method that you wrote earlier.

(c) A nice feature of our multi find function is that if the substring is not found, an empty string is returned. In particular, if the substring is not found, the returned empty string resolves to be False in a Boolean expression. The returned value will be True otherwise. That feature allows one to use multi find in an if statement, such as: if multi find(S,substring,0,20). The Python find string method does not share that characteristic (why?). Write a program that exercises both your find and your multi find functions including their use in Boolean expressions. Create some strings using only the base letters, ATCG, and search for substrings within them. PYTHON PLEASE.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!