ubuntu2004
Exercise 18.1
Restriction enzymes are proteins that cut DNA at specific sites called cleavage sites. These sites are widely used for DNA modification and cloning. Interestingly, cleavage sites are palindromic.
A DNA palindrome is not quite the same as a word palindrome though. Remember, a word palindrome reads the same backward and forward, such as "level".
DNA is double stranded. The two strands are complementary, so an A on one strand pairs with a T on the other strand, and G pairs with C. So given one strand, say "AACCGGTT" we know that its complement will be "TTGGCCAA".
A DNA sequence is said to be palindromic if its reverse complement is the same as the DNA sequence. For example, the DNA sequence "ATGATCAT" is palindromic because its complement is "TACTAGTA", which, when reversed, is "ATGATCAT".
Write some code to test and print whether the following DNA sequence is palindromic.
Hint 1: You can reuse the code in Notebook 18 to construct a complementary sequence.
Hint 2: You need a conditional statement to test if the DNA sequence equals its reverse complement.
Exercise 18.2
Modify your code so that it tests each of the DNA sequences in the following list.
Hint 1: You'll need a nested loop; the outer loop goes through the list one sequence at a time and the nested loop goes through the bases of each sequence.
Hint 2: The complement sequence string needs to be assigned the empty string on each iteration of the loop.
Exercise 18.3
The molecular masses of amino acids vary. The dictionary in the following code cell gives the molecular masses in Daltons (1 Dalton is 1.7x10-24 grams) of each of the amino acids represented by their letters.
Write a a program that calculates and prints the molecular mass of the peptide "FWGCYPT" to 5dp.
Hint: Have a variable to store the peptide's mass and initialise to 0. Loop through the peptide sequence incrementing the peptide's mass by looking up each amino acid's mass in the dictionary
masses
.