is made up of sugar, a phosphate group, and one of the four nitrogenous bases: adenine

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Problem A. DNA: CG Pairs
DNA (Deoxyribonucleic Acid) is a molecule that encodes genetic blueprints for living

organisms. Understanding how it works is one of the fundamental pursuits of modern biology and genetics. Each strand of DNA is a chain of nucleotides. Each nucleotide is made up of sugar, a phosphate group, and one of the four nitrogenous bases: adenine (A), thymine (T), cytosine (C) and guanine (G). For this reason, a common way to represent a strand of DNA is by simply writing out the letters corresponding to the base that each nucleotide contains. For example, a small strand of DNA could be represented as:

dna_str = 'AGCTTTCATTCTGAC'

(This is a very very short dna sequence, actual sequences are much longer. If you're interested in what a real DNA sequence looks like, check out the National Center for Biotechnology Information at the National Institute of Health. Here is the page that contains the first segment of the genome for a Burmese python.)

Vertebrates have a much lower density of CG pairs than would occur by chance, but they have a relatively high concentration near genes. Because of this, finding higher concentrations of CG pairs is a good way to find possible sites of genes.

Build a function cg_pairs(dna) that takes a string containing a dna strand as its argument and returns the fraction of dinucleotides (i.e. pairs of consecutive nucleotides) that are “cg” in that strand, without using the built-in count method. For example, the following dna strand has a cg_ratio of 0.25:

cg_pairs('accgttcgc')

because it contains 8 dinucleotides (‘ac’, ‘cc’, ‘cg’, ‘gt’, ‘tt’, ‘tc’, ‘cg’, ‘gc’), and 2 of them are ‘cg’, so we get 2/8 = 0.25.

 

Examples (values in bold are returned, values in italics are printed) >>> cg_pairs('atcgttcg')
0.2857142857142857
>>> cg_pairs('ggGCg')

0.25

>>> cg_pairs('cGa')

0.5

>>> cg_pairs('testing') Error in DNA strand

0.0

>>> cg_pairs('gccGtTfa') Error in DNA strand

0.0

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY