From b115e671058d26d54f162a15a061b25639b0ff85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bertrand=20N=C3=A9ron?= <bneron@pasteur.fr> Date: Mon, 11 Aug 2014 23:26:51 +0200 Subject: [PATCH] add exercise on reverse complement a sequence --- source/Collection_Data_Types.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/Collection_Data_Types.rst b/source/Collection_Data_Types.rst index 9170f14..7a4e7b7 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 -------- -- GitLab