Commit 71ed45c0 authored by Bertrand Néron's avatar Bertrand Néron
Browse files

mv solution of matrix in dive into function as in course

parent 555491c4
......@@ -492,4 +492,36 @@ This function have to take the phase as parameter
:download:`translate.py <_static/code/translate.py>` .
\ No newline at end of file
.. _matrix_exercise:
Exercise
--------
Write a program that calculates the similarity of 2 RNA sequences.
* To compute the similarity you need to parse a file containing the :download:`similarity matrix <_static/data/similarity_matrix>`.
**Hint**: use the module containing the functions that handle a matrix from previous chapter.
put this matrix.py file in a directory named "my_python_lib" in your home or Desktop
and import it in your current program (the similarity script must be placed elsewhere).
* The similarity of the 2 sequences is the sum of base similarities.
so you have to compare the first base of two sequences and use the matrix to get the similarity
from the similarity table, on so on for all bases then sum these similarities.
First implementation
.. literalinclude:: _static/code/matrix.py
:linenos:
:language: python
:download:`matrix.py <_static/code/matrix.py>` .
Second implementation
.. literalinclude:: _static/code/matrix2.py
:linenos:
:language: python
:download:`matrix2.py <_static/code/matrix2.py>` .
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment