2- In the analysis of genes one encounters many problem settings involving searching for certain combinations...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2- In the analysis of genes one encounters many problem settings involving searching for certain combinations of letters in a long string. For example, we may have a string like gene = 'AGTCAATGGAATAGGCCAAGCGAATATTTGGGCTACCA' We may traverse this string, letter by letter, by the for loop for letter in gene. The length of the string is given by len(gene), so an alternative traversal over an index i is for i in range(len(gene)). Letter number i is reached through gene[i], and a substring from index i up to, but not including j, is created by gene[i:j]. Write a function freq(letter, text) that returns the frequency of the letter letter in the string text, i.e., the number of occurrences of letter divided by the length of text. Call the function to determine the frequency of C and G in the gene string above. 2- In the analysis of genes one encounters many problem settings involving searching for certain combinations of letters in a long string. For example, we may have a string like gene = 'AGTCAATGGAATAGGCCAAGCGAATATTTGGGCTACCA' We may traverse this string, letter by letter, by the for loop for letter in gene. The length of the string is given by len(gene), so an alternative traversal over an index i is for i in range(len(gene)). Letter number i is reached through gene[i], and a substring from index i up to, but not including j, is created by gene[i:j]. Write a function freq(letter, text) that returns the frequency of the letter letter in the string text, i.e., the number of occurrences of letter divided by the length of text. Call the function to determine the frequency of C and G in the gene string above.
Expert Answer:
Related Book For
Introduction to Operations Research
ISBN: 978-1259162985
10th edition
Authors: Frederick S. Hillier, Gerald J. Lieberman
Posted Date:
Students also viewed these programming questions
-
Youre going to build this program in parts. In this exercise, you will build a program that stores a secret word and allows the user to repeatedly guess a letter. Each time the user makes a guess,...
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
Suppose that General Motors Acceptance Corporation issued a bond with 10 years until maturity, a face value of $1000, and a coupon rate of 7% (annual payments). The yield to maturity on this bond...
-
Hummingbird Company uses the product cost concept of applying the cost-plus approach to product pricing. The costs and expenses of producing 25,000 units of Product K are as follows: Variable costs:...
-
In a certain community, levels of air pollution may exceed federal standards for ozone or for particulate matter on some days. For a particular summer season, let X be the number of days on which the...
-
Give an example of how bias can creep into the training of a machine learning application, resulting in unintended but negative consequences?
-
The data in Exhibit 11.3 on industry median betas suggest that firms in the following three sets of related industries have different degrees of systematic risk. Median Beta during 19992007 Utilities...
-
Main Street Bakery offers its employees the option of contributing up to 7% of their salaries to a voluntary retirement plan, with the employer matching their contribution. The company also pays 100%...
-
The strength of an item is known to be normally distributed with an unknown mean and unknown variance \({ }^{2}\). A random sample of ten items is taken and their strength measured. The strengths...
-
Property: Office One, Anytown, U.S.A. Acquisition date: December 31, 1999 Purchase Price: 2000 NOI @ 10% CAP RATE Deal Terms: 65% financed with debt, 9% interest-only, 10-year term 35% equity...
-
In the diagram shown the tension in Rope 1 is 678.5 N. Angle A is 46.4 degrees, angle B is 32.4 degrees. What is the tension in Rope 2 and the weight of the mass? The tension in Rope 2 is? The weight...
-
2.4 Find the expression for the potential difference between two points a and b out from a very large charged plastic sheet with charge o(C/m) (b>a). The sheet is in air.
-
A. What is the ratio Tf Is | Ti for the process shown in the right? p (atm) 4 3- 2. 1 f 2 V (m)
-
Q2/ Consider a sphere with a permanent dipole density, radius R. Let the dipole density of the sphere be P = Uz . 1. U is constant, and find its unit. Determine the bound charges density. Write down...
-
In the figure below, find each of the following.(a) the length of the side opposite (b) the length of the side adjacent to p (C) cos(8) (d) sin(p) (e) tan(p)
-
Discuss examples of studies involved in the field of Nanoscience and Nanotechnology?
-
[a] Two foam blocks, each with a charge of 19 micro coulombs (1 C = 10-6 C), are both held in place 19 cm apart in the east-west direction. A foam ball with a charge 49 C is placed 55 cm north of the...
-
Poor inventory management at the local warehouse for Furniture City has led to overstocking of many items and frequent shortages of some others. To begin to rectify this situation, the 20 most...
-
Suppose that the demand for a product is 30 units per month and the items are withdrawn at a constant rate. The setup cost each time a production run is undertaken to replenish inventory is $15. The...
-
Consider the Reliable Construction Co. bidding problem discussed in Sec. 28.1. The spreadsheet model is available on this website. The parameter analysis report generated in Sec. 28.7 (see Fig....
-
What is thermodynamics?
-
An astronaut weighs \(800 \mathrm{~N}\) on the earth's surface where the acceleration of gravity is \(g=9.83 \mathrm{~m} / \mathrm{s}^{2}\). The mass and the radius of the moon are \(7.4 \times...
-
Explain the scope and limitations of thermodynamics.
Study smarter with the SolutionInn App