DNA sequences are strings made up of the letters: A, T, G, C; they stand for...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
DNA sequences are strings made up of the letters: A, T, G, C; they stand for the names of the 4 nucleobases (often shortened to just bases) that may appear in naturally occurring DNA molecules. The nucleobases bind to each other in complementary pairs: A and T form a complementary pair and C and G form the other. The complement of a sequence is a sequence of the complements of each nucleobase, taken one at a time. For example, the complement of ATTAGTC is TAATCAG. Some researchers are investigating whether a drug that has been tagged with a short DNA sequence, t, would be able to bind to a longer DNA sequence, s, from a cell. To do this, they want to know the maximum distance between two consecutive binding sites of the drug. In this case, a binding site for t is any consecutive substring of s where the complement of t appears. (Note that binding sites can overlap). They define the distance between two binding sites as the number of bases lying strictly between the last base of of one binding site and the first base of the next. Help these researchers with their experiment by writing a program to read in s and t and determine the maximum distance between consecutive binding sites. If there is only 1 binding site, it should output the number of bases that appear before it in the source. If there are no binding sites, then it should output -1. Input Format Line 1: s The DNA sequence from the cell Line 2: t The DNA sequence tagging the drug Constraints 1 s 105 1 t 100 Output Format Output the length of the longest gap between any two binding sites for t in s. If there is only one binding site, output its distance from the start of s. If there are no binding sites, output -1. Sample Input 0 TATAGGGATAGGCTAGTATTT TC Sample Output 0 4 Explanation 0 The tag string is TC, so its binding sites will be where its complement (AG) occurs. We see that in the source string, AG occurs at indexes 3-4, 9-10, and 14-15. The longest gap between two successive binding sites occurs between indexes 4 and 9, specifically indexes 5 to 8, giving us a length of 4 nucleobases Sample Input 1 GGGAAAGGGG ding/problem CC Sample Output 1 Sample Output 1 3 Explanation 1 The tag sequence is 'CC', so its complement is 'GG', and we can find that particular sequence at indexes 0, 1, 6, 7, and 8 (some of those overlap). The overlapping consecutive sequences technically have a negative distance between them, so they are not in contention for the longest gap. The sequence starting at index 1, ends at index 2, so the gap to the next binding site, starting at index 6, consists of the 3 A's at indexes 3 to 5. 1 2345 600 import math 4 import os 5 import random import re 7 import sys 9 10 11 12 13 14 #! /bin/python3 15 # # # # # # # # Complete the 'bindings' function below. # The function is expected to return an INTEGER. # The function accepts following parameters: 1. STRING S 2. STRING t 11 13 14 12 15 16 17 8987232 10 21 9 NANG 24 25 26 27 28 29 30 31 32 33 5 8 2 4 6 3 7 import sys #!/bin/python3 import math import os import random import re # # # Complete the 'bindings' function below. 20 if __name__ fptr # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. STRING S # 2. STRING t # def bindings (s, t): # write code here = '__main__': open (os.environ ['OUTPUT_PATH'], 'w') == s = input() t = input() answer bindings (s, t) fptr.write(str(answer) + ' ") fptr.close() Python 3 DNA sequences are strings made up of the letters: A, T, G, C; they stand for the names of the 4 nucleobases (often shortened to just bases) that may appear in naturally occurring DNA molecules. The nucleobases bind to each other in complementary pairs: A and T form a complementary pair and C and G form the other. The complement of a sequence is a sequence of the complements of each nucleobase, taken one at a time. For example, the complement of ATTAGTC is TAATCAG. Some researchers are investigating whether a drug that has been tagged with a short DNA sequence, t, would be able to bind to a longer DNA sequence, s, from a cell. To do this, they want to know the maximum distance between two consecutive binding sites of the drug. In this case, a binding site for t is any consecutive substring of s where the complement of t appears. (Note that binding sites can overlap). They define the distance between two binding sites as the number of bases lying strictly between the last base of of one binding site and the first base of the next. Help these researchers with their experiment by writing a program to read in s and t and determine the maximum distance between consecutive binding sites. If there is only 1 binding site, it should output the number of bases that appear before it in the source. If there are no binding sites, then it should output -1. Input Format Line 1: s The DNA sequence from the cell Line 2: t The DNA sequence tagging the drug Constraints 1 s 105 1 t 100 Output Format Output the length of the longest gap between any two binding sites for t in s. If there is only one binding site, output its distance from the start of s. If there are no binding sites, output -1. Sample Input 0 TATAGGGATAGGCTAGTATTT TC Sample Output 0 4 Explanation 0 The tag string is TC, so its binding sites will be where its complement (AG) occurs. We see that in the source string, AG occurs at indexes 3-4, 9-10, and 14-15. The longest gap between two successive binding sites occurs between indexes 4 and 9, specifically indexes 5 to 8, giving us a length of 4 nucleobases Sample Input 1 GGGAAAGGGG ding/problem CC Sample Output 1 Sample Output 1 3 Explanation 1 The tag sequence is 'CC', so its complement is 'GG', and we can find that particular sequence at indexes 0, 1, 6, 7, and 8 (some of those overlap). The overlapping consecutive sequences technically have a negative distance between them, so they are not in contention for the longest gap. The sequence starting at index 1, ends at index 2, so the gap to the next binding site, starting at index 6, consists of the 3 A's at indexes 3 to 5. 1 2345 600 import math 4 import os 5 import random import re 7 import sys 9 10 11 12 13 14 #! /bin/python3 15 # # # # # # # # Complete the 'bindings' function below. # The function is expected to return an INTEGER. # The function accepts following parameters: 1. STRING S 2. STRING t 11 13 14 12 15 16 17 8987232 10 21 9 NANG 24 25 26 27 28 29 30 31 32 33 5 8 2 4 6 3 7 import sys #!/bin/python3 import math import os import random import re # # # Complete the 'bindings' function below. 20 if __name__ fptr # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. STRING S # 2. STRING t # def bindings (s, t): # write code here = '__main__': open (os.environ ['OUTPUT_PATH'], 'w') == s = input() t = input() answer bindings (s, t) fptr.write(str(answer) + ' ") fptr.close() Python 3
Expert Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these programming questions
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
In figure, one end of a uniform beam weighing 20 x V3N is attached to a wall with a hinge. The other end is supported by a wire connected to the wall as shown. If the tension in the wire is a x 10N,...
-
The angle an airplane propeller makes with the horizontal as a function of time is given by = (125 rad/s)t + (42.5 rad/s2)t2. (a) Estimate the instantaneous angular velocity at t = 0.00 by...
-
In 2017, an article on bloomberg.com had the following headline: The Australian Dollars Outlook Darkens. The article stated, The march of the Fed toward higher U.S. interest rates has also been a...
-
As shown in Fig. P9.77, a vertical wind tunnel can be used for skydiving practice. Estimate the vertical wind speed needed if a 160-lb person is to be able to "float" motionless when the person (a)...
-
As shown in the cash flow diagram, there is an annual disbursement of money that varies from year to year from $100 to $300 in a fixed pattern that repeats forever. If interest is 10%, compute the...
-
Use the May 31 fiscal year-end information from the following ledger accounts (assume that all accounts have normal balances). General Ledger Retained Earnings Date May 31 PR Debit Account Number 318...
-
Currently, JustLee Books bills customers for orders by enclosing an invoice with each order when its shipped. A customer then has 10 days to send in the payment. Of course, this practice has resulted...
-
Q6. Market 6-1. How is the financial performance priced in the financial markets? Price-book ratio = [price per share] / [book value per share] Price-earnings ratios = [price per share] / [earnings...
-
A 3-year term insurance policy on (50) provides a benefit of 100,000 upon death or a benefit of 50,000 upon diagnosis of disability. The policy will only pay one benefit. The benefit in either case...
-
Why did you raise to power ^2 ? ( [537.300/(1+6%) ^2 ]*5% -25=[537.300/1.1236]*5% -25). Look at the question B again:) (you estimate that it will take 3 years to know) 3 YERAS. If you invest in R&D,...
-
Air is contained within a cylinder in which heat is being transferred to it via a heating coil. Initially the air is at a temperature T and is heated until a final temperature of T2. The total heat...
-
Use the websites to find CPP, EI, Federal Tax, and Provincial Tax. If the gross pay falls between the range, then use that number. One chart asks for claim code so connect the claim code with the...
-
Step 3: The function f is actually completed by 3 sub-steps: (1) expanding 32-bits to 48-bits using expansion permutation table E, and then exclusive OR the 48-bit key K1; (2) shrinking the 48-bits...
-
RFL Inc., a Canadian-controlled private corporation, has a July 31 year-end. It is not associated with any other corporation. Its tax manager has estimated its 2019 federal income tax liability at...
-
Briefly discuss the implications of the financial statement presentation project for the reporting of stockholders equity.
-
What elements does the array list contain after the following code is executed? int [] list {2, 18, 6, -4, 5, 1}; %3D for (int i = 0; i < list.length; i++) { list[i] list[i] + (list[i] / list [0]);
-
Why is recursion an effective way to implement a backtracking algorithm?
-
Write the map returned when the following method is passed the following maps: a. map1: {bar=1, baz=2, foo=3, mumble=4}, map2: {1=earth, 2=wind, 3=air, 4=fire} b. map1: {five=105, four=104, one=101,...
-
Use SecureRandom method ints to generate a stream of 50 random numbers in the range 1 to 999, then filter the resulting stream elements to select only the odd numbers and display the results in...
-
What percentage of the 9,449 survey respondents live in the Eastern part of the county?
-
(a) What percentage of those not completing high school were females? (b) What percentage of those not completing high school were males? (c) What percentage of those completing high school were...
Study smarter with the SolutionInn App