diff --git a/source/Collection_Data_Types.rst b/source/Collection_Data_Types.rst index def15ef4426562772fd6f4835a42d80d4b45fc02..968c933c1b51dd442b4c6526760050bb2936fcc1 100644 --- a/source/Collection_Data_Types.rst +++ b/source/Collection_Data_Types.rst @@ -292,7 +292,7 @@ So we can use the specificity of set :: Exercise -------- -We need to compute the occurrence of all kmers of a given length present in a sequence. +We need to compute the number of occurrences of all kmers of a given length present in a sequence. Below we propose 2 algorithms. @@ -431,8 +431,8 @@ Print the kmers by ordered by occurrences. Exercise -------- -| Write a function which take a sequence as parameter and return it's reversed complement. -| Write the pseudocode before to propose an implementation. +| Write a function which takes a sequence as parameter and returns its reversed complement. +| Write the pseudocode before proposing an implementation. pseudocode: """"""""""" @@ -462,17 +462,17 @@ pseudocode: other solution """""""""""""" -python provide an interesting method for our problem. +Python provides an interesting method for our problem. The ``translate`` method works on a string and needs a parameter which is an object that can do the correspondence between characters in the old string and the new one. -``maketrans`` is a function in module ``string`` that allow us to build this object. -``maketrans`` take 2 arguments, two strings, the first string contains the characters -to change, the second string the corresponding characters in the new string. +``maketrans`` is a function in module ``string`` that allows us to build this object. +``maketrans`` takes two strings as arguments, the first one contains the characters +to change, the second contains the corresponding characters in the new string. Thus the two strings **must** have the same length. The correspondence between the characters to change and their new values is made in function of their position. -the first character of the first string will be replaced by the first character of the second string, -the second character of the first string will be replaced by the second character of the second string, on so on. -So we can write the reverse complement without loop. +The first character of the first string will be replaced by the first character of the second string, +the second character of the first string will be replaced by the second character of the second string, and so on. +So we can write the reverse complement without a loop. .. literalinclude:: _static/code/rev_comp2.py :linenos: @@ -490,8 +490,8 @@ So we can write the reverse complement without loop. Exercise -------- -let the following enzymes collection: -We decide to implement enzymes as tuple with the following structure +We have a collection of restriction enzymes. +We decide to implement enzymes as tuples with the following structure ("name", "comment", "sequence", "cut", "end") :: @@ -506,7 +506,7 @@ We decide to implement enzymes as tuple with the following structure hae3 = ("HaeIII", "Haemophilus aegyptius", "ggcc", 2 , "blunt") sma1 = ("SmaI", "Serratia marcescens", "cccggg", 3 , "blunt") -and the 2 dna fragments: :: +We have the 2 dna fragments: :: dna_1 = """tcgcgcaacgtcgcctacatctcaagattcagcgccgagatccccgggggttgagcgatccccgtcagttggcgtgaattcag cagcagcgcaccccgggcgtagaattccagttgcagataatagctgatttagttaacttggatcacagaagcttccaga @@ -516,9 +516,9 @@ and the 2 dna fragments: :: attcagtggcttcagaattcctcccgggagaagctgaatagtgaaacgattgaggtgttgtggtgaaccgagtaag agcagcttaaatcggagagaattccatttactggccagggtaagagttttggtaaatatatagtgatatctggcttg""" -| which enzymes cut the dna_1 ? -| the dna_2 ? -| the dna_1 but not the dna_2? +| Which enzymes cut the dna_1 ? +| the dna_2 ? +| the dna_1 but not the dna_2? * In a file <my_file.py> @@ -548,7 +548,7 @@ and the 2 dna fragments: :: :download:`enzymes_1.py <_static/code/enzyme_1.py>`. -with this algorithm we find if an enzyme cut the dna but we cannot find all cuts in the dna for an enzyme. :: +With this algorithm we find if an enzyme cut the dna but we cannot find all cuts in the dna for an enzyme. :: enzymes = [ecor1, ecor5, bamh1, hind3, taq1, not1, sau3a1, hae3, sma1] digest_1 = []