DNA Sequencing:
The term DNA sequencing refers 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
findstring 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 argument—let’s 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 thefindmethod that you wrote earlier.(c) A nice feature of our
multi_findfunction 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 beFalsein a Boolean expression. The returned value will beTrueotherwise. That feature allows one to usemulti_findin anifstatement, such as:ifmulti_find(S,substring,0,20). The Pythonfindstring method does not share that characteristic (why?). Write a program that exercises both your find and yourmulti_findfunctions including their use in Boolean expressions. Create some strings using only the base letters, ATCG, and search for substrings within them.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.