Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python_one_week_4_biologists_solutions
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hub-courses
python_one_week_4_biologists_solutions
Commits
2e3acbb0
Commit
2e3acbb0
authored
10 years ago
by
Bertrand NÉRON
Browse files
Options
Downloads
Patches
Plain Diff
add exercise unsing matrix module made in create funtion chapter
parent
5a4a0786
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/Modules_and_Packages.rst
+46
-0
46 additions, 0 deletions
source/Modules_and_Packages.rst
with
46 additions
and
0 deletions
source/Modules_and_Packages.rst
+
46
−
0
View file @
2e3acbb0
...
@@ -3,3 +3,49 @@
...
@@ -3,3 +3,49 @@
********************
********************
Modules and Packages
Modules and Packages
********************
********************
Exercises
=========
Exercise
--------
Implement a matrix and functions to handle it.
choose the data structure of your choice.
The API (**A**\ pplication **P**\ rogramming **I**\ nterface) to implemet is the following:
.. literalinclude:: _static/code/matrix.py
:linenos:
:language: python
:download:`matrix.py <_static/code/matrix.py>` .
Exercise
--------
Write a program that calculates the similarity of 2 RNA sequences.
* To compute the simalirity you need to parse a file containing the similarity matrix.
* The similarity of the 2 sequences is the sum of base similarities.
so you have to compare the first base of to sequence and use the matrix to get the similarity
from the similarity table, on so on for all bases then sum these similarities.
.. note::
as we don't yet see how to read a file, we provide a list of strings that represents the file
as we can get them if we read that file.
::
lines = iter([' A G C U\n'
'A 1.0 0.5 0.0 0.0\n',
'G 0.5 1.0 0.0 0.0\n',
'C 0.0 0.0 1.0 0.5\n',
'U 0.0 0.0 0.5 1.0\n'])
.. literalinclude:: _static/code/similarity.py
:linenos:
:language: python
:download:`similarity.py <_static/code/similarity.py>` .
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment