Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Problem 3 gives you practice with string methods and file input using an example from biology. The problem is modeled after Finding a Motif

Python

Problem 3 gives you practice with string methods and file input using an example from biology. The problem is modeled after Finding a Motif in DNA, one of the problems on the Rosalind site ( http://rosalind.info ). Solving problems on this site is a great way to practice using Python to solve problems that are frequently encountered in bioinformatics. --------------- Finding the same interval of DNA in the genomes of two different organisms (often taken from different species) is highly suggestive that the interval has the same function in both organisms. We define a motif as such a commonly shared interval of DNA. A common task in molecular biology is to search an organism's genome for a known motif. Given two strings s and t, t is a substring of s if t is contained as a contiguous collection of symbols in s (as a result, t must be no longer than s). The position of a symbol in a string is determined by its distance from the initial symbol of the string, which is given the position 0 (e.g., the positions of all occurrences of 'U' in "AUGCUUCAGAAAGGUCUUACG" are 1, 4, 5, 14, 16, and 17). The symbol at position i of s is denoted by s[i]. A substring of s can be represented as s[j:k], where j and k represent the starting and ending positions of the substring in s; for example, if s = "AUGCUUCAGAAAGGUCUUACG", then s[1:5] = "UGCU". (NOTE: the ending position is NOT included in the substring). The location of a substring s[j:k] is its beginning position j; note that t will have multiple locations in s if it occurs more than once as a substring of s (see the Sample below). Occurrences of a motif are allowed to overlap with each other (see sample dataset and sample output for an example). Given: Two DNA strings s and t (each of length at most 1000 symbols). These strings are provided in the datafile motifFinding.txt provided. You will need to have your program read in the data from the datafile and assign the first string and the second string to different variables. HINT: the following commands may be useful for this problem: my_file = open(r" test.txt", "r") my_data = my_file.read().split() Return: All locations of t as a substring of s.

Sample Dataset GATATATGCATATACTT ATAT Sample Output 1 3 9

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago