diff --git a/source/Collection_Data_Types.rst b/source/Collection_Data_Types.rst index 9170f1492ba83c7df6946df865e6f061a7e579f6..7a4e7b79d362125191d098a37ff73eea87be6887 100644 --- a/source/Collection_Data_Types.rst +++ b/source/Collection_Data_Types.rst @@ -340,6 +340,26 @@ solution bonus :: for kmer, occurence in list_of_kmers: print kmer, " = ", occurence + +Exercise +-------- + +compute the reversed complement of the following sequence: :: + + seq = 'acggcaacatggctggccagtgggctctgagaggagaaagtccagtggatgctcttggtctggttcgtgagcgcaacaca' + + base_comp = { 'a' : 't', + 'c' : 'g', + 'g' : 'c', + 't' : 'a'} + complement = '' + for base in seq: + complement += base_comp[base] + + reverse_comp = complement[::-1] + print reverse_comp + tgtgttgcgctcacgaaccagaccaagagcatccactggactttctcctctcagagcccactggccagccatgttgccgt + Exercise --------