Sequence of the four nucleotide bases

Assignment Help Business Management
Reference no: EM131675787

For Intro to Python Class

DNA molecules consist of a sequence of the four nucleotide bases: adenine, thymine, cytosine, and guanine. The nucleotide bases are often abbreviated by their first letter, ATCG) so that DNA is represented as a string of these four letters. A DNA string can be millions of bases long.

One important problem on DNA strings is substring matching, which is the task of checking whether a shorter substring is contained within a longer string. Obviously, finding a substring in a long string has many interesting applications, but here we will focus on DNA sequences.

Python strings already provide an s.find(substring) method that returns the index in s at which substring first appears. If the substring does not appear, the method returns -1. For example: "ATCGCGTACT".find("CGCG") returns 2, but "ATCGCGTACT".find("CGAT") returns -1. 

(a) Without using the existing find method of Python strings, write a function find(s, substring).

that does the same thing as the find method. If the substring appears in s, the method should return its index, otherwise it should return -1. Write the function in the file problem2.py. 

(b) Without using the existing find method, write a function find_multi(s, substring).

that returns a list of the indices of all occurrences of the substring. If the substring is not found, the function can return an empty list. Make sure your function can handle overlapping substrings. For example: 

find_multi("ATGCGCGAT", "GCG") should return [2,4].

Add the function in the file problem2.py. 

(c) In the worst case, how many character comparisons are required by your algorithm in part (a)? Does the algorithm in part (b) need to make more comparisons? The answer does not need to be exact. Add your answer as a comment at the top of problem2.py.

Reference no: EM131675787

Questions Cloud

Generate a detailed multi-step income statement : Financial Accounting: Tools for Business Decision. Generate a detailed multi-step income statement with a brief explanation of 700 words. Assume a 25% tax rate.
What is americo effective tax rate : Americo is a U.S.-based multinational manufacturing firm with whollyowned subsidiaries in Brazil, Germany, and China, in addition to domestic operations.
Production schedule for the factory : A computer system that relies on extensive data input to produce a production schedule for the factory and a schedule of needed raw materials is what kind?
What happens to total production and consumption : Trade at Negotiated Mid-Price. The mid-price for exchange between France and China can be calculated as follows.
Sequence of the four nucleotide bases : DNA molecules consist of a sequence of the four nucleotide bases: adenine, thymine, cytosine, and guanine. The nucleotide bases are often abbreviated.
Define the teletransporter or the spaceship : Which option would you choose: the teletransporter or the spaceship. Explain why. Which of the four criteria of personal identity discussed
For intro to python class : Pig Latin is a language game in which words are altered according to certain rules.
Distinctions in international and multinational companies : Trident's Globalization. After reading the chapter's description of Trident's globalization process, how would you explain the distinctions.
Identify at least two types of feedback : What is the difference between effective praise and ineffective praise? How is praise the same or different than feedback?

Reviews

Write a Review

Business Management Questions & Answers

  Important information about cost leadership strategy

Important information about Cost leadership strategy - A company with a business-level strategy of cost leadership should pursue which of the following global expansion strategies?

  Estimated regression model wage

Suppose that a researcher, using wage data on randomly selected male and female workers, obtains the estimated regression model wagei = 12.52 + 2.12malei + ei, where wage is measured in dollars per hour and male is a dummy variable that is equal t..

  Identify leadership styles associated with path-goal theory

Identify four leadership styles associated with path-goal theory. Explain each style and relate it to styles described in other theories. Can leaders exhibit more than one style?

  Objectives and organizational culturewhy are short-term

objectives and organizational culturewhy are short-term objectives necessary when long-term objectives have been

  What concerns might shoppers have about the irprivacy

What concerns might shoppers have about the irprivacy? How would you advise Stop & Shop management to respond to these concerns? How would you assess the level of maturity of Stop & Shop's use of analytics?

  Price elasticity of demand for the hershey company

What are the factors that affect total revenue including but not limited to price elasticity of demand for the Hershey company?

  Process creating multinational enterprises

Consider the process creating multinational enterprises. What would you identify as the top three challenges and how might they be overcome?

  Did i establish eye contact with my audience before speech

Did I use an extemporaneous delivery style? Did I refer to my notes, but not read or memorize my speech? Did I establish eye contact with my audience before, during, and after my speech?

  Decisions about packaging and branding

1. Which of the following components of the marketing mix concerns decisions about packaging and branding? 2. Which of the following concerns how the whole marketing system works?

  Responsible for a horrible product failure

You are the product manager responsible for a horrible product failure, but in your wisdom, you are evaluating why the product failed. what factors would you consider in your evaluation?

  What is the social problem the researchers are investigating

What is the social problem the researchers are investigating? What is the research method (i.e.: survey, participant observation, experiment, secondary sources) used by the researchers?

  Production of chocolate and coffee

Suppose the north and south are trading cities and have the following production of chocolate and coffee: North output per hour is 2 chocolate and 8 coffee.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd