A DNA sequence is a sequence of pairs of special molecules called bases
Tagged: C assignment help
January 17, 2013 at 4:42 am #8502AakankshaParticipant
DNA Melting Temperature
A DNA sequence is a sequence of pairs of special molecules called bases. The bases are: adenine (A), thymine
(T), guanine (G), and cytosine (C). Since A can only be paired with T, and G can only be paired with C, we can represent
a DNA sequence as a single sequence of bases, by listing all the bases in the bottom strand from left to right. For
example, the sequence in Figure 1 can be represented as TACGTACGACGT.
In this question, we ask you to compute the temperature at which the DNA sequence melts. We provide two
formulae for computing this temperature:
The Classical Formula: In the classical formula, we begin with a base temperature of 25 C. For each pair of A and
T in the sequence, the temperature is increased by 3%. For each pair of C and G in the sequence, the temperature
is increased by 5%. For example, the melting temperature of the DNA sequence in Figure 1 according to the
classical formula is approximately 40:0036 C.
The Modern Formula: In the modern formula, we start with the temperature computed by the classical formula.
For each time A and T are adjacent, we add 1% to the temperature. For example, the melting temperature of
the DNA sequence in Figure 1 according to the modern formula is approximately 40:8077 C.
Your task is to write a function meltingTemperature(char *dnaSequence, char formula), where
dnaSequence is an array of characters that represents a DNA sequence. A valid sequence contains characters
from the set f’a’, ‘A’, ‘t’, ‘T’, ‘g’, ‘G’, ‘c’, ‘C’g (i.e a base can be represented with either a
lower-case or an upper-case letter) and ends with the character ‘!’. You may assume as a precondition that
the last character in dnaSequence is null (which is represented in C by ‘n0’).
the character ‘c’, if we wish to calculate the melting temperature using the classical method, and
the character ‘m’, if we wish to calculate the melting temperature using the modern method
The function meltingTemperature returns the temperature (a double) in degrees Kelvin calculated according to
the formula requested (via its second argument).
Reminder: to convert between temperature in degrees Celsius ( C) and temperature in Kelvin (K), you can use the
formula C = K-273:15.
If the input is invalid, the function meltingTemperature returns -1. Since a negative number is not a valid
temperature in Kelvin, this is an acceptable way to indicate error.
For example, meltingTemperature(“”TACgtACGaCGT!””,’c’) should return approximately 313:1536
meltingTemperature(“”TACgtACGaCGT!””,’m’) should return approximately 313:9577
meltingTemperature(“”TACgtACGaCGx””,’m’) should return -1
Submission: Put all the functions in the answer to this question in a file named dna.c. Put the prototypes of all
functions in dna.c in a file named dna.h.
- You must be logged in to reply to this topic.