PLEASE USE PYTHON! (Please use beginner methods if possible please) DNA Sequenci
ID: 3758375 • Letter: P
Question
PLEASE USE PYTHON! (Please use beginner methods if possible please)
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. 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 argument—let’s make it the first one. The resulting format of your function will be:
For example, if some_string is ‘ACGTCGA’ and ‘substring’ is ‘CG’, your find function should return 1.
(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.
For example, if some_string is ‘ACGTCGA’ and ‘substring’ is ‘CG’, your find function should return ‘1,4’.
(c) Write a program that exercises both your find and your multi_find functions. Create some strings using only the base letters, ATCG, and search for substrings within them.
Explanation / Answer
CODE :
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.